Skip to content

Commit 3050e36

Browse files
roberto-bayardoRoberto Bayardoprotolambdasebastianst
authored andcommitted
Updates to work with upstream geth v1.14.12 changes (ethereum-optimism#13002)
* all: update to op-geth with upstream v1.14.12 changes. * go.mod: bump go-ethereum dependency to 1.14.12 * go mod tidy * go.mod: update op-geth and scr --------- Co-authored-by: Roberto Bayardo <[email protected]> Co-authored-by: protolambda <[email protected]> Co-authored-by: Sebastian Stammler <[email protected]>
1 parent 783407c commit 3050e36

File tree

12 files changed

+83
-81
lines changed

12 files changed

+83
-81
lines changed

go.mod

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,6 @@ require (
219219
github.com/sigurn/crc8 v0.0.0-20220107193325-2243fe600f9f // indirect
220220
github.com/sirupsen/logrus v1.9.3 // indirect
221221
github.com/spaolacci/murmur3 v1.1.0 // indirect
222-
github.com/status-im/keycard-go v0.2.0 // indirect
223222
github.com/stretchr/objx v0.5.2 // indirect
224223
github.com/supranational/blst v0.3.13 // indirect
225224
github.com/syndtr/goleveldb v1.0.1-0.20220614013038-64ee5596c38a // indirect
@@ -253,9 +252,9 @@ require (
253252
rsc.io/tmplfunc v0.0.3 // indirect
254253
)
255254

256-
replace github.com/ethereum/go-ethereum => github.com/ethereum-optimism/op-geth v1.101411.5-rc.2
255+
replace github.com/ethereum/go-ethereum => github.com/ethereum-optimism/op-geth v1.101412.0-rc.1
257256

258-
//replace github.com/ethereum/go-ethereum => ../go-ethereum
257+
//replace github.com/ethereum/go-ethereum => ../op-geth
259258

260259
// replace github.com/ethereum-optimism/superchain-registry/superchain => ../superchain-registry/superchain
261260

go.sum

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -194,8 +194,8 @@ github.com/elastic/gosigar v0.14.3 h1:xwkKwPia+hSfg9GqrCUKYdId102m9qTJIIr7egmK/u
194194
github.com/elastic/gosigar v0.14.3/go.mod h1:iXRIGg2tLnu7LBdpqzyQfGDEidKCfWcCMS0WKyPWoMs=
195195
github.com/ethereum-optimism/go-ethereum-hdwallet v0.1.3 h1:RWHKLhCrQThMfch+QJ1Z8veEq5ZO3DfIhZ7xgRP9WTc=
196196
github.com/ethereum-optimism/go-ethereum-hdwallet v0.1.3/go.mod h1:QziizLAiF0KqyLdNJYD7O5cpDlaFMNZzlxYNcWsJUxs=
197-
github.com/ethereum-optimism/op-geth v1.101411.5-rc.2 h1:BZVp8LEVzeJOX+Uanie7h1ly23yPe8+pVjGEmzrOjc0=
198-
github.com/ethereum-optimism/op-geth v1.101411.5-rc.2/go.mod h1:rq9bjyaTP534guwZ7qdfNTliXFcCjO7buoWW7x97tCE=
197+
github.com/ethereum-optimism/op-geth v1.101412.0-rc.1 h1:Un6Cnr4QkQx+s/Rp1iWvsBD+lIE1xZd8RKIKxGmChTk=
198+
github.com/ethereum-optimism/op-geth v1.101412.0-rc.1/go.mod h1:lRTd6c45e98fA9Cm0c8SrtqiSNYtxUBBZo3ofJbQh5I=
199199
github.com/ethereum-optimism/superchain-registry/superchain v0.0.0-20250115145553-996c7aba6565 h1:jhMVWUohS71nsNg8Q8d7DatiGpPocvUNGr/zP8a+79A=
200200
github.com/ethereum-optimism/superchain-registry/superchain v0.0.0-20250115145553-996c7aba6565/go.mod h1:9feO8jcL5OZ1tvRjEfNAHz4Aggvd6373l+ZxmZZAyZs=
201201
github.com/ethereum/c-kzg-4844 v1.0.0 h1:0X1LBXxaEtYD9xsyj9B9ctQEZIpnvVDeoBx8aHEwTNA=
@@ -786,8 +786,6 @@ github.com/sourcegraph/syntaxhighlight v0.0.0-20170531221838-bd320f5d308e/go.mod
786786
github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA=
787787
github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI=
788788
github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA=
789-
github.com/status-im/keycard-go v0.2.0 h1:QDLFswOQu1r5jsycloeQh3bVU8n/NatHHaZobtDnDzA=
790-
github.com/status-im/keycard-go v0.2.0/go.mod h1:wlp8ZLbsmrF6g6WjugPAx+IzoLrkdf9+mHxBEeo3Hbg=
791789
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
792790
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
793791
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=

op-chain-ops/cmd/check-canyon/main.go

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ import (
1717
"github.com/mattn/go-isatty"
1818

1919
"github.com/ethereum/go-ethereum/common"
20-
"github.com/ethereum/go-ethereum/common/math"
2120
"github.com/ethereum/go-ethereum/core/types"
2221
"github.com/ethereum/go-ethereum/crypto"
2322
"github.com/ethereum/go-ethereum/ethclient"
@@ -48,19 +47,22 @@ func CalcBaseFee(parent eth.BlockInfo, elasticity uint64, canyonActive bool) *bi
4847
num.Mul(num, parent.BaseFee())
4948
num.Div(num, denom.SetUint64(parentGasTarget))
5049
num.Div(num, denom.SetUint64(denomUint))
51-
baseFeeDelta := math.BigMax(num, common.Big1)
52-
53-
return num.Add(parent.BaseFee(), baseFeeDelta)
50+
if num.Cmp(common.Big1) < 0 {
51+
num.Set(common.Big1)
52+
}
53+
return num.Add(num, parent.BaseFee())
5454
} else {
5555
// Otherwise if the parent block used less gas than its target, the baseFee should decrease.
5656
// max(0, parentBaseFee * gasUsedDelta / parentGasTarget / baseFeeChangeDenominator)
5757
num.SetUint64(parentGasTarget - parent.GasUsed())
5858
num.Mul(num, parent.BaseFee())
5959
num.Div(num, denom.SetUint64(parentGasTarget))
6060
num.Div(num, denom.SetUint64(denomUint))
61-
baseFee := num.Sub(parent.BaseFee(), num)
62-
63-
return math.BigMax(baseFee, common.Big0)
61+
num.Sub(parent.BaseFee(), num)
62+
if num.Cmp(common.Big0) < 0 {
63+
return common.Big0
64+
}
65+
return num
6466
}
6567
}
6668

op-chain-ops/genesis/genesis.go

Lines changed: 31 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -42,36 +42,35 @@ func NewL2Genesis(config *DeployConfig, l1StartHeader *types.Header) (*core.Gene
4242
l1StartTime := l1StartHeader.Time
4343

4444
optimismChainConfig := params.ChainConfig{
45-
ChainID: new(big.Int).SetUint64(config.L2ChainID),
46-
HomesteadBlock: big.NewInt(0),
47-
DAOForkBlock: nil,
48-
DAOForkSupport: false,
49-
EIP150Block: big.NewInt(0),
50-
EIP155Block: big.NewInt(0),
51-
EIP158Block: big.NewInt(0),
52-
ByzantiumBlock: big.NewInt(0),
53-
ConstantinopleBlock: big.NewInt(0),
54-
PetersburgBlock: big.NewInt(0),
55-
IstanbulBlock: big.NewInt(0),
56-
MuirGlacierBlock: big.NewInt(0),
57-
BerlinBlock: big.NewInt(0),
58-
LondonBlock: big.NewInt(0),
59-
ArrowGlacierBlock: big.NewInt(0),
60-
GrayGlacierBlock: big.NewInt(0),
61-
MergeNetsplitBlock: big.NewInt(0),
62-
TerminalTotalDifficulty: big.NewInt(0),
63-
TerminalTotalDifficultyPassed: true,
64-
BedrockBlock: new(big.Int).SetUint64(uint64(config.L2GenesisBlockNumber)),
65-
RegolithTime: config.RegolithTime(l1StartTime),
66-
CanyonTime: config.CanyonTime(l1StartTime),
67-
ShanghaiTime: config.CanyonTime(l1StartTime),
68-
CancunTime: config.EcotoneTime(l1StartTime),
69-
EcotoneTime: config.EcotoneTime(l1StartTime),
70-
FjordTime: config.FjordTime(l1StartTime),
71-
GraniteTime: config.GraniteTime(l1StartTime),
72-
HoloceneTime: config.HoloceneTime(l1StartTime),
73-
IsthmusTime: config.IsthmusTime(l1StartTime),
74-
InteropTime: config.InteropTime(l1StartTime),
45+
ChainID: new(big.Int).SetUint64(config.L2ChainID),
46+
HomesteadBlock: big.NewInt(0),
47+
DAOForkBlock: nil,
48+
DAOForkSupport: false,
49+
EIP150Block: big.NewInt(0),
50+
EIP155Block: big.NewInt(0),
51+
EIP158Block: big.NewInt(0),
52+
ByzantiumBlock: big.NewInt(0),
53+
ConstantinopleBlock: big.NewInt(0),
54+
PetersburgBlock: big.NewInt(0),
55+
IstanbulBlock: big.NewInt(0),
56+
MuirGlacierBlock: big.NewInt(0),
57+
BerlinBlock: big.NewInt(0),
58+
LondonBlock: big.NewInt(0),
59+
ArrowGlacierBlock: big.NewInt(0),
60+
GrayGlacierBlock: big.NewInt(0),
61+
MergeNetsplitBlock: big.NewInt(0),
62+
TerminalTotalDifficulty: big.NewInt(0),
63+
BedrockBlock: new(big.Int).SetUint64(uint64(config.L2GenesisBlockNumber)),
64+
RegolithTime: config.RegolithTime(l1StartTime),
65+
CanyonTime: config.CanyonTime(l1StartTime),
66+
ShanghaiTime: config.CanyonTime(l1StartTime),
67+
CancunTime: config.EcotoneTime(l1StartTime),
68+
EcotoneTime: config.EcotoneTime(l1StartTime),
69+
FjordTime: config.FjordTime(l1StartTime),
70+
GraniteTime: config.GraniteTime(l1StartTime),
71+
HoloceneTime: config.HoloceneTime(l1StartTime),
72+
IsthmusTime: config.IsthmusTime(l1StartTime),
73+
InteropTime: config.InteropTime(l1StartTime),
7574
Optimism: &params.OptimismConfig{
7675
EIP1559Denominator: eip1559Denom,
7776
EIP1559Elasticity: eip1559Elasticity,
@@ -144,9 +143,8 @@ func NewL1Genesis(config *DeployConfig) (*core.Genesis, error) {
144143
ShanghaiTime: u64ptr(0),
145144
CancunTime: u64ptr(0),
146145
// To enable post-Merge consensus at genesis
147-
MergeNetsplitBlock: big.NewInt(0),
148-
TerminalTotalDifficulty: big.NewInt(0),
149-
TerminalTotalDifficultyPassed: true,
146+
MergeNetsplitBlock: big.NewInt(0),
147+
TerminalTotalDifficulty: big.NewInt(0),
150148
}
151149

152150
gasLimit := config.L1GenesisBlockGasLimit

op-chain-ops/script/forking/db.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,10 +109,10 @@ func (f *ForkDB) TrieDB() *triedb.Database {
109109
IsVerkle: false,
110110
HashDB: nil,
111111
PathDB: &pathdb.Config{
112-
StateHistory: 0,
113-
CleanCacheSize: 0,
114-
DirtyCacheSize: 0,
115-
ReadOnly: true,
112+
StateHistory: 0,
113+
CleanCacheSize: 0,
114+
WriteBufferSize: 0,
115+
ReadOnly: true,
116116
},
117117
})
118118
return tdb

op-chain-ops/script/forking/state.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -250,12 +250,12 @@ func (fst *ForkableState) CreateContract(address common.Address) {
250250
fst.stateFor(address).CreateContract(address)
251251
}
252252

253-
func (fst *ForkableState) SubBalance(address common.Address, u *uint256.Int, reason tracing.BalanceChangeReason) {
254-
fst.stateFor(address).SubBalance(address, u, reason)
253+
func (fst *ForkableState) SubBalance(address common.Address, u *uint256.Int, reason tracing.BalanceChangeReason) uint256.Int {
254+
return fst.stateFor(address).SubBalance(address, u, reason)
255255
}
256256

257-
func (fst *ForkableState) AddBalance(address common.Address, u *uint256.Int, reason tracing.BalanceChangeReason) {
258-
fst.stateFor(address).AddBalance(address, u, reason)
257+
func (fst *ForkableState) AddBalance(address common.Address, u *uint256.Int, reason tracing.BalanceChangeReason) uint256.Int {
258+
return fst.stateFor(address).AddBalance(address, u, reason)
259259
}
260260

261261
func (fst *ForkableState) GetBalance(address common.Address) *uint256.Int {
@@ -306,8 +306,8 @@ func (fst *ForkableState) GetState(address common.Address, k common.Hash) common
306306
return fst.stateFor(address).GetState(address, k)
307307
}
308308

309-
func (fst *ForkableState) SetState(address common.Address, k common.Hash, v common.Hash) {
310-
fst.stateFor(address).SetState(address, k, v)
309+
func (fst *ForkableState) SetState(address common.Address, k common.Hash, v common.Hash) common.Hash {
310+
return fst.stateFor(address).SetState(address, k, v)
311311
}
312312

313313
func (fst *ForkableState) GetStorageRoot(addr common.Address) common.Hash {
@@ -322,16 +322,16 @@ func (fst *ForkableState) SetTransientState(addr common.Address, key, value comm
322322
fst.stateFor(addr).SetTransientState(addr, key, value)
323323
}
324324

325-
func (fst *ForkableState) SelfDestruct(address common.Address) {
326-
fst.stateFor(address).SelfDestruct(address)
325+
func (fst *ForkableState) SelfDestruct(address common.Address) uint256.Int {
326+
return fst.stateFor(address).SelfDestruct(address)
327327
}
328328

329329
func (fst *ForkableState) HasSelfDestructed(address common.Address) bool {
330330
return fst.stateFor(address).HasSelfDestructed(address)
331331
}
332332

333-
func (fst *ForkableState) Selfdestruct6780(address common.Address) {
334-
fst.stateFor(address).Selfdestruct6780(address)
333+
func (fst *ForkableState) SelfDestruct6780(address common.Address) (uint256.Int, bool) {
334+
return fst.stateFor(address).SelfDestruct6780(address)
335335
}
336336

337337
func (fst *ForkableState) Exist(address common.Address) bool {

op-chain-ops/script/script.go

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -209,12 +209,11 @@ func NewHost(
209209
GrayGlacierBlock: big.NewInt(0),
210210
MergeNetsplitBlock: big.NewInt(0),
211211
// Ethereum forks in proof-of-stake era.
212-
TerminalTotalDifficulty: big.NewInt(1),
213-
TerminalTotalDifficultyPassed: true,
214-
ShanghaiTime: new(uint64),
215-
CancunTime: new(uint64),
216-
PragueTime: nil,
217-
VerkleTime: nil,
212+
TerminalTotalDifficulty: big.NewInt(1),
213+
ShanghaiTime: new(uint64),
214+
CancunTime: new(uint64),
215+
PragueTime: nil,
216+
VerkleTime: nil,
218217
// OP-Stack forks are disabled, since we use this for L1.
219218
BedrockBlock: nil,
220219
RegolithTime: nil,

op-program/client/l2/db.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,10 @@ func (o *OracleKeyValueStore) Delete(key []byte) error {
7474
panic("not supported")
7575
}
7676

77+
func (o *OracleKeyValueStore) DeleteRange(start, end []byte) error {
78+
panic("not supported")
79+
}
80+
7781
func (o *OracleKeyValueStore) Stat() (string, error) {
7882
panic("not supported")
7983
}

op-program/client/l2/engineapi/l2_engine_api.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ func (ea *L2EngineAPI) NewPayloadV1(ctx context.Context, payload *eth.ExecutionP
301301
return &eth.PayloadStatusV1{Status: eth.ExecutionInvalid}, engine.InvalidParams.With(errors.New("withdrawals not supported in V1"))
302302
}
303303

304-
return ea.newPayload(ctx, payload, nil, nil)
304+
return ea.newPayload(ctx, payload, nil, nil, nil)
305305
}
306306

307307
func (ea *L2EngineAPI) NewPayloadV2(ctx context.Context, payload *eth.ExecutionPayload) (*eth.PayloadStatusV1, error) {
@@ -313,7 +313,7 @@ func (ea *L2EngineAPI) NewPayloadV2(ctx context.Context, payload *eth.ExecutionP
313313
return &eth.PayloadStatusV1{Status: eth.ExecutionInvalid}, engine.InvalidParams.With(errors.New("non-nil withdrawals pre-shanghai"))
314314
}
315315

316-
return ea.newPayload(ctx, payload, nil, nil)
316+
return ea.newPayload(ctx, payload, nil, nil, nil)
317317
}
318318

319319
// Ported from: https://github.com/ethereum-optimism/op-geth/blob/c50337a60a1309a0f1dca3bf33ed1bb38c46cdd7/eth/catalyst/api.go#L486C1-L507
@@ -342,7 +342,7 @@ func (ea *L2EngineAPI) NewPayloadV3(ctx context.Context, params *eth.ExecutionPa
342342
}
343343
}
344344

345-
return ea.newPayload(ctx, params, versionedHashes, beaconRoot)
345+
return ea.newPayload(ctx, params, versionedHashes, beaconRoot, nil)
346346
}
347347

348348
func (ea *L2EngineAPI) getPayload(_ context.Context, payloadId eth.PayloadID) (*eth.ExecutionPayloadEnvelope, error) {
@@ -479,7 +479,7 @@ func toGethWithdrawals(payload *eth.ExecutionPayload) []*types.Withdrawal {
479479
return result
480480
}
481481

482-
func (ea *L2EngineAPI) newPayload(_ context.Context, payload *eth.ExecutionPayload, hashes []common.Hash, root *common.Hash) (*eth.PayloadStatusV1, error) {
482+
func (ea *L2EngineAPI) newPayload(_ context.Context, payload *eth.ExecutionPayload, hashes []common.Hash, root *common.Hash, requests [][]byte) (*eth.PayloadStatusV1, error) {
483483
ea.log.Trace("L2Engine API request received", "method", "ExecutePayload", "number", payload.BlockNumber, "hash", payload.BlockHash)
484484
txs := make([][]byte, len(payload.Transactions))
485485
for i, tx := range payload.Transactions {
@@ -503,7 +503,7 @@ func (ea *L2EngineAPI) newPayload(_ context.Context, payload *eth.ExecutionPaylo
503503
Withdrawals: toGethWithdrawals(payload),
504504
ExcessBlobGas: (*uint64)(payload.ExcessBlobGas),
505505
BlobGasUsed: (*uint64)(payload.BlobGasUsed),
506-
}, hashes, root, ea.backend.Config())
506+
}, hashes, root, requests, ea.backend.Config())
507507
if err != nil {
508508
log.Debug("Invalid NewPayload params", "params", payload, "error", err)
509509
return &eth.PayloadStatusV1{Status: eth.ExecutionInvalidBlockHash}, nil

op-program/client/l2/engineapi/l2_engine_api_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ func newStubBackend(t *testing.T) *stubCachingBackend {
8484

8585
func createGenesis() *core.Genesis {
8686
config := *params.MergedTestChainConfig
87+
config.PragueTime = nil
8788
var zero uint64
8889
// activate recent OP-stack forks
8990
config.RegolithTime = &zero

0 commit comments

Comments
 (0)