mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2025-01-15 15:28:19 +00:00
EIP-3607 (check if sender is EOA). Update tests to v10.0 (#2820)
* Update Ethereum tests to v10.0 * Implement EIP-3607
This commit is contained in:
parent
0f9c0b99b7
commit
45fd38c30f
@ -83,4 +83,8 @@ var (
|
|||||||
// ErrFeeCapTooLow is returned if the transaction fee cap is less than the
|
// ErrFeeCapTooLow is returned if the transaction fee cap is less than the
|
||||||
// the base fee of the block.
|
// the base fee of the block.
|
||||||
ErrFeeCapTooLow = errors.New("fee cap less than block base fee")
|
ErrFeeCapTooLow = errors.New("fee cap less than block base fee")
|
||||||
|
|
||||||
|
// ErrSenderNoEOA is returned if the sender of a transaction is a contract.
|
||||||
|
// See EIP-3607: Reject transactions from senders with deployed code.
|
||||||
|
ErrSenderNoEOA = errors.New("sender not an eoa")
|
||||||
)
|
)
|
||||||
|
@ -26,9 +26,12 @@ import (
|
|||||||
cmath "github.com/ledgerwatch/erigon/common/math"
|
cmath "github.com/ledgerwatch/erigon/common/math"
|
||||||
"github.com/ledgerwatch/erigon/core/types"
|
"github.com/ledgerwatch/erigon/core/types"
|
||||||
"github.com/ledgerwatch/erigon/core/vm"
|
"github.com/ledgerwatch/erigon/core/vm"
|
||||||
|
"github.com/ledgerwatch/erigon/crypto"
|
||||||
"github.com/ledgerwatch/erigon/params"
|
"github.com/ledgerwatch/erigon/params"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var emptyCodeHash = crypto.Keccak256Hash(nil)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
The State Transitioning Model
|
The State Transitioning Model
|
||||||
|
|
||||||
@ -239,6 +242,15 @@ func (st *StateTransition) preCheck(gasBailout bool) error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Make sure the sender is an EOA (EIP-3607)
|
||||||
|
if codeHash := st.state.GetCodeHash(st.msg.From()); codeHash != emptyCodeHash && codeHash != (common.Hash{}) {
|
||||||
|
// common.Hash{} means that the sender is not in the state.
|
||||||
|
// Historically there were transactions with 0 gas price and non-existing sender,
|
||||||
|
// so we have to allow that.
|
||||||
|
return fmt.Errorf("%w: address %v, codehash: %s", ErrSenderNoEOA,
|
||||||
|
st.msg.From().Hex(), codeHash)
|
||||||
|
}
|
||||||
|
|
||||||
// Make sure the transaction gasFeeCap is greater than the block's baseFee.
|
// Make sure the transaction gasFeeCap is greater than the block's baseFee.
|
||||||
if st.evm.ChainRules.IsLondon {
|
if st.evm.ChainRules.IsLondon {
|
||||||
// Skip the checks if gas fields are zero and baseFee was explicitly disabled (eth_call)
|
// Skip the checks if gas fields are zero and baseFee was explicitly disabled (eth_call)
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit 5d651381daf9d12cc663a7326b3b16d7bb4c1aa0
|
Subproject commit 52cb3b3e724d13943bd8a457ed70929f98b9b8bf
|
Loading…
Reference in New Issue
Block a user