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
ce93e39b
Commit
ce93e39b
authored
Oct 14, 2021
by
George Hotz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
indentation
parent
10cfbb05
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
4 deletions
+7
-4
trie.go
mipsevm/trie.go
+7
-4
No files found.
mipsevm/trie.go
View file @
ce93e39b
...
@@ -6,6 +6,7 @@ import (
...
@@ -6,6 +6,7 @@ import (
"encoding/gob"
"encoding/gob"
"fmt"
"fmt"
"sort"
"sort"
"strings"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/crypto"
...
@@ -40,25 +41,27 @@ func (kw PreimageKeyValueWriter) Delete(key []byte) error {
...
@@ -40,25 +41,27 @@ func (kw PreimageKeyValueWriter) Delete(key []byte) error {
return
nil
return
nil
}
}
// full nodes have 17 values, each a hash
// 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
)
{
func
parseNode
(
node
common
.
Hash
,
depth
int
)
{
if
depth
>
2
{
if
depth
>
2
{
return
return
}
}
sprefix
:=
strings
.
Repeat
(
" "
,
depth
)
buf
:=
preimages
[
node
]
buf
:=
preimages
[
node
]
elems
,
_
,
err
:=
rlp
.
SplitList
(
buf
)
elems
,
_
,
err
:=
rlp
.
SplitList
(
buf
)
check
(
err
)
check
(
err
)
c
,
_
:=
rlp
.
CountValues
(
elems
)
c
,
_
:=
rlp
.
CountValues
(
elems
)
fmt
.
Println
(
"parsing"
,
node
,
depth
,
"elements"
,
c
)
fmt
.
Println
(
sprefix
,
"parsing"
,
node
,
depth
,
"elements"
,
c
)
rest
:=
elems
rest
:=
elems
for
i
:=
0
;
i
<
c
;
i
++
{
for
i
:=
0
;
i
<
c
;
i
++
{
kind
,
val
,
lrest
,
err
:=
rlp
.
Split
(
rest
)
kind
,
val
,
lrest
,
err
:=
rlp
.
Split
(
rest
)
rest
=
lrest
rest
=
lrest
check
(
err
)
check
(
err
)
fmt
.
Println
(
kind
,
val
,
len
(
val
))
fmt
.
Println
(
sprefix
,
i
,
kind
,
val
,
len
(
val
))
if
len
(
val
)
==
32
{
if
len
(
val
)
==
32
{
hh
:=
common
.
BytesToHash
(
val
)
hh
:=
common
.
BytesToHash
(
val
)
fmt
.
Println
(
"node found with len"
,
len
(
preimages
[
hh
]))
fmt
.
Println
(
sprefix
,
"node found with len"
,
len
(
preimages
[
hh
]))
parseNode
(
hh
,
depth
+
1
)
parseNode
(
hh
,
depth
+
1
)
}
}
}
}
...
...
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