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
0e44785f
Unverified
Commit
0e44785f
authored
Nov 28, 2022
by
Mark Tyneway
Committed by
GitHub
Nov 28, 2022
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4096 from ethereum-optimism/fix/log-set-storage
op-chain-ops: log when setting storage
parents
3b1dce10
7bd83a55
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
4 deletions
+5
-4
registry.go
op-bindings/bindings/registry.go
+2
-3
state.go
op-chain-ops/state/state.go
+3
-1
No files found.
op-bindings/bindings/registry.go
View file @
0e44785f
package
bindings
import
(
"errors"
"fmt"
"github.com/ethereum-optimism/optimism/op-bindings/solc"
...
...
@@ -15,7 +14,7 @@ var deployedBytecodes = make(map[string]string)
func
GetStorageLayout
(
name
string
)
(
*
solc
.
StorageLayout
,
error
)
{
layout
:=
layouts
[
name
]
if
layout
==
nil
{
return
nil
,
errors
.
New
(
"storage layout not found"
)
return
nil
,
fmt
.
Errorf
(
"%s: storage layout not found"
,
name
)
}
return
layout
,
nil
}
...
...
@@ -23,7 +22,7 @@ func GetStorageLayout(name string) (*solc.StorageLayout, error) {
func
GetDeployedBytecode
(
name
string
)
([]
byte
,
error
)
{
bc
:=
deployedBytecodes
[
name
]
if
bc
==
""
{
return
nil
,
fmt
.
Errorf
(
"
deployed bytecode %s
not found"
,
name
)
return
nil
,
fmt
.
Errorf
(
"
%s: deployed bytecode
not found"
,
name
)
}
return
common
.
FromHex
(
bc
),
nil
...
...
op-chain-ops/state/state.go
View file @
0e44785f
...
...
@@ -9,6 +9,7 @@ import (
"github.com/ethereum-optimism/optimism/op-bindings/solc"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/vm"
"github.com/ethereum/go-ethereum/log"
)
var
(
...
...
@@ -50,7 +51,7 @@ func EncodeStorage(entry solc.StorageLayoutEntry, value any, storageType solc.St
func
SetStorage
(
name
string
,
address
common
.
Address
,
values
StorageValues
,
db
vm
.
StateDB
)
error
{
layout
,
err
:=
bindings
.
GetStorageLayout
(
name
)
if
err
!=
nil
{
return
err
return
fmt
.
Errorf
(
"cannot set storage: %w"
,
err
)
}
slots
,
err
:=
ComputeStorageSlots
(
layout
,
values
)
if
err
!=
nil
{
...
...
@@ -58,6 +59,7 @@ func SetStorage(name string, address common.Address, values StorageValues, db vm
}
for
_
,
slot
:=
range
slots
{
db
.
SetState
(
address
,
slot
.
Key
,
slot
.
Value
)
log
.
Trace
(
"setting storage"
,
"address"
,
address
.
Hex
(),
"key"
,
slot
.
Key
.
Hex
(),
"value"
,
slot
.
Value
.
Hex
())
}
return
nil
}
...
...
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