Skip to content

Commit

Permalink
Add an EIP about making contract creation fail on address collision
Browse files Browse the repository at this point in the history
  • Loading branch information
pirapira committed Apr 4, 2018
1 parent 4b1d9aa commit 7e15422
Showing 1 changed file with 51 additions and 0 deletions.
51 changes: 51 additions & 0 deletions EIPS/address-collision-exceptional-halt.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
## Preamble

EIP: <to be assigned>
Title: Address Collision of Contract Address Causes Exceptional Halt
Author: Yoichi Hirai <[email protected]>
Type: Standard Track
Category: Core
Status: Draft
Created: 2017-08-15
Requires: none
Replaces: none


## Simple Summary

This EIP proposes to make contract creation fail on an account with nonempty code or non-zero nonce.

## Abstract

Some test cases in the consensus test suite try to deploy a contract at an address already with nonempty code. Although such cases can virtually never happen on the main network before the Constantinople fork block, the test cases detected discrepancies in clients' behavior. Currently, the Yellow Paper says that the contract creation starts with the empty code and the initial nonce even in the case of address collisions. To simplify the semantics, this EIP proposes that address collisions cause failures of contract creation.

## Motivation

This EIP has no practical relevance to the main net history, but simplifies testing and reasoning.

This EIP has no effects after Constantinople fork because [EIP-86](https://github.com/ethereum/EIPs/pull/208) contains the changes proposed in this EIP. Even before the Constantinople fork, this EIP has no practical relevance because the change is visible only in case of a hash collision of keccak256.

Regarding testing, this EIP releaves clients from supporting reversion of code overwriting.

Regarding reasoning, this EIP establishes an invariant that non-empty code is never modified.

## Specification

If `block.number >= 0`, when a contract creation is on an account with non-zero nonce or non-empty code, the creation fails as if init code execution resulted in an exceptional halt. This applies to contract creation triggered by a contract creation transaction and by CREATE instruction.

## Rationale

It seems unpractical to implement never-used features just for passing tests. Client implementations will be simpler with this EIP.

## Backwards Compatibility

This EIP is backwards compatible on the main network.

## Test Cases

At least the BlockchainTest called `createJS\_ExampleContract\_d0g0v0\_EIP158` will distinguish clients that implement this EIP.

## Implementation

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

0 comments on commit 7e15422

Please sign in to comment.