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
53ca600e
Unverified
Commit
53ca600e
authored
Feb 21, 2023
by
protolambda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
op-chain-ops,op-wheel: handle missing account in storage-trie lookup
parent
54db4e96
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
2 deletions
+24
-2
check.go
op-chain-ops/genesis/check.go
+12
-2
layer_one.go
op-chain-ops/genesis/layer_one.go
+3
-0
cheat.go
op-wheel/cheat/cheat.go
+9
-0
No files found.
op-chain-ops/genesis/check.go
View file @
53ca600e
...
...
@@ -5,6 +5,7 @@ import (
"encoding/binary"
"errors"
"fmt"
"github.com/ethereum/go-ethereum/core/types"
"math/big"
"github.com/ethereum-optimism/optimism/op-node/rollup/derive"
...
...
@@ -181,16 +182,25 @@ func PostCheckUntouchables(udb state.Database, currDB *state.StateDB, prevRoot c
log
.
Info
(
"checked code hash"
,
"address"
,
addr
,
"hash"
,
hash
)
// Ensure that the current/previous roots match
var
prevRoot
,
currRoot
common
.
Hash
prevStorage
,
err
:=
prevDB
.
StorageTrie
(
addr
)
if
err
!=
nil
{
return
fmt
.
Errorf
(
"failed to open previous-db storage trie of %s: %w"
,
addr
,
err
)
}
if
prevStorage
==
nil
{
prevRoot
=
types
.
EmptyRootHash
}
else
{
prevRoot
=
prevStorage
.
Hash
()
}
currStorage
,
err
:=
currDB
.
StorageTrie
(
addr
)
if
err
!=
nil
{
return
fmt
.
Errorf
(
"failed to open current-db storage trie of %s: %w"
,
addr
,
err
)
}
prevRoot
:=
prevStorage
.
Hash
()
currRoot
:=
currStorage
.
Hash
()
if
currStorage
==
nil
{
currRoot
=
types
.
EmptyRootHash
}
else
{
currRoot
=
currStorage
.
Hash
()
}
if
prevRoot
!=
currRoot
{
return
fmt
.
Errorf
(
"expected storage root for %s to be %s, but got %s"
,
addr
,
prevRoot
,
currRoot
)
}
...
...
op-chain-ops/genesis/layer_one.go
View file @
53ca600e
...
...
@@ -220,6 +220,9 @@ func BuildL1DeveloperGenesis(config *DeployConfig) (*core.Genesis, error) {
if
err
!=
nil
{
return
nil
,
fmt
.
Errorf
(
"failed to open storage trie of %s: %w"
,
dep
.
Address
,
err
)
}
if
st
==
nil
{
return
nil
,
fmt
.
Errorf
(
"missing account %s in state, address: %s"
,
dep
.
Name
,
dep
.
Address
)
}
iter
:=
trie
.
NewIterator
(
st
.
NodeIterator
(
nil
))
depAddr
:=
dep
.
Address
...
...
op-wheel/cheat/cheat.go
View file @
53ca600e
...
...
@@ -190,6 +190,9 @@ func StorageReadAll(address common.Address, w io.Writer) HeadFn {
if
err
!=
nil
{
return
fmt
.
Errorf
(
"failed to open storage trie of addr %s: %w"
,
address
,
err
)
}
if
storage
==
nil
{
return
fmt
.
Errorf
(
"no storage trie in state for account %s"
,
address
)
}
iter
:=
trie
.
NewIterator
(
storage
.
NodeIterator
(
nil
))
for
iter
.
Next
()
{
if
_
,
err
:=
fmt
.
Fprintf
(
w
,
"+ %x = %x
\n
"
,
iter
.
Key
,
dbValueToHash
(
iter
.
Value
));
err
!=
nil
{
...
...
@@ -220,10 +223,16 @@ func StorageDiff(out io.Writer, addressA, addressB common.Address) HeadFn {
if
err
!=
nil
{
return
fmt
.
Errorf
(
"failed to open storage trie of addr A %s: %w"
,
addressA
,
err
)
}
if
aStorage
==
nil
{
return
fmt
.
Errorf
(
"no storage trie in state for account A %s"
,
addressA
)
}
bStorage
,
err
:=
headState
.
StorageTrie
(
addressB
)
if
err
!=
nil
{
return
fmt
.
Errorf
(
"failed to open storage trie of addr B %s: %w"
,
addressB
,
err
)
}
if
bStorage
==
nil
{
return
fmt
.
Errorf
(
"no storage trie in state for account B %s"
,
addressB
)
}
aIter
:=
trie
.
NewIterator
(
aStorage
.
NodeIterator
(
nil
))
bIter
:=
trie
.
NewIterator
(
bStorage
.
NodeIterator
(
nil
))
hasA
:=
aIter
.
Next
()
...
...
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