Skip to content

Commit 491fee5

Browse files
add disable L1 charging to eth_call
1 parent fd56bdb commit 491fee5

File tree

4 files changed

+15
-1
lines changed

4 files changed

+15
-1
lines changed

core/state_transition.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,9 @@ type Message struct {
149149
// account nonce in state. It also disables checking that the sender is an EOA.
150150
// This field will be set to true for operations like RPC eth_call.
151151
SkipAccountChecks bool
152+
// L1 charging is disabled when SkipL1Charging is true.
153+
// This field might be set to true for operations like RPC eth_call.
154+
SkipL1Charging bool
152155
}
153156

154157
type MessageRunMode uint8

ethclient/ethclient.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -603,6 +603,9 @@ func toCallArg(msg ethereum.CallMsg) interface{} {
603603
if msg.GasPrice != nil {
604604
arg["gasPrice"] = (*hexutil.Big)(msg.GasPrice)
605605
}
606+
if msg.SkipL1Charging {
607+
arg["skipL1Charging"] = msg.SkipL1Charging
608+
}
606609
return arg
607610
}
608611

interfaces.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,8 @@ type CallMsg struct {
166166
Value *big.Int // amount of wei sent along with the call
167167
Data []byte // input data, usually an ABI-encoded contract method invocation
168168

169-
AccessList types.AccessList // EIP-2930 access list.
169+
AccessList types.AccessList // EIP-2930 access list.
170+
SkipL1Charging bool // L1 charging is disabled when SkipL1Charging is true
170171
}
171172

172173
// A ContractCaller provides contract calls, essentially transactions that are executed by

internal/ethapi/transaction_args.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ type TransactionArgs struct {
4444
MaxPriorityFeePerGas *hexutil.Big `json:"maxPriorityFeePerGas"`
4545
Value *hexutil.Big `json:"value"`
4646
Nonce *hexutil.Uint64 `json:"nonce"`
47+
SkipL1Charging *bool `json:"skipL1Charging"`
4748

4849
// We accept "data" and "input" for backwards-compatibility reasons.
4950
// "input" is the newer name and should be preferred by clients.
@@ -267,6 +268,11 @@ func (args *TransactionArgs) ToMessage(globalGasCap uint64, header *types.Header
267268
accessList = *args.AccessList
268269
}
269270

271+
skipL1Charging := false
272+
if args.SkipL1Charging != nil {
273+
skipL1Charging = *args.SkipL1Charging
274+
}
275+
270276
msg := &core.Message{
271277
From: addr,
272278
To: args.To,
@@ -279,6 +285,7 @@ func (args *TransactionArgs) ToMessage(globalGasCap uint64, header *types.Header
279285
AccessList: accessList,
280286
SkipAccountChecks: true,
281287
TxRunMode: runMode,
288+
SkipL1Charging: skipL1Charging,
282289
}
283290
// Arbitrum: raise the gas cap to ignore L1 costs so that it's compute-only
284291
if core.InterceptRPCGasCap != nil && state != nil {

0 commit comments

Comments
 (0)