Skip to content

Commit 3ac1364

Browse files
committed
Add estimateGas test cases for EIP-7702 and EIP-7623
1 parent bc5a37e commit 3ac1364

File tree

7 files changed

+33
-0
lines changed

7 files changed

+33
-0
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// checks that including ephemeral authorizations increases gas
2+
//
3+
// speconly: client response is only checked for schema validity.
4+
>> {"jsonrpc":"2.0","id":1,"method":"eth_estimateGas","params":[{"from":"0x0c2c51a0990aee1d73c1228de158688341557508","nonce":"0x0","to":"0x0100000000000000000000000000000000000000","value":"0x1"}]}
5+
<< {"jsonrpc":"2.0","id":1,"result":"0x5208"}
6+
>> {"jsonrpc":"2.0","id":2,"method":"eth_estimateGas","params":[{"authorizationList":[{"address":"0xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa","chainId":"0x1","nonce":"0x0","r":"0x1111111111111111111111111111111111111111111111111111111111111111","s":"0x2222222222222222222222222222222222222222222222222222222222222222","yParity":"0x0"}],"from":"0x0c2c51a0990aee1d73c1228de158688341557508","nonce":"0x0","to":"0x0100000000000000000000000000000000000000","type":"0x4","value":"0x1"}]}
7+
<< {"jsonrpc":"2.0","id":2,"result":"0xb52e"}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// checks gas estimation for blob transactions (EIP-4844)
2+
//
3+
// speconly: client response is only checked for schema validity.
4+
>> {"jsonrpc":"2.0","id":1,"method":"eth_estimateGas","params":[{"blobVersionedHashes":["0x0100000000000000000000000000000000000000000000000000000000000000"],"from":"0x0c2c51a0990aee1d73c1228de158688341557508","maxFeePerBlobGas":"0x5","nonce":"0x0","to":"0x0100000000000000000000000000000000000000","type":"0x5","value":"0x1"}]}
5+
<< {"jsonrpc":"2.0","id":1,"result":"0x5208"}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// checks combined effect of calldata floor and authorization gas cost
2+
//
3+
// speconly: client response is only checked for schema validity.
4+
>> {"jsonrpc":"2.0","id":1,"method":"eth_estimateGas","params":[{"authorizationList":[{"address":"0xbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb","chainId":"0x1","nonce":"0x0","r":"0x1111111111111111111111111111111111111111111111111111111111111111","s":"0x2222222222222222222222222222222222222222222222222222222222222222","yParity":"0x0"}],"from":"0x0c2c51a0990aee1d73c1228de158688341557508","nonce":"0x0","to":"0x0100000000000000000000000000000000000000","type":"0x4","value":"0x1"}]}
5+
<< {"jsonrpc":"2.0","id":1,"result":"0xb52e"}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// estimates a contract call that reverts
2+
>> {"jsonrpc":"2.0","id":1,"method":"eth_estimateGas","params":[{"from":"0x0102030000000000000000000000000000000000","input":"0xff030405","to":"0x17e7eedce4ac02ef114a7ed9fe6e2f33feba1667"}]}
3+
<< {"jsonrpc":"2.0","id":1,"error":{"code":3,"message":"execution reverted","data":"0x77726f6e672d63616c6c6461746173697a65"}}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// ensures floor calldata cost dominates the gas used for trivial execution
2+
//
3+
// speconly: client response is only checked for schema validity.
4+
>> {"jsonrpc":"2.0","id":1,"method":"eth_estimateGas","params":[{"from":"0x0c2c51a0990aee1d73c1228de158688341557508","input":"0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff","nonce":"0x0","to":"0x0100000000000000000000000000000000000000","value":"0x1"}]}
5+
<< {"jsonrpc":"2.0","id":1,"result":"0xf545"}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// estimates a simple transfer
2+
>> {"jsonrpc":"2.0","id":1,"method":"eth_estimateGas","params":[{"from":"0xaa00000000000000000000000000000000000000","to":"0x0100000000000000000000000000000000000000"}]}
3+
<< {"jsonrpc":"2.0","id":1,"result":"0x5208"}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// estimates a successful contract call
2+
//
3+
// speconly: client response is only checked for schema validity.
4+
>> {"jsonrpc":"2.0","id":1,"method":"eth_estimateGas","params":[{"from":"0x0102030000000000000000000000000000000000","input":"0xff01","to":"0x17e7eedce4ac02ef114a7ed9fe6e2f33feba1667"}]}
5+
<< {"jsonrpc":"2.0","id":1,"result":"0x5316"}

0 commit comments

Comments
 (0)