From 86de64a2a3139faec2e08016da2e4397939b5400 Mon Sep 17 00:00:00 2001 From: Andrew Ashikhmin <34320705+yperbasis@users.noreply.github.com> Date: Thu, 26 May 2022 12:08:59 +0200 Subject: [PATCH] TangerineWhistle instead of EIP150 & SpuriousDragon instead of EIP155/158 (#4273) * EIP150Block -> TangerineWhistleBlock * Merge EIP158Block into EIP155Block * EIP155Block -> SpuriousDragonBlock --- cmd/cons/commands/clique.go | 5 +- cmd/sentry/sentry/sentry_grpc_server_test.go | 11 +- consensus/bor/bor.go | 4 +- consensus/misc/eip1559_test.go | 35 ++- consensus/misc/forks.go | 6 +- core/state/database_test.go | 113 ++++---- core/state/intra_block_state.go | 14 +- core/types/transaction_signing.go | 4 +- core/vm/evm.go | 6 +- core/vm/gas_table.go | 20 +- core/vm/instructions.go | 2 +- core/vm/interpreter.go | 8 +- core/vm/jump_table.go | 2 +- core/vm/runtime/runtime.go | 31 ++- core/vm/runtime/runtime_test.go | 17 +- eth/stagedsync/stage_mining_exec.go | 6 +- params/chainspecs/bor-mainnet.json | 1 - params/chainspecs/bsc.json | 1 - params/chainspecs/chapel.json | 1 - params/chainspecs/fermion.json | 1 - params/chainspecs/goerli.json | 1 - params/chainspecs/kiln-devnet.json | 1 - params/chainspecs/mainnet.json | 1 - params/chainspecs/mumbai.json | 1 - params/chainspecs/rialto.json | 1 - params/chainspecs/rinkeby.json | 1 - params/chainspecs/ropsten.json | 1 - params/chainspecs/sepolia.json | 1 - params/chainspecs/sokol.json | 1 - params/config.go | 224 +++++++-------- params/config_test.go | 10 +- params/eip_ctx.go | 10 +- params/protocol_params.go | 4 +- tests/init.go | 254 +++++++++--------- tests/statedb_chain_test.go | 13 +- .../statedb_insert_chain_transaction_test.go | 13 +- turbo/stages/blockchain_test.go | 17 +- turbo/transactions/tracing.go | 2 +- 38 files changed, 391 insertions(+), 453 deletions(-) diff --git a/cmd/cons/commands/clique.go b/cmd/cons/commands/clique.go index e714c9e503..c63e6f23b8 100644 --- a/cmd/cons/commands/clique.go +++ b/cmd/cons/commands/clique.go @@ -227,10 +227,9 @@ func (cs *CliqueServerImpl) initAndConfig(configuration []byte) error { case "homestead": chainConfig.HomesteadBlock = bigNumber case "tangerine": - chainConfig.EIP150Block = bigNumber + chainConfig.TangerineWhistleBlock = bigNumber case "spurious": - chainConfig.EIP155Block = bigNumber - chainConfig.EIP158Block = bigNumber + chainConfig.SpuriousDragonBlock = bigNumber case "byzantium": chainConfig.ByzantiumBlock = bigNumber case "constantinople": diff --git a/cmd/sentry/sentry/sentry_grpc_server_test.go b/cmd/sentry/sentry/sentry_grpc_server_test.go index 5e397abb23..8cbd567a9e 100644 --- a/cmd/sentry/sentry/sentry_grpc_server_test.go +++ b/cmd/sentry/sentry/sentry_grpc_server_test.go @@ -57,12 +57,11 @@ func testForkIDSplit(t *testing.T, protocol uint) { ctx = context.Background() configNoFork = ¶ms.ChainConfig{HomesteadBlock: big.NewInt(1), ChainID: big.NewInt(1)} configProFork = ¶ms.ChainConfig{ - ChainID: big.NewInt(1), - HomesteadBlock: big.NewInt(1), - EIP150Block: big.NewInt(2), - EIP155Block: big.NewInt(2), - EIP158Block: big.NewInt(2), - ByzantiumBlock: big.NewInt(3), + ChainID: big.NewInt(1), + HomesteadBlock: big.NewInt(1), + TangerineWhistleBlock: big.NewInt(2), + SpuriousDragonBlock: big.NewInt(2), + ByzantiumBlock: big.NewInt(3), } dbNoFork = memdb.NewTestDB(t) dbProFork = memdb.NewTestDB(t) diff --git a/consensus/bor/bor.go b/consensus/bor/bor.go index 7d8a05e040..24c372d31a 100644 --- a/consensus/bor/bor.go +++ b/consensus/bor/bor.go @@ -721,7 +721,7 @@ func (c *Bor) Finalize(config *params.ChainConfig, header *types.Header, state * } // No block rewards in PoA, so the state remains as is and uncles are dropped - // header.Root = state.IntermediateRoot(chain.Config().IsEIP158(header.Number.Uint64())) + // header.Root = state.IntermediateRoot(chain.Config().IsSpuriousDragon(header.Number.Uint64())) header.UncleHash = types.CalcUncleHash(nil) // Set state sync data to blockchain @@ -791,7 +791,7 @@ func (c *Bor) FinalizeAndAssemble(chainConfig *params.ChainConfig, header *types } // No block rewards in PoA, so the state remains as is and uncles are dropped - // header.Root = state.IntermediateRoot(chain.Config().IsEIP158(header.Number)) + // header.Root = state.IntermediateRoot(chain.Config().IsSpuriousDragon(header.Number)) header.UncleHash = types.CalcUncleHash(nil) // Assemble block diff --git a/consensus/misc/eip1559_test.go b/consensus/misc/eip1559_test.go index 186cb653da..392a3a7067 100644 --- a/consensus/misc/eip1559_test.go +++ b/consensus/misc/eip1559_test.go @@ -29,24 +29,23 @@ import ( // do not use e.g. SetInt() on the numbers. For testing only func copyConfig(original *params.ChainConfig) *params.ChainConfig { return ¶ms.ChainConfig{ - ChainID: original.ChainID, - HomesteadBlock: original.HomesteadBlock, - DAOForkBlock: original.DAOForkBlock, - DAOForkSupport: original.DAOForkSupport, - EIP150Block: original.EIP150Block, - EIP150Hash: original.EIP150Hash, - EIP155Block: original.EIP155Block, - EIP158Block: original.EIP158Block, - ByzantiumBlock: original.ByzantiumBlock, - ConstantinopleBlock: original.ConstantinopleBlock, - PetersburgBlock: original.PetersburgBlock, - IstanbulBlock: original.IstanbulBlock, - MuirGlacierBlock: original.MuirGlacierBlock, - BerlinBlock: original.BerlinBlock, - LondonBlock: original.LondonBlock, - ArrowGlacierBlock: original.ArrowGlacierBlock, - Ethash: original.Ethash, - Clique: original.Clique, + ChainID: original.ChainID, + HomesteadBlock: original.HomesteadBlock, + DAOForkBlock: original.DAOForkBlock, + DAOForkSupport: original.DAOForkSupport, + TangerineWhistleBlock: original.TangerineWhistleBlock, + TangerineWhistleHash: original.TangerineWhistleHash, + SpuriousDragonBlock: original.SpuriousDragonBlock, + ByzantiumBlock: original.ByzantiumBlock, + ConstantinopleBlock: original.ConstantinopleBlock, + PetersburgBlock: original.PetersburgBlock, + IstanbulBlock: original.IstanbulBlock, + MuirGlacierBlock: original.MuirGlacierBlock, + BerlinBlock: original.BerlinBlock, + LondonBlock: original.LondonBlock, + ArrowGlacierBlock: original.ArrowGlacierBlock, + Ethash: original.Ethash, + Clique: original.Clique, } } diff --git a/consensus/misc/forks.go b/consensus/misc/forks.go index 18052d58ca..fc629aba12 100644 --- a/consensus/misc/forks.go +++ b/consensus/misc/forks.go @@ -33,9 +33,9 @@ func VerifyForkHashes(config *params.ChainConfig, header *types.Header, uncle bo return nil } // If the homestead reprice hash is set, validate it - if config.EIP150Block != nil && config.EIP150Block.Cmp(header.Number) == 0 { - if config.EIP150Hash != (common.Hash{}) && config.EIP150Hash != header.Hash() { - return fmt.Errorf("homestead gas reprice fork: have 0x%x, want 0x%x", header.Hash(), config.EIP150Hash) + if config.TangerineWhistleBlock != nil && config.TangerineWhistleBlock.Cmp(header.Number) == 0 { + if config.TangerineWhistleHash != (common.Hash{}) && config.TangerineWhistleHash != header.Hash() { + return fmt.Errorf("tangerine whistle gas reprice fork: have 0x%x, want 0x%x", header.Hash(), config.TangerineWhistleHash) } } // All ok, return diff --git a/core/state/database_test.go b/core/state/database_test.go index 05da286ad8..b89026d285 100644 --- a/core/state/database_test.go +++ b/core/state/database_test.go @@ -54,13 +54,12 @@ func TestCreate2Revive(t *testing.T) { funds = big.NewInt(1000000000) gspec = &core.Genesis{ Config: ¶ms.ChainConfig{ - ChainID: big.NewInt(1), - HomesteadBlock: new(big.Int), - EIP150Block: new(big.Int), - EIP155Block: new(big.Int), - EIP158Block: big.NewInt(1), - ByzantiumBlock: big.NewInt(1), - ConstantinopleBlock: big.NewInt(1), + ChainID: big.NewInt(1), + HomesteadBlock: new(big.Int), + TangerineWhistleBlock: new(big.Int), + SpuriousDragonBlock: big.NewInt(1), + ByzantiumBlock: big.NewInt(1), + ConstantinopleBlock: big.NewInt(1), }, Alloc: core.GenesisAlloc{ address: core.GenesisAccount{Balance: funds}, @@ -247,13 +246,12 @@ func TestCreate2Polymorth(t *testing.T) { funds = big.NewInt(1000000000) gspec = &core.Genesis{ Config: ¶ms.ChainConfig{ - ChainID: big.NewInt(1), - HomesteadBlock: new(big.Int), - EIP150Block: new(big.Int), - EIP155Block: new(big.Int), - EIP158Block: big.NewInt(1), - ByzantiumBlock: big.NewInt(1), - ConstantinopleBlock: big.NewInt(1), + ChainID: big.NewInt(1), + HomesteadBlock: new(big.Int), + TangerineWhistleBlock: new(big.Int), + SpuriousDragonBlock: big.NewInt(1), + ByzantiumBlock: big.NewInt(1), + ConstantinopleBlock: big.NewInt(1), }, Alloc: core.GenesisAlloc{ address: core.GenesisAccount{Balance: funds}, @@ -494,13 +492,12 @@ func TestReorgOverSelfDestruct(t *testing.T) { funds = big.NewInt(1000000000) gspec = &core.Genesis{ Config: ¶ms.ChainConfig{ - ChainID: big.NewInt(1), - HomesteadBlock: new(big.Int), - EIP150Block: new(big.Int), - EIP155Block: new(big.Int), - EIP158Block: big.NewInt(1), - ByzantiumBlock: big.NewInt(1), - ConstantinopleBlock: big.NewInt(1), + ChainID: big.NewInt(1), + HomesteadBlock: new(big.Int), + TangerineWhistleBlock: new(big.Int), + SpuriousDragonBlock: big.NewInt(1), + ByzantiumBlock: big.NewInt(1), + ConstantinopleBlock: big.NewInt(1), }, Alloc: core.GenesisAlloc{ address: core.GenesisAccount{Balance: funds}, @@ -644,13 +641,12 @@ func TestReorgOverStateChange(t *testing.T) { funds = big.NewInt(1000000000) gspec = &core.Genesis{ Config: ¶ms.ChainConfig{ - ChainID: big.NewInt(1), - HomesteadBlock: new(big.Int), - EIP150Block: new(big.Int), - EIP155Block: new(big.Int), - EIP158Block: big.NewInt(1), - ByzantiumBlock: big.NewInt(1), - ConstantinopleBlock: big.NewInt(1), + ChainID: big.NewInt(1), + HomesteadBlock: new(big.Int), + TangerineWhistleBlock: new(big.Int), + SpuriousDragonBlock: big.NewInt(1), + ByzantiumBlock: big.NewInt(1), + ConstantinopleBlock: big.NewInt(1), }, Alloc: core.GenesisAlloc{ address: {Balance: funds}, @@ -796,13 +792,12 @@ func TestCreateOnExistingStorage(t *testing.T) { funds = big.NewInt(1000000000) gspec = &core.Genesis{ Config: ¶ms.ChainConfig{ - ChainID: big.NewInt(1), - HomesteadBlock: new(big.Int), - EIP150Block: new(big.Int), - EIP155Block: new(big.Int), - EIP158Block: big.NewInt(1), - ByzantiumBlock: big.NewInt(1), - ConstantinopleBlock: big.NewInt(1), + ChainID: big.NewInt(1), + HomesteadBlock: new(big.Int), + TangerineWhistleBlock: new(big.Int), + SpuriousDragonBlock: big.NewInt(1), + ByzantiumBlock: big.NewInt(1), + ConstantinopleBlock: big.NewInt(1), }, Alloc: core.GenesisAlloc{ address: {Balance: funds}, @@ -929,15 +924,14 @@ func TestEip2200Gas(t *testing.T) { funds = big.NewInt(1000000000) gspec = &core.Genesis{ Config: ¶ms.ChainConfig{ - ChainID: big.NewInt(1), - HomesteadBlock: new(big.Int), - EIP150Block: new(big.Int), - EIP155Block: new(big.Int), - EIP158Block: big.NewInt(1), - ByzantiumBlock: big.NewInt(1), - PetersburgBlock: big.NewInt(1), - ConstantinopleBlock: big.NewInt(1), - IstanbulBlock: big.NewInt(1), + ChainID: big.NewInt(1), + HomesteadBlock: new(big.Int), + TangerineWhistleBlock: new(big.Int), + SpuriousDragonBlock: big.NewInt(1), + ByzantiumBlock: big.NewInt(1), + PetersburgBlock: big.NewInt(1), + ConstantinopleBlock: big.NewInt(1), + IstanbulBlock: big.NewInt(1), }, Alloc: core.GenesisAlloc{ address: {Balance: funds}, @@ -1026,11 +1020,10 @@ func TestWrongIncarnation(t *testing.T) { funds = big.NewInt(1000000000) gspec = &core.Genesis{ Config: ¶ms.ChainConfig{ - ChainID: big.NewInt(1), - HomesteadBlock: new(big.Int), - EIP150Block: new(big.Int), - EIP155Block: new(big.Int), - EIP158Block: big.NewInt(1), + ChainID: big.NewInt(1), + HomesteadBlock: new(big.Int), + TangerineWhistleBlock: new(big.Int), + SpuriousDragonBlock: big.NewInt(1), }, Alloc: core.GenesisAlloc{ address: core.GenesisAccount{Balance: funds}, @@ -1140,11 +1133,10 @@ func TestWrongIncarnation2(t *testing.T) { funds = big.NewInt(1000000000) gspec = &core.Genesis{ Config: ¶ms.ChainConfig{ - ChainID: big.NewInt(1), - HomesteadBlock: new(big.Int), - EIP150Block: new(big.Int), - EIP155Block: new(big.Int), - EIP158Block: big.NewInt(1), + ChainID: big.NewInt(1), + HomesteadBlock: new(big.Int), + TangerineWhistleBlock: new(big.Int), + SpuriousDragonBlock: big.NewInt(1), }, Alloc: core.GenesisAlloc{ address: core.GenesisAccount{Balance: funds}, @@ -1600,13 +1592,12 @@ func TestTxLookupUnwind(t *testing.T) { funds = big.NewInt(1000000000) gspec = &core.Genesis{ Config: ¶ms.ChainConfig{ - ChainID: big.NewInt(1), - HomesteadBlock: new(big.Int), - EIP150Block: new(big.Int), - EIP155Block: new(big.Int), - EIP158Block: big.NewInt(1), - ByzantiumBlock: big.NewInt(1), - ConstantinopleBlock: big.NewInt(1), + ChainID: big.NewInt(1), + HomesteadBlock: new(big.Int), + TangerineWhistleBlock: new(big.Int), + SpuriousDragonBlock: big.NewInt(1), + ByzantiumBlock: big.NewInt(1), + ConstantinopleBlock: big.NewInt(1), }, Alloc: core.GenesisAlloc{ address: core.GenesisAccount{Balance: funds}, diff --git a/core/state/intra_block_state.go b/core/state/intra_block_state.go index 14d3a0fd99..995f0965e1 100644 --- a/core/state/intra_block_state.go +++ b/core/state/intra_block_state.go @@ -662,8 +662,8 @@ func (sdb *IntraBlockState) GetRefund() uint64 { return sdb.refund } -func updateAccount(EIP158Enabled bool, stateWriter StateWriter, addr common.Address, stateObject *stateObject, isDirty bool) error { - emptyRemoval := EIP158Enabled && stateObject.empty() +func updateAccount(EIP161Enabled bool, stateWriter StateWriter, addr common.Address, stateObject *stateObject, isDirty bool) error { + emptyRemoval := EIP161Enabled && stateObject.empty() if stateObject.suicided || (isDirty && emptyRemoval) { if err := stateWriter.DeleteAccount(addr, &stateObject.original); err != nil { return err @@ -693,8 +693,8 @@ func updateAccount(EIP158Enabled bool, stateWriter StateWriter, addr common.Addr return nil } -func printAccount(EIP158Enabled bool, addr common.Address, stateObject *stateObject, isDirty bool) { - emptyRemoval := EIP158Enabled && stateObject.empty() +func printAccount(EIP161Enabled bool, addr common.Address, stateObject *stateObject, isDirty bool) { + emptyRemoval := EIP161Enabled && stateObject.empty() if stateObject.suicided || (isDirty && emptyRemoval) { fmt.Printf("delete: %x\n", addr) } @@ -735,7 +735,7 @@ func (sdb *IntraBlockState) FinalizeTx(chainRules params.Rules, stateWriter Stat continue } - if err := updateAccount(chainRules.IsEIP158, stateWriter, addr, so, true); err != nil { + if err := updateAccount(chainRules.IsSpuriousDragon, stateWriter, addr, so, true); err != nil { return err } @@ -759,7 +759,7 @@ func (sdb *IntraBlockState) CommitBlock(chainRules params.Rules, stateWriter Sta } for addr, stateObject := range sdb.stateObjects { _, isDirty := sdb.stateObjectsDirty[addr] - if err := updateAccount(chainRules.IsEIP158, stateWriter, addr, stateObject, isDirty); err != nil { + if err := updateAccount(chainRules.IsSpuriousDragon, stateWriter, addr, stateObject, isDirty); err != nil { return err } } @@ -773,7 +773,7 @@ func (sdb *IntraBlockState) Print(chainRules params.Rules) { _, isDirty := sdb.stateObjectsDirty[addr] _, isDirty2 := sdb.journal.dirties[addr] - printAccount(chainRules.IsEIP158, addr, stateObject, isDirty || isDirty2) + printAccount(chainRules.IsSpuriousDragon, addr, stateObject, isDirty || isDirty2) } } diff --git a/core/types/transaction_signing.go b/core/types/transaction_signing.go index 38e4414e74..89faa1c082 100644 --- a/core/types/transaction_signing.go +++ b/core/types/transaction_signing.go @@ -56,7 +56,7 @@ func MakeSigner(config *params.ChainConfig, blockNumber uint64) *Signer { signer.accesslist = true signer.chainID.Set(&chainId) signer.chainIDMul.Mul(&chainId, u256.Num2) - case config.IsEIP155(blockNumber): + case config.IsSpuriousDragon(blockNumber): signer.protected = true signer.chainID.Set(&chainId) signer.chainIDMul.Mul(&chainId, u256.Num2) @@ -98,7 +98,7 @@ func LatestSigner(config *params.ChainConfig) *Signer { if config.BerlinBlock != nil { signer.accesslist = true } - if config.EIP155Block != nil { + if config.SpuriousDragonBlock != nil { signer.protected = true } } diff --git a/core/vm/evm.go b/core/vm/evm.go index 15047c15e8..69627d02af 100644 --- a/core/vm/evm.go +++ b/core/vm/evm.go @@ -244,7 +244,7 @@ func (evm *EVM) Call(caller ContractRef, addr common.Address, input []byte, gas snapshot = evm.intraBlockState.Snapshot() ) if !evm.intraBlockState.Exist(addr) { - if !isPrecompile && evm.chainRules.IsEIP158 && value.IsZero() { + if !isPrecompile && evm.chainRules.IsSpuriousDragon && value.IsZero() { return nil, gas, nil } evm.intraBlockState.CreateAccount(addr, false) @@ -527,7 +527,7 @@ func (evm *EVM) create(caller ContractRef, codeAndHash *codeAndHash, gas uint64, // Create a new account on the state snapshot := evm.intraBlockState.Snapshot() evm.intraBlockState.CreateAccount(address, true) - if evm.chainRules.IsEIP158 { + if evm.chainRules.IsSpuriousDragon { evm.intraBlockState.SetNonce(address, 1) } evm.context.Transfer(evm.intraBlockState, caller.Address(), address, value, false /* bailout */) @@ -544,7 +544,7 @@ func (evm *EVM) create(caller ContractRef, codeAndHash *codeAndHash, gas uint64, ret, err = run(evm, contract, nil, false) // check whether the max code size has been exceeded - maxCodeSizeExceeded := evm.chainRules.IsEIP158 && len(ret) > params.MaxCodeSize + maxCodeSizeExceeded := evm.chainRules.IsSpuriousDragon && len(ret) > params.MaxCodeSize // Reject code starting with 0xEF if EIP-3541 is enabled. if err == nil && !maxCodeSizeExceeded { diff --git a/core/vm/gas_table.go b/core/vm/gas_table.go index cf29469a3c..fcbe14b47c 100644 --- a/core/vm/gas_table.go +++ b/core/vm/gas_table.go @@ -317,11 +317,11 @@ func gasExpFrontier(evm *EVM, contract *Contract, stack *stack.Stack, mem *Memor return gas, nil } -func gasExpEIP158(evm *EVM, contract *Contract, stack *stack.Stack, mem *Memory, memorySize uint64) (uint64, error) { +func gasExpEIP160(evm *EVM, contract *Contract, stack *stack.Stack, mem *Memory, memorySize uint64) (uint64, error) { expByteLen := uint64((stack.Data[stack.Len()-2].BitLen() + 7) / 8) var ( - gas = expByteLen * params.ExpByteEIP158 // no overflow check required. Max is 256 * ExpByte gas + gas = expByteLen * params.ExpByteEIP160 // no overflow check required. Max is 256 * ExpByte gas overflow bool ) if gas, overflow = math.SafeAdd(gas, params.ExpGas); overflow { @@ -336,7 +336,7 @@ func gasCall(evm *EVM, contract *Contract, stack *stack.Stack, mem *Memory, memo transfersValue = !stack.Back(2).IsZero() address = common.Address(stack.Back(1).Bytes20()) ) - if evm.ChainRules().IsEIP158 { + if evm.ChainRules().IsSpuriousDragon { if transfersValue && evm.IntraBlockState().Empty(address) { gas += params.CallNewAccountGas } @@ -355,7 +355,7 @@ func gasCall(evm *EVM, contract *Contract, stack *stack.Stack, mem *Memory, memo return 0, ErrGasUintOverflow } - evm.callGasTemp, err = callGas(evm.ChainRules().IsEIP150, contract.Gas, gas, stack.Back(0)) + evm.callGasTemp, err = callGas(evm.ChainRules().IsTangerineWhistle, contract.Gas, gas, stack.Back(0)) if err != nil { return 0, err } @@ -380,7 +380,7 @@ func gasCallCode(evm *EVM, contract *Contract, stack *stack.Stack, mem *Memory, if gas, overflow = math.SafeAdd(gas, memoryGas); overflow { return 0, ErrGasUintOverflow } - evm.callGasTemp, err = callGas(evm.ChainRules().IsEIP150, contract.Gas, gas, stack.Back(0)) + evm.callGasTemp, err = callGas(evm.ChainRules().IsTangerineWhistle, contract.Gas, gas, stack.Back(0)) if err != nil { return 0, err } @@ -395,7 +395,7 @@ func gasDelegateCall(evm *EVM, contract *Contract, stack *stack.Stack, mem *Memo if err != nil { return 0, err } - evm.callGasTemp, err = callGas(evm.ChainRules().IsEIP150, contract.Gas, gas, stack.Back(0)) + evm.callGasTemp, err = callGas(evm.ChainRules().IsTangerineWhistle, contract.Gas, gas, stack.Back(0)) if err != nil { return 0, err } @@ -411,7 +411,7 @@ func gasStaticCall(evm *EVM, contract *Contract, stack *stack.Stack, mem *Memory if err != nil { return 0, err } - evm.callGasTemp, err = callGas(evm.ChainRules().IsEIP150, contract.Gas, gas, stack.Back(0)) + evm.callGasTemp, err = callGas(evm.ChainRules().IsTangerineWhistle, contract.Gas, gas, stack.Back(0)) if err != nil { return 0, err } @@ -424,12 +424,12 @@ func gasStaticCall(evm *EVM, contract *Contract, stack *stack.Stack, mem *Memory func gasSelfdestruct(evm *EVM, contract *Contract, stack *stack.Stack, mem *Memory, memorySize uint64) (uint64, error) { var gas uint64 - // EIP150 homestead gas reprice fork: - if evm.ChainRules().IsEIP150 { + // TangerineWhistle (EIP150) gas reprice fork: + if evm.ChainRules().IsTangerineWhistle { gas = params.SelfdestructGasEIP150 var address = common.Address(stack.Back(0).Bytes20()) - if evm.ChainRules().IsEIP158 { + if evm.ChainRules().IsSpuriousDragon { // if empty and transfers value if evm.IntraBlockState().Empty(address) && !evm.IntraBlockState().GetBalance(contract.Address()).IsZero() { gas += params.CreateBySelfdestructGas diff --git a/core/vm/instructions.go b/core/vm/instructions.go index ed3c82b350..c8349bf80b 100644 --- a/core/vm/instructions.go +++ b/core/vm/instructions.go @@ -615,7 +615,7 @@ func opCreate(pc *uint64, interpreter *EVMInterpreter, scope *ScopeContext) ([]b input = scope.Memory.GetCopy(offset.Uint64(), size.Uint64()) gas = scope.Contract.Gas ) - if interpreter.evm.ChainRules().IsEIP150 { + if interpreter.evm.ChainRules().IsTangerineWhistle { gas -= gas / 64 } // reuse size int for stackvalue diff --git a/core/vm/interpreter.go b/core/vm/interpreter.go index 91833cdcdf..0191491323 100644 --- a/core/vm/interpreter.go +++ b/core/vm/interpreter.go @@ -100,9 +100,9 @@ func NewEVMInterpreter(evm *EVM, cfg Config) *EVMInterpreter { jt = &constantinopleInstructionSet case evm.ChainRules().IsByzantium: jt = &byzantiumInstructionSet - case evm.ChainRules().IsEIP158: + case evm.ChainRules().IsSpuriousDragon: jt = &spuriousDragonInstructionSet - case evm.ChainRules().IsEIP150: + case evm.ChainRules().IsTangerineWhistle: jt = &tangerineWhistleInstructionSet case evm.ChainRules().IsHomestead: jt = &homesteadInstructionSet @@ -141,9 +141,9 @@ func NewEVMInterpreterByVM(vm *VM) *EVMInterpreter { jt = &constantinopleInstructionSet case vm.evm.ChainRules().IsByzantium: jt = &byzantiumInstructionSet - case vm.evm.ChainRules().IsEIP158: + case vm.evm.ChainRules().IsSpuriousDragon: jt = &spuriousDragonInstructionSet - case vm.evm.ChainRules().IsEIP150: + case vm.evm.ChainRules().IsTangerineWhistle: jt = &tangerineWhistleInstructionSet case vm.evm.ChainRules().IsHomestead: jt = &homesteadInstructionSet diff --git a/core/vm/jump_table.go b/core/vm/jump_table.go index b231b2d3c5..4f4d514e3a 100644 --- a/core/vm/jump_table.go +++ b/core/vm/jump_table.go @@ -200,7 +200,7 @@ func newByzantiumInstructionSet() JumpTable { // EIP 158 a.k.a Spurious Dragon func newSpuriousDragonInstructionSet() JumpTable { instructionSet := newTangerineWhistleInstructionSet() - instructionSet[EXP].dynamicGas = gasExpEIP158 + instructionSet[EXP].dynamicGas = gasExpEIP160 return instructionSet } diff --git a/core/vm/runtime/runtime.go b/core/vm/runtime/runtime.go index d072dd631b..75deda37f5 100644 --- a/core/vm/runtime/runtime.go +++ b/core/vm/runtime/runtime.go @@ -60,22 +60,21 @@ type Config struct { func setDefaults(cfg *Config) { if cfg.ChainConfig == nil { cfg.ChainConfig = ¶ms.ChainConfig{ - ChainID: big.NewInt(1), - HomesteadBlock: new(big.Int), - DAOForkBlock: new(big.Int), - DAOForkSupport: false, - EIP150Block: new(big.Int), - EIP150Hash: common.Hash{}, - EIP155Block: new(big.Int), - EIP158Block: new(big.Int), - ByzantiumBlock: new(big.Int), - ConstantinopleBlock: new(big.Int), - PetersburgBlock: new(big.Int), - IstanbulBlock: new(big.Int), - MuirGlacierBlock: new(big.Int), - BerlinBlock: new(big.Int), - LondonBlock: new(big.Int), - ArrowGlacierBlock: new(big.Int), + ChainID: big.NewInt(1), + HomesteadBlock: new(big.Int), + DAOForkBlock: new(big.Int), + DAOForkSupport: false, + TangerineWhistleBlock: new(big.Int), + TangerineWhistleHash: common.Hash{}, + SpuriousDragonBlock: new(big.Int), + ByzantiumBlock: new(big.Int), + ConstantinopleBlock: new(big.Int), + PetersburgBlock: new(big.Int), + IstanbulBlock: new(big.Int), + MuirGlacierBlock: new(big.Int), + BerlinBlock: new(big.Int), + LondonBlock: new(big.Int), + ArrowGlacierBlock: new(big.Int), } } diff --git a/core/vm/runtime/runtime_test.go b/core/vm/runtime/runtime_test.go index 5b1987b09e..1d756cb6a2 100644 --- a/core/vm/runtime/runtime_test.go +++ b/core/vm/runtime/runtime_test.go @@ -177,15 +177,14 @@ func benchmarkEVM_Create(bench *testing.B, code string) { Coinbase: common.Address{}, BlockNumber: new(big.Int).SetUint64(1), ChainConfig: ¶ms.ChainConfig{ - ChainID: big.NewInt(1), - HomesteadBlock: new(big.Int), - ByzantiumBlock: new(big.Int), - ConstantinopleBlock: new(big.Int), - DAOForkBlock: new(big.Int), - DAOForkSupport: false, - EIP150Block: new(big.Int), - EIP155Block: new(big.Int), - EIP158Block: new(big.Int), + ChainID: big.NewInt(1), + HomesteadBlock: new(big.Int), + ByzantiumBlock: new(big.Int), + ConstantinopleBlock: new(big.Int), + DAOForkBlock: new(big.Int), + DAOForkSupport: false, + TangerineWhistleBlock: new(big.Int), + SpuriousDragonBlock: new(big.Int), }, EVMConfig: vm.Config{}, } diff --git a/eth/stagedsync/stage_mining_exec.go b/eth/stagedsync/stage_mining_exec.go index c7c7f50218..96e1a4e610 100644 --- a/eth/stagedsync/stage_mining_exec.go +++ b/eth/stagedsync/stage_mining_exec.go @@ -232,10 +232,10 @@ func addTransactionsToMiningBlock(logPrefix string, current *MiningBlock, chainC // // We use the eip155 signer regardless of the env hf. from, _ := txn.Sender(*signer) - // Check whether the txn is replay protected. If we're not in the EIP155 hf + // Check whether the txn is replay protected. If we're not in the EIP155 (Spurious Dragon) hf // phase, start ignoring the sender until we do. - if txn.Protected() && !chainConfig.IsEIP155(header.Number.Uint64()) { - log.Debug(fmt.Sprintf("[%s] Ignoring replay protected transaction", logPrefix), "hash", txn.Hash(), "eip155", chainConfig.EIP155Block) + if txn.Protected() && !chainConfig.IsSpuriousDragon(header.Number.Uint64()) { + log.Debug(fmt.Sprintf("[%s] Ignoring replay protected transaction", logPrefix), "hash", txn.Hash(), "eip155", chainConfig.SpuriousDragonBlock) txs.Pop() continue diff --git a/params/chainspecs/bor-mainnet.json b/params/chainspecs/bor-mainnet.json index 10d022547a..df6e684abc 100644 --- a/params/chainspecs/bor-mainnet.json +++ b/params/chainspecs/bor-mainnet.json @@ -7,7 +7,6 @@ "eip150Block": 0, "eip150Hash": "0x0000000000000000000000000000000000000000000000000000000000000000", "eip155Block": 0, - "eip158Block": 0, "byzantiumBlock": 0, "constantinopleBlock": 0, "petersburgBlock": 0, diff --git a/params/chainspecs/bsc.json b/params/chainspecs/bsc.json index 00a20f5564..7e8945cabc 100644 --- a/params/chainspecs/bsc.json +++ b/params/chainspecs/bsc.json @@ -6,7 +6,6 @@ "eip150Block": 0, "eip150Hash": "0x0000000000000000000000000000000000000000000000000000000000000000", "eip155Block": 0, - "eip158Block": 0, "byzantiumBlock": 0, "constantinopleBlock": 0, "petersburgBlock": 0, diff --git a/params/chainspecs/chapel.json b/params/chainspecs/chapel.json index ecef203ab6..ee755b44a1 100644 --- a/params/chainspecs/chapel.json +++ b/params/chainspecs/chapel.json @@ -6,7 +6,6 @@ "eip150Block": 0, "eip150Hash": "0x0000000000000000000000000000000000000000000000000000000000000000", "eip155Block": 0, - "eip158Block": 0, "byzantiumBlock": 0, "constantinopleBlock": 0, "petersburgBlock": 0, diff --git a/params/chainspecs/fermion.json b/params/chainspecs/fermion.json index 7e550f4efc..856f3f81f2 100644 --- a/params/chainspecs/fermion.json +++ b/params/chainspecs/fermion.json @@ -6,7 +6,6 @@ "eip150Block": 0, "eip150Hash": "0x0000000000000000000000000000000000000000000000000000000000000000", "eip155Block": 0, - "eip158Block": 0, "byzantiumBlock": 0, "constantinopleBlock": 0, "petersburgBlock": 0, diff --git a/params/chainspecs/goerli.json b/params/chainspecs/goerli.json index 41e93cb9ab..7596abd2be 100644 --- a/params/chainspecs/goerli.json +++ b/params/chainspecs/goerli.json @@ -7,7 +7,6 @@ "eip150Block": 0, "eip150Hash": "0x0000000000000000000000000000000000000000000000000000000000000000", "eip155Block": 0, - "eip158Block": 0, "byzantiumBlock": 0, "constantinopleBlock": 0, "petersburgBlock": 0, diff --git a/params/chainspecs/kiln-devnet.json b/params/chainspecs/kiln-devnet.json index 83098f2d59..5141f75aab 100644 --- a/params/chainspecs/kiln-devnet.json +++ b/params/chainspecs/kiln-devnet.json @@ -6,7 +6,6 @@ "eip150Block": 0, "eip150Hash": "0x0000000000000000000000000000000000000000000000000000000000000000", "eip155Block": 0, - "eip158Block": 0, "byzantiumBlock": 0, "constantinopleBlock": 0, "petersburgBlock": 0, diff --git a/params/chainspecs/mainnet.json b/params/chainspecs/mainnet.json index f015841076..c3ecaa123b 100644 --- a/params/chainspecs/mainnet.json +++ b/params/chainspecs/mainnet.json @@ -8,7 +8,6 @@ "eip150Block": 2463000, "eip150Hash": "0x2086799aeebeae135c246c65021c82b4e15a2c451340993aacfd2751886514f0", "eip155Block": 2675000, - "eip158Block": 2675000, "byzantiumBlock": 4370000, "constantinopleBlock": 7280000, "petersburgBlock": 7280000, diff --git a/params/chainspecs/mumbai.json b/params/chainspecs/mumbai.json index a0a5ca751e..92f2a6c7c7 100644 --- a/params/chainspecs/mumbai.json +++ b/params/chainspecs/mumbai.json @@ -7,7 +7,6 @@ "eip150Block": 0, "eip150Hash": "0x0000000000000000000000000000000000000000000000000000000000000000", "eip155Block": 0, - "eip158Block": 0, "byzantiumBlock": 0, "constantinopleBlock": 0, "petersburgBlock": 0, diff --git a/params/chainspecs/rialto.json b/params/chainspecs/rialto.json index 1aa92d1115..e11de7d144 100644 --- a/params/chainspecs/rialto.json +++ b/params/chainspecs/rialto.json @@ -6,7 +6,6 @@ "eip150Block": 0, "eip150Hash": "0x0000000000000000000000000000000000000000000000000000000000000000", "eip155Block": 0, - "eip158Block": 0, "byzantiumBlock": 0, "constantinopleBlock": 0, "petersburgBlock": 0, diff --git a/params/chainspecs/rinkeby.json b/params/chainspecs/rinkeby.json index d9a53ce663..6ebecf052a 100644 --- a/params/chainspecs/rinkeby.json +++ b/params/chainspecs/rinkeby.json @@ -7,7 +7,6 @@ "eip150Block": 2, "eip150Hash": "0x9b095b36c15eaf13044373aef8ee0bd3a382a5abb92e402afa44b8249c3a90e9", "eip155Block": 3, - "eip158Block": 3, "byzantiumBlock": 1035301, "constantinopleBlock": 3660663, "petersburgBlock": 4321234, diff --git a/params/chainspecs/ropsten.json b/params/chainspecs/ropsten.json index 2296766d0c..b4a6cff3bf 100644 --- a/params/chainspecs/ropsten.json +++ b/params/chainspecs/ropsten.json @@ -7,7 +7,6 @@ "eip150Block": 0, "eip150Hash": "0x41941023680923e0fe4d74a34bdac8141f2540e3ae90623718e47d66d1ca4a2d", "eip155Block": 10, - "eip158Block": 10, "byzantiumBlock": 1700000, "constantinopleBlock": 4230000, "petersburgBlock": 4939394, diff --git a/params/chainspecs/sepolia.json b/params/chainspecs/sepolia.json index 22eda8925e..e349c2525e 100644 --- a/params/chainspecs/sepolia.json +++ b/params/chainspecs/sepolia.json @@ -7,7 +7,6 @@ "eip150Block": 0, "eip150Hash": "0x0000000000000000000000000000000000000000000000000000000000000000", "eip155Block": 0, - "eip158Block": 0, "byzantiumBlock": 0, "constantinopleBlock": 0, "petersburgBlock": 0, diff --git a/params/chainspecs/sokol.json b/params/chainspecs/sokol.json index 3bec92071b..ea8d6fc24f 100644 --- a/params/chainspecs/sokol.json +++ b/params/chainspecs/sokol.json @@ -6,7 +6,6 @@ "eip150Block": 0, "eip150Hash": "0x0000000000000000000000000000000000000000000000000000000000000000", "eip155Block": 0, - "eip158Block": 0, "byzantiumBlock": 0, "constantinopleBlock": 6464300, "petersburgBlock": 7026400, diff --git a/params/config.go b/params/config.go index c32dadd639..e93bf73a95 100644 --- a/params/config.go +++ b/params/config.go @@ -115,49 +115,47 @@ var ( // AllEthashProtocolChanges contains every protocol change (EIPs) introduced // and accepted by the Ethereum core developers into the Ethash consensus. AllEthashProtocolChanges = &ChainConfig{ - ChainID: big.NewInt(1337), - Consensus: EtHashConsensus, - HomesteadBlock: big.NewInt(0), - DAOForkBlock: nil, - DAOForkSupport: false, - EIP150Block: big.NewInt(0), - EIP150Hash: common.Hash{}, - 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: nil, - ArrowGlacierBlock: nil, - Ethash: new(EthashConfig), - Clique: nil, + ChainID: big.NewInt(1337), + Consensus: EtHashConsensus, + HomesteadBlock: big.NewInt(0), + DAOForkBlock: nil, + DAOForkSupport: false, + TangerineWhistleBlock: big.NewInt(0), + TangerineWhistleHash: common.Hash{}, + SpuriousDragonBlock: 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: nil, + ArrowGlacierBlock: nil, + Ethash: new(EthashConfig), + Clique: nil, } // AllCliqueProtocolChanges contains every protocol change (EIPs) introduced // and accepted by the Ethereum core developers into the Clique consensus. AllCliqueProtocolChanges = &ChainConfig{ - ChainID: big.NewInt(1337), - Consensus: CliqueConsensus, - HomesteadBlock: big.NewInt(0), - DAOForkBlock: nil, - DAOForkSupport: false, - EIP150Block: big.NewInt(0), - EIP150Hash: common.Hash{}, - 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: nil, - Ethash: nil, - Clique: &CliqueConfig{Period: 0, Epoch: 30000}, + ChainID: big.NewInt(1337), + Consensus: CliqueConsensus, + HomesteadBlock: big.NewInt(0), + DAOForkBlock: nil, + DAOForkSupport: false, + TangerineWhistleBlock: big.NewInt(0), + TangerineWhistleHash: common.Hash{}, + SpuriousDragonBlock: 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: nil, + Ethash: nil, + Clique: &CliqueConfig{Period: 0, Epoch: 30000}, } MumbaiChainConfig = readChainSpec("chainspecs/mumbai.json") @@ -167,46 +165,44 @@ var ( CliqueSnapshot = NewSnapshotConfig(10, 1024, 16384, true, "") TestChainConfig = &ChainConfig{ - ChainID: big.NewInt(1), - Consensus: EtHashConsensus, - HomesteadBlock: big.NewInt(0), - DAOForkBlock: nil, - DAOForkSupport: false, - EIP150Block: big.NewInt(0), - EIP150Hash: common.Hash{}, - 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: nil, - ArrowGlacierBlock: nil, - Ethash: new(EthashConfig), - Clique: nil, + ChainID: big.NewInt(1), + Consensus: EtHashConsensus, + HomesteadBlock: big.NewInt(0), + DAOForkBlock: nil, + DAOForkSupport: false, + TangerineWhistleBlock: big.NewInt(0), + TangerineWhistleHash: common.Hash{}, + SpuriousDragonBlock: 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: nil, + ArrowGlacierBlock: nil, + Ethash: new(EthashConfig), + Clique: nil, } TestChainAuraConfig = &ChainConfig{ - ChainID: big.NewInt(1), - Consensus: AuRaConsensus, - HomesteadBlock: big.NewInt(0), - DAOForkBlock: nil, - DAOForkSupport: false, - EIP150Block: big.NewInt(0), - EIP150Hash: common.Hash{}, - 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: nil, - ArrowGlacierBlock: nil, - Aura: &AuRaConfig{}, + ChainID: big.NewInt(1), + Consensus: AuRaConsensus, + HomesteadBlock: big.NewInt(0), + DAOForkBlock: nil, + DAOForkSupport: false, + TangerineWhistleBlock: big.NewInt(0), + TangerineWhistleHash: common.Hash{}, + SpuriousDragonBlock: 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: nil, + ArrowGlacierBlock: nil, + Aura: &AuRaConfig{}, } TestRules = TestChainConfig.Rules(0) @@ -228,12 +224,11 @@ type ChainConfig struct { DAOForkBlock *big.Int `json:"daoForkBlock,omitempty"` // TheDAO hard-fork switch block (nil = no fork) DAOForkSupport bool `json:"daoForkSupport,omitempty"` // Whether the nodes supports or opposes the DAO hard-fork - // EIP150 implements the Gas price changes (https://github.com/ethereum/EIPs/issues/150) - EIP150Block *big.Int `json:"eip150Block,omitempty"` // EIP150 HF block (nil = no fork) - EIP150Hash common.Hash `json:"eip150Hash,omitempty"` // EIP150 HF hash (needed for header only clients as only gas pricing changed) + // Tangerine Whistle (EIP150) implements the Gas price changes (https://github.com/ethereum/EIPs/issues/150) + TangerineWhistleBlock *big.Int `json:"eip150Block,omitempty"` // EIP150 HF block (nil = no fork) + TangerineWhistleHash common.Hash `json:"eip150Hash,omitempty"` // EIP150 HF hash (needed for header only clients as only gas pricing changed) - EIP155Block *big.Int `json:"eip155Block,omitempty"` // EIP155 HF block - EIP158Block *big.Int `json:"eip158Block,omitempty"` // EIP158 HF block + SpuriousDragonBlock *big.Int `json:"eip155Block,omitempty"` // Spurious Dragon HF block ByzantiumBlock *big.Int `json:"byzantiumBlock,omitempty"` // Byzantium switch block (nil = no fork, 0 = already on byzantium) ConstantinopleBlock *big.Int `json:"constantinopleBlock,omitempty"` // Constantinople switch block (nil = no fork, 0 = already activated) @@ -393,14 +388,13 @@ func (c *ChainConfig) String() string { ) } - return fmt.Sprintf("{ChainID: %v Homestead: %v DAO: %v DAOSupport: %v EIP150: %v EIP155: %v EIP158: %v Byzantium: %v Constantinople: %v Petersburg: %v Istanbul: %v, Muir Glacier: %v, Berlin: %v, London: %v, Arrow Glacier: %v, Terminal Total Difficulty: %v, Engine: %v}", + return fmt.Sprintf("{ChainID: %v Homestead: %v DAO: %v DAO Support: %v Tangerine Whistle: %v Spurious Dragon: %v Byzantium: %v Constantinople: %v Petersburg: %v Istanbul: %v, Muir Glacier: %v, Berlin: %v, London: %v, Arrow Glacier: %v, Terminal Total Difficulty: %v, Engine: %v}", c.ChainID, c.HomesteadBlock, c.DAOForkBlock, c.DAOForkSupport, - c.EIP150Block, - c.EIP155Block, - c.EIP158Block, + c.TangerineWhistleBlock, + c.SpuriousDragonBlock, c.ByzantiumBlock, c.ConstantinopleBlock, c.PetersburgBlock, @@ -452,19 +446,14 @@ func (c *ChainConfig) IsDAOFork(num uint64) bool { return isForked(c.DAOForkBlock, num) } -// IsEIP150 returns whether num is either equal to the EIP150 fork block or greater. -func (c *ChainConfig) IsEIP150(num uint64) bool { - return isForked(c.EIP150Block, num) +// IsTangerineWhistle returns whether num is either equal to the Tangerine Whistle (EIP150) fork block or greater. +func (c *ChainConfig) IsTangerineWhistle(num uint64) bool { + return isForked(c.TangerineWhistleBlock, num) } -// IsEIP155 returns whether num is either equal to the EIP155 fork block or greater. -func (c *ChainConfig) IsEIP155(num uint64) bool { - return isForked(c.EIP155Block, num) -} - -// IsEIP158 returns whether num is either equal to the EIP158 fork block or greater. -func (c *ChainConfig) IsEIP158(num uint64) bool { - return isForked(c.EIP158Block, num) +// IsSpuriousDragon returns whether num is either equal to the Spurious Dragon fork block or greater. +func (c *ChainConfig) IsSpuriousDragon(num uint64) bool { + return isForked(c.SpuriousDragonBlock, num) } // IsByzantium returns whether num is either equal to the Byzantium fork block or greater. @@ -582,9 +571,8 @@ func (c *ChainConfig) CheckConfigForkOrder() error { for _, cur := range []fork{ {name: "homesteadBlock", block: c.HomesteadBlock}, {name: "daoForkBlock", block: c.DAOForkBlock, optional: true}, - {name: "eip150Block", block: c.EIP150Block}, - {name: "eip155Block", block: c.EIP155Block}, - {name: "eip158Block", block: c.EIP158Block}, + {name: "eip150Block", block: c.TangerineWhistleBlock}, + {name: "eip155Block", block: c.SpuriousDragonBlock}, {name: "byzantiumBlock", block: c.ByzantiumBlock}, {name: "constantinopleBlock", block: c.ConstantinopleBlock}, {name: "petersburgBlock", block: c.PetersburgBlock}, @@ -625,17 +613,14 @@ func (c *ChainConfig) checkCompatible(newcfg *ChainConfig, head uint64) *ConfigC if c.IsDAOFork(head) && c.DAOForkSupport != newcfg.DAOForkSupport { return newCompatError("DAO fork support flag", c.DAOForkBlock, newcfg.DAOForkBlock) } - if isForkIncompatible(c.EIP150Block, newcfg.EIP150Block, head) { - return newCompatError("EIP150 fork block", c.EIP150Block, newcfg.EIP150Block) - } - if isForkIncompatible(c.EIP155Block, newcfg.EIP155Block, head) { - return newCompatError("EIP155 fork block", c.EIP155Block, newcfg.EIP155Block) + if isForkIncompatible(c.TangerineWhistleBlock, newcfg.TangerineWhistleBlock, head) { + return newCompatError("Tangerine Whistle fork block", c.TangerineWhistleBlock, newcfg.TangerineWhistleBlock) } - if isForkIncompatible(c.EIP158Block, newcfg.EIP158Block, head) { - return newCompatError("EIP158 fork block", c.EIP158Block, newcfg.EIP158Block) + if isForkIncompatible(c.SpuriousDragonBlock, newcfg.SpuriousDragonBlock, head) { + return newCompatError("Spurious Dragon fork block", c.SpuriousDragonBlock, newcfg.SpuriousDragonBlock) } - if c.IsEIP158(head) && !configNumEqual(c.ChainID, newcfg.ChainID) { - return newCompatError("EIP158 chain ID", c.EIP158Block, newcfg.EIP158Block) + if c.IsSpuriousDragon(head) && !configNumEqual(c.ChainID, newcfg.ChainID) { + return newCompatError("EIP155 chain ID", c.SpuriousDragonBlock, newcfg.SpuriousDragonBlock) } if isForkIncompatible(c.ByzantiumBlock, newcfg.ByzantiumBlock, head) { return newCompatError("Byzantium fork block", c.ByzantiumBlock, newcfg.ByzantiumBlock) @@ -730,7 +715,7 @@ func (err *ConfigCompatError) Error() string { // phases. type Rules struct { ChainID *big.Int - IsHomestead, IsEIP150, IsEIP155, IsEIP158 bool + IsHomestead, IsTangerineWhistle, IsSpuriousDragon bool IsByzantium, IsConstantinople, IsPetersburg, IsIstanbul bool IsBerlin, IsLondon, IsParlia bool } @@ -742,18 +727,17 @@ func (c *ChainConfig) Rules(num uint64) Rules { chainID = new(big.Int) } return Rules{ - ChainID: new(big.Int).Set(chainID), - IsHomestead: c.IsHomestead(num), - IsEIP150: c.IsEIP150(num), - IsEIP155: c.IsEIP155(num), - IsEIP158: c.IsEIP158(num), - IsByzantium: c.IsByzantium(num), - IsConstantinople: c.IsConstantinople(num), - IsPetersburg: c.IsPetersburg(num), - IsIstanbul: c.IsIstanbul(num), - IsBerlin: c.IsBerlin(num), - IsLondon: c.IsLondon(num), - IsParlia: c.Parlia != nil, + ChainID: new(big.Int).Set(chainID), + IsHomestead: c.IsHomestead(num), + IsTangerineWhistle: c.IsTangerineWhistle(num), + IsSpuriousDragon: c.IsSpuriousDragon(num), + IsByzantium: c.IsByzantium(num), + IsConstantinople: c.IsConstantinople(num), + IsPetersburg: c.IsPetersburg(num), + IsIstanbul: c.IsIstanbul(num), + IsBerlin: c.IsBerlin(num), + IsLondon: c.IsLondon(num), + IsParlia: c.Parlia != nil, } } diff --git a/params/config_test.go b/params/config_test.go index 3c8ebaf4a5..97fb72ab3a 100644 --- a/params/config_test.go +++ b/params/config_test.go @@ -32,8 +32,8 @@ func TestCheckCompatible(t *testing.T) { {stored: AllEthashProtocolChanges, new: AllEthashProtocolChanges, head: 0, wantErr: nil}, {stored: AllEthashProtocolChanges, new: AllEthashProtocolChanges, head: 100, wantErr: nil}, { - stored: &ChainConfig{EIP150Block: big.NewInt(10)}, - new: &ChainConfig{EIP150Block: big.NewInt(20)}, + stored: &ChainConfig{TangerineWhistleBlock: big.NewInt(10)}, + new: &ChainConfig{TangerineWhistleBlock: big.NewInt(20)}, head: 9, wantErr: nil, }, @@ -60,11 +60,11 @@ func TestCheckCompatible(t *testing.T) { }, }, { - stored: &ChainConfig{HomesteadBlock: big.NewInt(30), EIP150Block: big.NewInt(10)}, - new: &ChainConfig{HomesteadBlock: big.NewInt(25), EIP150Block: big.NewInt(20)}, + stored: &ChainConfig{HomesteadBlock: big.NewInt(30), TangerineWhistleBlock: big.NewInt(10)}, + new: &ChainConfig{HomesteadBlock: big.NewInt(25), TangerineWhistleBlock: big.NewInt(20)}, head: 25, wantErr: &ConfigCompatError{ - What: "EIP150 fork block", + What: "Tangerine Whistle fork block", StoredConfig: big.NewInt(10), NewConfig: big.NewInt(20), RewindTo: 9, diff --git a/params/eip_ctx.go b/params/eip_ctx.go index f60449a030..3858d4f0fe 100644 --- a/params/eip_ctx.go +++ b/params/eip_ctx.go @@ -9,9 +9,8 @@ type configKey int const ( IsHomesteadEnabled configKey = iota - IsEIP150Enabled - IsEIP155Enabled - IsEIP158Enabled + IsTangerineWhistleEnabled + IsSpuriousDragonEnabled IsByzantiumEnabled IsConstantinopleEnabled IsPetersburgEnabled @@ -21,9 +20,8 @@ const ( func (c *ChainConfig) WithEIPsFlags(ctx context.Context, blockNum uint64) context.Context { ctx = context.WithValue(ctx, IsHomesteadEnabled, c.IsHomestead(blockNum)) - ctx = context.WithValue(ctx, IsEIP150Enabled, c.IsEIP150(blockNum)) - ctx = context.WithValue(ctx, IsEIP155Enabled, c.IsEIP155(blockNum)) - ctx = context.WithValue(ctx, IsEIP158Enabled, c.IsEIP158(blockNum)) + ctx = context.WithValue(ctx, IsTangerineWhistleEnabled, c.IsTangerineWhistle(blockNum)) + ctx = context.WithValue(ctx, IsSpuriousDragonEnabled, c.IsSpuriousDragon(blockNum)) ctx = context.WithValue(ctx, IsByzantiumEnabled, c.IsByzantium(blockNum)) ctx = context.WithValue(ctx, IsConstantinopleEnabled, c.IsConstantinople(blockNum)) ctx = context.WithValue(ctx, IsPetersburgEnabled, c.IsPetersburg(blockNum)) diff --git a/params/protocol_params.go b/params/protocol_params.go index 3c13678413..b2f3c1b3c3 100644 --- a/params/protocol_params.go +++ b/params/protocol_params.go @@ -93,7 +93,7 @@ const ( // These have been changed during the course of the chain CallGasFrontier uint64 = 40 // Once per CALL operation & message call transaction. - CallGasEIP150 uint64 = 700 // Static portion of gas for CALL-derivates after EIP 150 (Tangerine) + CallGasEIP150 uint64 = 700 // Static portion of gas for CALL-derivatives after EIP 150 (Tangerine) BalanceGasFrontier uint64 = 20 // The cost of a BALANCE operation BalanceGasEIP150 uint64 = 400 // The cost of a BALANCE operation after Tangerine BalanceGasEIP1884 uint64 = 700 // The cost of a BALANCE operation after EIP 1884 (part of Istanbul) @@ -109,7 +109,7 @@ const ( // EXP has a dynamic portion depending on the size of the exponent ExpByteFrontier uint64 = 10 // was set to 10 in Frontier - ExpByteEIP158 uint64 = 50 // was raised to 50 during Eip158 (Spurious Dragon) + ExpByteEIP160 uint64 = 50 // was raised to 50 during EIP 160 (Spurious Dragon) // Extcodecopy has a dynamic AND a static cost. This represents only the // static portion of the gas. It was changed during EIP 150 (Tangerine) diff --git a/tests/init.go b/tests/init.go index 794b52b237..b9c54386bc 100644 --- a/tests/init.go +++ b/tests/init.go @@ -34,68 +34,63 @@ var Forks = map[string]*params.ChainConfig{ HomesteadBlock: big.NewInt(0), }, "EIP150": { - ChainID: big.NewInt(1), - HomesteadBlock: big.NewInt(0), - EIP150Block: big.NewInt(0), + ChainID: big.NewInt(1), + HomesteadBlock: big.NewInt(0), + TangerineWhistleBlock: big.NewInt(0), }, "EIP158": { - ChainID: big.NewInt(1), - HomesteadBlock: big.NewInt(0), - EIP150Block: big.NewInt(0), - EIP155Block: big.NewInt(0), - EIP158Block: big.NewInt(0), + ChainID: big.NewInt(1), + HomesteadBlock: big.NewInt(0), + TangerineWhistleBlock: big.NewInt(0), + SpuriousDragonBlock: big.NewInt(0), }, "Byzantium": { - ChainID: big.NewInt(1), - HomesteadBlock: big.NewInt(0), - EIP150Block: big.NewInt(0), - EIP155Block: big.NewInt(0), - EIP158Block: big.NewInt(0), - DAOForkBlock: big.NewInt(0), - ByzantiumBlock: big.NewInt(0), + ChainID: big.NewInt(1), + HomesteadBlock: big.NewInt(0), + TangerineWhistleBlock: big.NewInt(0), + SpuriousDragonBlock: big.NewInt(0), + DAOForkBlock: big.NewInt(0), + ByzantiumBlock: big.NewInt(0), }, "Constantinople": { - ChainID: big.NewInt(1), - HomesteadBlock: big.NewInt(0), - EIP150Block: big.NewInt(0), - EIP155Block: big.NewInt(0), - EIP158Block: big.NewInt(0), - DAOForkBlock: big.NewInt(0), - ByzantiumBlock: big.NewInt(0), - ConstantinopleBlock: big.NewInt(0), - PetersburgBlock: big.NewInt(10000000), + ChainID: big.NewInt(1), + HomesteadBlock: big.NewInt(0), + TangerineWhistleBlock: big.NewInt(0), + SpuriousDragonBlock: big.NewInt(0), + DAOForkBlock: big.NewInt(0), + ByzantiumBlock: big.NewInt(0), + ConstantinopleBlock: big.NewInt(0), + PetersburgBlock: big.NewInt(10000000), }, "ConstantinopleFix": { - ChainID: big.NewInt(1), - HomesteadBlock: big.NewInt(0), - EIP150Block: big.NewInt(0), - EIP155Block: big.NewInt(0), - EIP158Block: big.NewInt(0), - DAOForkBlock: big.NewInt(0), - ByzantiumBlock: big.NewInt(0), - ConstantinopleBlock: big.NewInt(0), - PetersburgBlock: big.NewInt(0), + ChainID: big.NewInt(1), + HomesteadBlock: big.NewInt(0), + TangerineWhistleBlock: big.NewInt(0), + SpuriousDragonBlock: big.NewInt(0), + DAOForkBlock: big.NewInt(0), + ByzantiumBlock: big.NewInt(0), + ConstantinopleBlock: big.NewInt(0), + PetersburgBlock: big.NewInt(0), }, "Istanbul": { - ChainID: big.NewInt(1), - HomesteadBlock: big.NewInt(0), - EIP150Block: big.NewInt(0), - EIP155Block: big.NewInt(0), - EIP158Block: big.NewInt(0), - DAOForkBlock: big.NewInt(0), - ByzantiumBlock: big.NewInt(0), - ConstantinopleBlock: big.NewInt(0), - PetersburgBlock: big.NewInt(0), - IstanbulBlock: big.NewInt(0), + ChainID: big.NewInt(1), + HomesteadBlock: big.NewInt(0), + TangerineWhistleBlock: big.NewInt(0), + SpuriousDragonBlock: big.NewInt(0), + DAOForkBlock: big.NewInt(0), + ByzantiumBlock: big.NewInt(0), + ConstantinopleBlock: big.NewInt(0), + PetersburgBlock: big.NewInt(0), + IstanbulBlock: big.NewInt(0), }, "FrontierToHomesteadAt5": { ChainID: big.NewInt(1), HomesteadBlock: big.NewInt(5), }, "HomesteadToEIP150At5": { - ChainID: big.NewInt(1), - HomesteadBlock: big.NewInt(0), - EIP150Block: big.NewInt(5), + ChainID: big.NewInt(1), + HomesteadBlock: big.NewInt(0), + TangerineWhistleBlock: big.NewInt(5), }, "HomesteadToDaoAt5": { ChainID: big.NewInt(1), @@ -104,110 +99,101 @@ var Forks = map[string]*params.ChainConfig{ DAOForkSupport: true, }, "EIP158ToByzantiumAt5": { - ChainID: big.NewInt(1), - HomesteadBlock: big.NewInt(0), - EIP150Block: big.NewInt(0), - EIP155Block: big.NewInt(0), - EIP158Block: big.NewInt(0), - ByzantiumBlock: big.NewInt(5), + ChainID: big.NewInt(1), + HomesteadBlock: big.NewInt(0), + TangerineWhistleBlock: big.NewInt(0), + SpuriousDragonBlock: big.NewInt(0), + ByzantiumBlock: big.NewInt(5), }, "ByzantiumToConstantinopleAt5": { - ChainID: big.NewInt(1), - HomesteadBlock: big.NewInt(0), - EIP150Block: big.NewInt(0), - EIP155Block: big.NewInt(0), - EIP158Block: big.NewInt(0), - ByzantiumBlock: big.NewInt(0), - ConstantinopleBlock: big.NewInt(5), + ChainID: big.NewInt(1), + HomesteadBlock: big.NewInt(0), + TangerineWhistleBlock: big.NewInt(0), + SpuriousDragonBlock: big.NewInt(0), + ByzantiumBlock: big.NewInt(0), + ConstantinopleBlock: big.NewInt(5), }, "ByzantiumToConstantinopleFixAt5": { - ChainID: big.NewInt(1), - HomesteadBlock: big.NewInt(0), - EIP150Block: big.NewInt(0), - EIP155Block: big.NewInt(0), - EIP158Block: big.NewInt(0), - ByzantiumBlock: big.NewInt(0), - ConstantinopleBlock: big.NewInt(5), - PetersburgBlock: big.NewInt(5), + ChainID: big.NewInt(1), + HomesteadBlock: big.NewInt(0), + TangerineWhistleBlock: big.NewInt(0), + SpuriousDragonBlock: big.NewInt(0), + ByzantiumBlock: big.NewInt(0), + ConstantinopleBlock: big.NewInt(5), + PetersburgBlock: big.NewInt(5), }, "ConstantinopleFixToIstanbulAt5": { - ChainID: big.NewInt(1), - HomesteadBlock: big.NewInt(0), - 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(5), + ChainID: big.NewInt(1), + HomesteadBlock: big.NewInt(0), + TangerineWhistleBlock: big.NewInt(0), + SpuriousDragonBlock: big.NewInt(0), + ByzantiumBlock: big.NewInt(0), + ConstantinopleBlock: big.NewInt(0), + PetersburgBlock: big.NewInt(0), + IstanbulBlock: big.NewInt(5), }, "EIP2384": { - ChainID: big.NewInt(1), - HomesteadBlock: big.NewInt(0), - 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), + ChainID: big.NewInt(1), + HomesteadBlock: big.NewInt(0), + TangerineWhistleBlock: big.NewInt(0), + SpuriousDragonBlock: big.NewInt(0), + ByzantiumBlock: big.NewInt(0), + ConstantinopleBlock: big.NewInt(0), + PetersburgBlock: big.NewInt(0), + IstanbulBlock: big.NewInt(0), + MuirGlacierBlock: big.NewInt(0), }, "Berlin": { - ChainID: big.NewInt(1), - HomesteadBlock: big.NewInt(0), - 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), + ChainID: big.NewInt(1), + HomesteadBlock: big.NewInt(0), + TangerineWhistleBlock: big.NewInt(0), + SpuriousDragonBlock: 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), }, "BerlinToLondonAt5": { - ChainID: big.NewInt(1), - HomesteadBlock: big.NewInt(0), - 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(5), + ChainID: big.NewInt(1), + HomesteadBlock: big.NewInt(0), + TangerineWhistleBlock: big.NewInt(0), + SpuriousDragonBlock: 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(5), }, "London": { - ChainID: big.NewInt(1), - HomesteadBlock: big.NewInt(0), - 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), + ChainID: big.NewInt(1), + HomesteadBlock: big.NewInt(0), + TangerineWhistleBlock: big.NewInt(0), + SpuriousDragonBlock: 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), }, "ArrowGlacier": { - ChainID: big.NewInt(1), - HomesteadBlock: big.NewInt(0), - 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), + ChainID: big.NewInt(1), + HomesteadBlock: big.NewInt(0), + TangerineWhistleBlock: big.NewInt(0), + SpuriousDragonBlock: 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), }, } diff --git a/tests/statedb_chain_test.go b/tests/statedb_chain_test.go index 287aa1fcdd..a578c46e23 100644 --- a/tests/statedb_chain_test.go +++ b/tests/statedb_chain_test.go @@ -43,13 +43,12 @@ func TestSelfDestructReceive(t *testing.T) { funds = big.NewInt(1000000000) gspec = &core.Genesis{ Config: ¶ms.ChainConfig{ - ChainID: big.NewInt(1), - HomesteadBlock: new(big.Int), - ByzantiumBlock: new(big.Int), - ConstantinopleBlock: new(big.Int), - EIP150Block: new(big.Int), - EIP155Block: new(big.Int), - EIP158Block: big.NewInt(0), + ChainID: big.NewInt(1), + HomesteadBlock: new(big.Int), + ByzantiumBlock: new(big.Int), + ConstantinopleBlock: new(big.Int), + TangerineWhistleBlock: new(big.Int), + SpuriousDragonBlock: new(big.Int), }, Alloc: core.GenesisAlloc{ address: {Balance: funds}, diff --git a/tests/statedb_insert_chain_transaction_test.go b/tests/statedb_insert_chain_transaction_test.go index 26ab29f4d7..0d228d5d63 100644 --- a/tests/statedb_insert_chain_transaction_test.go +++ b/tests/statedb_insert_chain_transaction_test.go @@ -716,13 +716,12 @@ func getGenesis(funds ...*big.Int) initialData { transactOpts: transactOpts, genesisSpec: &core.Genesis{ Config: ¶ms.ChainConfig{ - ChainID: big.NewInt(1), - HomesteadBlock: new(big.Int), - EIP150Block: new(big.Int), - EIP155Block: new(big.Int), - EIP158Block: big.NewInt(1), - ByzantiumBlock: big.NewInt(1), - ConstantinopleBlock: big.NewInt(1), + ChainID: big.NewInt(1), + HomesteadBlock: new(big.Int), + TangerineWhistleBlock: new(big.Int), + SpuriousDragonBlock: big.NewInt(1), + ByzantiumBlock: big.NewInt(1), + ConstantinopleBlock: big.NewInt(1), }, Alloc: allocs, }, diff --git a/turbo/stages/blockchain_test.go b/turbo/stages/blockchain_test.go index a4ccfb4890..28851bd909 100644 --- a/turbo/stages/blockchain_test.go +++ b/turbo/stages/blockchain_test.go @@ -558,7 +558,7 @@ func TestEIP155Transition(t *testing.T) { funds = big.NewInt(1000000000) deleteAddr = common.Address{1} gspec = &core.Genesis{ - Config: ¶ms.ChainConfig{ChainID: big.NewInt(1), EIP150Block: big.NewInt(0), EIP155Block: big.NewInt(2), HomesteadBlock: new(big.Int)}, + Config: ¶ms.ChainConfig{ChainID: big.NewInt(1), TangerineWhistleBlock: big.NewInt(0), SpuriousDragonBlock: big.NewInt(2), HomesteadBlock: new(big.Int)}, Alloc: core.GenesisAlloc{address: {Balance: funds}, deleteAddr: {Balance: new(big.Int)}}, } ) @@ -633,7 +633,7 @@ func TestEIP155Transition(t *testing.T) { } // generate an invalid chain id transaction - config := ¶ms.ChainConfig{ChainID: big.NewInt(2), EIP150Block: big.NewInt(0), EIP155Block: big.NewInt(2), HomesteadBlock: new(big.Int)} + config := ¶ms.ChainConfig{ChainID: big.NewInt(2), TangerineWhistleBlock: big.NewInt(0), SpuriousDragonBlock: big.NewInt(2), HomesteadBlock: new(big.Int)} chain, chainErr = core.GenerateChain(config, chain.TopBlock, m.Engine, m.DB, 4, func(i int, block *core.BlockGen) { var ( basicTx = func(signer types.Signer) (types.Transaction, error) { @@ -683,7 +683,7 @@ func doModesTest(t *testing.T, pm prune.Mode) error { funds = big.NewInt(1000000000) deleteAddr = common.Address{1} gspec = &core.Genesis{ - Config: ¶ms.ChainConfig{ChainID: big.NewInt(1), EIP150Block: big.NewInt(0), EIP155Block: big.NewInt(2), HomesteadBlock: new(big.Int)}, + Config: ¶ms.ChainConfig{ChainID: big.NewInt(1), TangerineWhistleBlock: big.NewInt(0), SpuriousDragonBlock: big.NewInt(2), HomesteadBlock: new(big.Int)}, Alloc: core.GenesisAlloc{address: {Balance: funds}, deleteAddr: {Balance: new(big.Int)}}, } ) @@ -874,11 +874,10 @@ func TestEIP161AccountRemoval(t *testing.T) { theAddr = common.Address{1} gspec = &core.Genesis{ Config: ¶ms.ChainConfig{ - ChainID: big.NewInt(1), - HomesteadBlock: new(big.Int), - EIP155Block: new(big.Int), - EIP150Block: new(big.Int), - EIP158Block: big.NewInt(2), + ChainID: big.NewInt(1), + HomesteadBlock: new(big.Int), + TangerineWhistleBlock: new(big.Int), + SpuriousDragonBlock: big.NewInt(2), }, Alloc: core.GenesisAlloc{address: {Balance: funds}}, } @@ -889,7 +888,7 @@ func TestEIP161AccountRemoval(t *testing.T) { var ( txn types.Transaction err error - signer = types.LatestSigner(gspec.Config) + signer = types.MakeFrontierSigner() ) switch i { case 0: diff --git a/turbo/transactions/tracing.go b/turbo/transactions/tracing.go index 203633e910..7bc90ed56b 100644 --- a/turbo/transactions/tracing.go +++ b/turbo/transactions/tracing.go @@ -64,7 +64,7 @@ func ComputeTxEnv(ctx context.Context, block *types.Block, cfg *params.ChainConf return nil, vm.BlockContext{}, vm.TxContext{}, nil, nil, fmt.Errorf("transaction %x failed: %w", tx.Hash(), err) } // Ensure any modifications are committed to the state - // Only delete empty objects if EIP158/161 (a.k.a Spurious Dragon) is in effect + // Only delete empty objects if EIP161 (part of Spurious Dragon) is in effect _ = statedb.FinalizeTx(vmenv.ChainRules(), reader) if idx+1 == len(block.Transactions()) { -- GitLab