@@ -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,9 @@ 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.hasInstruction () )
284
312
return false ;
313
+
285
314
switch (_item.instruction ())
286
315
{
287
316
// note that CALL, CALLCODE and CREATE do not really alter the control flow, because we
@@ -293,6 +322,7 @@ bool SemanticInformation::altersControlFlow(AssemblyItem const& _item)
293
322
case Instruction::STOP:
294
323
case Instruction::INVALID:
295
324
case Instruction::REVERT:
325
+ case Instruction::RETURNCONTRACT:
296
326
return true ;
297
327
default :
298
328
return false ;
@@ -301,7 +331,7 @@ bool SemanticInformation::altersControlFlow(AssemblyItem const& _item)
301
331
302
332
bool SemanticInformation::terminatesControlFlow (AssemblyItem const & _item)
303
333
{
304
- if (_item.type () != evmasm::Operation )
334
+ if (! _item.hasInstruction () )
305
335
return false ;
306
336
return terminatesControlFlow (_item.instruction ());
307
337
}
@@ -315,6 +345,7 @@ bool SemanticInformation::terminatesControlFlow(Instruction _instruction)
315
345
case Instruction::STOP:
316
346
case Instruction::INVALID:
317
347
case Instruction::REVERT:
348
+ case Instruction::RETURNCONTRACT:
318
349
return true ;
319
350
default :
320
351
return false ;
@@ -337,7 +368,7 @@ bool SemanticInformation::isDeterministic(AssemblyItem const& _item)
337
368
{
338
369
assertThrow (_item.type () != VerbatimBytecode, AssemblyException, " " );
339
370
340
- if (_item.type () != evmasm::Operation )
371
+ if (! _item.hasInstruction () )
341
372
return true ;
342
373
343
374
switch (_item.instruction ())
@@ -357,6 +388,7 @@ bool SemanticInformation::isDeterministic(AssemblyItem const& _item)
357
388
case Instruction::EXTCODEHASH:
358
389
case Instruction::RETURNDATACOPY: // depends on previous calls
359
390
case Instruction::RETURNDATASIZE:
391
+ case Instruction::EOFCREATE:
360
392
return false ;
361
393
default :
362
394
return true ;
@@ -436,6 +468,8 @@ SemanticInformation::Effect SemanticInformation::memory(Instruction _instruction
436
468
case Instruction::LOG2:
437
469
case Instruction::LOG3:
438
470
case Instruction::LOG4:
471
+ case Instruction::EOFCREATE:
472
+ case Instruction::RETURNCONTRACT:
439
473
return SemanticInformation::Read;
440
474
441
475
default :
@@ -473,6 +507,8 @@ SemanticInformation::Effect SemanticInformation::storage(Instruction _instructio
473
507
case Instruction::CREATE:
474
508
case Instruction::CREATE2:
475
509
case Instruction::SSTORE:
510
+ case Instruction::EOFCREATE:
511
+ case Instruction::RETURNCONTRACT:
476
512
return SemanticInformation::Write;
477
513
478
514
case Instruction::SLOAD:
@@ -494,6 +530,8 @@ SemanticInformation::Effect SemanticInformation::transientStorage(Instruction _i
494
530
case Instruction::CREATE:
495
531
case Instruction::CREATE2:
496
532
case Instruction::TSTORE:
533
+ case Instruction::EOFCREATE:
534
+ case Instruction::RETURNCONTRACT:
497
535
return SemanticInformation::Write;
498
536
499
537
case Instruction::TLOAD:
@@ -514,6 +552,8 @@ SemanticInformation::Effect SemanticInformation::otherState(Instruction _instruc
514
552
case Instruction::DELEGATECALL:
515
553
case Instruction::CREATE:
516
554
case Instruction::CREATE2:
555
+ case Instruction::EOFCREATE:
556
+ case Instruction::RETURNCONTRACT:
517
557
case Instruction::SELFDESTRUCT:
518
558
case Instruction::STATICCALL: // because it can affect returndatasize
519
559
// Strictly speaking, log0, .., log4 writes to the state, but the EVM cannot read it, so they
@@ -588,6 +628,10 @@ bool SemanticInformation::invalidInViewFunctions(Instruction _instruction)
588
628
case Instruction::CALL:
589
629
case Instruction::CALLCODE:
590
630
case Instruction::DELEGATECALL:
631
+ // According to EOF spec https://eips.ethereum.org/EIPS/eip-7620#eofcreate
632
+ case Instruction::EOFCREATE:
633
+ // According to EOF spec https://eips.ethereum.org/EIPS/eip-7620#returncontract
634
+ case Instruction::RETURNCONTRACT:
591
635
case Instruction::CREATE2:
592
636
case Instruction::SELFDESTRUCT:
593
637
return true ;
0 commit comments