@@ -185,7 +185,7 @@ pub struct NodeArgs {
185185 pub transaction_block_keeper : Option < usize > ,
186186
187187 #[ command( flatten) ]
188- pub evm_opts : AnvilEvmArgs ,
188+ pub evm : AnvilEvmArgs ,
189189
190190 #[ command( flatten) ]
191191 pub server_config : ServerConfig ,
@@ -209,15 +209,12 @@ const DEFAULT_DUMP_INTERVAL: Duration = Duration::from_secs(60);
209209impl NodeArgs {
210210 pub fn into_node_config ( self ) -> eyre:: Result < NodeConfig > {
211211 let genesis_balance = Unit :: ETHER . wei ( ) . saturating_mul ( U256 :: from ( self . balance ) ) ;
212- let compute_units_per_second = if self . evm_opts . no_rate_limit {
213- Some ( u64:: MAX )
214- } else {
215- self . evm_opts . compute_units_per_second
216- } ;
212+ let compute_units_per_second =
213+ if self . evm . no_rate_limit { Some ( u64:: MAX ) } else { self . evm . compute_units_per_second } ;
217214
218215 let hardfork = match & self . hardfork {
219216 Some ( hf) => {
220- if self . evm_opts . optimism {
217+ if self . evm . optimism {
221218 Some ( OptimismHardfork :: from_str ( hf) ?. into ( ) )
222219 } else {
223220 Some ( EthereumHardfork :: from_str ( hf) ?. into ( ) )
@@ -227,9 +224,9 @@ impl NodeArgs {
227224 } ;
228225
229226 Ok ( NodeConfig :: default ( )
230- . with_gas_limit ( self . evm_opts . gas_limit )
231- . disable_block_gas_limit ( self . evm_opts . disable_block_gas_limit )
232- . with_gas_price ( self . evm_opts . gas_price )
227+ . with_gas_limit ( self . evm . gas_limit )
228+ . disable_block_gas_limit ( self . evm . disable_block_gas_limit )
229+ . with_gas_price ( self . evm . gas_price )
233230 . with_hardfork ( hardfork)
234231 . with_blocktime ( self . block_time )
235232 . with_no_mining ( self . no_mining )
@@ -238,54 +235,50 @@ impl NodeArgs {
238235 . with_genesis_balance ( genesis_balance)
239236 . with_genesis_timestamp ( self . timestamp )
240237 . with_port ( self . port )
241- . with_fork_choice (
242- match ( self . evm_opts . fork_block_number , self . evm_opts . fork_transaction_hash ) {
243- ( Some ( block) , None ) => Some ( ForkChoice :: Block ( block) ) ,
244- ( None , Some ( hash) ) => Some ( ForkChoice :: Transaction ( hash) ) ,
245- _ => {
246- self . evm_opts . fork_url . as_ref ( ) . and_then ( |f| f. block ) . map ( ForkChoice :: Block )
247- }
248- } ,
249- )
250- . with_fork_headers ( self . evm_opts . fork_headers )
251- . with_fork_chain_id ( self . evm_opts . fork_chain_id . map ( u64:: from) . map ( U256 :: from) )
252- . fork_request_timeout ( self . evm_opts . fork_request_timeout . map ( Duration :: from_millis) )
253- . fork_request_retries ( self . evm_opts . fork_request_retries )
254- . fork_retry_backoff ( self . evm_opts . fork_retry_backoff . map ( Duration :: from_millis) )
238+ . with_fork_choice ( match ( self . evm . fork_block_number , self . evm . fork_transaction_hash ) {
239+ ( Some ( block) , None ) => Some ( ForkChoice :: Block ( block) ) ,
240+ ( None , Some ( hash) ) => Some ( ForkChoice :: Transaction ( hash) ) ,
241+ _ => self . evm . fork_url . as_ref ( ) . and_then ( |f| f. block ) . map ( ForkChoice :: Block ) ,
242+ } )
243+ . with_fork_headers ( self . evm . fork_headers )
244+ . with_fork_chain_id ( self . evm . fork_chain_id . map ( u64:: from) . map ( U256 :: from) )
245+ . fork_request_timeout ( self . evm . fork_request_timeout . map ( Duration :: from_millis) )
246+ . fork_request_retries ( self . evm . fork_request_retries )
247+ . fork_retry_backoff ( self . evm . fork_retry_backoff . map ( Duration :: from_millis) )
255248 . fork_compute_units_per_second ( compute_units_per_second)
256- . with_eth_rpc_url ( self . evm_opts . fork_url . map ( |fork| fork. url ) )
257- . with_base_fee ( self . evm_opts . block_base_fee_per_gas )
258- . disable_min_priority_fee ( self . evm_opts . disable_min_priority_fee )
259- . with_storage_caching ( self . evm_opts . no_storage_caching )
249+ . with_eth_rpc_url ( self . evm . fork_url . map ( |fork| fork. url ) )
250+ . with_base_fee ( self . evm . block_base_fee_per_gas )
251+ . disable_min_priority_fee ( self . evm . disable_min_priority_fee )
252+ . with_storage_caching ( self . evm . no_storage_caching )
260253 . with_server_config ( self . server_config )
261254 . with_host ( self . host )
262255 . set_silent ( shell:: is_quiet ( ) )
263256 . set_config_out ( self . config_out )
264- . with_chain_id ( self . evm_opts . chain_id )
257+ . with_chain_id ( self . evm . chain_id )
265258 . with_transaction_order ( self . order )
266259 . with_genesis ( self . init )
267- . with_steps_tracing ( self . evm_opts . steps_tracing )
268- . with_print_logs ( !self . evm_opts . disable_console_log )
269- . with_auto_impersonate ( self . evm_opts . auto_impersonate )
260+ . with_steps_tracing ( self . evm . steps_tracing )
261+ . with_print_logs ( !self . evm . disable_console_log )
262+ . with_auto_impersonate ( self . evm . auto_impersonate )
270263 . with_ipc ( self . ipc )
271- . with_code_size_limit ( self . evm_opts . code_size_limit )
272- . disable_code_size_limit ( self . evm_opts . disable_code_size_limit )
264+ . with_code_size_limit ( self . evm . code_size_limit )
265+ . disable_code_size_limit ( self . evm . disable_code_size_limit )
273266 . set_pruned_history ( self . prune_history )
274267 . with_init_state ( self . load_state . or_else ( || self . state . and_then ( |s| s. state ) ) )
275268 . with_transaction_block_keeper ( self . transaction_block_keeper )
276269 . with_max_persisted_states ( self . max_persisted_states )
277- . with_optimism ( self . evm_opts . optimism )
278- . with_odyssey ( self . evm_opts . odyssey )
279- . with_disable_default_create2_deployer ( self . evm_opts . disable_default_create2_deployer )
270+ . with_optimism ( self . evm . optimism )
271+ . with_odyssey ( self . evm . odyssey )
272+ . with_disable_default_create2_deployer ( self . evm . disable_default_create2_deployer )
280273 . with_slots_in_an_epoch ( self . slots_in_an_epoch )
281- . with_memory_limit ( self . evm_opts . memory_limit )
274+ . with_memory_limit ( self . evm . memory_limit )
282275 . with_cache_path ( self . cache_path ) )
283276 }
284277
285278 fn account_generator ( & self ) -> AccountGenerator {
286279 let mut gen = AccountGenerator :: new ( self . accounts as usize )
287280 . phrase ( DEFAULT_MNEMONIC )
288- . chain_id ( self . evm_opts . chain_id . unwrap_or_else ( || CHAIN_ID . into ( ) ) ) ;
281+ . chain_id ( self . evm . chain_id . unwrap_or_else ( || CHAIN_ID . into ( ) ) ) ;
289282 if let Some ( ref mnemonic) = self . mnemonic {
290283 gen = gen. phrase ( mnemonic) ;
291284 } else if let Some ( count) = self . mnemonic_random {
@@ -845,10 +838,7 @@ mod tests {
845838 "--fork-header" ,
846839 "Referrer: example.com" ,
847840 ] ) ;
848- assert_eq ! (
849- args. evm_opts. fork_headers,
850- vec![ "User-Agent: test-agent" , "Referrer: example.com" ]
851- ) ;
841+ assert_eq ! ( args. evm. fork_headers, vec![ "User-Agent: test-agent" , "Referrer: example.com" ] ) ;
852842 }
853843
854844 #[ test]
@@ -869,7 +859,7 @@ mod tests {
869859 #[ test]
870860 fn can_parse_disable_block_gas_limit ( ) {
871861 let args: NodeArgs = NodeArgs :: parse_from ( [ "anvil" , "--disable-block-gas-limit" ] ) ;
872- assert ! ( args. evm_opts . disable_block_gas_limit) ;
862+ assert ! ( args. evm . disable_block_gas_limit) ;
873863
874864 let args =
875865 NodeArgs :: try_parse_from ( [ "anvil" , "--disable-block-gas-limit" , "--gas-limit" , "100" ] ) ;
@@ -879,7 +869,7 @@ mod tests {
879869 #[ test]
880870 fn can_parse_disable_code_size_limit ( ) {
881871 let args: NodeArgs = NodeArgs :: parse_from ( [ "anvil" , "--disable-code-size-limit" ] ) ;
882- assert ! ( args. evm_opts . disable_code_size_limit) ;
872+ assert ! ( args. evm . disable_code_size_limit) ;
883873
884874 let args = NodeArgs :: try_parse_from ( [
885875 "anvil" ,
0 commit comments