mirror of
https://github.com/status-im/EIPs.git
synced 2025-02-23 04:08:09 +00:00
3607: update to use empty code hash instead of codesize (#3632)
This commit is contained in:
parent
6854f0274c
commit
93e9a74809
@ -11,7 +11,7 @@ created: 2021-06-10
|
|||||||
|
|
||||||
## Simple Summary
|
## Simple Summary
|
||||||
|
|
||||||
Do not allow transactions for which `tx.sender` has any code deployed, i.e. `tx.sender` has `CODESIZE != 0`
|
Do not allow transactions for which `tx.sender` has any code deployed, i.e. `tx.sender` has a `CODEHASH != EMPTYCODEHASH`
|
||||||
|
|
||||||
## Abstract
|
## Abstract
|
||||||
|
|
||||||
@ -38,7 +38,8 @@ This EIP is to specify this behaviour to always forbid such transactions. This f
|
|||||||
|
|
||||||
## Specification
|
## Specification
|
||||||
|
|
||||||
Any transaction where `tx.sender` has a `CODESIZE != 0` MUST be rejected as invalid.
|
Any transaction where `tx.sender` has a `CODEHASH != EMPTYCODEHASH` MUST be rejected as invalid.
|
||||||
|
With `EMPTYCODEHASH = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470`.
|
||||||
|
|
||||||
## Rationale
|
## Rationale
|
||||||
|
|
||||||
@ -76,8 +77,8 @@ A set of test cases can be found [here](https://github.com/ethereum/tests/pull/8
|
|||||||
The following check must be added to the state transition checks after checking that the nonce of the sender is correct.
|
The following check must be added to the state transition checks after checking that the nonce of the sender is correct.
|
||||||
```
|
```
|
||||||
// Make sure the sender is an EOA
|
// Make sure the sender is an EOA
|
||||||
Set cs to the CodeSize of the sender account
|
Set ch to the CodeHash of the sender account
|
||||||
if cs is not 0 then
|
if cs is not equal to EmptyCodeHash then
|
||||||
return ErrSenderNoEOA
|
return ErrSenderNoEOA
|
||||||
end if
|
end if
|
||||||
```
|
```
|
||||||
|
@ -7,9 +7,9 @@ index 18777d8d4..3b25155c6 100644
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
+ // Make sure the sender is an EOA
|
+ // Make sure the sender is an EOA
|
||||||
+ if codesize := st.state.GetCodeSize(st.msg.From()); codesize != 0 {
|
+ if codeHash := st.state.GetCodeHash(st.msg.From()); codeHash != emptyCodeHash {
|
||||||
+ return fmt.Errorf("%w: address %v, codesize: %d", ErrSenderNoEOA,
|
+ return fmt.Errorf("%w: address %v, codehash: %s", ErrSenderNoEOA,
|
||||||
+ st.msg.From().Hex(), codesize)
|
+ st.msg.From().Hex(), codeHash)
|
||||||
+ }
|
+ }
|
||||||
// Make sure that transaction feeCap is greater than the baseFee (post london)
|
// Make sure that transaction feeCap is greater than the baseFee (post london)
|
||||||
if st.evm.ChainConfig().IsLondon(st.evm.Context.BlockNumber) {
|
if st.evm.ChainConfig().IsLondon(st.evm.Context.BlockNumber) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user