Gracefully handle inconsistent RPC providers in ForwardMessageSyncCursor (#2302)

### Description

RPC providers can be inconsistent. When a message has just been inserted
into the mailbox, it's possible that one Mailbox.count() query returns N
and a subsequent query returns N-1.

### Drive-by changes

None
pull/2315/head
Asa Oines 2 years ago committed by GitHub
parent bb0d688311
commit 2ace873f9e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      rust/hyperlane-base/src/contract_sync/cursor.rs

@ -121,7 +121,10 @@ impl ForwardMessageSyncCursor {
Ok(Some((from, to, Duration::from_secs(0)))) Ok(Some((from, to, Duration::from_secs(0))))
} }
Ordering::Greater => { Ordering::Greater => {
panic!("Cursor is ahead of mailbox, this should never happen."); // Providers may be internally inconsistent, e.g. RPC request A could hit a node
// whose tip is N and subsequent RPC request B could hit a node whose tip is < N.
debug!("Cursor count is greater than Mailbox count");
Ok(None)
} }
} }
} }

Loading…
Cancel
Save