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
4d4cb63b
Commit
4d4cb63b
authored
Oct 09, 2021
by
George Hotz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use a sentinel to confirm output happened
parent
13727ecb
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
4 deletions
+11
-4
Challenge.sol
contracts/Challenge.sol
+3
-1
embedded_mips.go
minigeth/oracle/embedded_mips.go
+4
-2
run.py
mipigeth/run.py
+4
-1
No files found.
contracts/Challenge.sol
View file @
4d4cb63b
...
...
@@ -110,7 +110,9 @@ contract Challenge {
// confirm the finalSystemHash asserts the state you claim (in $t0-$t7) and the machine is stopped
// you must load these proofs into MIPS before calling this
// we disagree at the end
require(mem.ReadBytes32(finalSystemState, 0x30000800) == assertionRoot, "you are claiming a different state root in machine");
require(mem.ReadMemory(finalSystemState, 0x30000800) == 0x1337f00d, "state is not outputted");
require(mem.ReadBytes32(finalSystemState, 0x30000804) == assertionRoot, "you are claiming a different state root in machine");
require(mem.ReadMemory(finalSystemState, 0xC0000080) == 0x5EAD0000, "machine is not stopped in final state (PC == 0x5EAD0000)");
return newChallengeTrusted(startState, finalSystemState, stepCount);
...
...
minigeth/oracle/embedded_mips.go
View file @
4d4cb63b
...
...
@@ -57,10 +57,12 @@ func Halt() {
}
func
Output
(
output
common
.
Hash
,
receipts
common
.
Hash
)
{
ret
:=
byteAt
(
0x3000080
0
,
0x20
)
ret
:=
byteAt
(
0x3000080
4
,
0x20
)
copy
(
ret
,
output
.
Bytes
())
rret
:=
byteAt
(
0x3000082
0
,
0x20
)
rret
:=
byteAt
(
0x3000082
4
,
0x20
)
copy
(
rret
,
receipts
.
Bytes
())
magic
:=
byteAt
(
0x30000800
,
4
)
copy
(
magic
,
[]
byte
{
0x13
,
0x37
,
0xf0
,
0x0d
})
Halt
()
}
...
...
mipigeth/run.py
View file @
4d4cb63b
...
...
@@ -295,8 +295,11 @@ except unicorn.UcError:
if
not
died_well
:
raise
Exception
(
"program exitted early"
)
magic
=
struct
.
unpack
(
">I"
,
mu
.
mem_read
(
0x30000800
,
4
))[
0
]
assert
magic
==
0x1337f00d
real_hash
=
binascii
.
hexlify
(
inputs
[
-
0x40
:
-
0x20
])
compare_hash
=
binascii
.
hexlify
(
mu
.
mem_read
(
0x3000080
0
,
0x20
))
compare_hash
=
binascii
.
hexlify
(
mu
.
mem_read
(
0x3000080
4
,
0x20
))
print
(
"compare"
,
real_hash
,
"to computed"
,
compare_hash
)
if
real_hash
!=
compare_hash
:
...
...
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