Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EIP-1712: Disallow Deployment of Unused Opcodes #1712

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions EIPS/eip-1712.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
eip: 1712
title: Disallow Deployment of Unused Opcodes
author: Wei Tang (@sorpaas)
discussions-to: https://github.com/sorpaas/EIPs/issues/4
status: Draft
type: Standards Track
category: Core
created: 2019-01-19
---

## Simple Summary

Hard fork can change existing contract behavior. One of the point can
be raised about adding new opcodes is that it modifies existing unused
opcodes from throwing out of gas to another behavior. While we can
mostly argue that deploying unused opcode is not of much use so no
sane developers would do that, it would be better to just disallow
deployment of unused opcodes.

## Specification

After `HARD_FORK` number, before executing a contract creation
transaction, or adding contract code to the state, do the following
check:

* Iterate over the code bytes one by one.
* If the code byte is a PUSH(n) opcode, skip next n bytes.
* If the code byte is a valid opcode or designated invalid
instruction (`0xfe`), continue.
* Otherwise, throw out-of-gas.

Note that this check is similar to jump destination checks.

## Copyright

Copyright and related rights waived via
[CC0](https://creativecommons.org/publicdomain/zero/1.0/).