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
411aa9c8
Commit
411aa9c8
authored
Sep 27, 2021
by
George Hotz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
check the receipts also
parent
e7e3af9f
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
16 additions
and
8 deletions
+16
-8
main.go
minigeth/main.go
+5
-2
embedded_mips.go
minigeth/oracle/embedded_mips.go
+4
-1
prefetch.go
minigeth/oracle/prefetch.go
+5
-3
main.go
mipsevm/main.go
+1
-1
run.py
risc/run.py
+1
-1
No files found.
minigeth/main.go
View file @
411aa9c8
...
...
@@ -113,12 +113,15 @@ func main() {
panic
(
"wrong uncles for block "
+
newheader
.
UncleHash
.
String
()
+
" "
+
block
.
Header
()
.
UncleHash
.
String
())
}
_
,
_
,
_
,
err
:=
processor
.
Process
(
block
,
statedb
,
vmconfig
)
// validateState is more complete, gas used + bloom also
receipts
,
_
,
_
,
err
:=
processor
.
Process
(
block
,
statedb
,
vmconfig
)
receiptSha
:=
types
.
DeriveSha
(
types
.
Receipts
(
receipts
),
trie
.
NewStackTrie
(
nil
))
if
err
!=
nil
{
log
.
Fatal
(
err
)
}
newroot
:=
statedb
.
IntermediateRoot
(
bc
.
Config
()
.
IsEIP158
(
newheader
.
Number
))
fmt
.
Println
(
"receipt count"
,
len
(
receipts
),
"hash"
,
receiptSha
)
fmt
.
Println
(
"process done with hash"
,
parent
.
Root
,
"->"
,
newroot
)
oracle
.
Output
(
newroot
)
oracle
.
Output
(
newroot
,
receiptSha
)
}
minigeth/oracle/embedded_mips.go
View file @
411aa9c8
...
...
@@ -15,6 +15,7 @@ import (
)
var
preimages
=
make
(
map
[
common
.
Hash
][]
byte
)
// only 6 here
var
inputs
[
6
]
common
.
Hash
var
inputsLoaded
bool
=
false
...
...
@@ -54,9 +55,11 @@ func Halt() {
os
.
Exit
(
0
)
}
func
Output
(
output
common
.
Hash
)
{
func
Output
(
output
common
.
Hash
,
receipts
common
.
Hash
)
{
ret
:=
byteAt
(
0x30000800
,
0x20
)
copy
(
ret
,
output
.
Bytes
())
rret
:=
byteAt
(
0x30000820
,
0x20
)
copy
(
rret
,
receipts
.
Bytes
())
Halt
()
}
...
...
minigeth/oracle/prefetch.go
View file @
411aa9c8
...
...
@@ -184,7 +184,7 @@ func PrefetchCode(blockNumber *big.Int, addrHash common.Hash) {
preimages
[
hash
]
=
ret
}
var
inputs
[
7
]
common
.
Hash
var
inputs
[
8
]
common
.
Hash
func
Input
(
index
int
)
common
.
Hash
{
if
index
<
0
||
index
>
5
{
...
...
@@ -193,11 +193,12 @@ func Input(index int) common.Hash {
return
inputs
[
index
]
}
func
Output
(
output
common
.
Hash
)
{
if
output
==
inputs
[
6
]
{
func
Output
(
output
common
.
Hash
,
receipts
common
.
Hash
)
{
if
output
==
inputs
[
6
]
&&
receipts
==
inputs
[
7
]
{
fmt
.
Println
(
"good transition"
)
}
else
{
fmt
.
Println
(
output
,
"!="
,
inputs
[
6
])
fmt
.
Println
(
receipts
,
"!="
,
inputs
[
7
])
panic
(
"BAD transition :(("
)
}
}
...
...
@@ -289,6 +290,7 @@ func PrefetchBlock(blockNumber *big.Int, startBlock bool, hasher types.TrieHashe
// secret input
inputs
[
6
]
=
blockHeader
.
Root
inputs
[
7
]
=
blockHeader
.
ReceiptHash
// save the inputs
saveinput
:=
make
([]
byte
,
0
)
...
...
mipsevm/main.go
View file @
411aa9c8
...
...
@@ -187,10 +187,10 @@ func main() {
//fmt.Println(bytecode, jj.Bytecode)
statedb
:=
&
StateDB
{
Bytecode
:
bytecode
}
bc
:=
core
.
NewBlockChain
()
var
header
types
.
Header
header
.
Number
=
big
.
NewInt
(
13284469
)
header
.
Difficulty
=
common
.
Big0
bc
:=
core
.
NewBlockChain
(
&
header
)
author
:=
common
.
Address
{}
blockContext
:=
core
.
NewEVMBlockContext
(
&
header
,
bc
,
&
author
)
txContext
:=
vm
.
TxContext
{}
...
...
risc/run.py
View file @
411aa9c8
...
...
@@ -375,7 +375,7 @@ except unicorn.UcError:
if
not
died_well
:
raise
Exception
(
"program exitted early"
)
real_hash
=
binascii
.
hexlify
(
inputs
[
-
0x
20
:
])
real_hash
=
binascii
.
hexlify
(
inputs
[
-
0x
40
:
-
0x20
])
compare_hash
=
binascii
.
hexlify
(
mu
.
mem_read
(
0x30000800
,
0x20
))
print
(
"compare"
,
real_hash
,
"to computed"
,
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