Replies: 2 comments 1 reply
-
|
Please help confirm whether such a problem is possible. |
Beta Was this translation helpful? Give feedback.
0 replies
-
|
hmm, I believe this is technically reachable yes maybe we should pick the max value here? |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Description
There is a potential race condition in
SenderInfo::updatethat can causethe tracked
state_nonceto regress (go backwards), which may incorrectlyaffect transaction pool state.
Problem
In
crates/transaction-pool/src/pool/txpool.rs:impl SenderInfo {
const fn update(&mut self, state_nonce: u64, balance: U256) {
*self = Self { state_nonce, balance }; // Directly replaces!
}
}When
add_transactionis called, it updatessender_infowith thestate_noncefrom validation:
self.sender_info
.entry(tx.sender_id())
.or_default()
.update(on_chain_nonce, on_chain_balance);### Race Condition Scenario
on_canonical_state_changeupdatessender_info.nonce = 5client.latest()which may returnslightly stale state (nonce = 4)
sender_info.update(4, balance)regresses nonce from 5 to 4Impact
Beta Was this translation helpful? Give feedback.
All reactions