diff --git a/accounts/abi/bind/backends/simulated.go b/accounts/abi/bind/backends/simulated.go index 15f6e35dba7..be1d8834f23 100644 --- a/accounts/abi/bind/backends/simulated.go +++ b/accounts/abi/bind/backends/simulated.go @@ -564,7 +564,7 @@ func (b *SimulatedBackend) callContract(ctx context.Context, call ethereum.CallM return nil, errors.New("both gasPrice and (maxFeePerGas or maxPriorityFeePerGas) specified") } head := b.blockchain.CurrentHeader() - if !b.blockchain.Config().IsEHardfork(head.Number) { + if !b.blockchain.Config().IsEspresso(head.Number) { // If there's no basefee, then it must be a non-1559 execution if call.GasPrice == nil { call.GasPrice = new(big.Int) @@ -615,7 +615,7 @@ func (b *SimulatedBackend) callContract(ctx context.Context, call ethereum.CallM gasPool := new(core.GasPool).AddGas(math.MaxUint64) vmRunner := b.blockchain.NewEVMRunner(block.Header(), stateDB) var sysCtx *core.SysContractCallCtx - if b.config.IsEHardfork(block.Number()) { + if b.config.IsEspresso(block.Number()) { parent := b.blockchain.GetBlockByNumber(block.NumberU64() - 1) sysStateDB, err := b.blockchain.StateAt(parent.Root()) if err != nil { diff --git a/cmd/evm/internal/t8ntool/transition.go b/cmd/evm/internal/t8ntool/transition.go index 1ff25ef7652..ff30dbfe129 100644 --- a/cmd/evm/internal/t8ntool/transition.go +++ b/cmd/evm/internal/t8ntool/transition.go @@ -250,7 +250,7 @@ func Main(ctx *cli.Context) error { return NewError(ErrorJson, fmt.Errorf("failed signing transactions: %v", err)) } // Sanity check, to not `panic` in state_transition - if chainConfig.IsEHardfork(big.NewInt(int64(prestate.Env.Number))) { + if chainConfig.IsEspresso(big.NewInt(int64(prestate.Env.Number))) { if prestate.Env.BaseFee == nil { return NewError(ErrorVMConfig, errors.New("EIP-1559 config but missing 'currentBaseFee' in env section")) } diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go index 931c89c9f88..b5d17c9d5e1 100644 --- a/cmd/utils/flags.go +++ b/cmd/utils/flags.go @@ -240,8 +240,8 @@ var ( // Hard fork activation overrides OverrideEHardforkFlag = cli.Uint64Flag{ - Name: "override.eHardfork", - Usage: "Manually specify E fork-block, overriding the bundled setting", + Name: "override.espresso", + Usage: "Manually specify the espresso fork block, overriding the bundled setting", } BloomFilterSizeFlag = cli.Uint64Flag{ diff --git a/consensus/istanbul/core/core.go b/consensus/istanbul/core/core.go index 7d6523b28d3..e8ba04911c6 100644 --- a/consensus/istanbul/core/core.go +++ b/consensus/istanbul/core/core.go @@ -724,7 +724,7 @@ func (c *core) getRoundChangeTimeout() time.Duration { if round == 0 { return baseTimeout + blockTime } else { - if c.backend.ChainConfig().IsEHardfork(c.current.Sequence()) { + if c.backend.ChainConfig().IsEspresso(c.current.Sequence()) { return baseTimeout + blockTime + time.Duration(math.Pow(2, float64(round)))*time.Duration(c.config.TimeoutBackoffFactor)*time.Millisecond } else { return baseTimeout + time.Duration(math.Pow(2, float64(round)))*time.Duration(c.config.TimeoutBackoffFactor)*time.Millisecond diff --git a/core/genesis.go b/core/genesis.go index 18e17168855..325bea8ed28 100644 --- a/core/genesis.go +++ b/core/genesis.go @@ -203,7 +203,7 @@ func SetupGenesisBlockWithOverride(db ethdb.Database, genesis *Genesis, override // Get the existing chain configuration. newcfg := genesis.configOrDefault(stored) if overrideEHardfork != nil { - newcfg.EBlock = overrideEHardfork + newcfg.EspressoBlock = overrideEHardfork } if err := newcfg.CheckConfigForkOrder(); err != nil { diff --git a/core/state_prefetcher.go b/core/state_prefetcher.go index e3d000e582b..2f1e822b50f 100644 --- a/core/state_prefetcher.go +++ b/core/state_prefetcher.go @@ -60,7 +60,7 @@ func (p *statePrefetcher) Prefetch(block *types.Block, statedb *state.StateDB, c ) // Iterate over and process the individual transactions byzantium := p.config.IsByzantium(block.Number()) - espresso := p.bc.chainConfig.IsEHardfork(block.Number()) + espresso := p.bc.chainConfig.IsEspresso(block.Number()) if espresso { sysCtx = NewSysContractCallCtx(p.bc.NewEVMRunner(header, statedb)) } @@ -103,7 +103,7 @@ func precacheTransaction(config *params.ChainConfig, bc *BlockChain, author *com vm := vm.NewEVM(context, txContext, statedb, config, cfg) var sysCtx *SysContractCallCtx - if config.IsEHardfork(header.Number) { + if config.IsEspresso(header.Number) { sysVmRunner := bc.NewEVMRunner(header, statedb) sysCtx = NewSysContractCallCtx(sysVmRunner) } diff --git a/core/state_processor.go b/core/state_processor.go index 82376fdcaca..c17685b6be1 100644 --- a/core/state_processor.go +++ b/core/state_processor.go @@ -85,7 +85,7 @@ func (p *StateProcessor) Process(block *types.Block, statedb *state.StateDB, cfg baseFee *big.Int sysCtx *SysContractCallCtx ) - if p.bc.Config().IsEHardfork(blockNumber) { + if p.bc.Config().IsEspresso(blockNumber) { sysVmRunner := p.bc.NewEVMRunner(header, statedb) sysCtx = NewSysContractCallCtx(sysVmRunner) if p.bc.Config().Faker { @@ -96,7 +96,7 @@ func (p *StateProcessor) Process(block *types.Block, statedb *state.StateDB, cfg vmenv := vm.NewEVM(blockContext, vm.TxContext{}, statedb, p.config, cfg) // Iterate over and process the individual transactions for i, tx := range block.Transactions() { - if p.bc.chainConfig.IsEHardfork(header.Number) { + if p.bc.chainConfig.IsEspresso(header.Number) { baseFee = sysCtx.GetGasPriceMinimum(tx.FeeCurrency()) } msg, err := tx.AsMessage(types.MakeSigner(p.config, header.Number), baseFee) @@ -175,7 +175,7 @@ func applyTransaction(msg types.Message, config *params.ChainConfig, gp *GasPool // indicating the block was invalid. func ApplyTransaction(config *params.ChainConfig, bc ChainContext, txFeeRecipient *common.Address, gp *GasPool, statedb *state.StateDB, header *types.Header, tx *types.Transaction, usedGas *uint64, cfg vm.Config, vmRunner vm.EVMRunner, sysCtx *SysContractCallCtx) (*types.Receipt, error) { var baseFee *big.Int - if config.IsEHardfork(header.Number) { + if config.IsEspresso(header.Number) { baseFee = sysCtx.GetGasPriceMinimum(tx.FeeCurrency()) } msg, err := tx.AsMessage(types.MakeSigner(config, header.Number), baseFee) diff --git a/core/state_processor_test.go b/core/state_processor_test.go index 63739edc20a..78c7c5ab347 100644 --- a/core/state_processor_test.go +++ b/core/state_processor_test.go @@ -50,7 +50,7 @@ func TestStateProcessorErrors(t *testing.T) { IstanbulBlock: big.NewInt(0), ChurritoBlock: big.NewInt(0), DonutBlock: big.NewInt(0), - EBlock: big.NewInt(0), + EspressoBlock: big.NewInt(0), Faker: true, } signer = types.LatestSigner(config) diff --git a/core/state_transition.go b/core/state_transition.go index de97ba17a98..623304d0d27 100644 --- a/core/state_transition.go +++ b/core/state_transition.go @@ -208,7 +208,7 @@ func IntrinsicGas(data []byte, accessList types.AccessList, isContractCreation b // NewStateTransition initialises and returns a new state transition object. func NewStateTransition(evm *vm.EVM, msg Message, gp *GasPool, vmRunner vm.EVMRunner, sysCtx *SysContractCallCtx) *StateTransition { var gasPriceMinimum *big.Int - if evm.ChainConfig().IsEHardfork(evm.Context.BlockNumber) { + if evm.ChainConfig().IsEspresso(evm.Context.BlockNumber) { gasPriceMinimum = sysCtx.GetGasPriceMinimum(msg.FeeCurrency()) } else { gasPriceMinimum, _ = gpm.GetGasPriceMinimum(vmRunner, msg.FeeCurrency()) @@ -262,9 +262,9 @@ func (st *StateTransition) to() common.Address { } // payFees deducts gas and gateway fees from sender balance and adds the purchased amount of gas to the state. -func (st *StateTransition) payFees(eHardFork bool) error { +func (st *StateTransition) payFees(espresso bool) error { var isWhiteListed bool - if eHardFork { + if espresso { isWhiteListed = st.sysCtx.IsWhitelisted(st.msg.FeeCurrency()) } else { isWhiteListed = currency.IsWhitelisted(st.vmRunner, st.msg.FeeCurrency()) @@ -274,7 +274,7 @@ func (st *StateTransition) payFees(eHardFork bool) error { return ErrNonWhitelistedFeeCurrency } - if err := st.canPayFee(st.msg.From(), st.msg.FeeCurrency(), eHardFork); err != nil { + if err := st.canPayFee(st.msg.From(), st.msg.FeeCurrency(), espresso); err != nil { return err } if err := st.gp.SubGas(st.msg.Gas()); err != nil { @@ -437,7 +437,7 @@ func (st *StateTransition) preCheck() error { } // Make sure that transaction gasFeeCap >= baseFee (post Espresso) - if st.evm.ChainConfig().IsEHardfork(st.evm.Context.BlockNumber) { + if st.evm.ChainConfig().IsEspresso(st.evm.Context.BlockNumber) { // 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 l := st.gasFeeCap.BitLen(); l > 256 { @@ -516,14 +516,14 @@ func (st *StateTransition) TransitionDb() (*ExecutionResult, error) { msg := st.msg sender := vm.AccountRef(msg.From()) istanbul := st.evm.ChainConfig().IsIstanbul(st.evm.Context.BlockNumber) - eHardfork := st.evm.ChainConfig().IsEHardfork(st.evm.Context.BlockNumber) + espresso := st.evm.ChainConfig().IsEspresso(st.evm.Context.BlockNumber) contractCreation := msg.To() == nil // Calculate intrinsic gas, check clauses 5-6 gasForAlternativeCurrency := uint64(0) // If the fee currency is nil, do not retrieve the intrinsic gas adjustment from the chain state, as it will not be used. if msg.FeeCurrency() != nil { - if eHardfork { + if espresso { gasForAlternativeCurrency = st.sysCtx.GetIntrinsicGasForAlternativeFeeCurrency() } else { gasForAlternativeCurrency = blockchain_parameters.GetIntrinsicGasForAlternativeFeeCurrencyOrDefault(st.vmRunner) @@ -539,7 +539,7 @@ func (st *StateTransition) TransitionDb() (*ExecutionResult, error) { return nil, fmt.Errorf("%w: have %d, want %d", ErrIntrinsicGas, st.msg.Gas(), gas) } // Check clauses 3-4, pay the fees (which buys gas), and subtract the intrinsic gas - err = st.payFees(eHardfork) + err = st.payFees(espresso) if err != nil { log.Error("Transaction failed to buy gas", "err", err, "gas", gas) return nil, err @@ -552,7 +552,7 @@ func (st *StateTransition) TransitionDb() (*ExecutionResult, error) { } // Set up the initial access list. - if rules := st.evm.ChainConfig().Rules(st.evm.Context.BlockNumber); eHardfork { + if rules := st.evm.ChainConfig().Rules(st.evm.Context.BlockNumber); espresso { st.state.PrepareAccessList(msg.From(), msg.To(), vm.ActivePrecompiles(rules), msg.AccessList()) } var ( @@ -567,7 +567,7 @@ func (st *StateTransition) TransitionDb() (*ExecutionResult, error) { ret, st.gas, vmerr = st.evm.Call(sender, st.to(), st.data, st.gas, st.value) } - if !eHardfork { + if !espresso { // Before EIP-3529: refunds were capped to gasUsed / 2 st.refundGas(params.RefundQuotient) } else { @@ -600,7 +600,7 @@ func (st *StateTransition) distributeTxFees() error { totalTxFee := new(big.Int).Mul(gasUsed, st.gasPrice) from := st.msg.From() - // Divide the transaction into a base (the minimum transaction fee) and tip (any extra, or min(max tip, feecap - GPM) if ehardfork). + // Divide the transaction into a base (the minimum transaction fee) and tip (any extra, or min(max tip, feecap - GPM) if espresso). baseTxFee := new(big.Int).Mul(gasUsed, st.gasPriceMinimum) // No need to do effectiveTip calculation, because st.gasPrice == effectiveGasPrice, and effectiveTip = effectiveGasPrice - baseTxFee tipTxFee := new(big.Int).Sub(totalTxFee, baseTxFee) diff --git a/core/tx_pool.go b/core/tx_pool.go index 1f16c13460f..9c96dc783f6 100644 --- a/core/tx_pool.go +++ b/core/tx_pool.go @@ -266,9 +266,9 @@ type TxPool struct { signer types.Signer mu sync.RWMutex - istanbul bool // Fork indicator whether we are in the istanbul stage. - donut bool // Fork indicator for the Donut fork. - eHardfork bool // Fork indicator for the E fork. + istanbul bool // Fork indicator whether we are in the istanbul stage. + donut bool // Fork indicator for the Donut fork. + espresso bool // Fork indicator for the Espresso fork. currentState *state.StateDB // Current state in the blockchain head currentVMRunner vm.EVMRunner // Current EVMRunner @@ -660,11 +660,11 @@ func (pool *TxPool) validateTx(tx *types.Transaction, local bool) error { } // Accept only legacy transactions until EIP-2718/2930 activates. - if !pool.eHardfork && tx.Type() != types.LegacyTxType { + if !pool.espresso && tx.Type() != types.LegacyTxType { return ErrTxTypeNotSupported } // Reject dynamic fee transactions until EIP-1559 activates. - if !pool.eHardfork && tx.Type() == types.DynamicFeeTxType { + if !pool.espresso && tx.Type() == types.DynamicFeeTxType { return ErrTxTypeNotSupported } // Reject transactions over defined size to prevent DOS attacks @@ -712,7 +712,7 @@ func (pool *TxPool) validateTx(tx *types.Transaction, local bool) error { return ErrNonceTooLow } // Transactor should have enough funds to cover the costs - err = ValidateTransactorBalanceCoversTx(tx, from, pool.currentState, pool.currentVMRunner, pool.eHardfork) + err = ValidateTransactorBalanceCoversTx(tx, from, pool.currentState, pool.currentVMRunner, pool.espresso) if err != nil { return err } @@ -1255,7 +1255,7 @@ func (pool *TxPool) runReorg(done chan struct{}, reset *txpoolResetRequest, dirt // because of another transaction (e.g. higher gas price). if reset != nil { pool.demoteUnexecutables() - if reset.newHead != nil && pool.chainconfig.IsEHardfork(new(big.Int).Add(reset.newHead.Number, big.NewInt(1))) { + if reset.newHead != nil && pool.chainconfig.IsEspresso(new(big.Int).Add(reset.newHead.Number, big.NewInt(1))) { pool.priced.SetBaseFee(pool.ctx()) } } @@ -1387,7 +1387,7 @@ func (pool *TxPool) reset(oldHead, newHead *types.Header) { if pool.donut && !wasDonut { pool.handleDonutActivation() } - pool.eHardfork = pool.chainconfig.IsEHardfork(next) + pool.espresso = pool.chainconfig.IsEspresso(next) } // promoteExecutables moves transactions that have become processable from the diff --git a/core/tx_pool_test.go b/core/tx_pool_test.go index f3ce6933825..17653548f03 100644 --- a/core/tx_pool_test.go +++ b/core/tx_pool_test.go @@ -59,7 +59,7 @@ func init() { cpy := *params.TestChainConfig eip1559Config = &cpy - eip1559Config.EBlock = common.Big0 + eip1559Config.EspressoBlock = common.Big0 } type testBlockChain struct { diff --git a/core/types/transaction_signing.go b/core/types/transaction_signing.go index d935194bd30..3b8b65d3c3c 100644 --- a/core/types/transaction_signing.go +++ b/core/types/transaction_signing.go @@ -40,7 +40,7 @@ type sigCache struct { func MakeSigner(config *params.ChainConfig, blockNumber *big.Int) Signer { var signer Signer switch { - case config.IsEHardfork(blockNumber): + case config.IsEspresso(blockNumber): signer = NewLondonSigner(config.ChainID) case config.IsEIP155(blockNumber): signer = NewEIP155Signer(config.ChainID) @@ -61,7 +61,7 @@ func MakeSigner(config *params.ChainConfig, blockNumber *big.Int) Signer { // have the current block number available, use MakeSigner instead. func LatestSigner(config *params.ChainConfig) Signer { if config.ChainID != nil { - if config.EBlock != nil { + if config.EspressoBlock != nil { return NewLondonSigner(config.ChainID) } if config.EIP155Block != nil { diff --git a/core/vm/contracts.go b/core/vm/contracts.go index 92c14ff64b2..44b781cf539 100644 --- a/core/vm/contracts.go +++ b/core/vm/contracts.go @@ -275,7 +275,7 @@ func init() { // ActivePrecompiles returns the precompiles enabled with the current configuration. func ActivePrecompiles(rules params.Rules) []common.Address { switch { - case rules.IsEHardfork: + case rules.IsEspresso: return PrecompiledAddressesE case rules.IsDonut: return PrecompiledAddressesDonut diff --git a/core/vm/evm.go b/core/vm/evm.go index 5ba1e583c33..67319ee4deb 100644 --- a/core/vm/evm.go +++ b/core/vm/evm.go @@ -57,7 +57,7 @@ type ( func (evm *EVM) precompile(addr common.Address) (PrecompiledContract, bool) { var precompiles map[common.Address]PrecompiledContract switch { - case evm.chainRules.IsEHardfork: + case evm.chainRules.IsEspresso: precompiles = PrecompiledContractsE case evm.chainRules.IsDonut: precompiles = PrecompiledContractsDonut @@ -429,7 +429,7 @@ func (evm *EVM) create(caller ContractRef, codeAndHash *codeAndHash, gas uint64, // We add this to the access list _before_ taking a snapshot. Even if the creation fails, // the access-list change should not be rolled back - if evm.chainRules.IsEHardfork { + if evm.chainRules.IsEspresso { evm.StateDB.AddAddressToAccessList(address) } // Ensure there's no existing contract already at the designated address @@ -467,7 +467,7 @@ func (evm *EVM) create(caller ContractRef, codeAndHash *codeAndHash, gas uint64, } // Reject code starting with 0xEF if EIP-3541 is enabled. - if err == nil && len(ret) >= 1 && ret[0] == 0xEF && evm.chainRules.IsEHardfork { + if err == nil && len(ret) >= 1 && ret[0] == 0xEF && evm.chainRules.IsEspresso { err = ErrInvalidCode } diff --git a/core/vm/interpreter.go b/core/vm/interpreter.go index c318f52b5b6..9883b81ad8e 100644 --- a/core/vm/interpreter.go +++ b/core/vm/interpreter.go @@ -74,7 +74,7 @@ func NewEVMInterpreter(evm *EVM, cfg Config) *EVMInterpreter { if cfg.JumpTable[STOP] == nil { var jt JumpTable switch { - case evm.chainRules.IsEHardfork: + case evm.chainRules.IsEspresso: jt = espressoInstructionSet case evm.chainRules.IsIstanbul: jt = istanbulInstructionSet diff --git a/core/vm/runtime/runtime.go b/core/vm/runtime/runtime.go index e0bf49b870d..de8d0135bec 100644 --- a/core/vm/runtime/runtime.go +++ b/core/vm/runtime/runtime.go @@ -66,7 +66,7 @@ func setDefaults(cfg *Config) { IstanbulBlock: new(big.Int), ChurritoBlock: new(big.Int), DonutBlock: new(big.Int), - EBlock: new(big.Int), + EspressoBlock: new(big.Int), } } if cfg.Time == nil { @@ -110,7 +110,7 @@ func Execute(code, input []byte, cfg *Config) ([]byte, *state.StateDB, error) { vmenv = NewEnv(cfg) sender = vm.AccountRef(cfg.Origin) ) - if rules := cfg.ChainConfig.Rules(vmenv.Context.BlockNumber); rules.IsEHardfork { + if rules := cfg.ChainConfig.Rules(vmenv.Context.BlockNumber); rules.IsEspresso { cfg.State.PrepareAccessList(cfg.Origin, &address, vm.ActivePrecompiles(rules), nil) } cfg.State.CreateAccount(address) @@ -143,7 +143,7 @@ func Create(input []byte, cfg *Config) ([]byte, common.Address, uint64, error) { sender = vm.AccountRef(cfg.Origin) ) - if rules := cfg.ChainConfig.Rules(vmenv.Context.BlockNumber); rules.IsEHardfork { + if rules := cfg.ChainConfig.Rules(vmenv.Context.BlockNumber); rules.IsEspresso { cfg.State.PrepareAccessList(cfg.Origin, nil, vm.ActivePrecompiles(rules), nil) } // Call the code with the given configuration. @@ -169,7 +169,7 @@ func Call(address common.Address, input []byte, cfg *Config) ([]byte, uint64, er sender := cfg.State.GetOrNewStateObject(cfg.Origin) statedb := cfg.State - if rules := cfg.ChainConfig.Rules(vmenv.Context.BlockNumber); rules.IsEHardfork { + if rules := cfg.ChainConfig.Rules(vmenv.Context.BlockNumber); rules.IsEspresso { statedb.PrepareAccessList(cfg.Origin, &address, vm.ActivePrecompiles(rules), nil) } // Call the code with the given configuration. diff --git a/eth/state_accessor.go b/eth/state_accessor.go index 61a52af83f3..41c296600ed 100644 --- a/eth/state_accessor.go +++ b/eth/state_accessor.go @@ -161,7 +161,7 @@ func (eth *Ethereum) stateAtTransaction(block *types.Block, txIndex int, reexec } // Get the SysContractCallCtx var sysCtx *core.SysContractCallCtx - espresso := eth.blockchain.Config().IsEHardfork(block.Number()) + espresso := eth.blockchain.Config().IsEspresso(block.Number()) if espresso { sysCtx = core.NewSysContractCallCtx(eth.blockchain.NewEVMRunner(block.Header(), statedb)) } diff --git a/eth/tracers/api.go b/eth/tracers/api.go index f17f6b91b12..3c2acddb14a 100644 --- a/eth/tracers/api.go +++ b/eth/tracers/api.go @@ -276,7 +276,7 @@ func (api *API) traceChain(ctx context.Context, start, end *types.Block, config signer := types.MakeSigner(api.backend.ChainConfig(), task.block.Number()) blockCtx := core.NewEVMBlockContext(task.block.Header(), api.chainContext(localctx), nil) var sysCtx *core.SysContractCallCtx - if api.backend.ChainConfig().IsEHardfork(blockCtx.BlockNumber) { + if api.backend.ChainConfig().IsEspresso(blockCtx.BlockNumber) { sysVmRunner := api.backend.VmRunnerAtHeader(task.block.Header(), task.statedb) sysCtx = core.NewSysContractCallCtx(sysVmRunner) } @@ -530,7 +530,7 @@ func (api *API) traceBlock(ctx context.Context, block *types.Block, config *Trac blockCtx := core.NewEVMBlockContext(block.Header(), api.chainContext(ctx), nil) blockHash := block.Hash() var sysCtx *core.SysContractCallCtx - if api.backend.ChainConfig().IsEHardfork(block.Number()) { + if api.backend.ChainConfig().IsEspresso(block.Number()) { sysVmRunner := api.backend.VmRunnerAtHeader(block.Header(), statedb) sysCtx = core.NewSysContractCallCtx(sysVmRunner) } @@ -640,13 +640,13 @@ func (api *API) standardTraceBlockToFile(ctx context.Context, block *types.Block chainConfigCopy := new(params.ChainConfig) *chainConfigCopy = *chainConfig chainConfig = chainConfigCopy - if E := config.LogConfig.Overrides.EBlock; E != nil { - chainConfig.EBlock = E + if E := config.LogConfig.Overrides.EspressoBlock; E != nil { + chainConfig.EspressoBlock = E canon = false } } var sysCtx *core.SysContractCallCtx - if api.backend.ChainConfig().IsEHardfork(block.Number()) { + if api.backend.ChainConfig().IsEspresso(block.Number()) { sysVmRunner := api.backend.VmRunnerAtHeader(block.Header(), statedb) sysCtx = core.NewSysContractCallCtx(sysVmRunner) } @@ -740,7 +740,7 @@ func (api *API) TraceTransaction(ctx context.Context, hash common.Hash, config * } var sysCtx *core.SysContractCallCtx - if api.backend.ChainConfig().IsEHardfork(block.Number()) { + if api.backend.ChainConfig().IsEspresso(block.Number()) { parent, err := api.blockByNumber(ctx, rpc.BlockNumber(blockNumber-1)) if err != nil { return nil, err @@ -808,7 +808,7 @@ func (api *API) TraceCall(ctx context.Context, args ethapi.TransactionArgs, bloc vmctx := core.NewEVMBlockContext(block.Header(), api.chainContext(ctx), nil) vmRunner := api.backend.VmRunnerAtHeader(block.Header(), statedb) var sysCtx *core.SysContractCallCtx - if api.backend.ChainConfig().IsEHardfork(block.Number()) { + if api.backend.ChainConfig().IsEspresso(block.Number()) { sysVmRunner := api.backend.VmRunnerAtHeader(block.Header(), statedb) sysCtx = core.NewSysContractCallCtx(sysVmRunner) } diff --git a/eth/tracers/tracer_test.go b/eth/tracers/tracer_test.go index ba072824660..eaa23449983 100644 --- a/eth/tracers/tracer_test.go +++ b/eth/tracers/tracer_test.go @@ -208,10 +208,10 @@ func TestNoStepExec(t *testing.T) { } func TestIsPrecompile(t *testing.T) { - chaincfg := ¶ms.ChainConfig{ChainID: big.NewInt(1), 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(100), ConstantinopleBlock: big.NewInt(0), PetersburgBlock: big.NewInt(0), IstanbulBlock: big.NewInt(200), EBlock: big.NewInt(0)} + chaincfg := ¶ms.ChainConfig{ChainID: big.NewInt(1), 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(100), ConstantinopleBlock: big.NewInt(0), PetersburgBlock: big.NewInt(0), IstanbulBlock: big.NewInt(200), EspressoBlock: big.NewInt(0)} chaincfg.ByzantiumBlock = big.NewInt(100) chaincfg.IstanbulBlock = big.NewInt(200) - chaincfg.EBlock = big.NewInt(300) + chaincfg.EspressoBlock = big.NewInt(300) txCtx := vm.TxContext{GasPrice: big.NewInt(100000)} tracer, err := New("{addr: toAddress('0000000000000000000000000000000000000009'), res: null, step: function() { this.res = isPrecompiled(this.addr); }, fault: function() {}, result: function() { return this.res; }}", new(Context)) if err != nil { diff --git a/internal/ethapi/api.go b/internal/ethapi/api.go index 233ac95eda6..ea336760f6b 100644 --- a/internal/ethapi/api.go +++ b/internal/ethapi/api.go @@ -848,7 +848,7 @@ func DoCall(ctx context.Context, b Backend, args TransactionArgs, blockNrOrHash // Create SysContractCallCtx var sysCtx *core.SysContractCallCtx - if b.ChainConfig().IsEHardfork(header.Number) { + if b.ChainConfig().IsEspresso(header.Number) { vmRunner := b.NewEVMRunner(header, state) if err != nil { return nil, err @@ -1557,7 +1557,7 @@ func (s *PublicTransactionPoolAPI) GetTransactionReceipt(ctx context.Context, ha fields := generateReceiptResponse(receipt, signer, tx, blockHash, blockNumber, index) // Assign the effective gas price paid - if !s.b.ChainConfig().IsEHardfork(bigblock) { + if !s.b.ChainConfig().IsEspresso(bigblock) { fields["effectiveGasPrice"] = hexutil.Uint64(tx.GasPrice().Uint64()) } else { header, err := s.b.HeaderByHash(ctx, blockHash) diff --git a/internal/ethapi/transaction_args.go b/internal/ethapi/transaction_args.go index fd2104789c8..5bbc1864974 100644 --- a/internal/ethapi/transaction_args.go +++ b/internal/ethapi/transaction_args.go @@ -91,7 +91,7 @@ func (args *TransactionArgs) setDefaults(ctx context.Context, b Backend) error { // need to consult the chain for defaults. It's definitely a London tx. if args.MaxPriorityFeePerGas == nil || args.MaxFeePerGas == nil { // In this clause, user left some fields unspecified. - if b.ChainConfig().IsEHardfork(head.Number) && (args.GasPrice == nil || args.GasPrice.ToInt().Cmp(big.NewInt(0)) == 0) { + if b.ChainConfig().IsEspresso(head.Number) && (args.GasPrice == nil || args.GasPrice.ToInt().Cmp(big.NewInt(0)) == 0) { if args.MaxPriorityFeePerGas == nil { tip, err := b.SuggestGasTipCap(ctx, args.FeeCurrency) if err != nil { @@ -122,7 +122,7 @@ func (args *TransactionArgs) setDefaults(ctx context.Context, b Backend) error { if err != nil { return err } - if b.ChainConfig().IsEHardfork(head.Number) { + if b.ChainConfig().IsEspresso(head.Number) { gasPriceMinimum, err := b.CurrentGasPriceMinimum(ctx, args.FeeCurrency) if err != nil { return err diff --git a/les/state_accessor.go b/les/state_accessor.go index d49c5d55500..b3c0a20250a 100644 --- a/les/state_accessor.go +++ b/les/state_accessor.go @@ -54,7 +54,7 @@ func (leth *LightEthereum) stateAtTransaction(ctx context.Context, block *types. } // Create SysContractCallCtx var sysCtx *core.SysContractCallCtx - if leth.chainConfig.IsEHardfork(block.Number()) { + if leth.chainConfig.IsEspresso(block.Number()) { vmRunner := vmcontext.NewEVMRunner(leth.blockchain, block.Header(), statedb.Copy()) sysCtx = core.NewSysContractCallCtx(vmRunner) } diff --git a/light/txpool.go b/light/txpool.go index 9a13916a062..a8333520e87 100644 --- a/light/txpool.go +++ b/light/txpool.go @@ -69,9 +69,9 @@ type TxPool struct { mined map[common.Hash][]*types.Transaction // mined transactions by block hash clearIdx uint64 // earliest block nr that can contain mined tx info - istanbul bool // Fork indicator whether we are in the istanbul stage - donut bool // Fork indicator whether Donut has been activated - eHardfork bool // Fork indicator whether E hard fork has been activated + istanbul bool // Fork indicator whether we are in the istanbul stage + donut bool // Fork indicator whether Donut has been activated + espresso bool // Fork indicator whether Espresso has been activated } // TxRelayBackend provides an interface to the mechanism that forwards transacions @@ -326,7 +326,7 @@ func (pool *TxPool) setNewHead(head *types.Header) { next := new(big.Int).Add(head.Number, big.NewInt(1)) pool.istanbul = pool.config.IsIstanbul(next) pool.donut = pool.config.IsDonut(next) - pool.eHardfork = pool.config.IsEHardfork(next) + pool.espresso = pool.config.IsEspresso(next) } // Stop stops the light transaction pool @@ -392,7 +392,7 @@ func (pool *TxPool) validateTx(ctx context.Context, tx *types.Transaction) error vmRunner := pool.chain.NewEVMRunner(pool.chain.CurrentHeader(), currentState) // Transactor should have enough funds to cover the costs - err = core.ValidateTransactorBalanceCoversTx(tx, from, currentState, vmRunner, pool.eHardfork) + err = core.ValidateTransactorBalanceCoversTx(tx, from, currentState, vmRunner, pool.espresso) if err != nil { return err } diff --git a/miner/stress/1559/main.go b/miner/stress/1559/main.go index d3a3e64bacd..bed9d77ffe9 100644 --- a/miner/stress/1559/main.go +++ b/miner/stress/1559/main.go @@ -186,7 +186,7 @@ func makeGenesis(faucets []*ecdsa.PrivateKey) *core.Genesis { genesis := core.DefaultBaklavaGenesisBlock() genesis.Config = params.BaklavaChainConfig - genesis.Config.EBlock = espressoBlock + genesis.Config.EspressoBlock = espressoBlock genesis.Config.ChainID = big.NewInt(18) genesis.Config.EIP150Hash = common.Hash{} diff --git a/miner/worker.go b/miner/worker.go index c48d383508d..b55170f5d75 100644 --- a/miner/worker.go +++ b/miner/worker.go @@ -292,7 +292,7 @@ func (w *worker) constructAndSubmitNewBlock(ctx context.Context) { } w.submitTaskToEngine(&task{receipts: b.receipts, state: b.state, block: block, createdAt: time.Now()}) baseFeeFn, toCELO := createConversionFunctions(b.sysCtx, w.chain, b.header, b.state) - feesCelo := totalFees(block, b.receipts, baseFeeFn, toCELO, w.chainConfig.IsEHardfork(b.header.Number)) + feesCelo := totalFees(block, b.receipts, baseFeeFn, toCELO, w.chainConfig.IsEspresso(b.header.Number)) log.Info("Commit new mining work", "number", block.Number(), "txs", b.tcount, "gas", block.GasUsed(), "fees", feesCelo, "elapsed", common.PrettyDuration(time.Since(start))) diff --git a/mycelo/genesis/config.go b/mycelo/genesis/config.go index c151088d17e..9df2bda8e45 100644 --- a/mycelo/genesis/config.go +++ b/mycelo/genesis/config.go @@ -81,6 +81,7 @@ func (cfg *Config) ChainConfig() *params.ChainConfig { ChurritoBlock: cfg.Hardforks.ChurritoBlock, DonutBlock: cfg.Hardforks.DonutBlock, + EspressoBlock: cfg.Hardforks.EspressoBlock, Istanbul: ¶ms.IstanbulConfig{ Epoch: cfg.Istanbul.Epoch, @@ -96,6 +97,7 @@ func (cfg *Config) ChainConfig() *params.ChainConfig { type HardforkConfig struct { ChurritoBlock *big.Int `json:"churritoBlock"` DonutBlock *big.Int `json:"donutBlock"` + EspressoBlock *big.Int `json:"espressoBlock"` } // MultiSigParameters are the initial configuration parameters for a MultiSig contract diff --git a/mycelo/loadbot/bot.go b/mycelo/loadbot/bot.go index cb453240999..221a6175a91 100644 --- a/mycelo/loadbot/bot.go +++ b/mycelo/loadbot/bot.go @@ -130,7 +130,7 @@ func runTransaction(ctx context.Context, client *ethclient.Client, chainID *big. abi := contract.AbiFor("StableToken") stableToken := bind.NewBoundContract(env.MustProxyAddressFor("StableToken"), *abi, client) - transactor := bind.NewKeyedTransactor(txCfg.Acc.PrivateKey) + transactor, _ := bind.NewKeyedTransactorWithChainID(txCfg.Acc.PrivateKey, chainID) transactor.Context = ctx transactor.ChainID = chainID transactor.Nonce = new(big.Int).SetUint64(txCfg.Nonce) diff --git a/params/config.go b/params/config.go index e6d7e468e03..5b84ce59805 100644 --- a/params/config.go +++ b/params/config.go @@ -64,7 +64,7 @@ var ( IstanbulBlock: big.NewInt(0), ChurritoBlock: big.NewInt(6774000), DonutBlock: big.NewInt(6774000), - EBlock: nil, + EspressoBlock: nil, Istanbul: &IstanbulConfig{ Epoch: 17280, ProposerPolicy: 2, @@ -89,7 +89,7 @@ var ( IstanbulBlock: big.NewInt(0), ChurritoBlock: big.NewInt(2719099), DonutBlock: big.NewInt(5002000), - EBlock: nil, + EspressoBlock: nil, Istanbul: &IstanbulConfig{ Epoch: 17280, ProposerPolicy: 2, @@ -114,7 +114,7 @@ var ( IstanbulBlock: big.NewInt(0), ChurritoBlock: big.NewInt(4960000), DonutBlock: big.NewInt(4960000), - EBlock: nil, + EspressoBlock: nil, Istanbul: &IstanbulConfig{ Epoch: 17280, ProposerPolicy: 2, @@ -229,7 +229,7 @@ type ChainConfig struct { EWASMBlock *big.Int `json:"ewasmBlock,omitempty"` // EWASM switch block (nil = no fork, 0 = already activated) ChurritoBlock *big.Int `json:"churritoBlock,omitempty"` // Churrito switch block (nil = no fork, 0 = already activated) DonutBlock *big.Int `json:"donutBlock,omitempty"` // Donut switch block (nil = no fork, 0 = already activated) - EBlock *big.Int `json:"dBlock,omitempty"` // E switch block (nil = no fork, 0 = already activated) + EspressoBlock *big.Int `json:"espressoBlock,omitempty"` // Espresso switch block (nil = no fork, 0 = already activated) Istanbul *IstanbulConfig `json:"istanbul,omitempty"` // This does not belong here but passing it to every function is not possible since that breaks @@ -271,7 +271,7 @@ func (c *ChainConfig) String() string { } else { engine = "MockEngine" } - 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 Churrito: %v, Donut: %v, EHardfork: %v, Engine: %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 Churrito: %v, Donut: %v, Espresso: %v, Engine: %v}", c.ChainID, c.HomesteadBlock, c.DAOForkBlock, @@ -285,7 +285,7 @@ func (c *ChainConfig) String() string { c.IstanbulBlock, c.ChurritoBlock, c.DonutBlock, - c.EBlock, + c.EspressoBlock, engine, ) } @@ -352,9 +352,9 @@ func (c *ChainConfig) IsDonut(num *big.Int) bool { return isForked(c.DonutBlock, num) } -// IsEHardfork returns whether num represents a block number after the E fork -func (c *ChainConfig) IsEHardfork(num *big.Int) bool { - return isForked(c.EBlock, num) +// IsEspresso returns whether num represents a block number after the E fork +func (c *ChainConfig) IsEspresso(num *big.Int) bool { + return isForked(c.EspressoBlock, num) } // CheckCompatible checks whether scheduled fork transitions have been imported @@ -395,7 +395,7 @@ func (c *ChainConfig) CheckConfigForkOrder() error { {name: "istanbulBlock", block: c.IstanbulBlock}, {name: "churritoBlock", block: c.ChurritoBlock}, {name: "donutBlock", block: c.DonutBlock}, - {name: "eBlock", block: c.EBlock}, + {name: "espressoBlock", block: c.EspressoBlock}, } { if lastFork.name != "" { // Next one must be higher number @@ -465,8 +465,8 @@ func (c *ChainConfig) checkCompatible(newcfg *ChainConfig, head *big.Int) *Confi if isForkIncompatible(c.DonutBlock, newcfg.DonutBlock, head) { return newCompatError("Donut fork block", c.DonutBlock, newcfg.DonutBlock) } - if isForkIncompatible(c.EBlock, newcfg.EBlock, head) { - return newCompatError("E fork block", c.EBlock, newcfg.EBlock) + if isForkIncompatible(c.EspressoBlock, newcfg.EspressoBlock, head) { + return newCompatError("E fork block", c.EspressoBlock, newcfg.EspressoBlock) } return nil } @@ -535,7 +535,7 @@ type Rules struct { ChainID *big.Int IsHomestead, IsEIP150, IsEIP155, IsEIP158 bool IsByzantium, IsConstantinople, IsPetersburg, IsIstanbul bool - IsChurrito, IsDonut, IsEHardfork bool + IsChurrito, IsDonut, IsEspresso bool } // Rules ensures c's ChainID is not nil. @@ -556,6 +556,6 @@ func (c *ChainConfig) Rules(num *big.Int) Rules { IsIstanbul: c.IsIstanbul(num), IsChurrito: c.IsChurrito(num), IsDonut: c.IsDonut(num), - IsEHardfork: c.IsEHardfork(num), + IsEspresso: c.IsEspresso(num), } } diff --git a/tests/init.go b/tests/init.go index 17a751a8854..ac9c1df3ddb 100644 --- a/tests/init.go +++ b/tests/init.go @@ -154,7 +154,7 @@ var Forks = map[string]*params.ChainConfig{ IstanbulBlock: big.NewInt(0), ChurritoBlock: big.NewInt(0), DonutBlock: big.NewInt(0), - EBlock: big.NewInt(0), + EspressoBlock: big.NewInt(0), }, "DonutToEspressoAt5": { ChainID: big.NewInt(1), @@ -168,7 +168,7 @@ var Forks = map[string]*params.ChainConfig{ IstanbulBlock: big.NewInt(0), ChurritoBlock: big.NewInt(0), DonutBlock: big.NewInt(0), - EBlock: big.NewInt(5), + EspressoBlock: big.NewInt(5), }, } diff --git a/tests/state_test_util.go b/tests/state_test_util.go index af069247063..4d22b471d91 100644 --- a/tests/state_test_util.go +++ b/tests/state_test_util.go @@ -183,7 +183,7 @@ func (t *StateTest) RunNoVerify(subtest StateSubtest, vmconfig vm.Config, snapsh snaps, statedb := MakePreState(rawdb.NewMemoryDatabase(), t.json.Pre, snapshotter) var baseFee *big.Int - if config.IsEHardfork(new(big.Int)) { + if config.IsEspresso(new(big.Int)) { // baseFee = t.json.Env.BaseFee ? if baseFee == nil { // Retesteth uses `0x10` for genesis baseFee. Therefore, it defaults to