@@ -673,3 +673,55 @@ tape('step event: ensure EVM memory and not internal memory gets reported', asyn
673
673
await evm . runCall ( runCallArgs )
674
674
t . ok ( verifyMemoryExpanded , 'memory did expand' )
675
675
} )
676
+
677
+ tape ( 'ensure code deposit errors are logged correctly (>= Homestead)' , async ( t ) => {
678
+ const common = new Common ( { chain : Chain . Mainnet , hardfork : Hardfork . Berlin } )
679
+ const evm = await EVM . create ( {
680
+ common,
681
+ stateManager : new DefaultStateManager ( ) ,
682
+ } )
683
+
684
+ // Create a contract which is too large
685
+ const runCallArgs = {
686
+ gasLimit : BigInt ( 10000000 ) ,
687
+ data : hexToBytes ( '61FFFF6000F3' ) ,
688
+ }
689
+
690
+ const res = await evm . runCall ( runCallArgs )
691
+ t . ok ( res . execResult . exceptionError ?. error === ERROR . CODESIZE_EXCEEDS_MAXIMUM )
692
+
693
+ // Create a contract which goes OOG when creating
694
+ const runCallArgs2 = {
695
+ gasLimit : BigInt ( 100000 ) ,
696
+ data : hexToBytes ( '62FFFFFF6000F3' ) ,
697
+ }
698
+
699
+ const res2 = await evm . runCall ( runCallArgs2 )
700
+ t . ok ( res2 . execResult . exceptionError ?. error === ERROR . OUT_OF_GAS )
701
+ } )
702
+
703
+ tape ( 'ensure code deposit errors are logged correctly (Frontier)' , async ( t ) => {
704
+ const common = new Common ( { chain : Chain . Mainnet , hardfork : Hardfork . Chainstart } )
705
+ const evm = await EVM . create ( {
706
+ common,
707
+ stateManager : new DefaultStateManager ( ) ,
708
+ } )
709
+
710
+ // Create a contract which cannot pay the code deposit fee
711
+ const runCallArgs = {
712
+ gasLimit : BigInt ( 10000000 ) ,
713
+ data : hexToBytes ( '61FFFF6000F3' ) ,
714
+ }
715
+
716
+ const res = await evm . runCall ( runCallArgs )
717
+ t . ok ( res . execResult . exceptionError ?. error === ERROR . CODESTORE_OUT_OF_GAS )
718
+
719
+ // Create a contract which goes OOG when creating
720
+ const runCallArgs2 = {
721
+ gasLimit : BigInt ( 100000 ) ,
722
+ data : hexToBytes ( '62FFFFFF6000F3' ) ,
723
+ }
724
+
725
+ const res2 = await evm . runCall ( runCallArgs2 )
726
+ t . ok ( res2 . execResult . exceptionError ?. error === ERROR . OUT_OF_GAS )
727
+ } )
0 commit comments