diff --git a/core/state_transition.go b/core/state_transition.go index 6e8f809248..a70ce4eb06 100644 --- a/core/state_transition.go +++ b/core/state_transition.go @@ -149,6 +149,9 @@ type Message struct { // account nonce in state. It also disables checking that the sender is an EOA. // This field will be set to true for operations like RPC eth_call. SkipAccountChecks bool + // L1 charging is disabled when SkipL1Charging is true. + // This field might be set to true for operations like RPC eth_call. + SkipL1Charging bool } type MessageRunMode uint8 diff --git a/ethclient/ethclient.go b/ethclient/ethclient.go index 5cdaf01eae..8a99a545aa 100644 --- a/ethclient/ethclient.go +++ b/ethclient/ethclient.go @@ -617,6 +617,9 @@ func toCallArg(msg ethereum.CallMsg) interface{} { if msg.GasPrice != nil { arg["gasPrice"] = (*hexutil.Big)(msg.GasPrice) } + if msg.SkipL1Charging { + arg["skipL1Charging"] = msg.SkipL1Charging + } return arg } diff --git a/interfaces.go b/interfaces.go index a2aee612e7..253317e1cd 100644 --- a/interfaces.go +++ b/interfaces.go @@ -166,7 +166,8 @@ type CallMsg struct { Value *big.Int // amount of wei sent along with the call Data []byte // input data, usually an ABI-encoded contract method invocation - AccessList types.AccessList // EIP-2930 access list. + AccessList types.AccessList // EIP-2930 access list. + SkipL1Charging bool // L1 charging is disabled when SkipL1Charging is true } // A ContractCaller provides contract calls, essentially transactions that are executed by diff --git a/internal/ethapi/transaction_args.go b/internal/ethapi/transaction_args.go index a5aa8daec5..17244ddba3 100644 --- a/internal/ethapi/transaction_args.go +++ b/internal/ethapi/transaction_args.go @@ -44,6 +44,7 @@ type TransactionArgs struct { MaxPriorityFeePerGas *hexutil.Big `json:"maxPriorityFeePerGas"` Value *hexutil.Big `json:"value"` Nonce *hexutil.Uint64 `json:"nonce"` + SkipL1Charging *bool `json:"skipL1Charging"` // We accept "data" and "input" for backwards-compatibility reasons. // "input" is the newer name and should be preferred by clients. @@ -267,6 +268,11 @@ func (args *TransactionArgs) ToMessage(globalGasCap uint64, header *types.Header accessList = *args.AccessList } + skipL1Charging := false + if args.SkipL1Charging != nil { + skipL1Charging = *args.SkipL1Charging + } + msg := &core.Message{ From: addr, To: args.To, @@ -279,6 +285,7 @@ func (args *TransactionArgs) ToMessage(globalGasCap uint64, header *types.Header AccessList: accessList, SkipAccountChecks: true, TxRunMode: runMode, + SkipL1Charging: skipL1Charging, } // Arbitrum: raise the gas cap to ignore L1 costs so that it's compute-only if core.InterceptRPCGasCap != nil && state != nil {