@@ -246,6 +246,7 @@ impl NodeArgs {
246246 . with_auto_impersonate ( self . evm_opts . auto_impersonate )
247247 . with_ipc ( self . ipc )
248248 . with_code_size_limit ( self . evm_opts . code_size_limit )
249+ . disable_code_size_limit ( self . evm_opts . disable_code_size_limit )
249250 . set_pruned_history ( self . prune_history )
250251 . with_init_state ( self . load_state . or_else ( || self . state . and_then ( |s| s. state ) ) )
251252 . with_transaction_block_keeper ( self . transaction_block_keeper )
@@ -495,11 +496,20 @@ pub struct AnvilEvmArgs {
495496 ) ]
496497 pub disable_block_gas_limit : bool ,
497498
498- /// EIP-170: Contract code size limit in bytes. Useful to increase this because of tests. By
499- /// default, it is 0x6000 (~25kb).
499+ /// EIP-170: Contract code size limit in bytes. Useful to increase this because of tests. To
500+ /// disable entirely, use `--disable-code-size-limit`. By default, it is 0x6000 (~25kb).
500501 #[ arg( long, value_name = "CODE_SIZE" , help_heading = "Environment config" ) ]
501502 pub code_size_limit : Option < usize > ,
502503
504+ /// Disable EIP-170: Contract code size limit.
505+ #[ arg(
506+ long,
507+ value_name = "DISABLE_CODE_SIZE_LIMIT" ,
508+ conflicts_with = "code_size_limit" ,
509+ help_heading = "Environment config"
510+ ) ]
511+ pub disable_code_size_limit : bool ,
512+
503513 /// The gas price.
504514 #[ arg( long, help_heading = "Environment config" ) ]
505515 pub gas_price : Option < u128 > ,
@@ -805,6 +815,21 @@ mod tests {
805815 assert ! ( args. is_err( ) ) ;
806816 }
807817
818+ #[ test]
819+ fn can_parse_disable_code_size_limit ( ) {
820+ let args: NodeArgs = NodeArgs :: parse_from ( [ "anvil" , "--disable-code-size-limit" ] ) ;
821+ assert ! ( args. evm_opts. disable_code_size_limit) ;
822+
823+ let args = NodeArgs :: try_parse_from ( [
824+ "anvil" ,
825+ "--disable-code-size-limit" ,
826+ "--code-size-limit" ,
827+ "100" ,
828+ ] ) ;
829+ // can't be used together
830+ assert ! ( args. is_err( ) ) ;
831+ }
832+
808833 #[ test]
809834 fn can_parse_host ( ) {
810835 let args = NodeArgs :: parse_from ( [ "anvil" ] ) ;
0 commit comments