Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
nebula
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
exchain
nebula
Commits
97433e28
Commit
97433e28
authored
Feb 09, 2022
by
George Hotz
Committed by
George Hotz
Feb 09, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
allow mips to overwrite the output
parent
954eea32
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
2 deletions
+23
-2
README.md
README.md
+1
-2
main.go
mipsevm/main.go
+22
-0
No files found.
README.md
View file @
97433e28
...
...
@@ -92,9 +92,8 @@ ID=0 BLOCK=13284469 npx hardhat run scripts/assert.js --network hosthat
# compute real MIPS checkpoint
minigeth/go-ethereum 13284491 && mipsevm/mipsevm 13284491
# alternate fake MIPS checkpoint
# alternate fake MIPS checkpoint
(will modify output file)
BASEDIR=/tmp/cannon_fault minigeth/go-ethereum 13284491 && OUTPUTFAULT=1 BASEDIR=/tmp/cannon_fault mipsevm/mipsevm 13284491
python3 -c 'f="/tmp/cannon_fault/0_13284491/output";o=b"\xba\xba\xba\xba"+open(f, "rb").read()[4:]; open(f, "wb").write(o)'
# start challenge
BASEDIR=/tmp/cannon_fault BLOCK=13284491 npx hardhat run scripts/challenge.js --network hosthat
...
...
mipsevm/main.go
View file @
97433e28
package
main
import
(
"bytes"
"encoding/binary"
"fmt"
"io/ioutil"
"os"
...
...
@@ -94,7 +96,27 @@ func main() {
}
if
target
==
-
1
{
output_filename
:=
fmt
.
Sprintf
(
"%s/output"
,
root
)
outputs
,
err
:=
ioutil
.
ReadFile
(
output_filename
)
check
(
err
)
real
:=
append
([]
byte
{
0x13
,
0x37
,
0xf0
,
0x0d
},
outputs
...
)
output
:=
[]
byte
{}
for
i
:=
0
;
i
<
0x44
;
i
+=
4
{
t
:=
make
([]
byte
,
4
)
binary
.
BigEndian
.
PutUint32
(
t
,
ram
[
uint32
(
0x30000800
+
i
)])
output
=
append
(
output
,
t
...
)
}
if
bytes
.
Compare
(
real
,
output
)
!=
0
{
fmt
.
Println
(
"MISMATCH OUTPUT, OVERWRITING!!!"
)
ioutil
.
WriteFile
(
output_filename
,
output
[
4
:
],
0644
)
}
else
{
fmt
.
Println
(
"output match"
)
}
WriteCheckpoint
(
ram
,
fmt
.
Sprintf
(
"%s/checkpoint_final.json"
,
root
),
lastStep
)
}
// step 2 (optional), validate each 1 million chunk in EVM
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment