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
1b3bc386
Commit
1b3bc386
authored
Oct 16, 2021
by
George Hotz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
parse trie better
parent
04ff70f6
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
13 deletions
+20
-13
full.go
mipsevm/full.go
+1
-1
full_test.go
mipsevm/full_test.go
+1
-1
trie.go
mipsevm/trie.go
+18
-11
No files found.
mipsevm/full.go
View file @
1b3bc386
...
...
@@ -42,7 +42,7 @@ func getTrieNode(str common.Hash, interpreter *vm.EVMInterpreter, statedb *State
ret
,
err
:=
interpreter
.
Run
(
contract
,
input
,
false
)
check
(
err
)
fmt
.
Println
(
"getTrieNode"
,
str
,
ret
)
//
fmt.Println("getTrieNode", str, ret)
return
ret
[
64
:
]
}
...
...
mipsevm/full_test.go
View file @
1b3bc386
...
...
@@ -7,7 +7,7 @@ import (
"github.com/ethereum/go-ethereum/common"
)
func
TestFull
(
t
*
testing
.
T
)
{
func
TestFull
Slow
(
t
*
testing
.
T
)
{
RunFull
()
}
...
...
mipsevm/trie.go
View file @
1b3bc386
...
...
@@ -54,18 +54,10 @@ func (kw PreimageKeyValueWriter) Delete(key []byte) error {
return
nil
}
// full nodes / BRANCH_NODE have 17 values, each a hash
// LEAF or EXTENSION nodes have 2 values, a path and value
func
ParseNode
(
node
common
.
Hash
,
depth
int
,
callback
func
(
common
.
Hash
)
[]
byte
)
{
if
depth
>
3
{
return
}
func
ParseNodeInternal
(
elems
[]
byte
,
depth
int
,
callback
func
(
common
.
Hash
)
[]
byte
)
{
sprefix
:=
strings
.
Repeat
(
" "
,
depth
)
buf
:=
callback
(
node
)
elems
,
_
,
err
:=
rlp
.
SplitList
(
buf
)
check
(
err
)
c
,
_
:=
rlp
.
CountValues
(
elems
)
fmt
.
Println
(
sprefix
,
"parsing"
,
node
,
depth
,
"elements"
,
c
)
fmt
.
Println
(
sprefix
,
"parsing"
,
depth
,
"elements"
,
c
)
rest
:=
elems
for
i
:=
0
;
i
<
c
;
i
++
{
kind
,
val
,
lrest
,
err
:=
rlp
.
Split
(
rest
)
...
...
@@ -74,12 +66,27 @@ func ParseNode(node common.Hash, depth int, callback func(common.Hash) []byte) {
fmt
.
Println
(
sprefix
,
i
,
kind
,
val
,
len
(
val
))
if
len
(
val
)
==
32
{
hh
:=
common
.
BytesToHash
(
val
)
fmt
.
Println
(
sprefix
,
"node found with len"
,
len
(
Preimages
[
hh
]))
//
fmt.Println(sprefix, "node found with len", len(Preimages[hh]))
ParseNode
(
hh
,
depth
+
1
,
callback
)
}
if
kind
==
rlp
.
List
&&
len
(
val
)
>
0
&&
len
(
val
)
<
32
{
ParseNodeInternal
(
val
,
depth
+
1
,
callback
)
}
}
}
// full nodes / BRANCH_NODE have 17 values, each a hash
// LEAF or EXTENSION nodes have 2 values, a path and value
func
ParseNode
(
node
common
.
Hash
,
depth
int
,
callback
func
(
common
.
Hash
)
[]
byte
)
{
if
depth
>
4
{
return
}
buf
:=
callback
(
node
)
elems
,
_
,
err
:=
rlp
.
SplitList
(
buf
)
check
(
err
)
ParseNodeInternal
(
elems
,
depth
,
callback
)
}
func
RamToTrie
(
ram
map
[
uint32
](
uint32
))
common
.
Hash
{
mt
:=
trie
.
NewStackTrie
(
PreimageKeyValueWriter
{})
...
...
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