@@ -184,6 +184,34 @@ std::vector<SemanticInformation::Operation> SemanticInformation::readWriteOperat
184
184
Operation{Location::TransientStorage, Effect::Read, {}, {}, {}},
185
185
Operation{Location::TransientStorage, Effect::Write, {}, {}, {}}
186
186
};
187
+ case Instruction::EOFCREATE:
188
+ return std::vector<Operation>{
189
+ Operation{
190
+ Location::Memory,
191
+ Effect::Read,
192
+ 2 ,
193
+ 3 ,
194
+ {}
195
+ },
196
+ Operation{Location::Storage, Effect::Read, {}, {}, {}},
197
+ Operation{Location::Storage, Effect::Write, {}, {}, {}},
198
+ Operation{Location::TransientStorage, Effect::Read, {}, {}, {}},
199
+ Operation{Location::TransientStorage, Effect::Write, {}, {}, {}}
200
+ };
201
+ case Instruction::RETURNCONTRACT:
202
+ return std::vector<Operation>{
203
+ Operation{
204
+ Location::Memory,
205
+ Effect::Read,
206
+ 0 ,
207
+ 1 ,
208
+ {}
209
+ },
210
+ Operation{Location::Storage, Effect::Read, {}, {}, {}},
211
+ Operation{Location::Storage, Effect::Write, {}, {}, {}},
212
+ Operation{Location::TransientStorage, Effect::Read, {}, {}, {}},
213
+ Operation{Location::TransientStorage, Effect::Write, {}, {}, {}}
214
+ };
187
215
case Instruction::MSIZE:
188
216
// This is just to satisfy the assert below.
189
217
return std::vector<Operation>{};
@@ -280,8 +308,11 @@ bool SemanticInformation::isJumpInstruction(AssemblyItem const& _item)
280
308
281
309
bool SemanticInformation::altersControlFlow (AssemblyItem const & _item)
282
310
{
283
- if (_item.type () != evmasm::Operation)
311
+ if (_item.type () == evmasm::ReturnContract)
312
+ return true ;
313
+ else if (_item.type () != evmasm::Operation)
284
314
return false ;
315
+
285
316
switch (_item.instruction ())
286
317
{
287
318
// note that CALL, CALLCODE and CREATE do not really alter the control flow, because we
@@ -293,6 +324,7 @@ bool SemanticInformation::altersControlFlow(AssemblyItem const& _item)
293
324
case Instruction::STOP:
294
325
case Instruction::INVALID:
295
326
case Instruction::REVERT:
327
+ case Instruction::RETURNCONTRACT:
296
328
return true ;
297
329
default :
298
330
return false ;
@@ -301,7 +333,9 @@ bool SemanticInformation::altersControlFlow(AssemblyItem const& _item)
301
333
302
334
bool SemanticInformation::terminatesControlFlow (AssemblyItem const & _item)
303
335
{
304
- if (_item.type () != evmasm::Operation)
336
+ if (_item.type () == evmasm::ReturnContract)
337
+ return true ;
338
+ else if (_item.type () != evmasm::Operation)
305
339
return false ;
306
340
return terminatesControlFlow (_item.instruction ());
307
341
}
@@ -315,6 +349,7 @@ bool SemanticInformation::terminatesControlFlow(Instruction _instruction)
315
349
case Instruction::STOP:
316
350
case Instruction::INVALID:
317
351
case Instruction::REVERT:
352
+ case Instruction::RETURNCONTRACT:
318
353
return true ;
319
354
default :
320
355
return false ;
@@ -337,7 +372,9 @@ bool SemanticInformation::isDeterministic(AssemblyItem const& _item)
337
372
{
338
373
assertThrow (_item.type () != VerbatimBytecode, AssemblyException, " " );
339
374
340
- if (_item.type () != evmasm::Operation)
375
+ if (_item.type () == evmasm::EOFCreate)
376
+ return false ;
377
+ else if (_item.type () != evmasm::Operation)
341
378
return true ;
342
379
343
380
switch (_item.instruction ())
@@ -357,6 +394,7 @@ bool SemanticInformation::isDeterministic(AssemblyItem const& _item)
357
394
case Instruction::EXTCODEHASH:
358
395
case Instruction::RETURNDATACOPY: // depends on previous calls
359
396
case Instruction::RETURNDATASIZE:
397
+ case Instruction::EOFCREATE:
360
398
return false ;
361
399
default :
362
400
return true ;
@@ -436,6 +474,8 @@ SemanticInformation::Effect SemanticInformation::memory(Instruction _instruction
436
474
case Instruction::LOG2:
437
475
case Instruction::LOG3:
438
476
case Instruction::LOG4:
477
+ case Instruction::EOFCREATE:
478
+ case Instruction::RETURNCONTRACT:
439
479
return SemanticInformation::Read;
440
480
441
481
default :
@@ -473,6 +513,8 @@ SemanticInformation::Effect SemanticInformation::storage(Instruction _instructio
473
513
case Instruction::CREATE:
474
514
case Instruction::CREATE2:
475
515
case Instruction::SSTORE:
516
+ case Instruction::EOFCREATE:
517
+ case Instruction::RETURNCONTRACT:
476
518
return SemanticInformation::Write;
477
519
478
520
case Instruction::SLOAD:
@@ -494,6 +536,8 @@ SemanticInformation::Effect SemanticInformation::transientStorage(Instruction _i
494
536
case Instruction::CREATE:
495
537
case Instruction::CREATE2:
496
538
case Instruction::TSTORE:
539
+ case Instruction::EOFCREATE:
540
+ case Instruction::RETURNCONTRACT:
497
541
return SemanticInformation::Write;
498
542
499
543
case Instruction::TLOAD:
@@ -514,6 +558,8 @@ SemanticInformation::Effect SemanticInformation::otherState(Instruction _instruc
514
558
case Instruction::DELEGATECALL:
515
559
case Instruction::CREATE:
516
560
case Instruction::CREATE2:
561
+ case Instruction::EOFCREATE:
562
+ case Instruction::RETURNCONTRACT:
517
563
case Instruction::SELFDESTRUCT:
518
564
case Instruction::STATICCALL: // because it can affect returndatasize
519
565
// Strictly speaking, log0, .., log4 writes to the state, but the EVM cannot read it, so they
@@ -588,6 +634,10 @@ bool SemanticInformation::invalidInViewFunctions(Instruction _instruction)
588
634
case Instruction::CALL:
589
635
case Instruction::CALLCODE:
590
636
case Instruction::DELEGATECALL:
637
+ // According to EOF spec https://eips.ethereum.org/EIPS/eip-7620#eofcreate
638
+ case Instruction::EOFCREATE:
639
+ // According to EOF spec https://eips.ethereum.org/EIPS/eip-7620#returncontract
640
+ case Instruction::RETURNCONTRACT:
591
641
case Instruction::CREATE2:
592
642
case Instruction::SELFDESTRUCT:
593
643
return true ;
0 commit comments