@@ -269,8 +269,21 @@ func (st *StateTransition) buyGas() error {
269
269
}
270
270
271
271
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
+
272
285
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
274
287
// Gas is free, but no refunds!
275
288
st .gas += st .msg .Gas ()
276
289
st .initialGas = st .msg .Gas ()
@@ -291,12 +304,6 @@ func (st *StateTransition) preCheck() error {
291
304
return fmt .Errorf ("%w: address %v, nonce: %d" , ErrNonceMax ,
292
305
st .msg .From ().Hex (), stNonce )
293
306
}
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
- }
300
307
}
301
308
// Make sure that transaction gasFeeCap is greater than the baseFee (post london)
302
309
// Note: Logically, this should be `IsCurie`, but we keep `IsLondon` to ensure backward compatibility.
0 commit comments