Skip to content

Commit b393386

Browse files
colinlyguoThegaram
andauthored
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 <[email protected]> --------- Co-authored-by: Péter Garamvölgyi <[email protected]>
1 parent 12536ac commit b393386

File tree

2 files changed

+15
-8
lines changed

2 files changed

+15
-8
lines changed

core/state_transition.go

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -269,8 +269,21 @@ func (st *StateTransition) buyGas() error {
269269
}
270270

271271
func (st *StateTransition) preCheck() error {
272+
// Only check transactions that are not fake
273+
if !st.msg.IsFake() {
274+
// Make sure the sender is an EOA
275+
code := st.state.GetCode(st.msg.From())
276+
_, delegated := types.ParseDelegation(code)
277+
if len(code) > 0 && !delegated {
278+
// If the sender on L1 is a (delegated) EOA, then it must be a (delegated) EOA on L2, too.
279+
// If the sender on L1 is a contract, then we apply address aliasing.
280+
// The probability that the aliased address happens to be a smart contract on L2 is negligible.
281+
return fmt.Errorf("%w: address %v, len(code): %d", ErrSenderNoEOA, st.msg.From().Hex(), len(code))
282+
}
283+
}
284+
272285
if st.msg.IsL1MessageTx() {
273-
// No fee fields to check, no nonce to check, and no need to check if EOA (L1 already verified it for us)
286+
// No fee fields to check, no nonce to check
274287
// Gas is free, but no refunds!
275288
st.gas += st.msg.Gas()
276289
st.initialGas = st.msg.Gas()
@@ -291,12 +304,6 @@ func (st *StateTransition) preCheck() error {
291304
return fmt.Errorf("%w: address %v, nonce: %d", ErrNonceMax,
292305
st.msg.From().Hex(), stNonce)
293306
}
294-
// Make sure the sender is an EOA
295-
code := st.state.GetCode(st.msg.From())
296-
_, delegated := types.ParseDelegation(code)
297-
if len(code) > 0 && !delegated {
298-
return fmt.Errorf("%w: address %v, len(code): %d", ErrSenderNoEOA, st.msg.From().Hex(), len(code))
299-
}
300307
}
301308
// Make sure that transaction gasFeeCap is greater than the baseFee (post london)
302309
// Note: Logically, this should be `IsCurie`, but we keep `IsLondon` to ensure backward compatibility.

params/version.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import (
2424
const (
2525
VersionMajor = 5 // Major version component of the current release
2626
VersionMinor = 8 // Minor version component of the current release
27-
VersionPatch = 25 // Patch version component of the current release
27+
VersionPatch = 26 // Patch version component of the current release
2828
VersionMeta = "mainnet" // Version metadata to append to the version string
2929
)
3030

0 commit comments

Comments
 (0)