@@ -161,6 +161,37 @@ TEST_F(state_transition, eofcreate_empty_auxdata)
161
161
expect.post [create_address].nonce = 1 ;
162
162
}
163
163
164
+ TEST_F (state_transition, eofcreate_extcall_returncontract)
165
+ {
166
+ rev = EVMC_PRAGUE;
167
+ constexpr auto callee = 0xca11ee_address;
168
+ const auto deploy_container = eof_bytecode (bytecode (OP_INVALID));
169
+
170
+ pre.insert (
171
+ callee, {
172
+ .code = eof_bytecode (returncontract (0 , 0 , 0 ), 2 ).container (deploy_container),
173
+ });
174
+
175
+
176
+ const auto init_code = mstore (0 , extcall (callee)) + revert (0 , 32 );
177
+ const bytecode init_container = eof_bytecode (init_code, 4 );
178
+
179
+ const auto factory_code =
180
+ sstore (0 , eofcreate ().container (0 ).salt (Salt)) + sstore (1 , returndataload (0 )) + OP_STOP;
181
+ const auto factory_container = eof_bytecode (factory_code, 4 ).container (init_container);
182
+
183
+ tx.to = To;
184
+
185
+ pre.insert (*tx.to , {.nonce = 1 , .code = factory_container});
186
+
187
+ expect.post [*tx.to ].nonce = pre.get (*tx.to ).nonce + 1 ;
188
+ // No new address returned from EOFCREATE.
189
+ expect.post [*tx.to ].storage [0x00_bytes32] = 0x00_bytes32;
190
+ // Internal EXTCALL returned 2 (abort).
191
+ expect.post [*tx.to ].storage [0x01_bytes32] = 0x02_bytes32;
192
+ expect.post [callee].exists = true ;
193
+ }
194
+
164
195
TEST_F (state_transition, eofcreate_auxdata_equal_to_declared)
165
196
{
166
197
rev = EVMC_PRAGUE;
0 commit comments