diff --git a/core/blockchain.go b/core/blockchain.go index 016c4ecf21..7fc8711eea 100644 --- a/core/blockchain.go +++ b/core/blockchain.go @@ -236,7 +236,7 @@ func NewBlockChain(db ethdb.Database, cacheConfig *CacheConfig, chainConfig *par cacheConfig.SnapshotLimit = 0 } - if chainConfig.Scroll.L1FeeEnabled() { + if chainConfig.Scroll.FeeVaultEnabled() { log.Warn("Using fee vault address", "FeeVaultAddress", *chainConfig.Scroll.FeeVaultAddress) } diff --git a/core/state_transition.go b/core/state_transition.go index b4830ec560..8e5c4a8e0f 100644 --- a/core/state_transition.go +++ b/core/state_transition.go @@ -166,7 +166,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) *StateTransition { l1Fee := new(big.Int) - if evm.ChainConfig().Scroll.L1FeeEnabled() { + if evm.ChainConfig().Scroll.FeeVaultEnabled() { l1Fee, _ = fees.CalculateL1MsgFee(msg, evm.StateDB) } @@ -207,7 +207,7 @@ func (st *StateTransition) buyGas() error { mgval := new(big.Int).SetUint64(st.msg.Gas()) mgval = mgval.Mul(mgval, st.gasPrice) - if st.evm.ChainConfig().Scroll.L1FeeEnabled() { + if st.evm.ChainConfig().Scroll.FeeVaultEnabled() { // always add l1fee, because all tx are L2-to-L1 ATM log.Debug("Adding L1 fee", "l1_fee", st.l1Fee) mgval = mgval.Add(mgval, st.l1Fee) @@ -218,7 +218,7 @@ func (st *StateTransition) buyGas() error { balanceCheck = new(big.Int).SetUint64(st.msg.Gas()) balanceCheck = balanceCheck.Mul(balanceCheck, st.gasFeeCap) balanceCheck.Add(balanceCheck, st.value) - if st.evm.ChainConfig().Scroll.L1FeeEnabled() { + if st.evm.ChainConfig().Scroll.FeeVaultEnabled() { // always add l1fee, because all tx are L2-to-L1 ATM balanceCheck.Add(balanceCheck, st.l1Fee) } @@ -370,7 +370,7 @@ func (st *StateTransition) TransitionDb() (*ExecutionResult, error) { } } - if st.evm.ChainConfig().Scroll.L1FeeEnabled() { + if st.evm.ChainConfig().Scroll.FeeVaultEnabled() { // The L2 Fee is the same as the fee that is charged in the normal geth // codepath. Add the L1 fee to the L2 fee for the total fee that is sent // to the sequencer. diff --git a/core/tx_pool.go b/core/tx_pool.go index cb7042825d..96f7ff9905 100644 --- a/core/tx_pool.go +++ b/core/tx_pool.go @@ -682,7 +682,7 @@ func (pool *TxPool) add(tx *types.Transaction, local bool) (replaced bool, err e // the sender is marked as local previously, treat it as the local transaction. isLocal := local || pool.locals.containsTx(tx) - if pool.chainconfig.Scroll.L1FeeEnabled() { + if pool.chainconfig.Scroll.FeeVaultEnabled() { if err := fees.VerifyFee(pool.signer, tx, pool.currentState); err != nil { log.Trace("Discarding insufficient l1fee transaction", "hash", hash, "err", err) invalidTxMeter.Mark(1) diff --git a/core/vm/evm.go b/core/vm/evm.go index b3324f7655..d94303518f 100644 --- a/core/vm/evm.go +++ b/core/vm/evm.go @@ -535,7 +535,7 @@ func (evm *EVM) ChainConfig() *params.ChainConfig { return evm.chainConfig } // FeeRecipient returns the environment's transaction fee recipient address. func (evm *EVM) FeeRecipient() common.Address { - if evm.ChainConfig().Scroll.L1FeeEnabled() { + if evm.ChainConfig().Scroll.FeeVaultEnabled() { return *evm.chainConfig.Scroll.FeeVaultAddress } else { return evm.Context.Coinbase diff --git a/eth/tracers/api.go b/eth/tracers/api.go index 1c1b7b8f8f..3b962e28b9 100644 --- a/eth/tracers/api.go +++ b/eth/tracers/api.go @@ -900,7 +900,7 @@ func (api *API) traceTx(ctx context.Context, message core.Message, txctx *Contex vmenv := vm.NewEVM(vmctx, txContext, statedb, api.backend.ChainConfig(), vm.Config{Debug: true, Tracer: tracer, NoBaseFee: true}) // If gasPrice is 0, make sure that the account has sufficient balance to cover `l1Fee`. - if api.backend.ChainConfig().Scroll.L1FeeEnabled() && message.GasPrice().Cmp(big.NewInt(0)) == 0 { + if api.backend.ChainConfig().Scroll.FeeVaultEnabled() && message.GasPrice().Cmp(big.NewInt(0)) == 0 { l1Fee, err := fees.CalculateL1MsgFee(message, vmenv.StateDB) if err != nil { return nil, err diff --git a/eth/tracers/api_blocktrace.go b/eth/tracers/api_blocktrace.go index 87c62d5975..165b358aa3 100644 --- a/eth/tracers/api_blocktrace.go +++ b/eth/tracers/api_blocktrace.go @@ -98,7 +98,7 @@ func (api *API) createTraceEnv(ctx context.Context, config *TraceConfig, block * // get coinbase var coinbase common.Address - if api.backend.ChainConfig().Scroll.L1FeeEnabled() { + if api.backend.ChainConfig().Scroll.FeeVaultEnabled() { coinbase = *api.backend.ChainConfig().Scroll.FeeVaultAddress } else { coinbase, err = api.backend.Engine().Author(block.Header()) diff --git a/eth/tracers/api_blocktrace_test.go b/eth/tracers/api_blocktrace_test.go index 81484a8bc1..c3c5c70eb6 100644 --- a/eth/tracers/api_blocktrace_test.go +++ b/eth/tracers/api_blocktrace_test.go @@ -181,7 +181,7 @@ func checkStructLogs(t *testing.T, expect []*txTraceResult, actual []*types.Exec func checkCoinbase(t *testing.T, b *testBackend, wrapper *types.AccountWrapper) { var coinbase common.Address - if b.chainConfig.Scroll.L1FeeEnabled() { + if b.chainConfig.Scroll.FeeVaultEnabled() { coinbase = *b.chainConfig.Scroll.FeeVaultAddress } else { header, err := b.HeaderByNumber(context.Background(), 1) diff --git a/internal/ethapi/api.go b/internal/ethapi/api.go index 0f1f191f5f..25fc673f74 100644 --- a/internal/ethapi/api.go +++ b/internal/ethapi/api.go @@ -908,7 +908,7 @@ func newRPCBalance(balance *big.Int) **hexutil.Big { } func CalculateL1MsgFee(ctx context.Context, b Backend, args TransactionArgs, blockNrOrHash rpc.BlockNumberOrHash, overrides *StateOverride, timeout time.Duration, globalGasCap uint64, config *params.ChainConfig) (*big.Int, error) { - if !config.Scroll.L1FeeEnabled() { + if !config.Scroll.FeeVaultEnabled() { return big.NewInt(0), nil } diff --git a/light/txpool.go b/light/txpool.go index 823cee4086..8b9d2a150f 100644 --- a/light/txpool.go +++ b/light/txpool.go @@ -405,7 +405,7 @@ func (pool *TxPool) add(ctx context.Context, tx *types.Transaction) error { return fmt.Errorf("Known transaction (%x)", hash[:4]) } - if pool.config.Scroll.L1FeeEnabled() { + if pool.config.Scroll.FeeVaultEnabled() { if err := fees.VerifyFee(pool.signer, tx, pool.currentState(ctx)); err != nil { return err } diff --git a/params/config.go b/params/config.go index 6a5a5c910d..e05f0f12c0 100644 --- a/params/config.go +++ b/params/config.go @@ -445,7 +445,7 @@ func (s ScrollConfig) BaseFeeEnabled() bool { return s.EnableEIP2718 && s.EnableEIP1559 } -func (s ScrollConfig) L1FeeEnabled() bool { +func (s ScrollConfig) FeeVaultEnabled() bool { return s.FeeVaultAddress != nil }