From 2cd0387cbe49bdcbebc7ee2741911326ef912f80 Mon Sep 17 00:00:00 2001 From: Sunny Date: Tue, 13 Jun 2023 18:35:32 +0800 Subject: [PATCH] test: Add EIP-2718 unit test for parlia ChainConfig --- core/blockchain_test.go | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/core/blockchain_test.go b/core/blockchain_test.go index 20615eef8c..dcb61b505b 100644 --- a/core/blockchain_test.go +++ b/core/blockchain_test.go @@ -3581,12 +3581,24 @@ func TestInitThenFailCreateContract(t *testing.T) { } } -// TestEIP2718Transition tests that an EIP-2718 transaction will be accepted +// TestEIP2718Transition* tests that an EIP-2718 transaction will be accepted // after the fork block has passed. This is verified by sending an EIP-2930 // access list transaction, which specifies a single slot access, and then // checking that the gas usage of a hot SLOAD and a cold SLOAD are calculated // correctly. -func TestEIP2718Transition(t *testing.T) { + +// TestEIP2718TransitionWithTestChainConfig tests EIP-2718 with TestChainConfig. +func TestEIP2718TransitionWithTestChainConfig(t *testing.T) { + testEIP2718TransitionWithConfig(t, params.TestChainConfig) +} + +// TestEIP2718TransitionWithParliaConfig tests EIP-2718 with Parlia Config. +func TestEIP2718TransitionWithParliaConfig(t *testing.T) { + testEIP2718TransitionWithConfig(t, params.ParliaTestChainConfig) +} + +// testEIP2718TransitionWithConfig tests EIP02718 with given ChainConfig. +func testEIP2718TransitionWithConfig(t *testing.T, config *params.ChainConfig) { var ( aa = common.HexToAddress("0x000000000000000000000000000000000000aaaa") @@ -3599,7 +3611,7 @@ func TestEIP2718Transition(t *testing.T) { address = crypto.PubkeyToAddress(key.PublicKey) funds = big.NewInt(1000000000000000) gspec = &Genesis{ - Config: params.TestChainConfig, + Config: config, Alloc: GenesisAlloc{ address: {Balance: funds}, // The address 0xAAAA sloads 0x00 and 0x01