diff --git a/execution/nodeInterface/NodeInterface.go b/execution/nodeInterface/NodeInterface.go index 005cc62d44..00da1ba4b6 100644 --- a/execution/nodeInterface/NodeInterface.go +++ b/execution/nodeInterface/NodeInterface.go @@ -522,11 +522,10 @@ func (n NodeInterface) GasEstimateL1Component( args.Gas = (*hexutil.Uint64)(&randomGas) // We set the run mode to eth_call mode here because we want an exact estimate, not a padded estimate - gasLimitNotSetByUser := args.Gas == nil - if err := args.CallDefaults(randomGas, evm.Context.BaseFee, evm.ChainConfig().ChainID, gasLimitNotSetByUser); err != nil { + if err := args.CallDefaults(randomGas, evm.Context.BaseFee, evm.ChainConfig().ChainID); err != nil { return 0, nil, nil, err } - msg := args.ToMessage(evm.Context.BaseFee, randomGas, n.header, evm.StateDB.(*state.StateDB), core.MessageEthcallMode, evm.ChainConfig().ChainID, gasLimitNotSetByUser) + msg := args.ToMessage(evm.Context.BaseFee, randomGas, n.header, evm.StateDB.(*state.StateDB), core.MessageEthcallMode) pricing := c.State.L1PricingState() l1BaseFeeEstimate, err := pricing.PricePerUnit() @@ -579,11 +578,10 @@ func (n NodeInterface) GasEstimateComponents( // Setting the gas currently doesn't affect the PosterDataCost, // but we do it anyways for accuracy with potential future changes. args.Gas = &totalRaw - gasLimitNotSetByUser := args.Gas == nil - if err := args.CallDefaults(gasCap, evm.Context.BaseFee, evm.ChainConfig().ChainID, gasLimitNotSetByUser); err != nil { + if err := args.CallDefaults(gasCap, evm.Context.BaseFee, evm.ChainConfig().ChainID); err != nil { return 0, 0, nil, nil, err } - msg := args.ToMessage(evm.Context.BaseFee, gasCap, n.header, evm.StateDB.(*state.StateDB), core.MessageGasEstimationMode, evm.ChainConfig().ChainID, gasLimitNotSetByUser) + msg := args.ToMessage(evm.Context.BaseFee, gasCap, n.header, evm.StateDB.(*state.StateDB), core.MessageGasEstimationMode) brotliCompressionLevel, err := c.State.BrotliCompressionLevel() if err != nil { return 0, 0, nil, nil, fmt.Errorf("failed to get brotli compression level: %w", err) diff --git a/execution/nodeInterface/virtual-contracts.go b/execution/nodeInterface/virtual-contracts.go index d04be10857..86382870b7 100644 --- a/execution/nodeInterface/virtual-contracts.go +++ b/execution/nodeInterface/virtual-contracts.go @@ -23,7 +23,6 @@ import ( "github.com/offchainlabs/nitro/precompiles" "github.com/offchainlabs/nitro/solgen/go/node_interfacegen" "github.com/offchainlabs/nitro/solgen/go/precompilesgen" - "github.com/offchainlabs/nitro/util/arbmath" ) type addr = common.Address @@ -115,35 +114,28 @@ func init() { return msg, nil, nil } - core.InterceptRPCGasCap = func(gascap *uint64, msg *core.Message, header *types.Header, statedb *state.StateDB) { - if *gascap == 0 { - // It's already unlimited - return - } + core.RPCPostingGasHook = func(msg *core.Message, header *types.Header, statedb *state.StateDB) (uint64, error) { arbosVersion := arbosState.ArbOSVersion(statedb) if arbosVersion == 0 { // ArbOS hasn't been installed, so use the vanilla gas cap - return + return 0, nil } state, err := arbosState.OpenSystemArbosState(statedb, nil, true) if err != nil { - log.Error("failed to open ArbOS state", "err", err) - return + return 0, err } if header.BaseFee.Sign() == 0 { // if gas is free or there's no reimbursable poster, the user won't pay for L1 data costs - return + return 0, nil } brotliCompressionLevel, err := state.BrotliCompressionLevel() if err != nil { - log.Error("failed to get brotli compression level", "err", err) - return + return 0, err } posterCost, _ := state.L1PricingState().PosterDataCost(msg, l1pricing.BatchPosterAddress, brotliCompressionLevel) // Use estimate mode because this is used to raise the gas cap, so we don't want to underestimate. - posterCostInL2Gas := arbos.GetPosterGas(state, header.BaseFee, core.MessageGasEstimationMode, posterCost) - *gascap = arbmath.SaturatingUAdd(*gascap, posterCostInL2Gas) + return arbos.GetPosterGas(state, header.BaseFee, core.MessageGasEstimationMode, posterCost), nil } core.GetArbOSSpeedLimitPerSecond = func(statedb *state.StateDB) (uint64, error) { diff --git a/go-ethereum b/go-ethereum index c4334737c9..973f8a3c27 160000 --- a/go-ethereum +++ b/go-ethereum @@ -1 +1 @@ -Subproject commit c4334737c95dc2b1bd398d2fe7feefee72da2f0f +Subproject commit 973f8a3c278c961ac5cb5049167c8e28dd16262b