Feat/#434 Implement ErrorInvalidCreationCode error state#478
Conversation
1ac18db to
8e8ec2d
Compare
f6fa5cc to
1084dc9
Compare
1084dc9 to
581a37c
Compare
davidnevadoc
left a comment
There was a problem hiding this comment.
Just a question and a typo fix, all the rest LGTM! 👍
| # opcode mut be `RETURN` | ||
| instruction.constrain_equal(opcode, Opcode.RETURN) | ||
|
|
||
| # the call must be coming from CREATE or CREATE2 |
There was a problem hiding this comment.
Can it also be that tx.to == null as it is mentioned in the MD?
There was a problem hiding this comment.
I think we couldn't add this constraint. There are two routes for this error, a.) it's a CREATE/CREATE2 opcode execution and b.) it's a contract deployment transaction (which is tx.to == null). If we add this constraint, then the first case a.) would be failed.
…ode.py Co-authored-by: David Nevado <davidnevadoc@users.noreply.github.com>
|
|
||
| ### EVM behavior | ||
|
|
||
| When handling a contract creation transaction, initial bytecode are executed and the current call context is `CREATE` or `CREATE2`. The last opcode to store for new contract is `RETURN`. It returns `memory[offset...offset + length]` content as contract bytecode to store into state DB. |
| 2. The first byte of contract code is `0xEF`. | ||
| 3. Current call must be failed. | ||
| 4. If it's a root call, it transits to `EndTx`. | ||
| 5. if it is not root call, it restores caller's context by reading to `rw_table`, then does step state transition to it. |
There was a problem hiding this comment.
Do we need to check that it's not a static call?
There was a problem hiding this comment.
I think we don't. If it's a CREATE callcontext and also a static call, it would hit ErrorWriteProtection first. Correct me if I misunderstand error states handling mechanism.
and updated version of #400 and closed #434