Skip to content

Commit 05487be

Browse files
authored
Merge cd1bf3c into 6e1cc69
2 parents 6e1cc69 + cd1bf3c commit 05487be

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

EIPS/eip-3540.md

+6-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
eip: 3540
33
title: EOF - EVM Object Format v1
44
description: EOF is an extensible and versioned container format for EVM bytecode with a once-off validation at deploy time.
5-
author: Alex Beregszaszi (@axic), Paweł Bylica (@chfast), Andrei Maiboroda (@gumb0)
5+
author: Alex Beregszaszi (@axic), Paweł Bylica (@chfast), Andrei Maiboroda (@gumb0), Hubert Ritzdorf (@ritzdorf)
66
discussions-to: https://ethereum-magicians.org/t/evm-object-format-eof/5727
77
status: Review
88
type: Standards Track
@@ -164,6 +164,7 @@ For clarity, the *container* refers to the complete account code, while *code* r
164164
4. `CODECOPY`/`CODESIZE`/`EXTCODECOPY`/`EXTCODESIZE`/`EXTCODEHASH` keeps operating on the entire *container*.
165165
5. The input to `CREATE`/`CREATE2` is still the entire *container*.
166166
6. The size limit for deployed code as specified in [EIP-170](./eip-170.md) and for initcode as specified in [EIP-3860](./eip-3860.md) is applied to the entire *container* size, not to the *code* size. This also means if initcode validation fails, it is still charged the EIP-3860 `initcode_cost`.
167+
7. When an EOF1 contract performs a `DELEGATECALL` the target contract has to be EOF1. If it is not EOF1 (e.g. it is EOF0 or EOF2), the `DELEGATECALL` exceptionally halts. Hence, (among other things) all the gas passed to the `DELEGATECALL` is consumed and 0 is pushed onto the stack. As it is not valid EOF1, `DELEGATECALL` to an empty container also fails.
167168

168169
(*Remark:* Due to [EIP-4750](./eip-4750.md), `JUMP` and `JUMPI` are disabled and therefore are not discussed in relation to EOF.)
169170

@@ -250,6 +251,10 @@ It is possible in the future that this data will be accessible with data-specifi
250251

251252
The value for `PC` is specified to start at 0 and to be within the active *code* section. We considered keeping `PC` to operate on the whole *container* and be consistent with `CODECOPY`/`EXTCODECOPY` but in the end decided otherwise. This also feels more natural and easier to implement in EVM: the new EOF EVM should only care about traversing *code* and accessing other parts of the *container* only on special occasions (e.g. in `CODECOPY` instruction).
252253

254+
### EOF1 contracts can only `DELEGATECALL` EOF1 contracts
255+
256+
Currently contracts can selfdestruct in three different ways (directly through `SELFDESTRUCT`, indirectly through `CALLCODE` and indirectly through `DELEGATECALL`). EIP 3670 disables the first two possibilities, however the third possibility remains. Allowing EOF1 contracts to only `DELEGATECALL` other EOF1 contracts allows the following strong statement: EOF1 contract can never be destructed. Attacks based on `SELFDESTRUCT` completely disappear for EOF1 contracts. These include destructed library contracts (e.g. Parity Multisig).
257+
253258
## Backwards Compatibility
254259

255260
This is a breaking change given that any code starting with `0xEF` was not deployable before (and resulted in exceptional abort if executed), but now some subset of such codes can be deployed and executed successfully.

0 commit comments

Comments
 (0)