@ -52,12 +52,7 @@ class CreateOperationTest {
private final WorldUpdater worldUpdater = mock ( WorldUpdater . class ) ;
private final WorldUpdater worldUpdater = mock ( WorldUpdater . class ) ;
private final MutableAccount account = mock ( MutableAccount . class ) ;
private final MutableAccount account = mock ( MutableAccount . class ) ;
private final MutableAccount newAccount = mock ( MutableAccount . class ) ;
private final MutableAccount newAccount = mock ( MutableAccount . class ) ;
private final CreateOperation operation =
private final CreateOperation operation = new CreateOperation ( new ConstantinopleGasCalculator ( ) ) ;
new CreateOperation ( new ConstantinopleGasCalculator ( ) , Integer . MAX_VALUE ) ;
private final CreateOperation maxInitCodeOperation =
new CreateOperation (
new ConstantinopleGasCalculator ( ) , MainnetEVMs . SHANGHAI_INIT_CODE_SIZE_LIMIT ) ;
private final EVM evm = MainnetEVMs . pragueEOF ( EvmConfiguration . DEFAULT ) ;
private static final String TOPIC =
private static final String TOPIC =
"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff" ; // 32 FFs
"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff" ; // 32 FFs
@ -190,7 +185,7 @@ class CreateOperationTest {
when ( worldUpdater . updater ( ) ) . thenReturn ( worldUpdater ) ;
when ( worldUpdater . updater ( ) ) . thenReturn ( worldUpdater ) ;
final EVM evm = MainnetEVMs . shanghai ( DEV_NET_CHAIN_ID , EvmConfiguration . DEFAULT ) ;
final EVM evm = MainnetEVMs . shanghai ( DEV_NET_CHAIN_ID , EvmConfiguration . DEFAULT ) ;
var result = maxInitC odeO peration. execute ( messageFrame , evm ) ;
var result = operation . execute ( messageFrame , evm ) ;
final MessageFrame createFrame = messageFrame . getMessageFrameStack ( ) . peek ( ) ;
final MessageFrame createFrame = messageFrame . getMessageFrameStack ( ) . peek ( ) ;
final ContractCreationProcessor ccp =
final ContractCreationProcessor ccp =
new ContractCreationProcessor ( evm , false , List . of ( ) , 0 , List . of ( ) ) ;
new ContractCreationProcessor ( evm , false , List . of ( ) , 0 , List . of ( ) ) ;
@ -218,17 +213,18 @@ class CreateOperationTest {
when ( worldUpdater . updater ( ) ) . thenReturn ( worldUpdater ) ;
when ( worldUpdater . updater ( ) ) . thenReturn ( worldUpdater ) ;
final EVM evm = MainnetEVMs . shanghai ( DEV_NET_CHAIN_ID , EvmConfiguration . DEFAULT ) ;
final EVM evm = MainnetEVMs . shanghai ( DEV_NET_CHAIN_ID , EvmConfiguration . DEFAULT ) ;
var result = maxInitC odeO peration. execute ( messageFrame , evm ) ;
var result = operation . execute ( messageFrame , evm ) ;
assertThat ( result . getHaltReason ( ) ) . isEqualTo ( CODE_TOO_LARGE ) ;
assertThat ( result . getHaltReason ( ) ) . isEqualTo ( CODE_TOO_LARGE ) ;
}
}
@Test
@Test
void eofV1CannotCall ( ) {
void eofV1CannotCall ( ) {
final EVM pragueEvm = MainnetEVMs . pragueEOF ( EvmConfiguration . DEFAULT ) ;
final UInt256 memoryOffset = UInt256 . fromHexString ( "0xFF" ) ;
final UInt256 memoryOffset = UInt256 . fromHexString ( "0xFF" ) ;
final UInt256 memoryLength = UInt256 . valueOf ( SIMPLE_CREATE . size ( ) ) ;
final UInt256 memoryLength = UInt256 . valueOf ( SIMPLE_CREATE . size ( ) ) ;
final MessageFrame messageFrame =
final MessageFrame messageFrame =
new TestMessageFrameBuilder ( )
new TestMessageFrameBuilder ( )
. code ( evm . getCodeUncached ( SIMPLE_EOF ) )
. code ( pragu eE vm. getCodeUncached ( SIMPLE_EOF ) )
. pushStackItem ( memoryLength )
. pushStackItem ( memoryLength )
. pushStackItem ( memoryOffset )
. pushStackItem ( memoryOffset )
. pushStackItem ( Bytes . EMPTY )
. pushStackItem ( Bytes . EMPTY )
@ -252,6 +248,7 @@ class CreateOperationTest {
final UInt256 memoryLength ,
final UInt256 memoryLength ,
final UInt256 value ,
final UInt256 value ,
final int depth ) {
final int depth ) {
final EVM evm = MainnetEVMs . pragueEOF ( EvmConfiguration . DEFAULT ) ;
final MessageFrame messageFrame =
final MessageFrame messageFrame =
MessageFrame . builder ( )
MessageFrame . builder ( )
. type ( MessageFrame . Type . CONTRACT_CREATION )
. type ( MessageFrame . Type . CONTRACT_CREATION )