Skip to content

Commit

Permalink
Merge branch 'main' of github.com:abacus-network/abacus-monorepo into…
Browse files Browse the repository at this point in the history
… trevor/some-svm-improvements
  • Loading branch information
tkporter committed Dec 12, 2024
2 parents 51e643d + f9396fc commit 720d269
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
19 changes: 12 additions & 7 deletions rust/main/agents/relayer/src/msg/processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,24 +86,29 @@ impl ForwardBackwardIterator {
loop {
let high_nonce_message_status = self.high_nonce_iter.try_get_next_nonce(metrics)?;
let low_nonce_message_status = self.low_nonce_iter.try_get_next_nonce(metrics)?;
// Always prioritize the high nonce message

match (high_nonce_message_status, low_nonce_message_status) {
// Keep iterating if only processed messages are found
// Always prioritize advancing the the high nonce iterator, as
// we have a preference for higher nonces
(MessageStatus::Processed, _) => {
self.high_nonce_iter.iterate();
}
(_, MessageStatus::Processed) => {
self.low_nonce_iter.iterate();
}
// Otherwise return - either a processable message or nothing to process
(MessageStatus::Processable(high_nonce_message), _) => {
self.high_nonce_iter.iterate();
return Ok(Some(high_nonce_message));
}

// Low nonce messages are only processed if the high nonce iterator
// can't make any progress
(_, MessageStatus::Processed) => {
self.low_nonce_iter.iterate();
}
(_, MessageStatus::Processable(low_nonce_message)) => {
self.low_nonce_iter.iterate();
return Ok(Some(low_nonce_message));
}

// If both iterators give us unindexed messages, there are no messages at the moment
(MessageStatus::Unindexed, MessageStatus::Unindexed) => return Ok(None),
}
// This loop may iterate through millions of processed messages, blocking the runtime.
Expand Down Expand Up @@ -157,7 +162,7 @@ impl DirectionalNonceIterator {
}

fn try_get_next_nonce(
&mut self,
&self,
metrics: &MessageProcessorMetrics,
) -> Result<MessageStatus<HyperlaneMessage>> {
if let Some(message) = self.indexed_message_with_nonce()? {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ impl HyperlaneSealevelTokenPlugin for CollateralPlugin {
vec![
AccountMeta::new_readonly(token.plugin_data.spl_token_program, false).into(),
AccountMeta::new_readonly(spl_associated_token_account::id(), false).into(),
AccountMeta::new(token.plugin_data.mint, false).into(),
AccountMeta::new_readonly(token.plugin_data.mint, false).into(),
AccountMeta::new(recipient_associated_token_account, false).into(),
AccountMeta::new(ata_payer_account_key, false).into(),
AccountMeta::new(token.plugin_data.escrow, false).into(),
Expand Down

0 comments on commit 720d269

Please sign in to comment.