feat: update upcoming fork names (#680)

* feat: update upcoming fork names

* bump version

* Apply suggestions from code review

Co-authored-by: Nazarii Denha <dengaaa2002@gmail.com>

* bump version

---------

Co-authored-by: Nazarii Denha <dengaaa2002@gmail.com>
This commit is contained in:
Péter Garamvölgyi 2024-03-26 14:41:32 +00:00 committed by GitHub
parent 411889ef92
commit 0f0cd99f7a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
27 changed files with 92 additions and 70 deletions

View file

@ -590,7 +590,7 @@ func (b *SimulatedBackend) callContract(ctx context.Context, call ethereum.CallM
return nil, errors.New("both gasPrice and (maxFeePerGas or maxPriorityFeePerGas) specified") return nil, errors.New("both gasPrice and (maxFeePerGas or maxPriorityFeePerGas) specified")
} }
head := b.blockchain.CurrentHeader() head := b.blockchain.CurrentHeader()
if !b.blockchain.Config().IsBanach(head.Number) { if !b.blockchain.Config().IsCurie(head.Number) {
// If there's no basefee, then it must be a non-1559 execution // If there's no basefee, then it must be a non-1559 execution
if call.GasPrice == nil { if call.GasPrice == nil {
call.GasPrice = new(big.Int) call.GasPrice = new(big.Int)

View file

@ -289,7 +289,7 @@ func (c *BoundContract) createDynamicTx(opts *TransactOpts, contract *common.Add
func (c *BoundContract) createLegacyTx(opts *TransactOpts, contract *common.Address, input []byte) (*types.Transaction, error) { func (c *BoundContract) createLegacyTx(opts *TransactOpts, contract *common.Address, input []byte) (*types.Transaction, error) {
if opts.GasFeeCap != nil || opts.GasTipCap != nil { if opts.GasFeeCap != nil || opts.GasTipCap != nil {
return nil, errors.New("maxFeePerGas or maxPriorityFeePerGas specified but banach is not active yet") return nil, errors.New("maxFeePerGas or maxPriorityFeePerGas specified but curie is not active yet")
} }
// Normalize value // Normalize value
value := opts.Value value := opts.Value

View file

@ -247,7 +247,7 @@ func Transition(ctx *cli.Context) error {
return NewError(ErrorJson, fmt.Errorf("failed signing transactions: %v", err)) return NewError(ErrorJson, fmt.Errorf("failed signing transactions: %v", err))
} }
// Sanity check, to not `panic` in state_transition // Sanity check, to not `panic` in state_transition
if chainConfig.IsBanach(big.NewInt(int64(prestate.Env.Number))) { if chainConfig.IsCurie(big.NewInt(int64(prestate.Env.Number))) {
if prestate.Env.BaseFee == nil { if prestate.Env.BaseFee == nil {
return NewError(ErrorConfig, errors.New("EIP-1559 config but missing 'currentBaseFee' in env section")) return NewError(ErrorConfig, errors.New("EIP-1559 config but missing 'currentBaseFee' in env section"))
} }

View file

@ -335,7 +335,7 @@ func (c *Clique) verifyCascadingFields(chain consensus.ChainHeaderReader, header
if header.GasUsed > header.GasLimit { if header.GasUsed > header.GasLimit {
return fmt.Errorf("invalid gasUsed: have %d, gasLimit %d", header.GasUsed, header.GasLimit) return fmt.Errorf("invalid gasUsed: have %d, gasLimit %d", header.GasUsed, header.GasLimit)
} }
if !chain.Config().IsBanach(header.Number) { if !chain.Config().IsCurie(header.Number) {
// Verify BaseFee not present before EIP-1559 fork. // Verify BaseFee not present before EIP-1559 fork.
if header.BaseFee != nil { if header.BaseFee != nil {
return fmt.Errorf("invalid baseFee before fork: have %d, want <nil>", header.BaseFee) return fmt.Errorf("invalid baseFee before fork: have %d, want <nil>", header.BaseFee)

View file

@ -291,7 +291,7 @@ func (ethash *Ethash) verifyHeader(chain consensus.ChainHeaderReader, header, pa
return fmt.Errorf("invalid gasUsed: have %d, gasLimit %d", header.GasUsed, header.GasLimit) return fmt.Errorf("invalid gasUsed: have %d, gasLimit %d", header.GasUsed, header.GasLimit)
} }
// Verify the block's gas usage and (if applicable) verify the base fee. // Verify the block's gas usage and (if applicable) verify the base fee.
if !chain.Config().IsBanach(header.Number) { if !chain.Config().IsCurie(header.Number) {
// Verify BaseFee not present before EIP-1559 fork. // Verify BaseFee not present before EIP-1559 fork.
if header.BaseFee != nil { if header.BaseFee != nil {
return fmt.Errorf("invalid baseFee before fork: have %d, expected 'nil'", header.BaseFee) return fmt.Errorf("invalid baseFee before fork: have %d, expected 'nil'", header.BaseFee)

View file

@ -51,8 +51,8 @@ func copyConfig(original *params.ChainConfig) *params.ChainConfig {
func config() *params.ChainConfig { func config() *params.ChainConfig {
config := copyConfig(params.TestChainConfig) config := copyConfig(params.TestChainConfig)
config.LondonBlock = big.NewInt(3) config.BernoulliBlock = big.NewInt(3)
config.BanachBlock = big.NewInt(5) config.CurieBlock = big.NewInt(5)
return config return config
} }
@ -67,13 +67,13 @@ func TestBlockGasLimits(t *testing.T) {
gasLimit uint64 gasLimit uint64
ok bool ok bool
}{ }{
// Transitions from non-banach to banach // Transitions from non-curie to curie
{10000000, 4, 10000000, true}, // No change {10000000, 4, 10000000, true}, // No change
{10000000, 4, 10009764, true}, // Upper limit {10000000, 4, 10009764, true}, // Upper limit
{10000000, 4, 10009765, false}, // Upper +1 {10000000, 4, 10009765, false}, // Upper +1
{10000000, 4, 9990236, true}, // Lower limit {10000000, 4, 9990236, true}, // Lower limit
{10000000, 4, 9990235, false}, // Lower limit -1 {10000000, 4, 9990235, false}, // Lower limit -1
// Banach to Banach // Curie to Curie
{20000000, 5, 20000000, true}, {20000000, 5, 20000000, true},
{20000000, 5, 20019530, true}, // Upper limit {20000000, 5, 20019530, true}, // Upper limit
{20000000, 5, 20019531, false}, // Upper limit +1 {20000000, 5, 20019531, false}, // Upper limit +1

View file

@ -276,7 +276,7 @@ func makeHeader(chain consensus.ChainReader, parent *types.Block, state *state.S
Number: new(big.Int).Add(parent.Number(), common.Big1), Number: new(big.Int).Add(parent.Number(), common.Big1),
Time: time, Time: time,
} }
if chain.Config().IsBanach(header.Number) { if chain.Config().IsCurie(header.Number) {
parentL1BaseFee := fees.GetL1BaseFee(state) parentL1BaseFee := fees.GetL1BaseFee(state)
header.BaseFee = misc.CalcBaseFee(chain.Config(), parent.Header(), parentL1BaseFee) header.BaseFee = misc.CalcBaseFee(chain.Config(), parent.Header(), parentL1BaseFee)
} }

View file

@ -313,7 +313,7 @@ func (g *Genesis) ToBlock(db ethdb.Database) *types.Block {
if g.Difficulty == nil { if g.Difficulty == nil {
head.Difficulty = params.GenesisDifficulty head.Difficulty = params.GenesisDifficulty
} }
if g.Config != nil && g.Config.IsBanach(common.Big0) { if g.Config != nil && g.Config.IsCurie(common.Big0) {
if g.BaseFee != nil { if g.BaseFee != nil {
head.BaseFee = g.BaseFee head.BaseFee = g.BaseFee
} else { } else {

View file

@ -56,7 +56,8 @@ func TestStateProcessorErrors(t *testing.T) {
BerlinBlock: big.NewInt(0), BerlinBlock: big.NewInt(0),
LondonBlock: big.NewInt(0), LondonBlock: big.NewInt(0),
ShanghaiBlock: big.NewInt(0), ShanghaiBlock: big.NewInt(0),
BanachBlock: big.NewInt(0), BernoulliBlock: big.NewInt(0),
CurieBlock: big.NewInt(0),
Ethash: new(params.EthashConfig), Ethash: new(params.EthashConfig),
} }
signer = types.LatestSigner(config) signer = types.LatestSigner(config)
@ -333,7 +334,8 @@ func TestStateProcessorErrors(t *testing.T) {
ArrowGlacierBlock: big.NewInt(0), ArrowGlacierBlock: big.NewInt(0),
ArchimedesBlock: big.NewInt(0), ArchimedesBlock: big.NewInt(0),
ShanghaiBlock: big.NewInt(0), ShanghaiBlock: big.NewInt(0),
BanachBlock: big.NewInt(0), BernoulliBlock: big.NewInt(0),
CurieBlock: big.NewInt(0),
}, },
Alloc: GenesisAlloc{ Alloc: GenesisAlloc{
common.HexToAddress("0x71562b71999873DB5b286dF957af199Ec94617F7"): GenesisAccount{ common.HexToAddress("0x71562b71999873DB5b286dF957af199Ec94617F7"): GenesisAccount{
@ -398,7 +400,7 @@ func GenerateBadBlock(parent *types.Block, engine consensus.Engine, txs types.Tr
UncleHash: types.EmptyUncleHash, UncleHash: types.EmptyUncleHash,
} }
if config.IsBanach(header.Number) { if config.IsCurie(header.Number) {
parentL1BaseFee := big.NewInt(1000000000) // 1 gwei parentL1BaseFee := big.NewInt(1000000000) // 1 gwei
header.BaseFee = misc.CalcBaseFee(config, parent.Header(), parentL1BaseFee) header.BaseFee = misc.CalcBaseFee(config, parent.Header(), parentL1BaseFee)
} }

View file

@ -288,7 +288,7 @@ func (st *StateTransition) preCheck() error {
} }
} }
// Make sure that transaction gasFeeCap is greater than the baseFee (post london) // Make sure that transaction gasFeeCap is greater than the baseFee (post london)
// Note: Logically, this should be `IsBanach`, but we keep `IsLondon` to ensure backward compatibility. // Note: Logically, this should be `IsCurie`, but we keep `IsLondon` to ensure backward compatibility.
if st.evm.ChainConfig().IsLondon(st.evm.Context.BlockNumber) { if st.evm.ChainConfig().IsLondon(st.evm.Context.BlockNumber) {
// Skip the checks if gas fields are zero and baseFee was explicitly disabled (eth_call) // Skip the checks if gas fields are zero and baseFee was explicitly disabled (eth_call)
if !st.evm.Config.NoBaseFee || st.gasFeeCap.BitLen() > 0 || st.gasTipCap.BitLen() > 0 { if !st.evm.Config.NoBaseFee || st.gasFeeCap.BitLen() > 0 || st.gasTipCap.BitLen() > 0 {
@ -414,7 +414,7 @@ func (st *StateTransition) TransitionDb() (*ExecutionResult, error) {
effectiveTip := st.gasPrice effectiveTip := st.gasPrice
// only burn the base fee if the fee vault is not enabled // only burn the base fee if the fee vault is not enabled
if rules.IsBanach && !st.evm.ChainConfig().Scroll.FeeVaultEnabled() { if rules.IsCurie && !st.evm.ChainConfig().Scroll.FeeVaultEnabled() {
effectiveTip = cmath.BigMin(st.gasTipCap, new(big.Int).Sub(st.gasFeeCap, st.evm.Context.BaseFee)) effectiveTip = cmath.BigMin(st.gasTipCap, new(big.Int).Sub(st.gasFeeCap, st.evm.Context.BaseFee))
} }

View file

@ -1231,7 +1231,7 @@ func (pool *TxPool) runReorg(done chan struct{}, reset *txpoolResetRequest, dirt
// because of another transaction (e.g. higher gas price). // because of another transaction (e.g. higher gas price).
if reset != nil { if reset != nil {
pool.demoteUnexecutables() pool.demoteUnexecutables()
if reset.newHead != nil && pool.chainconfig.IsBanach(new(big.Int).Add(reset.newHead.Number, big.NewInt(1))) { if reset.newHead != nil && pool.chainconfig.IsCurie(new(big.Int).Add(reset.newHead.Number, big.NewInt(1))) {
l1BaseFee := fees.GetL1BaseFee(pool.currentState) l1BaseFee := fees.GetL1BaseFee(pool.currentState)
pendingBaseFee := misc.CalcBaseFee(pool.chainconfig, reset.newHead, l1BaseFee) pendingBaseFee := misc.CalcBaseFee(pool.chainconfig, reset.newHead, l1BaseFee)
pool.priced.SetBaseFee(pendingBaseFee) pool.priced.SetBaseFee(pendingBaseFee)
@ -1357,8 +1357,8 @@ func (pool *TxPool) reset(oldHead, newHead *types.Header) {
next := new(big.Int).Add(newHead.Number, big.NewInt(1)) next := new(big.Int).Add(newHead.Number, big.NewInt(1))
pool.istanbul = pool.chainconfig.IsIstanbul(next) pool.istanbul = pool.chainconfig.IsIstanbul(next)
pool.eip2718 = pool.chainconfig.IsBanach(next) pool.eip2718 = pool.chainconfig.IsCurie(next)
pool.eip1559 = pool.chainconfig.IsBanach(next) pool.eip1559 = pool.chainconfig.IsCurie(next)
pool.shanghai = pool.chainconfig.IsShanghai(next) pool.shanghai = pool.chainconfig.IsShanghai(next)
} }

View file

@ -40,7 +40,7 @@ type sigCache struct {
func MakeSigner(config *params.ChainConfig, blockNumber *big.Int) Signer { func MakeSigner(config *params.ChainConfig, blockNumber *big.Int) Signer {
var signer Signer var signer Signer
switch { switch {
case config.IsBanach(blockNumber): case config.IsCurie(blockNumber):
signer = NewLondonSignerWithEIP4844(config.ChainID) signer = NewLondonSignerWithEIP4844(config.ChainID)
case config.IsLondon(blockNumber): case config.IsLondon(blockNumber):
signer = NewLondonSignerWithEIP4844(config.ChainID) signer = NewLondonSignerWithEIP4844(config.ChainID)

View file

@ -111,9 +111,9 @@ var PrecompiledContractsArchimedes = map[common.Address]PrecompiledContract{
common.BytesToAddress([]byte{9}): &blake2FDisabled{}, common.BytesToAddress([]byte{9}): &blake2FDisabled{},
} }
// PrecompiledContractsBanach contains the default set of pre-compiled Ethereum // PrecompiledContractsBernoulli contains the default set of pre-compiled Ethereum
// contracts used in the Banach release. Same as Archimedes but with sha256hash enabled again // contracts used in the Bernoulli release. Same as Archimedes but with sha256hash enabled again
var PrecompiledContractsBanach = map[common.Address]PrecompiledContract{ var PrecompiledContractsBernoulli = map[common.Address]PrecompiledContract{
common.BytesToAddress([]byte{1}): &ecrecover{}, common.BytesToAddress([]byte{1}): &ecrecover{},
common.BytesToAddress([]byte{2}): &sha256hash{}, common.BytesToAddress([]byte{2}): &sha256hash{},
common.BytesToAddress([]byte{3}): &ripemd160hashDisabled{}, common.BytesToAddress([]byte{3}): &ripemd160hashDisabled{},
@ -140,7 +140,7 @@ var PrecompiledContractsBLS = map[common.Address]PrecompiledContract{
} }
var ( var (
PrecompiledAddressesBanach []common.Address PrecompiledAddressesBernoulli []common.Address
PrecompiledAddressesArchimedes []common.Address PrecompiledAddressesArchimedes []common.Address
PrecompiledAddressesBerlin []common.Address PrecompiledAddressesBerlin []common.Address
PrecompiledAddressesIstanbul []common.Address PrecompiledAddressesIstanbul []common.Address
@ -164,16 +164,16 @@ func init() {
for k := range PrecompiledContractsArchimedes { for k := range PrecompiledContractsArchimedes {
PrecompiledAddressesArchimedes = append(PrecompiledAddressesArchimedes, k) PrecompiledAddressesArchimedes = append(PrecompiledAddressesArchimedes, k)
} }
for k := range PrecompiledContractsBanach { for k := range PrecompiledContractsBernoulli {
PrecompiledAddressesBanach = append(PrecompiledAddressesBanach, k) PrecompiledAddressesBernoulli = append(PrecompiledAddressesBernoulli, k)
} }
} }
// ActivePrecompiles returns the precompiles enabled with the current configuration. // ActivePrecompiles returns the precompiles enabled with the current configuration.
func ActivePrecompiles(rules params.Rules) []common.Address { func ActivePrecompiles(rules params.Rules) []common.Address {
switch { switch {
case rules.IsBanach: case rules.IsBernoulli:
return PrecompiledAddressesBanach return PrecompiledAddressesBernoulli
case rules.IsArchimedes: case rules.IsArchimedes:
return PrecompiledAddressesArchimedes return PrecompiledAddressesArchimedes
case rules.IsBerlin: case rules.IsBerlin:

View file

@ -46,8 +46,8 @@ type (
func (evm *EVM) precompile(addr common.Address) (PrecompiledContract, bool) { func (evm *EVM) precompile(addr common.Address) (PrecompiledContract, bool) {
var precompiles map[common.Address]PrecompiledContract var precompiles map[common.Address]PrecompiledContract
switch { switch {
case evm.chainRules.IsBanach: case evm.chainRules.IsBernoulli:
precompiles = PrecompiledContractsBanach precompiles = PrecompiledContractsBernoulli
case evm.chainRules.IsArchimedes: case evm.chainRules.IsArchimedes:
precompiles = PrecompiledContractsArchimedes precompiles = PrecompiledContractsArchimedes
case evm.chainRules.IsBerlin: case evm.chainRules.IsBerlin:

View file

@ -74,8 +74,8 @@ func NewEVMInterpreter(evm *EVM, cfg Config) *EVMInterpreter {
if cfg.JumpTable[STOP] == nil { if cfg.JumpTable[STOP] == nil {
var jt JumpTable var jt JumpTable
switch { switch {
case evm.chainRules.IsBanach: case evm.chainRules.IsCurie:
jt = banachInstructionSet jt = curieInstructionSet
case evm.chainRules.IsShanghai: case evm.chainRules.IsShanghai:
jt = shanghaiInstructionSet jt = shanghaiInstructionSet
case evm.chainRules.IsLondon: case evm.chainRules.IsLondon:

View file

@ -59,15 +59,15 @@ var (
berlinInstructionSet = newBerlinInstructionSet() berlinInstructionSet = newBerlinInstructionSet()
londonInstructionSet = newLondonInstructionSet() londonInstructionSet = newLondonInstructionSet()
shanghaiInstructionSet = newShanghaiInstructionSet() shanghaiInstructionSet = newShanghaiInstructionSet()
banachInstructionSet = newBanachInstructionSet() curieInstructionSet = newCurieInstructionSet()
) )
// JumpTable contains the EVM opcodes supported at a given fork. // JumpTable contains the EVM opcodes supported at a given fork.
type JumpTable [256]*operation type JumpTable [256]*operation
// newBanachInstructionSet returns the frontier, homestead, byzantium, // newCurieInstructionSet returns the frontier, homestead, byzantium,
// contantinople, istanbul, petersburg, berlin, london, shanghai, and banach instructions. // contantinople, istanbul, petersburg, berlin, london, shanghai, and curie instructions.
func newBanachInstructionSet() JumpTable { func newCurieInstructionSet() JumpTable {
instructionSet := newShanghaiInstructionSet() instructionSet := newShanghaiInstructionSet()
enable3198(&instructionSet) // Base fee opcode https://eips.ethereum.org/EIPS/eip-3198 enable3198(&instructionSet) // Base fee opcode https://eips.ethereum.org/EIPS/eip-3198
return instructionSet return instructionSet

View file

@ -69,7 +69,9 @@ func setDefaults(cfg *Config) {
BerlinBlock: new(big.Int), BerlinBlock: new(big.Int),
LondonBlock: new(big.Int), LondonBlock: new(big.Int),
ArchimedesBlock: new(big.Int), ArchimedesBlock: new(big.Int),
BanachBlock: new(big.Int), ShanghaiBlock: new(big.Int),
BernoulliBlock: new(big.Int),
CurieBlock: new(big.Int),
} }
} }

View file

@ -142,7 +142,7 @@ func (api *consensusAPI) AssembleBlock(params assembleBlockParams) (*executableD
Extra: []byte{}, Extra: []byte{},
Time: params.Timestamp, Time: params.Timestamp,
} }
if config := api.eth.BlockChain().Config(); config.IsBanach(header.Number) { if config := api.eth.BlockChain().Config(); config.IsCurie(header.Number) {
stateDb, err := api.eth.BlockChain().StateAt(parent.Root()) stateDb, err := api.eth.BlockChain().StateAt(parent.Root())
if err != nil { if err != nil {
return nil, err return nil, err
@ -273,7 +273,7 @@ func insertBlockParamsToBlock(config *chainParams.ChainConfig, parent *types.Hea
GasUsed: params.GasUsed, GasUsed: params.GasUsed,
Time: params.Timestamp, Time: params.Timestamp,
} }
if config.IsBanach(number) { if config.IsCurie(number) {
header.BaseFee = misc.CalcBaseFee(config, parent, parentL1BaseFee) header.BaseFee = misc.CalcBaseFee(config, parent, parentL1BaseFee)
} }
block := types.NewBlockWithHeader(header).WithBody(txs, nil /* uncles */) block := types.NewBlockWithHeader(header).WithBody(txs, nil /* uncles */)

View file

@ -89,7 +89,7 @@ func (oracle *Oracle) processBlock(bf *blockFees, percentiles []float64) {
if bf.results.baseFee = bf.header.BaseFee; bf.results.baseFee == nil { if bf.results.baseFee = bf.header.BaseFee; bf.results.baseFee == nil {
bf.results.baseFee = new(big.Int) bf.results.baseFee = new(big.Int)
} }
if chainconfig.IsBanach(big.NewInt(int64(bf.blockNumber + 1))) { if chainconfig.IsCurie(big.NewInt(int64(bf.blockNumber + 1))) {
state, err := oracle.backend.StateAt(bf.header.Root) state, err := oracle.backend.StateAt(bf.header.Root)
if err != nil || state == nil { if err != nil || state == nil {
log.Error("State not found", "number", bf.header.Number, "hash", bf.header.Hash().Hex(), "state", state, "err", err) log.Error("State not found", "number", bf.header.Number, "hash", bf.header.Hash().Hex(), "state", state, "err", err)

View file

@ -111,7 +111,8 @@ func newTestBackend(t *testing.T, londonBlock *big.Int, pending bool) *testBacke
config.ArrowGlacierBlock = londonBlock config.ArrowGlacierBlock = londonBlock
config.ArchimedesBlock = londonBlock config.ArchimedesBlock = londonBlock
config.ShanghaiBlock = londonBlock config.ShanghaiBlock = londonBlock
config.BanachBlock = londonBlock config.BernoulliBlock = londonBlock
config.CurieBlock = londonBlock
engine := ethash.NewFaker() engine := ethash.NewFaker()
db := rawdb.NewMemoryDatabase() db := rawdb.NewMemoryDatabase()
genesis, err := gspec.Commit(db) genesis, err := gspec.Commit(db)

View file

@ -1681,7 +1681,7 @@ func (s *PublicTransactionPoolAPI) GetTransactionReceipt(ctx context.Context, ha
"l1Fee": (*hexutil.Big)(receipt.L1Fee), "l1Fee": (*hexutil.Big)(receipt.L1Fee),
} }
// Assign the effective gas price paid // Assign the effective gas price paid
if !s.b.ChainConfig().IsBanach(bigblock) { if !s.b.ChainConfig().IsCurie(bigblock) {
fields["effectiveGasPrice"] = hexutil.Uint64(tx.GasPrice().Uint64()) fields["effectiveGasPrice"] = hexutil.Uint64(tx.GasPrice().Uint64())
} else { } else {
header, err := s.b.HeaderByHash(ctx, blockHash) header, err := s.b.HeaderByHash(ctx, blockHash)

View file

@ -78,13 +78,13 @@ func (args *TransactionArgs) setDefaults(ctx context.Context, b Backend) error {
if args.GasPrice != nil && (args.MaxFeePerGas != nil || args.MaxPriorityFeePerGas != nil) { if args.GasPrice != nil && (args.MaxFeePerGas != nil || args.MaxPriorityFeePerGas != nil) {
return errors.New("both gasPrice and (maxFeePerGas or maxPriorityFeePerGas) specified") return errors.New("both gasPrice and (maxFeePerGas or maxPriorityFeePerGas) specified")
} }
// After banach, default to 1559 unless gasPrice is set // After curie, default to 1559 unless gasPrice is set
head := b.CurrentHeader() head := b.CurrentHeader()
// If user specifies both maxPriorityfee and maxFee, then we do not // If user specifies both maxPriorityfee and maxFee, then we do not
// need to consult the chain for defaults. It's definitely a Banach tx. // need to consult the chain for defaults. It's definitely a Curie tx.
if args.MaxPriorityFeePerGas == nil || args.MaxFeePerGas == nil { if args.MaxPriorityFeePerGas == nil || args.MaxFeePerGas == nil {
// In this clause, user left some fields unspecified. // In this clause, user left some fields unspecified.
if b.ChainConfig().IsBanach(head.Number) && args.GasPrice == nil { if b.ChainConfig().IsCurie(head.Number) && args.GasPrice == nil {
if args.MaxPriorityFeePerGas == nil { if args.MaxPriorityFeePerGas == nil {
tip, err := b.SuggestGasTipCap(ctx) tip, err := b.SuggestGasTipCap(ctx)
if err != nil { if err != nil {
@ -110,14 +110,14 @@ func (args *TransactionArgs) setDefaults(ctx context.Context, b Backend) error {
} }
} else { } else {
if args.MaxFeePerGas != nil || args.MaxPriorityFeePerGas != nil { if args.MaxFeePerGas != nil || args.MaxPriorityFeePerGas != nil {
return errors.New("maxFeePerGas or maxPriorityFeePerGas specified but banach is not active yet") return errors.New("maxFeePerGas or maxPriorityFeePerGas specified but curie is not active yet")
} }
if args.GasPrice == nil { if args.GasPrice == nil {
price, err := b.SuggestGasTipCap(ctx) price, err := b.SuggestGasTipCap(ctx)
if err != nil { if err != nil {
return err return err
} }
if b.ChainConfig().IsBanach(head.Number) { if b.ChainConfig().IsCurie(head.Number) {
// The legacy tx gas price suggestion should not add 2x base fee // The legacy tx gas price suggestion should not add 2x base fee
// because all fees are consumed, so it would result in a spiral // because all fees are consumed, so it would result in a spiral
// upwards. // upwards.

View file

@ -1324,7 +1324,7 @@ func (w *worker) commitNewWork(interrupt *int32, noempty bool, timestamp int64)
Time: uint64(timestamp), Time: uint64(timestamp),
} }
// Set baseFee if we are on an EIP-1559 chain // Set baseFee if we are on an EIP-1559 chain
if w.chainConfig.IsBanach(header.Number) { if w.chainConfig.IsCurie(header.Number) {
state, err := w.chain.StateAt(parent.Root()) state, err := w.chain.StateAt(parent.Root())
if err != nil { if err != nil {
log.Error("Failed to create mining context", "err", err) log.Error("Failed to create mining context", "err", err)

View file

@ -279,7 +279,8 @@ var (
ArrowGlacierBlock: nil, ArrowGlacierBlock: nil,
ArchimedesBlock: big.NewInt(2646311), ArchimedesBlock: big.NewInt(2646311),
ShanghaiBlock: nil, ShanghaiBlock: nil,
BanachBlock: nil, BernoulliBlock: nil,
CurieBlock: nil,
Clique: &CliqueConfig{ Clique: &CliqueConfig{
Period: 3, Period: 3,
Epoch: 30000, Epoch: 30000,
@ -316,7 +317,8 @@ var (
ArrowGlacierBlock: nil, ArrowGlacierBlock: nil,
ArchimedesBlock: big.NewInt(0), ArchimedesBlock: big.NewInt(0),
ShanghaiBlock: big.NewInt(0), ShanghaiBlock: big.NewInt(0),
BanachBlock: nil, BernoulliBlock: nil,
CurieBlock: nil,
Clique: &CliqueConfig{ Clique: &CliqueConfig{
Period: 3, Period: 3,
Epoch: 30000, Epoch: 30000,
@ -353,7 +355,8 @@ var (
ArrowGlacierBlock: nil, ArrowGlacierBlock: nil,
ArchimedesBlock: big.NewInt(0), ArchimedesBlock: big.NewInt(0),
ShanghaiBlock: big.NewInt(0), ShanghaiBlock: big.NewInt(0),
BanachBlock: nil, BernoulliBlock: nil,
CurieBlock: nil,
Clique: &CliqueConfig{ Clique: &CliqueConfig{
Period: 3, Period: 3,
Epoch: 30000, Epoch: 30000,
@ -377,7 +380,7 @@ var (
// //
// This configuration is intentionally not using keyed fields to force anyone // This configuration is intentionally not using keyed fields to force anyone
// adding flags to the config to also have to set these fields. // adding flags to the config to also have to set these fields.
AllEthashProtocolChanges = &ChainConfig{big.NewInt(1337), big.NewInt(0), nil, false, big.NewInt(0), common.Hash{}, big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), nil, new(EthashConfig), nil, AllEthashProtocolChanges = &ChainConfig{big.NewInt(1337), big.NewInt(0), nil, false, big.NewInt(0), common.Hash{}, big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), nil, new(EthashConfig), nil,
ScrollConfig{ ScrollConfig{
UseZktrie: false, UseZktrie: false,
FeeVaultAddress: nil, FeeVaultAddress: nil,
@ -391,7 +394,7 @@ var (
// //
// This configuration is intentionally not using keyed fields to force anyone // This configuration is intentionally not using keyed fields to force anyone
// adding flags to the config to also have to set these fields. // adding flags to the config to also have to set these fields.
AllCliqueProtocolChanges = &ChainConfig{big.NewInt(1337), big.NewInt(0), nil, false, big.NewInt(0), common.Hash{}, big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), nil, nil, &CliqueConfig{Period: 0, Epoch: 30000}, AllCliqueProtocolChanges = &ChainConfig{big.NewInt(1337), big.NewInt(0), nil, false, big.NewInt(0), common.Hash{}, big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), nil, nil, &CliqueConfig{Period: 0, Epoch: 30000},
ScrollConfig{ ScrollConfig{
UseZktrie: false, UseZktrie: false,
FeeVaultAddress: nil, FeeVaultAddress: nil,
@ -400,7 +403,7 @@ var (
L1Config: &L1Config{5, common.HexToAddress("0x0000000000000000000000000000000000000000"), 0, common.HexToAddress("0x0000000000000000000000000000000000000000")}, L1Config: &L1Config{5, common.HexToAddress("0x0000000000000000000000000000000000000000"), 0, common.HexToAddress("0x0000000000000000000000000000000000000000")},
}} }}
TestChainConfig = &ChainConfig{big.NewInt(1), big.NewInt(0), nil, false, big.NewInt(0), common.Hash{}, big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), nil, new(EthashConfig), nil, TestChainConfig = &ChainConfig{big.NewInt(1), big.NewInt(0), nil, false, big.NewInt(0), common.Hash{}, big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), nil, new(EthashConfig), nil,
ScrollConfig{ ScrollConfig{
UseZktrie: false, UseZktrie: false,
FeeVaultAddress: &common.Address{123}, FeeVaultAddress: &common.Address{123},
@ -410,7 +413,7 @@ var (
}} }}
TestRules = TestChainConfig.Rules(new(big.Int)) TestRules = TestChainConfig.Rules(new(big.Int))
TestNoL1DataFeeChainConfig = &ChainConfig{big.NewInt(1), big.NewInt(0), nil, false, big.NewInt(0), common.Hash{}, big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), nil, new(EthashConfig), nil, TestNoL1DataFeeChainConfig = &ChainConfig{big.NewInt(1), big.NewInt(0), nil, false, big.NewInt(0), common.Hash{}, big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), nil, new(EthashConfig), nil,
ScrollConfig{ ScrollConfig{
UseZktrie: false, UseZktrie: false,
FeeVaultAddress: nil, FeeVaultAddress: nil,
@ -498,7 +501,8 @@ type ChainConfig struct {
ArrowGlacierBlock *big.Int `json:"arrowGlacierBlock,omitempty"` // Eip-4345 (bomb delay) switch block (nil = no fork, 0 = already activated) ArrowGlacierBlock *big.Int `json:"arrowGlacierBlock,omitempty"` // Eip-4345 (bomb delay) switch block (nil = no fork, 0 = already activated)
ArchimedesBlock *big.Int `json:"archimedesBlock,omitempty"` // Archimedes switch block (nil = no fork, 0 = already on archimedes) ArchimedesBlock *big.Int `json:"archimedesBlock,omitempty"` // Archimedes switch block (nil = no fork, 0 = already on archimedes)
ShanghaiBlock *big.Int `json:"shanghaiBlock,omitempty"` // Shanghai switch block (nil = no fork, 0 = already on shanghai) ShanghaiBlock *big.Int `json:"shanghaiBlock,omitempty"` // Shanghai switch block (nil = no fork, 0 = already on shanghai)
BanachBlock *big.Int `json:"banachBlock,omitempty"` // Banach switch block (nil = no fork, 0 = already on banach) BernoulliBlock *big.Int `json:"bernoulliBlock,omitempty"` // Bernoulli switch block (nil = no fork, 0 = already on bernoulli)
CurieBlock *big.Int `json:"curieBlock,omitempty"` // Curie switch block (nil = no fork, 0 = already on curie)
// TerminalTotalDifficulty is the amount of total difficulty reached by // TerminalTotalDifficulty is the amount of total difficulty reached by
// the network that triggers the consensus upgrade. // the network that triggers the consensus upgrade.
@ -614,7 +618,7 @@ func (c *ChainConfig) String() string {
default: default:
engine = "unknown" engine = "unknown"
} }
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, Archimedes: %v, Shanghai: %v, Banach: %v, Engine: %v, Scroll config: %v}", 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, Archimedes: %v, Shanghai: %v, Bernoulli: %v, Curie: %v, Engine: %v, Scroll config: %v}",
c.ChainID, c.ChainID,
c.HomesteadBlock, c.HomesteadBlock,
c.DAOForkBlock, c.DAOForkBlock,
@ -632,7 +636,8 @@ func (c *ChainConfig) String() string {
c.ArrowGlacierBlock, c.ArrowGlacierBlock,
c.ArchimedesBlock, c.ArchimedesBlock,
c.ShanghaiBlock, c.ShanghaiBlock,
c.BanachBlock, c.BernoulliBlock,
c.CurieBlock,
engine, engine,
c.Scroll, c.Scroll,
) )
@ -715,9 +720,14 @@ func (c *ChainConfig) IsShanghai(num *big.Int) bool {
return isForked(c.ShanghaiBlock, num) return isForked(c.ShanghaiBlock, num)
} }
// IsBanach returns whether num is either equal to the Banach fork block or greater. // IsBernoulli returns whether num is either equal to the Bernoulli fork block or greater.
func (c *ChainConfig) IsBanach(num *big.Int) bool { func (c *ChainConfig) IsBernoulli(num *big.Int) bool {
return isForked(c.BanachBlock, num) return isForked(c.BernoulliBlock, num)
}
// IsCurie returns whether num is either equal to the Curie fork block or greater.
func (c *ChainConfig) IsCurie(num *big.Int) bool {
return isForked(c.CurieBlock, num)
} }
// IsTerminalPoWBlock returns whether the given block is the last block of PoW stage. // IsTerminalPoWBlock returns whether the given block is the last block of PoW stage.
@ -771,7 +781,8 @@ func (c *ChainConfig) CheckConfigForkOrder() error {
{name: "arrowGlacierBlock", block: c.ArrowGlacierBlock, optional: true}, {name: "arrowGlacierBlock", block: c.ArrowGlacierBlock, optional: true},
{name: "archimedesBlock", block: c.ArchimedesBlock, optional: true}, {name: "archimedesBlock", block: c.ArchimedesBlock, optional: true},
{name: "shanghaiBlock", block: c.ShanghaiBlock, optional: true}, {name: "shanghaiBlock", block: c.ShanghaiBlock, optional: true},
{name: "banachBlock", block: c.BanachBlock, optional: true}, {name: "bernoulliBlock", block: c.BernoulliBlock, optional: true},
{name: "curieBlock", block: c.CurieBlock, optional: true},
} { } {
if lastFork.name != "" { if lastFork.name != "" {
// Next one must be higher number // Next one must be higher number
@ -850,8 +861,11 @@ func (c *ChainConfig) checkCompatible(newcfg *ChainConfig, head *big.Int) *Confi
if isForkIncompatible(c.ShanghaiBlock, newcfg.ShanghaiBlock, head) { if isForkIncompatible(c.ShanghaiBlock, newcfg.ShanghaiBlock, head) {
return newCompatError("Shanghai fork block", c.ShanghaiBlock, newcfg.ShanghaiBlock) return newCompatError("Shanghai fork block", c.ShanghaiBlock, newcfg.ShanghaiBlock)
} }
if isForkIncompatible(c.BanachBlock, newcfg.BanachBlock, head) { if isForkIncompatible(c.BernoulliBlock, newcfg.BernoulliBlock, head) {
return newCompatError("Hard fork block", c.BanachBlock, newcfg.BanachBlock) return newCompatError("Bernoulli fork block", c.BernoulliBlock, newcfg.BernoulliBlock)
}
if isForkIncompatible(c.CurieBlock, newcfg.CurieBlock, head) {
return newCompatError("Curie fork block", c.CurieBlock, newcfg.CurieBlock)
} }
return nil return nil
} }
@ -921,7 +935,7 @@ type Rules struct {
IsHomestead, IsEIP150, IsEIP155, IsEIP158 bool IsHomestead, IsEIP150, IsEIP155, IsEIP158 bool
IsByzantium, IsConstantinople, IsPetersburg, IsIstanbul bool IsByzantium, IsConstantinople, IsPetersburg, IsIstanbul bool
IsBerlin, IsLondon, IsArchimedes, IsShanghai bool IsBerlin, IsLondon, IsArchimedes, IsShanghai bool
IsBanach bool IsBernoulli, IsCurie bool
} }
// Rules ensures c's ChainID is not nil. // Rules ensures c's ChainID is not nil.
@ -944,6 +958,7 @@ func (c *ChainConfig) Rules(num *big.Int) Rules {
IsLondon: c.IsLondon(num), IsLondon: c.IsLondon(num),
IsArchimedes: c.IsArchimedes(num), IsArchimedes: c.IsArchimedes(num),
IsShanghai: c.IsShanghai(num), IsShanghai: c.IsShanghai(num),
IsBanach: c.IsBanach(num), IsBernoulli: c.IsBernoulli(num),
IsCurie: c.IsCurie(num),
} }
} }

View file

@ -24,7 +24,7 @@ import (
const ( const (
VersionMajor = 5 // Major version component of the current release VersionMajor = 5 // Major version component of the current release
VersionMinor = 1 // Minor version component of the current release VersionMinor = 1 // Minor version component of the current release
VersionPatch = 25 // Patch version component of the current release VersionPatch = 26 // Patch version component of the current release
VersionMeta = "mainnet" // Version metadata to append to the version string VersionMeta = "mainnet" // Version metadata to append to the version string
) )

View file

@ -213,7 +213,7 @@ var Forks = map[string]*params.ChainConfig{
ArrowGlacierBlock: big.NewInt(0), ArrowGlacierBlock: big.NewInt(0),
ArchimedesBlock: big.NewInt(0), ArchimedesBlock: big.NewInt(0),
}, },
"Banach": { "Curie": {
ChainID: big.NewInt(1), ChainID: big.NewInt(1),
HomesteadBlock: big.NewInt(0), HomesteadBlock: big.NewInt(0),
EIP150Block: big.NewInt(0), EIP150Block: big.NewInt(0),
@ -228,7 +228,9 @@ var Forks = map[string]*params.ChainConfig{
LondonBlock: big.NewInt(0), LondonBlock: big.NewInt(0),
ArrowGlacierBlock: big.NewInt(0), ArrowGlacierBlock: big.NewInt(0),
ArchimedesBlock: big.NewInt(0), ArchimedesBlock: big.NewInt(0),
BanachBlock: big.NewInt(0), ShanghaiBlock: big.NewInt(0),
BernoulliBlock: big.NewInt(0),
CurieBlock: big.NewInt(0),
}, },
} }

View file

@ -188,7 +188,7 @@ func (t *StateTest) RunNoVerify(subtest StateSubtest, vmconfig vm.Config, snapsh
snaps, statedb := MakePreState(rawdb.NewMemoryDatabase(), t.json.Pre, snapshotter) snaps, statedb := MakePreState(rawdb.NewMemoryDatabase(), t.json.Pre, snapshotter)
var baseFee *big.Int var baseFee *big.Int
if config.IsBanach(new(big.Int)) { if config.IsCurie(new(big.Int)) {
baseFee = t.json.Env.BaseFee baseFee = t.json.Env.BaseFee
if baseFee == nil { if baseFee == nil {
// Retesteth uses `0x10` for genesis baseFee. Therefore, it defaults to // Retesteth uses `0x10` for genesis baseFee. Therefore, it defaults to