mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-27 15:16:43 +00:00
fix: add EIP-3607 check in L1 messages (#1149)
* fix: add EIP-3607 check in l1 message * Update core/state_transition.go Co-authored-by: Péter Garamvölgyi <peter@scroll.io> --------- Co-authored-by: Péter Garamvölgyi <peter@scroll.io>
This commit is contained in:
parent
12536ac34b
commit
b3933861ae
2 changed files with 15 additions and 8 deletions
|
|
@ -269,8 +269,21 @@ func (st *StateTransition) buyGas() error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (st *StateTransition) preCheck() error {
|
func (st *StateTransition) preCheck() error {
|
||||||
|
// Only check transactions that are not fake
|
||||||
|
if !st.msg.IsFake() {
|
||||||
|
// Make sure the sender is an EOA
|
||||||
|
code := st.state.GetCode(st.msg.From())
|
||||||
|
_, delegated := types.ParseDelegation(code)
|
||||||
|
if len(code) > 0 && !delegated {
|
||||||
|
// If the sender on L1 is a (delegated) EOA, then it must be a (delegated) EOA on L2, too.
|
||||||
|
// If the sender on L1 is a contract, then we apply address aliasing.
|
||||||
|
// The probability that the aliased address happens to be a smart contract on L2 is negligible.
|
||||||
|
return fmt.Errorf("%w: address %v, len(code): %d", ErrSenderNoEOA, st.msg.From().Hex(), len(code))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if st.msg.IsL1MessageTx() {
|
if st.msg.IsL1MessageTx() {
|
||||||
// No fee fields to check, no nonce to check, and no need to check if EOA (L1 already verified it for us)
|
// No fee fields to check, no nonce to check
|
||||||
// Gas is free, but no refunds!
|
// Gas is free, but no refunds!
|
||||||
st.gas += st.msg.Gas()
|
st.gas += st.msg.Gas()
|
||||||
st.initialGas = st.msg.Gas()
|
st.initialGas = st.msg.Gas()
|
||||||
|
|
@ -291,12 +304,6 @@ func (st *StateTransition) preCheck() error {
|
||||||
return fmt.Errorf("%w: address %v, nonce: %d", ErrNonceMax,
|
return fmt.Errorf("%w: address %v, nonce: %d", ErrNonceMax,
|
||||||
st.msg.From().Hex(), stNonce)
|
st.msg.From().Hex(), stNonce)
|
||||||
}
|
}
|
||||||
// Make sure the sender is an EOA
|
|
||||||
code := st.state.GetCode(st.msg.From())
|
|
||||||
_, delegated := types.ParseDelegation(code)
|
|
||||||
if len(code) > 0 && !delegated {
|
|
||||||
return fmt.Errorf("%w: address %v, len(code): %d", ErrSenderNoEOA, st.msg.From().Hex(), len(code))
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// Make sure that transaction gasFeeCap is greater than the baseFee (post london)
|
// Make sure that transaction gasFeeCap is greater than the baseFee (post london)
|
||||||
// Note: Logically, this should be `IsCurie`, but we keep `IsLondon` to ensure backward compatibility.
|
// Note: Logically, this should be `IsCurie`, but we keep `IsLondon` to ensure backward compatibility.
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ import (
|
||||||
const (
|
const (
|
||||||
VersionMajor = 5 // Major version component of the current release
|
VersionMajor = 5 // Major version component of the current release
|
||||||
VersionMinor = 8 // Minor version component of the current release
|
VersionMinor = 8 // Minor version component of the current release
|
||||||
VersionPatch = 25 // Patch version component of the current release
|
VersionPatch = 26 // Patch version component of the current release
|
||||||
VersionMeta = "mainnet" // Version metadata to append to the version string
|
VersionMeta = "mainnet" // Version metadata to append to the version string
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue