Skip to content

fix(transaction-pool): reject queued txs discarded on insert#3360

Open
joohhnnn wants to merge 3 commits intotempoxyz:mainfrom
joohhnnn:fix/aa2d-queued-discard-result
Open

fix(transaction-pool): reject queued txs discarded on insert#3360
joohhnnn wants to merge 3 commits intotempoxyz:mainfrom
joohhnnn:fix/aa2d-queued-discard-result

Conversation

@joohhnnn
Copy link
Copy Markdown
Contributor

Returns DiscardedOnInsert when an AA2d queued transaction is immediately evicted by discard() during insertion instead of reporting it as parked.

keeps AA2d pool insert semantics aligned with the standard pool and avoids reporting success for transactions that are no longer in the pool.

Copy link
Copy Markdown
Contributor

@mattsse mattsse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this has unrelated changes

please reduce this to just the fix

@joohhnnn joohhnnn requested a review from mattsse March 30, 2026 10:34
Copy link
Copy Markdown
Contributor

@mattsse mattsse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this is correct and we should return an error here because it's possible that this will discard the tx itself if its queued.

but this now introduces some side-effects because this will then bypass:

let added = self.aa_2d_pool.write().add_transaction(
Arc::new(tx),
state_nonce,
hardfork,
)?;
let hash = *added.hash();
if let Some(pending) = added.as_pending() {
if pending.discarded.iter().any(|tx| *tx.hash() == hash) {
return Err(PoolError::new(hash, PoolErrorKind::DiscardedOnInsert));
}
self.protocol_pool
.inner()
.on_new_pending_transaction(pending);
}
let state = added.transaction_state();
// notify regular event listeners from the protocol pool
self.protocol_pool.inner().notify_event_listeners(&added);
self.protocol_pool
.inner()
.on_new_transaction(added.into_new_transaction_event());

so idk we should make this change like this

@joohhnnn joohhnnn requested a review from mattsse March 30, 2026 13:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants