Skip to content

Commit

Permalink
Spec out behavior of legacy CREATE/CREATE2 w/ eof initcode
Browse files Browse the repository at this point in the history
  • Loading branch information
pdobacz committed Feb 1, 2024
1 parent 92adf64 commit 8d31dab
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions spec/eof.md
Original file line number Diff line number Diff line change
Expand Up @@ -159,13 +159,17 @@ Code executing within an EOF environment will behave differently than legacy cod
- If the target account of `EXTCODESIZE` is an EOF contract, then it will return 2.
- The instruction `JUMPDEST` is renamed to `NOP` and remains charging 1 gas without any effect.
- Note: jumpdest-analysis is not performed anymore.
- EOF contract may not deploy legacy code
- Legacy contract may not deploy EOF code
- ~~If a `DELEGATECALL` crosses an EOF<>legacy boundary, then it returns 0 to signal failure (i.e. legacy->EOF and EOF->legacy `DELEGATECALL`s are disallowed).~~
- EOF contract may not deploy legacy code (it is naturally rejected on the code validation stage)
- Legacy contract or legacy creation tx may not deploy EOF code per [EIP-3541](https://eips.ethereum.org/EIPS/eip-3541):
- If instructions `CREATE` and `CREATE2` have EOF code as initcode (starting with `EF00` magic)
- deployment fails (returns 0 on the stack)
- caller's nonce is not updated and gas for initcode execution is not consumed
- `DELEGATECALL` from an EOF contract to a legacy contract is disallowed, and it returns 0 to signal failure. We allow legacy to EOF path for existing proxy contracts to be able to use EOF upgrades.

### New Behavior

The following instructions are introduced in EOF code:

- `RJUMP (0xe0)` instruction
- deduct 2 gas
- read int16 operand `offset`, set `pc = offset + pc + 3`
Expand Down

0 comments on commit 8d31dab

Please sign in to comment.