diff --git a/spec/eof.md b/spec/eof.md index 70a833c..dc184a6 100644 --- a/spec/eof.md +++ b/spec/eof.md @@ -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`