Skip to content

Commit

Permalink
Move EIP-3607 to review (#4340)
Browse files Browse the repository at this point in the history
* Move EIP-3607 to review

* 3607: fix review comments
  • Loading branch information
MariusVanDerWijden authored Oct 22, 2021
1 parent f24c67f commit f600032
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions EIPS/eip-3607.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
---
eip: 3607
title: Reject transactions from senders with deployed code
description: Do not allow transactions for which `tx.sender` has any code deployed.
author: Dankrad Feist (@dankrad), Dmitry Khovratovich (@khovratovich), Marius van der Wijden (@MariusVanDerWijden)
discussions-to: https://github.com/ethereum/EIPs/issues/3608
status: Draft
status: Review
type: Standards Track
category: Core
created: 2021-06-10
---

## Simple Summary

Do not allow transactions for which `tx.sender` has any code deployed, i.e. `tx.sender` has a `CODEHASH != EMPTYCODEHASH`

## Abstract

Ethereum addresses are currently only 160 bits long. This means it is possible to create a collision between a contract account and an Externally Owned Account (EOA) using an estimated `2**80` computing operations, which is feasible now given a large budget (ca. 10 billion USD). The fix in this EIP prevents the worst possible attack, where a safe looking contract (e.g. a token wrapper or an AMM-type contract) is deployed to attract user funds, which can then be spent using the EOA key for the same address. The fix is to never allow to use an address that already has code deployed as an EOA address.
Expand Down Expand Up @@ -40,6 +37,8 @@ This EIP is to specify this behaviour to always forbid such transactions. This f

Any transaction where `tx.sender` has a `CODEHASH != EMPTYCODEHASH` MUST be rejected as invalid.
With `EMPTYCODEHASH = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470`.
The invalid transaction MUST be rejected by the client and not be included in a block.
A block containing such a transaction MUST be considered invalid.

## Rationale

Expand All @@ -58,6 +57,8 @@ It is unlikely that an attack like this has already occurred on the Ethereum mai

Private networks may have deployed contracts which also work as EOAs at genesis and should check that this upgrade does not impact their workflows.

Clients might choose to disable this rule for RPC calls like `eth_call` and `eth_estimateGas` as some Multi-Sig contracts use these calls to create transactions as if they originated from the multisig contract itself.

## Test Cases

Given a genesis allocation of
Expand All @@ -67,14 +68,14 @@ Balance: 1000000000000000000 // 1 ether
Nonce: 0,
Code: 0xB0B0FACE",
```
Every transaction send by the private key corresponding to `0x715656...` (
`b71c71a67e1177ad4e901695e1b4b9ee17ae16c6668d313eac2f96dbcda3f291`) fails.

A set of test cases can be found [here](https://github.com/ethereum/tests/pull/879)
Every transaction sent by the private key corresponding to `0x715656...` (
`b71c71a67e1177ad4e901695e1b4b9ee17ae16c6668d313eac2f96dbcda3f291`) should be rejected.
These transaction must be rejected and not included in a block.

## Reference Implementation

The following check must be added to the state transition checks after checking that the nonce of the sender is correct.
The sender is the address recovered from the signature of the transaction.
```
// Make sure the sender is an EOA
Set ch to the CodeHash of the sender account
Expand All @@ -83,7 +84,7 @@ if cs is not equal to EmptyCodeHash then
end if
```

An diff to implement EIP-3607 in go-ethereum can be found [here](../assets/eip-3607/geth.diff)
A diff to implement EIP-3607 in go-ethereum can be found [here](../assets/eip-3607/geth.diff)

## Security Considerations

Expand Down

0 comments on commit f600032

Please sign in to comment.