Conversation
Co-Authored-By: Danno Ferrin <[email protected]>
EIPS/eip-2327.md
Outdated
|
|
||
| ## Motivation | ||
| <!--The motivation is critical for EIPs that want to change the Ethereum protocol. It should clearly explain why the existing protocol specification is inadequate to address the problem that the EIP solves. EIP submissions without sufficient motivation may be rejected outright.--> | ||
| The `BEGINDATA` opcode has been suggested before as part of the EIP `Subroutines and Static Jumps for the EVM` [EIP-615](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-615.md) as a way to determine the position of jumptables in contract bytecode. It is here introduced in its own right in order to exclude data from the JUMPDEST analysis of contracts, making it impossible to jump to data. This makes it easier for static analysis tools to analyse contracts, allows disassemblers, chain explorers and debuggers to not display data as a mess of INVALID opcodes and may even provide a marginal improvement in performance. Additionally, it paves the way for suggestions such as [EIP 1712](https://github.com/ethereum/EIPs/pull/1712) to disallow unused opcodes, jumptables [EIP-615](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-615.md) and speculative proposals to disallow for deployment of contracts with stack usage violations. |
There was a problem hiding this comment.
Please use the canonical URL (https://eips.ethereum.org/EIPS/eip-XX) whenever possible.
EIPS/eip-2327.md
Outdated
| ## Rationale | ||
| <!--The rationale fleshes out the specification by describing what motivated the design and why particular design decisions were made. It should describe alternate designs that were considered and related work, e.g. how the feature is supported in other languages. The rationale may also provide evidence of consensus within the community, and should discuss important objections or concerns raised during discussion.--> | ||
| The byte `0xb6` was chosen to align with [EIP-615](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-615.md). | ||
| The choice to STOP if `BEGINDATA` is encountered is somewhat arbitrary. An alternative would be to `THROW`. |
There was a problem hiding this comment.
There is no such thing as "throw" defined anywhere.
EIPS/eip-2327.md
Outdated
| ## Rationale | ||
| <!--The rationale fleshes out the specification by describing what motivated the design and why particular design decisions were made. It should describe alternate designs that were considered and related work, e.g. how the feature is supported in other languages. The rationale may also provide evidence of consensus within the community, and should discuss important objections or concerns raised during discussion.--> | ||
| The byte `0xb6` was chosen to align with [EIP-615](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-615.md). | ||
| The choice to STOP if `BEGINDATA` is encountered is somewhat arbitrary. An alternative would be to `THROW`. |
There was a problem hiding this comment.
It may make it nicer to read if all JUMPDEST and STOP opcodes are escaped.
EIPS/eip-2327.md
Outdated
| ## Test Cases | ||
| <!--Test cases for an implementation are mandatory for EIPs that are affecting consensus changes. Other EIPs can choose to include links to test cases if applicable.--> | ||
| Test cases should include: | ||
| 1) A contract which jumps to a destination `X`, where `X` has a pc value higher than the `BEGINDATA` opcode, and the byte at `X` is `0x5b`. This should fail with a `BAD_JUMPDEST`. |
There was a problem hiding this comment.
Please use BAD_JUMPDEST or BAD_JUMP_DESTINATION consistently.
There was a problem hiding this comment.
Albeit there is no such error clearly defined in EVM semantics, I'd still opt to keep that in the EIP (for now).
There was a problem hiding this comment.
I am referring to the status codes as defined by EVMC https://evmc.ethereum.org/group__EVMC.html#ga4c0be97f333c050ff45321fcaa34d920. Even if they haven't been universally accepted, they do provide the most systematic treatment of exceptions I'm aware of.
There was a problem hiding this comment.
I'm aware of them and glad to see them utilised, they haven't been referenced yet (apart from #2003).
e4571da to
832f229
Compare
axic
left a comment
There was a problem hiding this comment.
I think this is sound enough for a draft.
|
Thanks @axic for the review |
* Draft EIP: BEGINDATA opcode * EIP-BEGINDATA: Add discussions-to link * use eip number 2327 * Update EIPS/eip-2327.md Co-Authored-By: Danno Ferrin <[email protected]> * eip-2327: Update formatting and clarify CODECOPY behaviour
* Draft EIP: BEGINDATA opcode * EIP-BEGINDATA: Add discussions-to link * use eip number 2327 * Update EIPS/eip-2327.md Co-Authored-By: Danno Ferrin <[email protected]> * eip-2327: Update formatting and clarify CODECOPY behaviour
* Draft EIP: BEGINDATA opcode * EIP-BEGINDATA: Add discussions-to link * use eip number 2327 * Update EIPS/eip-2327.md Co-Authored-By: Danno Ferrin <[email protected]> * eip-2327: Update formatting and clarify CODECOPY behaviour
* Draft EIP: BEGINDATA opcode * EIP-BEGINDATA: Add discussions-to link * use eip number 2327 * Update EIPS/eip-2327.md Co-Authored-By: Danno Ferrin <[email protected]> * eip-2327: Update formatting and clarify CODECOPY behaviour
Waiting for EIP number to be assigned. Will post link to discussions after having opened this PR.