From 12089354ca8f651796580fc563d2ceac15ac52bd Mon Sep 17 00:00:00 2001 From: Dror Tirosh Date: Tue, 25 Jun 2024 10:54:13 +0300 Subject: [PATCH] refactor dev genesis (#10) --- tests/rip7560/rip7560TestUtils.go | 14 +------------- tests/rip7560/validation_test.go | 2 +- 2 files changed, 2 insertions(+), 14 deletions(-) diff --git a/tests/rip7560/rip7560TestUtils.go b/tests/rip7560/rip7560TestUtils.go index d891d4b223..258d8ed609 100644 --- a/tests/rip7560/rip7560TestUtils.go +++ b/tests/rip7560/rip7560TestUtils.go @@ -9,7 +9,6 @@ import ( "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/core/vm" "github.com/ethereum/go-ethereum/internal/ethapi" - "github.com/ethereum/go-ethereum/params" "github.com/status-im/keycard-go/hexutils" "math/big" "testing" @@ -21,7 +20,6 @@ type testContext struct { genesisAlloc types.GenesisAlloc t *testing.T chainContext *ethapi.ChainContext - chainConfig *params.ChainConfig gaspool *core.GasPool genesis *core.Genesis genesisBlock *types.Block @@ -33,29 +31,20 @@ func newTestContext(t *testing.T) *testContext { type testContextBuilder struct { t *testing.T - chainConfig *params.ChainConfig genesisAlloc types.GenesisAlloc } func newTestContextBuilder(t *testing.T) *testContextBuilder { genesisAlloc := types.GenesisAlloc{} - chainConfig := params.AllDevChainProtocolChanges - // probably bug in geth.. - chainConfig.PragueTime = chainConfig.CancunTime - return &testContextBuilder{ t: t, - chainConfig: chainConfig, genesisAlloc: genesisAlloc, } } func (tb *testContextBuilder) build() *testContext { - genesis := &core.Genesis{ - Config: params.AllDevChainProtocolChanges, - Alloc: tb.genesisAlloc, - } + genesis := core.DeveloperGenesisBlock(10_000_000, &common.Address{}) genesisBlock := genesis.ToBlock() gaspool := new(core.GasPool).AddGas(genesisBlock.GasLimit()) @@ -66,7 +55,6 @@ func (tb *testContextBuilder) build() *testContext { t: tb.t, genesisAlloc: tb.genesisAlloc, chainContext: ethapi.NewChainContext(context.TODO(), backend), - chainConfig: tb.chainConfig, genesis: genesis, genesisBlock: genesisBlock, gaspool: gaspool, diff --git a/tests/rip7560/validation_test.go b/tests/rip7560/validation_test.go index 357fc3a8e8..4a0b47f6b8 100644 --- a/tests/rip7560/validation_test.go +++ b/tests/rip7560/validation_test.go @@ -69,7 +69,7 @@ func validatePhase(tb *testContextBuilder, aatx types.Rip7560AccountAbstractionT var state = tests.MakePreState(rawdb.NewMemoryDatabase(), t.genesisAlloc, false, rawdb.HashScheme) defer state.Close() - _, err := core.ApplyRip7560ValidationPhases(t.chainConfig, t.chainContext, &common.Address{}, t.gaspool, state.StateDB, t.genesisBlock.Header(), tx, vm.Config{}) + _, err := core.ApplyRip7560ValidationPhases(t.genesis.Config, t.chainContext, &common.Address{}, t.gaspool, state.StateDB, t.genesisBlock.Header(), tx, vm.Config{}) // err string or empty if nil errStr := "" if err != nil {