mirror of
https://gitlab.com/pulsechaincom/go-pulse.git
synced 2025-01-03 09:17:38 +00:00
Support for non-pulse, non-mainnet eth chains
This commit is contained in:
parent
b4e9dd5362
commit
30708436bf
@ -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:
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user