diff --git a/core/types/transaction_signing.go b/core/types/transaction_signing.go index e1458316a..51057a55b 100644 --- a/core/types/transaction_signing.go +++ b/core/types/transaction_signing.go @@ -20,11 +20,11 @@ import ( "crypto/ecdsa" "errors" "fmt" - "github.com/ethereum/go-ethereum/log" "math/big" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/crypto" + "github.com/ethereum/go-ethereum/log" "github.com/ethereum/go-ethereum/params" ) @@ -41,19 +41,22 @@ type sigCache struct { func MakeSigner(config *params.ChainConfig, blockNumber *big.Int) Signer { var signer Signer - // ethereum mainnet chainID is 1 - // required to validate transactions on mainnet - chainID := big.NewInt(1) + chainID := config.ChainID + if config.PrimordialPulseAhead(blockNumber) { + // ethereum mainnet chainID is 1 + // required to validate transactions on mainnet + chainID = big.NewInt(1) + } switch { case config.IsPrimordialPulse(blockNumber): signer = NewLondonSigner(chainID) case config.IsLondon(blockNumber): - signer = NewLondonSigner(config.ChainID) + signer = NewLondonSigner(chainID) case config.IsBerlin(blockNumber): - signer = NewEIP2930Signer(config.ChainID) + signer = NewEIP2930Signer(chainID) case config.IsEIP155(blockNumber): - signer = NewEIP155Signer(config.ChainID) + signer = NewEIP155Signer(chainID) case config.IsHomestead(blockNumber): signer = HomesteadSigner{} default: diff --git a/core/vm/evm.go b/core/vm/evm.go index 6727e5e48..44803f1d7 100644 --- a/core/vm/evm.go +++ b/core/vm/evm.go @@ -127,7 +127,7 @@ type EVM struct { func NewEVM(blockCtx BlockContext, txCtx TxContext, statedb StateDB, chainConfig *params.ChainConfig, config Config) *EVM { msgChainConfig := chainConfig - if !chainConfig.IsPrimordialPulse(blockCtx.BlockNumber) { + if chainConfig.PrimordialPulseAhead(blockCtx.BlockNumber) { // create a shallow of chainConfig struct and set to ethereum mainnet chainCfgCpy := *chainConfig chainCfgCpy.ChainID = big.NewInt(1) diff --git a/params/config.go b/params/config.go index 8916ff44a..e8b5fcef8 100644 --- a/params/config.go +++ b/params/config.go @@ -80,7 +80,7 @@ var ( SectionHead: common.HexToHash("0x50fd3cec5376ede90ef9129772022690cd1467f22c18abb7faa11e793c51e9c9"), CHTRoot: common.HexToHash("0xb57b4b22a77b5930847b1ca9f62daa11eae6578948cb7b18997f2c0fe5757025"), BloomRoot: common.HexToHash("0xa338f8a868a194fa90327d0f5877f656a9f3640c618d2a01a01f2e76ef9ef954"), -} + } // MainnetCheckpointOracle contains a set of configs for the main network oracle. MainnetCheckpointOracle = &CheckpointOracleConfig{ @@ -649,7 +649,7 @@ func (c *ChainConfig) IsPrimordialPulseBlock(number uint64) bool { } // Returns true if there is a PrimordialPulse block in the future, indicating this chain -// should still be evaluated using the ethash consensus engine. +// should still be evaluated using the ethash consensus engine and with mainnet ChainID. func (c *ChainConfig) PrimordialPulseAhead(number *big.Int) bool { return c.PrimordialPulseBlock != nil && c.PrimordialPulseBlock.Cmp(number) > 0 }