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
aa5ed436
Unverified
Commit
aa5ed436
authored
Sep 20, 2023
by
protolambda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
go: update to op-geth with upstream v1.13.1 changes
parent
99d0ef1b
Changes
12
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
69 additions
and
51 deletions
+69
-51
go.mod
go.mod
+10
-11
go.sum
go.sum
+22
-23
l1_replica_test.go
op-e2e/actions/l1_replica_test.go
+4
-1
l2_engine_test.go
op-e2e/actions/l2_engine_test.go
+6
-2
reorg_test.go
op-e2e/actions/reorg_test.go
+3
-4
db_test.go
op-program/client/l2/db_test.go
+6
-2
engine.go
op-program/client/l2/engine.go
+1
-1
engine_backend_test.go
op-program/client/l2/engine_backend_test.go
+4
-1
l2_engine_api.go
op-program/client/l2/engineapi/l2_engine_api.go
+1
-1
trie.go
op-program/client/mpt/trie.go
+2
-1
cheat.go
op-wheel/cheat/cheat.go
+9
-3
engine.go
op-wheel/engine/engine.go
+1
-1
No files found.
go.mod
View file @
aa5ed436
...
...
@@ -9,7 +9,7 @@ require (
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0
github.com/ethereum-optimism/go-ethereum-hdwallet v0.1.3
github.com/ethereum-optimism/superchain-registry/superchain v0.0.0-20230921190252-f29074de9e36
github.com/ethereum/go-ethereum v1.1
2.2
github.com/ethereum/go-ethereum v1.1
3.1
github.com/fsnotify/fsnotify v1.6.0
github.com/go-chi/chi/v5 v5.0.10
github.com/go-chi/docgen v1.2.0
...
...
@@ -50,6 +50,7 @@ require (
require (
github.com/DataDog/zstd v1.5.2 // indirect
github.com/Microsoft/go-winio v0.6.1 // indirect
github.com/VictoriaMetrics/fastcache v1.10.0 // indirect
github.com/allegro/bigcache v1.2.1 // indirect
github.com/benbjohnson/clock v1.3.5 // indirect
...
...
@@ -61,7 +62,7 @@ require (
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/cockroachdb/errors v1.9.1 // indirect
github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b // indirect
github.com/cockroachdb/pebble v0.0.0-20230
209160836-829675f94811
// indirect
github.com/cockroachdb/pebble v0.0.0-20230
906160148-46873a6a7a06
// indirect
github.com/cockroachdb/redact v1.1.3 // indirect
github.com/consensys/bavard v0.1.13 // indirect
github.com/consensys/gnark-crypto v0.10.0 // indirect
...
...
@@ -76,9 +77,8 @@ require (
github.com/decred/dcrd/crypto/blake256 v1.0.1 // indirect
github.com/deepmap/oapi-codegen v1.8.2 // indirect
github.com/dlclark/regexp2 v1.7.0 // indirect
github.com/docker/docker v20.10.24+incompatible // indirect
github.com/docker/go-units v0.5.0 // indirect
github.com/dop251/goja v0.0.0-20230
605162241-28ee0ee714f3
// indirect
github.com/dop251/goja v0.0.0-20230
806174421-c933cf95e127
// indirect
github.com/elastic/gosigar v0.14.2 // indirect
github.com/ethereum/c-kzg-4844 v0.3.1 // indirect
github.com/fatih/color v1.7.0 // indirect
...
...
@@ -108,7 +108,7 @@ require (
github.com/hashicorp/golang-lru/arc/v2 v2.0.5 // indirect
github.com/holiman/billy v0.0.0-20230718173358-1c7e68d277a7 // indirect
github.com/holiman/bloomfilter/v2 v2.0.3 // indirect
github.com/huin/goupnp v1.
2
.0 // indirect
github.com/huin/goupnp v1.
3
.0 // indirect
github.com/influxdata/influxdb-client-go/v2 v2.4.0 // indirect
github.com/influxdata/influxdb1-client v0.0.0-20220302092344-a9ab5670611c // indirect
github.com/influxdata/line-protocol v0.0.0-20210311194329-9aa0e372d097 // indirect
...
...
@@ -120,7 +120,7 @@ require (
github.com/jackpal/go-nat-pmp v1.0.2 // indirect
github.com/jbenet/go-temp-err-catcher v0.1.0 // indirect
github.com/jbenet/goprocess v0.1.4 // indirect
github.com/jedisct1/go-minisign v0.0.0-20
190909160543-45766022959e
// indirect
github.com/jedisct1/go-minisign v0.0.0-20
230811132847-661be99b8267
// indirect
github.com/jinzhu/inflection v1.0.0 // indirect
github.com/jinzhu/now v1.1.5 // indirect
github.com/karalabe/usb v0.0.3-0.20230711191512-61db3e06439c // indirect
...
...
@@ -185,8 +185,8 @@ require (
github.com/stretchr/objx v0.5.0 // indirect
github.com/supranational/blst v0.3.11 // indirect
github.com/syndtr/goleveldb v1.0.1-0.20220614013038-64ee5596c38a // indirect
github.com/tklauser/go-sysconf v0.3.1
0
// indirect
github.com/tklauser/numcpus v0.
5.0
// indirect
github.com/tklauser/go-sysconf v0.3.1
2
// indirect
github.com/tklauser/numcpus v0.
6.1
// indirect
github.com/tyler-smith/go-bip39 v1.1.0 // indirect
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 // indirect
github.com/yusufpapurcu/wmi v1.2.2 // indirect
...
...
@@ -202,13 +202,12 @@ require (
golang.org/x/tools v0.13.0 // indirect
google.golang.org/protobuf v1.30.0 // indirect
gopkg.in/natefinch/lumberjack.v2 v2.0.0 // indirect
gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
lukechampine.com/blake3 v1.2.1 // indirect
rsc.io/tmplfunc v0.0.3 // indirect
)
replace github.com/ethereum/go-ethereum v1.1
2.2 => github.com/ethereum-optimism/op-geth v1.101200.2-rc.1.0.20230922185314-7997a6fed17c
replace github.com/ethereum/go-ethereum v1.1
3.1 => github.com/ethereum-optimism/op-geth v1.101200.2-rc.1.0.20230922190919-8737298ff823
//replace github.com/ethereum/go-ethereum v1.1
2.2
=> ../go-ethereum
//replace github.com/ethereum/go-ethereum v1.1
3.1
=> ../go-ethereum
go.sum
View file @
aa5ed436
This diff is collapsed.
Click to expand it.
op-e2e/actions/l1_replica_test.go
View file @
aa5ed436
...
...
@@ -10,6 +10,8 @@ import (
"github.com/ethereum/go-ethereum/core/rawdb"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/trie"
"github.com/ethereum/go-ethereum/trie/triedb/hashdb"
"github.com/stretchr/testify/require"
"github.com/ethereum-optimism/optimism/op-e2e/e2eutils"
...
...
@@ -58,7 +60,8 @@ func TestL1Replica_ActL1Sync(gt *testing.T) {
genesisBlock
:=
sd
.
L1Cfg
.
ToBlock
()
consensus
:=
beacon
.
New
(
ethash
.
NewFaker
())
db
:=
rawdb
.
NewMemoryDatabase
()
sd
.
L1Cfg
.
MustCommit
(
db
)
tdb
:=
trie
.
NewDatabase
(
db
,
&
trie
.
Config
{
HashDB
:
hashdb
.
Defaults
})
sd
.
L1Cfg
.
MustCommit
(
db
,
tdb
)
chainA
,
_
:=
core
.
GenerateChain
(
sd
.
L1Cfg
.
Config
,
genesisBlock
,
consensus
,
db
,
10
,
func
(
n
int
,
g
*
core
.
BlockGen
)
{
g
.
SetCoinbase
(
common
.
Address
{
'A'
})
...
...
op-e2e/actions/l2_engine_test.go
View file @
aa5ed436
...
...
@@ -13,6 +13,8 @@ import (
"github.com/ethereum/go-ethereum/core/rawdb"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/params"
"github.com/ethereum/go-ethereum/trie"
"github.com/ethereum/go-ethereum/trie/triedb/hashdb"
"github.com/stretchr/testify/require"
"github.com/ethereum/go-ethereum/log"
...
...
@@ -32,7 +34,8 @@ func TestL2EngineAPI(gt *testing.T) {
genesisBlock
:=
sd
.
L2Cfg
.
ToBlock
()
consensus
:=
beacon
.
New
(
ethash
.
NewFaker
())
db
:=
rawdb
.
NewMemoryDatabase
()
sd
.
L2Cfg
.
MustCommit
(
db
)
tdb
:=
trie
.
NewDatabase
(
db
,
&
trie
.
Config
{
HashDB
:
hashdb
.
Defaults
})
sd
.
L2Cfg
.
MustCommit
(
db
,
tdb
)
engine
:=
NewL2Engine
(
t
,
log
,
sd
.
L2Cfg
,
sd
.
RollupCfg
.
Genesis
.
L1
,
jwtPath
)
...
...
@@ -94,7 +97,8 @@ func TestL2EngineAPIBlockBuilding(gt *testing.T) {
log
:=
testlog
.
Logger
(
t
,
log
.
LvlDebug
)
genesisBlock
:=
sd
.
L2Cfg
.
ToBlock
()
db
:=
rawdb
.
NewMemoryDatabase
()
sd
.
L2Cfg
.
MustCommit
(
db
)
tdb
:=
trie
.
NewDatabase
(
db
,
&
trie
.
Config
{
HashDB
:
hashdb
.
Defaults
})
sd
.
L2Cfg
.
MustCommit
(
db
,
tdb
)
engine
:=
NewL2Engine
(
t
,
log
,
sd
.
L2Cfg
,
sd
.
RollupCfg
.
Genesis
.
L1
,
jwtPath
)
t
.
Cleanup
(
func
()
{
...
...
op-e2e/actions/reorg_test.go
View file @
aa5ed436
...
...
@@ -7,7 +7,6 @@ import (
"testing"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/txpool"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/eth/ethconfig"
"github.com/ethereum/go-ethereum/log"
...
...
@@ -95,7 +94,7 @@ func TestReorgOrphanBlock(gt *testing.T) {
miner
.
ActL1SetFeeRecipient
(
common
.
Address
{
'C'
})
// note: the geth tx pool reorgLoop is too slow (responds to chain head events, but async),
// and there's no way to manually trigger runReorg, so we re-insert it ourselves.
require
.
NoError
(
t
,
miner
.
eth
.
TxPool
()
.
Add
([]
*
t
xpool
.
Transaction
{{
Tx
:
batchTx
}
},
true
,
true
)[
0
])
require
.
NoError
(
t
,
miner
.
eth
.
TxPool
()
.
Add
([]
*
t
ypes
.
Transaction
{
batchTx
},
true
,
true
)[
0
])
// need to re-insert previously included tx into the block
miner
.
ActL1IncludeTx
(
sd
.
RollupCfg
.
Genesis
.
SystemConfig
.
BatcherAddr
)(
t
)
miner
.
ActL1EndBlock
(
t
)
...
...
@@ -174,7 +173,7 @@ func TestReorgFlipFlop(gt *testing.T) {
// re-include the batch tx that submitted L2 chain data that pointed to A0, in the new block B1
miner
.
ActL1SetFeeRecipient
(
common
.
Address
{
'B'
,
1
})
miner
.
ActL1StartBlock
(
12
)(
t
)
require
.
NoError
(
t
,
miner
.
eth
.
TxPool
()
.
Add
([]
*
t
xpool
.
Transaction
{{
Tx
:
batchTxA
}
},
true
,
true
)[
0
])
require
.
NoError
(
t
,
miner
.
eth
.
TxPool
()
.
Add
([]
*
t
ypes
.
Transaction
{
batchTxA
},
true
,
true
)[
0
])
miner
.
ActL1IncludeTx
(
sd
.
RollupCfg
.
Genesis
.
SystemConfig
.
BatcherAddr
)(
t
)
miner
.
ActL1EndBlock
(
t
)
...
...
@@ -230,7 +229,7 @@ func TestReorgFlipFlop(gt *testing.T) {
miner
.
ActL1SetFeeRecipient
(
common
.
Address
{
'A'
,
2
})
miner
.
ActL1StartBlock
(
12
)(
t
)
require
.
NoError
(
t
,
miner
.
eth
.
TxPool
()
.
Add
([]
*
t
xpool
.
Transaction
{{
Tx
:
batchTxA
}
},
true
,
true
)[
0
])
// replay chain A batches, but now in A2 instead of A1
require
.
NoError
(
t
,
miner
.
eth
.
TxPool
()
.
Add
([]
*
t
ypes
.
Transaction
{
batchTxA
},
true
,
true
)[
0
])
// replay chain A batches, but now in A2 instead of A1
miner
.
ActL1IncludeTx
(
sd
.
RollupCfg
.
Genesis
.
SystemConfig
.
BatcherAddr
)(
t
)
miner
.
ActL1EndBlock
(
t
)
...
...
op-program/client/l2/db_test.go
View file @
aa5ed436
...
...
@@ -15,6 +15,8 @@ import (
"github.com/ethereum/go-ethereum/ethdb"
"github.com/ethereum/go-ethereum/ethdb/memorydb"
"github.com/ethereum/go-ethereum/params"
"github.com/ethereum/go-ethereum/trie"
"github.com/ethereum/go-ethereum/trie/triedb/hashdb"
"github.com/stretchr/testify/require"
)
...
...
@@ -109,7 +111,8 @@ func TestPut(t *testing.T) {
func
TestSupportsStateDBOperations
(
t
*
testing
.
T
)
{
l2Genesis
:=
createGenesis
()
realDb
:=
rawdb
.
NewDatabase
(
memorydb
.
New
())
genesisBlock
:=
l2Genesis
.
MustCommit
(
realDb
)
trieDB
:=
trie
.
NewDatabase
(
realDb
,
&
trie
.
Config
{
HashDB
:
hashdb
.
Defaults
})
genesisBlock
:=
l2Genesis
.
MustCommit
(
realDb
,
trieDB
)
loader
:=
test
.
NewKvStateOracle
(
t
,
realDb
)
assertStateDataAvailable
(
t
,
NewOracleBackedDB
(
loader
),
l2Genesis
,
genesisBlock
)
...
...
@@ -120,7 +123,8 @@ func TestUpdateState(t *testing.T) {
oracle
:=
test
.
NewStubStateOracle
(
t
)
db
:=
rawdb
.
NewDatabase
(
NewOracleBackedDB
(
oracle
))
genesisBlock
:=
l2Genesis
.
MustCommit
(
db
)
trieDB
:=
trie
.
NewDatabase
(
db
,
&
trie
.
Config
{
HashDB
:
hashdb
.
Defaults
})
genesisBlock
:=
l2Genesis
.
MustCommit
(
db
,
trieDB
)
assertStateDataAvailable
(
t
,
db
,
l2Genesis
,
genesisBlock
)
statedb
,
err
:=
state
.
New
(
genesisBlock
.
Root
(),
state
.
NewDatabase
(
rawdb
.
NewDatabase
(
db
)),
nil
)
...
...
op-program/client/l2/engine.go
View file @
aa5ed436
...
...
@@ -40,7 +40,7 @@ func (o *OracleEngine) L2OutputRoot() (eth.Bytes32, error) {
if
err
!=
nil
{
return
eth
.
Bytes32
{},
fmt
.
Errorf
(
"failed to open L2 state db at block %s: %w"
,
outBlock
.
Hash
(),
err
)
}
withdrawalsTrie
,
err
:=
stateDB
.
StorageTrie
(
predeploys
.
L2ToL1MessagePasserAddr
)
withdrawalsTrie
,
err
:=
stateDB
.
Database
()
.
OpenStorageTrie
(
outBlock
.
Root
,
predeploys
.
L2ToL1MessagePasserAddr
,
stateDB
.
GetStorageRoot
(
predeploys
.
L2ToL1MessagePasserAddr
)
)
if
err
!=
nil
{
return
eth
.
Bytes32
{},
fmt
.
Errorf
(
"withdrawals trie unavailable at block %v: %w"
,
outBlock
.
Hash
(),
err
)
}
...
...
op-program/client/l2/engine_backend_test.go
View file @
aa5ed436
...
...
@@ -19,6 +19,8 @@ import (
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/params"
"github.com/ethereum/go-ethereum/trie"
"github.com/ethereum/go-ethereum/trie/triedb/hashdb"
"github.com/stretchr/testify/require"
)
...
...
@@ -229,9 +231,10 @@ func setupOracle(t *testing.T, blockCount int, headBlockNumber int) (*params.Cha
chainCfg
:=
l2Genesis
.
Config
consensus
:=
beacon
.
New
(
nil
)
db
:=
rawdb
.
NewMemoryDatabase
()
trieDB
:=
trie
.
NewDatabase
(
db
,
&
trie
.
Config
{
HashDB
:
hashdb
.
Defaults
})
// Set minimal amount of stuff to avoid nil references later
genesisBlock
:=
l2Genesis
.
MustCommit
(
db
)
genesisBlock
:=
l2Genesis
.
MustCommit
(
db
,
trieDB
)
blocks
,
_
:=
core
.
GenerateChain
(
chainCfg
,
genesisBlock
,
consensus
,
db
,
blockCount
,
func
(
i
int
,
gen
*
core
.
BlockGen
)
{})
blocks
=
append
([]
*
types
.
Block
{
genesisBlock
},
blocks
...
)
...
...
op-program/client/l2/engineapi/l2_engine_api.go
View file @
aa5ed436
...
...
@@ -294,7 +294,7 @@ func (ea *L2EngineAPI) NewPayloadV1(ctx context.Context, payload *eth.ExecutionP
BaseFeePerGas
:
payload
.
BaseFeePerGas
.
ToBig
(),
BlockHash
:
payload
.
BlockHash
,
Transactions
:
txs
,
},
nil
)
},
nil
,
nil
)
if
err
!=
nil
{
log
.
Debug
(
"Invalid NewPayload params"
,
"params"
,
payload
,
"error"
,
err
)
return
&
eth
.
PayloadStatusV1
{
Status
:
eth
.
ExecutionInvalidBlockHash
},
nil
...
...
op-program/client/mpt/trie.go
View file @
aa5ed436
...
...
@@ -9,6 +9,7 @@ import (
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/rlp"
"github.com/ethereum/go-ethereum/trie"
"github.com/ethereum/go-ethereum/trie/triedb/hashdb"
)
// ReadTrie takes a Merkle Patricia Trie (MPT) root of a "DerivableList", and a pre-image oracle getter,
...
...
@@ -46,7 +47,7 @@ func ReadTrie(root common.Hash, getPreimage func(key common.Hash) []byte) []hexu
//
// For now we just use the state DB trie approach.
tdb
:=
trie
.
NewDatabase
(
odb
)
tdb
:=
trie
.
NewDatabase
(
odb
,
&
trie
.
Config
{
HashDB
:
hashdb
.
Defaults
}
)
tr
,
err
:=
trie
.
New
(
trie
.
TrieID
(
root
),
tdb
)
if
err
!=
nil
{
panic
(
err
)
...
...
op-wheel/cheat/cheat.go
View file @
aa5ed436
...
...
@@ -78,6 +78,12 @@ func (ch *Cheater) Close() error {
return
ch
.
DB
.
Close
()
}
func
openStorageTrie
(
s
*
state
.
StateDB
,
addr
common
.
Address
)
(
state
.
Trie
,
error
)
{
stateRoot
:=
s
.
IntermediateRoot
(
true
)
storageRoot
:=
s
.
GetStorageRoot
(
addr
)
return
s
.
Database
()
.
OpenStorageTrie
(
stateRoot
,
addr
,
storageRoot
)
}
type
HeadFn
func
(
header
*
types
.
Header
,
headState
*
state
.
StateDB
)
error
// RunAndClose runs the given function on the head-state, and then persists any changes (if not ReadOnly),
...
...
@@ -192,7 +198,7 @@ func StorageGet(address common.Address, key common.Hash, w io.Writer) HeadFn {
// to another account (maybe even in a different database!).
func
StorageReadAll
(
address
common
.
Address
,
w
io
.
Writer
)
HeadFn
{
return
func
(
_
*
types
.
Header
,
headState
*
state
.
StateDB
)
error
{
storage
,
err
:=
headState
.
StorageTrie
(
address
)
storage
,
err
:=
openStorageTrie
(
headState
,
address
)
if
err
!=
nil
{
return
fmt
.
Errorf
(
"failed to open storage trie of addr %s: %w"
,
address
,
err
)
}
...
...
@@ -229,14 +235,14 @@ func dbValueToHash(enc []byte) common.Hash {
// Each difference is expressed with 1 character + or - to indicate the change from a to b, followed by key = value.
func
StorageDiff
(
out
io
.
Writer
,
addressA
,
addressB
common
.
Address
)
HeadFn
{
return
func
(
_
*
types
.
Header
,
headState
*
state
.
StateDB
)
error
{
aStorage
,
err
:=
headState
.
StorageTrie
(
addressA
)
aStorage
,
err
:=
openStorageTrie
(
headState
,
addressA
)
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
)
bStorage
,
err
:=
openStorageTrie
(
headState
,
addressB
)
if
err
!=
nil
{
return
fmt
.
Errorf
(
"failed to open storage trie of addr B %s: %w"
,
addressB
,
err
)
}
...
...
op-wheel/engine/engine.go
View file @
aa5ed436
...
...
@@ -296,7 +296,7 @@ func Copy(ctx context.Context, copyFrom client.RPC, copyTo client.RPC) error {
if
err
!=
nil
{
return
err
}
payloadEnv
:=
engine
.
BlockToExecutableData
(
copyHead
,
nil
,
nil
,
nil
,
nil
)
payloadEnv
:=
engine
.
BlockToExecutableData
(
copyHead
,
nil
,
nil
)
if
err
:=
updateForkchoice
(
ctx
,
copyTo
,
copyHead
.
ParentHash
(),
copySafe
.
Hash
(),
copyFinalized
.
Hash
());
err
!=
nil
{
return
err
}
...
...
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