Fix issue with different state depending on input order.

This commit fixes the issue where the submission of a transaction with an authority which already has a pending transaction would fail. While submitting the authorization first and the transaction second would work.

This is unexpected because when using gap nonces, the behavior could still be correct according to the limitations introduced for the EIP -27702.
This commit is contained in:
Luis Ayuso 2025-03-10 12:29:52 +01:00
parent 9fe8e2bab8
commit 00a4aa7f69
No known key found for this signature in database

View file

@ -633,10 +633,21 @@ func (pool *LegacyPool) validateAuth(tx *types.Transaction) error {
return ErrInflightTxLimitReached
}
}
// Authorities cannot conflict with any pending or queued transactions.
// For symmetry, Allow at most one in-flight tx for any authority with a pending
// transaction
if auths := tx.SetCodeAuthorities(); len(auths) > 0 {
for _, auth := range auths {
if pool.pending[auth] != nil || pool.queue[auth] != nil {
var count int
pending := pool.pending[auth]
if pending != nil {
count += pending.Len()
}
queue := pool.queue[auth]
if queue != nil {
count += queue.Len()
}
if count > 1 {
return ErrAuthorityReserved
}
}