From 36325bff024068b26a78208204549d2f2750e487 Mon Sep 17 00:00:00 2001 From: Roberto Bayardo Date: Wed, 20 Mar 2024 22:51:40 -0700 Subject: [PATCH] update geth moar --- go.mod | 4 +- go.sum | 4 +- .../crossdomain/legacy_withdrawal_test.go | 2 +- op-chain-ops/deployer/deployer.go | 75 ++++++------------- op-chain-ops/genesis/layer_one_test.go | 2 +- op-chain-ops/genesis/layer_two_test.go | 2 +- op-chain-ops/state/state_test.go | 2 +- op-proposer/proposer/abi_test.go | 2 +- op-ufm/go.mod | 4 +- op-ufm/go.sum | 4 +- 10 files changed, 35 insertions(+), 66 deletions(-) diff --git a/go.mod b/go.mod index ae4079b084ed..0650a42eaea1 100644 --- a/go.mod +++ b/go.mod @@ -12,7 +12,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-20240306093353-c557df8e6f41 - github.com/ethereum/go-ethereum v1.13.8 + github.com/ethereum/go-ethereum v1.13.9 github.com/fsnotify/fsnotify v1.7.0 github.com/go-chi/chi/v5 v5.0.12 github.com/go-chi/docgen v1.2.0 @@ -217,7 +217,7 @@ require ( rsc.io/tmplfunc v0.0.3 // indirect ) -replace github.com/ethereum/go-ethereum v1.13.8 => github.com/roberto-bayardo/op-geth v0.0.0-20240321010510-953d48bf7ab5 +replace github.com/ethereum/go-ethereum v1.13.9 => github.com/roberto-bayardo/op-geth v0.0.0-20240321212348-438dd5ed418e // replace github.com/ethereum-optimism/superchain-registry/superchain => ../superchain-registry/superchain diff --git a/go.sum b/go.sum index bcf6aed6ef47..755ae0c2d567 100644 --- a/go.sum +++ b/go.sum @@ -679,8 +679,8 @@ github.com/raulk/go-watchdog v1.3.0/go.mod h1:fIvOnLbF0b0ZwkB9YU4mOW9Did//4vPZtD github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= github.com/rivo/uniseg v0.4.3 h1:utMvzDsuh3suAEnhH0RdHmoPbU648o6CvXxTx4SBMOw= github.com/rivo/uniseg v0.4.3/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= -github.com/roberto-bayardo/op-geth v0.0.0-20240321010510-953d48bf7ab5 h1:Iyl99gawRUzc/MsL5/UGAnN+onjoRsGbnZhLT9hxKMU= -github.com/roberto-bayardo/op-geth v0.0.0-20240321010510-953d48bf7ab5/go.mod h1:k0UbrLuOITLD8goCyA2xWebAL03n2BZUCfwos0rxz60= +github.com/roberto-bayardo/op-geth v0.0.0-20240321212348-438dd5ed418e h1:DJb7sxdfBGUJbXZ8pTfqTfALvIbSp2yypsRfIHUS9g4= +github.com/roberto-bayardo/op-geth v0.0.0-20240321212348-438dd5ed418e/go.mod h1:k0UbrLuOITLD8goCyA2xWebAL03n2BZUCfwos0rxz60= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= diff --git a/op-chain-ops/crossdomain/legacy_withdrawal_test.go b/op-chain-ops/crossdomain/legacy_withdrawal_test.go index 72bd27583d5f..b91100315a14 100644 --- a/op-chain-ops/crossdomain/legacy_withdrawal_test.go +++ b/op-chain-ops/crossdomain/legacy_withdrawal_test.go @@ -201,7 +201,7 @@ func findPassMessage(trace *callFrame) *callFrame { // findCrossDomainMessage will parse a CrossDomainMessage from a receipt func findCrossDomainMessage(receipt *types.Receipt) (*crossdomain.CrossDomainMessage, error) { - backend := backends.NewSimulatedBackend(nil, 15000000) + backend := backends.NewSimulatedBackend(nil, 15000000) // nolint:staticcheck l2xdm, err := bindings.NewL2CrossDomainMessenger(predeploys.L2CrossDomainMessengerAddr, backend) if err != nil { return nil, err diff --git a/op-chain-ops/deployer/deployer.go b/op-chain-ops/deployer/deployer.go index 429bf6470723..c2639444a76c 100644 --- a/op-chain-ops/deployer/deployer.go +++ b/op-chain-ops/deployer/deployer.go @@ -11,11 +11,10 @@ import ( "github.com/ethereum/go-ethereum/accounts/abi/bind/backends" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/hexutil" - "github.com/ethereum/go-ethereum/consensus/beacon" - "github.com/ethereum/go-ethereum/consensus/ethash" "github.com/ethereum/go-ethereum/core" "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/crypto" + "github.com/ethereum/go-ethereum/eth/ethconfig" "github.com/ethereum/go-ethereum/params" ) @@ -50,54 +49,25 @@ type Deployer func(*backends.SimulatedBackend, *bind.TransactOpts, Constructor) // NewL1Backend returns a SimulatedBackend suitable for L1. It has // the latest L1 hardforks enabled. func NewL1Backend() (*backends.SimulatedBackend, error) { - backend, err := NewBackendWithGenesisTimestamp(ChainID, 0, true, nil) + backend, err := NewBackendWithGenesisTimestamp(ChainID, 0, nil) return backend, err } // NewL2Backend returns a SimulatedBackend suitable for L2. // It has the latest L2 hardforks enabled. func NewL2Backend() (*backends.SimulatedBackend, error) { - backend, err := NewBackendWithGenesisTimestamp(ChainID, 0, false, nil) + backend, err := NewBackendWithGenesisTimestamp(ChainID, 0, nil) return backend, err } // NewL2BackendWithChainIDAndPredeploys returns a SimulatedBackend suitable for L2. // It has the latest L2 hardforks enabled, and allows for the configuration of the network's chain ID and predeploys. func NewL2BackendWithChainIDAndPredeploys(chainID *big.Int, predeploys map[string]*common.Address) (*backends.SimulatedBackend, error) { - backend, err := NewBackendWithGenesisTimestamp(chainID, 0, false, predeploys) + backend, err := NewBackendWithGenesisTimestamp(chainID, 0, predeploys) return backend, err } -func NewBackendWithGenesisTimestamp(chainID *big.Int, ts uint64, shanghai bool, predeploys map[string]*common.Address) (*backends.SimulatedBackend, error) { - chainConfig := params.ChainConfig{ - ChainID: chainID, - HomesteadBlock: big.NewInt(0), - DAOForkBlock: nil, - DAOForkSupport: false, - EIP150Block: big.NewInt(0), - EIP155Block: big.NewInt(0), - EIP158Block: big.NewInt(0), - ByzantiumBlock: big.NewInt(0), - ConstantinopleBlock: big.NewInt(0), - PetersburgBlock: big.NewInt(0), - IstanbulBlock: big.NewInt(0), - MuirGlacierBlock: big.NewInt(0), - BerlinBlock: big.NewInt(0), - LondonBlock: big.NewInt(0), - ArrowGlacierBlock: big.NewInt(0), - GrayGlacierBlock: big.NewInt(0), - // Activated proof of stake. We manually build/commit blocks in the simulator anyway, - // and the timestamp verification of PoS is not against the wallclock, - // preventing blocks from getting stuck temporarily in the future-blocks queue, decreasing setup time a lot. - MergeNetsplitBlock: big.NewInt(0), - TerminalTotalDifficulty: big.NewInt(0), - TerminalTotalDifficultyPassed: true, - } - - if shanghai { - chainConfig.ShanghaiTime = u64ptr(0) - } - +func NewBackendWithGenesisTimestamp(chainID *big.Int, ts uint64, predeploys map[string]*common.Address) (*backends.SimulatedBackend, error) { alloc := core.GenesisAlloc{ crypto.PubkeyToAddress(TestKey.PublicKey): core.GenesisAccount{ Balance: thousandETH, @@ -113,19 +83,18 @@ func NewBackendWithGenesisTimestamp(chainID *big.Int, ts uint64, shanghai bool, } } - return backends.NewSimulatedBackendWithOpts( - backends.WithCacheConfig(&core.CacheConfig{ - Preimages: true, - }), - backends.WithGenesis(core.Genesis{ - Config: &chainConfig, - Timestamp: ts, - Difficulty: big.NewInt(0), - Alloc: alloc, - GasLimit: 30_000_000, - }), - backends.WithConsensus(beacon.New(ethash.NewFaker())), - ), nil + cfg := ethconfig.Defaults + cfg.Preimages = true + config := params.AllDevChainProtocolChanges + config.Ethash = new(params.EthashConfig) + cfg.Genesis = &core.Genesis{ + Config: config, + Timestamp: ts, + Difficulty: big.NewInt(0), + Alloc: alloc, + GasLimit: 30_000_000, + } + return backends.NewSimulatedBackendFromConfig(cfg), nil } func Deploy(backend *backends.SimulatedBackend, constructors []Constructor, cb Deployer) ([]Deployment, error) { @@ -188,7 +157,11 @@ func Deploy(backend *backends.SimulatedBackend, constructors []Constructor, cb D // The function logs a fatal error and exits if there are any issues with transaction mining, if the deployment fails, // or if the deployed bytecode is not found at the computed address. func DeployWithDeterministicDeployer(backend *backends.SimulatedBackend, contractName string) ([]byte, error) { - opts, err := bind.NewKeyedTransactorWithChainID(TestKey, backend.Blockchain().Config().ChainID) + cid, err := backend.ChainID(context.Background()) + if err != nil { + return nil, err + } + opts, err := bind.NewKeyedTransactorWithChainID(TestKey, cid) if err != nil { return nil, err } @@ -242,10 +215,6 @@ func DeployWithDeterministicDeployer(backend *backends.SimulatedBackend, contrac return code, nil } -func u64ptr(n uint64) *uint64 { - return &n -} - // create2Address computes the Ethereum address for a contract created using the CREATE2 opcode. // // The CREATE2 opcode allows for more deterministic address generation in Ethereum, as it computes the diff --git a/op-chain-ops/genesis/layer_one_test.go b/op-chain-ops/genesis/layer_one_test.go index ba8a8f0c0fa1..1ff89e72b690 100644 --- a/op-chain-ops/genesis/layer_one_test.go +++ b/op-chain-ops/genesis/layer_one_test.go @@ -46,7 +46,7 @@ func TestBuildL1DeveloperGenesis(t *testing.T) { genesis, err := BuildL1DeveloperGenesis(config, dump, nil) require.NoError(t, err) - sim := backends.NewSimulatedBackend( + sim := backends.NewSimulatedBackend( // nolint:staticcheck genesis.Alloc, 15000000, ) diff --git a/op-chain-ops/genesis/layer_two_test.go b/op-chain-ops/genesis/layer_two_test.go index 2dcf835d3126..4115b752baf1 100644 --- a/op-chain-ops/genesis/layer_two_test.go +++ b/op-chain-ops/genesis/layer_two_test.go @@ -31,7 +31,7 @@ var testKey, _ = crypto.HexToECDSA("b71c71a67e1177ad4e901695e1b4b9ee17ae16c6668d // Tests the BuildL2MainnetGenesis factory with the provided config. func testBuildL2Genesis(t *testing.T, config *genesis.DeployConfig) *core.Genesis { - backend := backends.NewSimulatedBackend( + backend := backends.NewSimulatedBackend( // nolint:staticcheck core.GenesisAlloc{ crypto.PubkeyToAddress(testKey.PublicKey): {Balance: big.NewInt(10000000000000000)}, }, diff --git a/op-chain-ops/state/state_test.go b/op-chain-ops/state/state_test.go index f596d30276f0..e181e239858c 100644 --- a/op-chain-ops/state/state_test.go +++ b/op-chain-ops/state/state_test.go @@ -63,7 +63,7 @@ func TestSetAndGetStorageSlots(t *testing.T) { slots, err := state.ComputeStorageSlots(&layout, values) require.Nil(t, err) - backend := backends.NewSimulatedBackend( + backend := backends.NewSimulatedBackend( // nolint:staticcheck core.GenesisAlloc{ crypto.PubkeyToAddress(testKey.PublicKey): {Balance: big.NewInt(10000000000000000)}, }, diff --git a/op-proposer/proposer/abi_test.go b/op-proposer/proposer/abi_test.go index 7ff576c365e3..fb634ec4dfab 100644 --- a/op-proposer/proposer/abi_test.go +++ b/op-proposer/proposer/abi_test.go @@ -28,7 +28,7 @@ func simulatedBackend() (privateKey *ecdsa.PrivateKey, address common.Address, o if err != nil { return nil, common.Address{}, nil, nil, err } - backend = backends.NewSimulatedBackend(core.GenesisAlloc{from: {Balance: big.NewInt(params.Ether)}}, 50_000_000) + backend = backends.NewSimulatedBackend(core.GenesisAlloc{from: {Balance: big.NewInt(params.Ether)}}, 50_000_000) // nolint:staticcheck return privateKey, from, opts, backend, nil } diff --git a/op-ufm/go.mod b/op-ufm/go.mod index e00d1ad4d24a..a11ee3ee3b23 100644 --- a/op-ufm/go.mod +++ b/op-ufm/go.mod @@ -8,7 +8,7 @@ require ( cloud.google.com/go/kms v1.12.1 github.com/BurntSushi/toml v1.3.2 github.com/ethereum-optimism/optimism v1.6.2-0.20240222202618-f707883038d5 - github.com/ethereum/go-ethereum v1.13.8 + github.com/ethereum/go-ethereum v1.13.9 github.com/gorilla/mux v1.8.0 github.com/pkg/errors v0.9.1 github.com/prometheus/client_golang v1.19.0 @@ -98,6 +98,6 @@ require ( rsc.io/tmplfunc v0.0.3 // indirect ) -replace github.com/ethereum/go-ethereum v1.13.8 => github.com/ethereum-optimism/op-geth v1.101308.2-rc.2 +replace github.com/ethereum/go-ethereum v1.13.9 => github.com/roberto-bayardo/op-geth v0.0.0-20240321212348-438dd5ed418e replace github.com/ethereum-optimism/optimism => ../. diff --git a/op-ufm/go.sum b/op-ufm/go.sum index a40bd9ece1ed..e88c3854ff3e 100644 --- a/op-ufm/go.sum +++ b/op-ufm/go.sum @@ -84,8 +84,6 @@ github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1m github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -github.com/ethereum-optimism/op-geth v1.101308.2-rc.2 h1:Tjm2n7/actyINbRIbqeDS+SyWAcIl+pRfOHODwW7lpQ= -github.com/ethereum-optimism/op-geth v1.101308.2-rc.2/go.mod h1:RPqVhnX00rJNys/YRDK4Wl4PvS6dgFrLqhsopIZOhEw= github.com/ethereum-optimism/superchain-registry/superchain v0.0.0-20240306093353-c557df8e6f41 h1:WKJvsRyW/YNgyT0P2x5U530ITOY8Dv9TrZnbliqSXd8= github.com/ethereum-optimism/superchain-registry/superchain v0.0.0-20240306093353-c557df8e6f41/go.mod h1:7xh2awFQqsiZxFrHKTgEd+InVfDRrkKVUIuK8SAFHp0= github.com/ethereum/c-kzg-4844 v0.4.0 h1:3MS1s4JtA868KpJxroZoepdV0ZKBp3u/O5HcZ7R3nlY= @@ -240,6 +238,8 @@ github.com/prometheus/procfs v0.12.0/go.mod h1:pcuDEFsWDnvcgNzo4EEweacyhjeA9Zk3c github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= github.com/rivo/uniseg v0.4.3 h1:utMvzDsuh3suAEnhH0RdHmoPbU648o6CvXxTx4SBMOw= github.com/rivo/uniseg v0.4.3/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= +github.com/roberto-bayardo/op-geth v0.0.0-20240321212348-438dd5ed418e h1:DJb7sxdfBGUJbXZ8pTfqTfALvIbSp2yypsRfIHUS9g4= +github.com/roberto-bayardo/op-geth v0.0.0-20240321212348-438dd5ed418e/go.mod h1:k0UbrLuOITLD8goCyA2xWebAL03n2BZUCfwos0rxz60= github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ=