@@ -79,7 +79,8 @@ def _trace_block_by_hash_params_factory(self, rng: RNG) -> list[BlockHash | dict
79
79
{"tracer" : "callTracer" , "timeout" : self ._default_trace_timeout },
80
80
]
81
81
82
- def _trace_replay_block_transaction_params_factory (self , rng : RNG ) -> list [str | list [str ]]:
82
+ @staticmethod
83
+ def _trace_replay_block_transaction_params_factory () -> list [str | list [str ]]:
83
84
return [
84
85
"latest" ,
85
86
["vmTrace" , "trace" , "stateDiff" ],
@@ -107,31 +108,30 @@ def _trace_filter_params_factory(self, rng: RNG) -> list[dict]:
107
108
}
108
109
]
109
110
110
- def _eth_estimate_gas_params_factory (self , rng : RNG ) -> list [dict ]:
111
- return [
112
- {
113
- "from" : self .test_data .get_random_account (rng ),
114
- "to" : self .test_data .get_random_account (rng ),
115
- }
116
- ]
117
-
118
- def _eth_fee_history_params_factory (self , rng : RNG ) -> list [int | str | list [int ]]:
111
+ @staticmethod
112
+ def _eth_fee_history_params_factory (rng : RNG ) -> list [int | str | list [int ]]:
119
113
return [rng .random .randint (1 , 1024 ), "latest" , [25 , 75 ]]
120
114
121
115
def _erc20_eth_call_params_factory (self , rng : RNG ):
122
- contract = self .test_data .chain_info .get_random_contract (rng )
123
- function_params = contract .get_random_function_params (rng )
116
+ contract = self .test_data .get_random_erc20_contract (rng )
117
+ functions_params = [
118
+ contract .total_supply_params (),
119
+ contract .balance_of_params (self .test_data .get_random_account (rng )),
120
+ contract .symbol_params (),
121
+ contract .name_params (),
122
+ ]
124
123
return [
125
- function_params ( address = self . test_data . get_random_account ( rng ) ),
124
+ rng . random . choice ( functions_params ),
126
125
"latest" ,
127
126
]
128
127
129
- def _erc20_eth_get_code_params_factory (self , rng :RNG ):
128
+ def _erc20_eth_get_code_params_factory (self , rng : RNG ):
130
129
return [
131
- self .test_data .chain_info . get_random_contract (rng ).address ,
130
+ self .test_data .get_random_erc20_contract (rng ).address ,
132
131
"latest" ,
133
132
]
134
133
134
+
135
135
class EVMMethods (EVMBenchUser ):
136
136
abstract = True
137
137
@@ -156,6 +156,13 @@ def eth_chain_id_task(self):
156
156
method = "eth_chainId" ,
157
157
)
158
158
159
+ def eth_estimate_gas_task (self ):
160
+ self .make_call (
161
+ name = "eth_estimate_gas" ,
162
+ method = "eth_estimateGas" ,
163
+ params = self ._erc20_eth_call_params_factory (self .rng .get_rng ()),
164
+ )
165
+
159
166
def eth_fee_history_task (self ) -> None :
160
167
self .make_call (
161
168
method = "eth_feeHistory" ,
@@ -333,7 +340,7 @@ def trace_block_task(self) -> None:
333
340
def trace_replay_block_transactions_task (self ) -> None :
334
341
self .make_call (
335
342
method = "trace_replayBlockTransactions" ,
336
- params = self ._trace_replay_block_transaction_params_factory (self . rng . get_rng () ),
343
+ params = self ._trace_replay_block_transaction_params_factory (),
337
344
)
338
345
339
346
def trace_replay_transaction_task (self ) -> None :
0 commit comments