Skip to content

Commit 4eef7e0

Browse files
committed
feat: fix nonce off by one
1 parent 0f9f94f commit 4eef7e0

2 files changed

Lines changed: 13 additions & 4 deletions

File tree

rust/main/lander/src/adapter/chains/ethereum/adapter.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -670,8 +670,8 @@ impl AdaptsChain for EthereumAdapter {
670670
);
671671

672672
let mut txs = Vec::new();
673-
let mut nonce = new_finalized_nonce;
674-
while nonce < old_finalized_nonce {
673+
let mut nonce = new_finalized_nonce.saturating_add(U256::one());
674+
while nonce <= old_finalized_nonce {
675675
let tx_uuid = self.nonce_manager.state.get_tracked_tx_uuid(&nonce).await?;
676676
if let Some(tx) = self.nonce_manager.state.get_tracked_tx(&tx_uuid).await? {
677677
txs.push(tx);

rust/main/lander/src/adapter/core.rs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,12 +115,21 @@ pub trait AdaptsChain: Send + Sync {
115115
todo!()
116116
}
117117

118-
/// How often to poll for txs that need to be reprocessed
118+
/// Returns the polling interval for checking if transactions need reprocessing.
119+
///
120+
/// Returns `None` if the adapter does not support transaction reprocessing,
121+
/// or `Some(Duration)` specifying how frequently to poll.
119122
fn reprocess_txs_poll_rate(&self) -> Option<Duration> {
120123
None
121124
}
122125

123-
/// Get a list of txs that need to be reprocessed
126+
/// Get a list of payloads that need to be reprocessed.
127+
///
128+
/// Returns an empty vector if no payloads need reprocessing or if the adapter
129+
/// does not support reprocessing.
130+
///
131+
/// Note: Implementations may update internal state (e.g., finalized nonce boundaries)
132+
/// as part of determining which payloads need reprocessing.
124133
async fn get_reprocess_txs(&self) -> Result<Vec<Transaction>, LanderError> {
125134
Ok(Vec::new())
126135
}

0 commit comments

Comments
 (0)