Skip to content

Commit

Permalink
chore: include txids in indexing logs; add vscode config for rust-ana… (
Browse files Browse the repository at this point in the history
hyperlane-xyz#4537)

- adds support for rust-analyzer with the new workspace split
- includes txids in agent indexing logs, to more easily link message_ids
to their txid. @Mo-Hussain and I spent quite some time today trying to
find the corresponding txid
  • Loading branch information
daniel-savu authored Sep 20, 2024
1 parent aef3dbf commit b872d63
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
11 changes: 10 additions & 1 deletion mono.code-workspace
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@
"cSpell.words": [
"hyperlane"
],
"rust-analyzer.linkedProjects": [
"./rust/main/Cargo.toml",
"./rust/sealevel/Cargo.toml",
],
},
"folders": [
{
Expand All @@ -33,7 +37,10 @@
"path": "./solidity"
},
{
"path": "./rust"
"path": "./rust/main"
},
{
"path": "./rust/sealevel"
}
],
"extensions": {
Expand Down Expand Up @@ -66,6 +73,8 @@
"yoavbls.pretty-ts-errors",
// Yaml language support
"redhat.vscode-yaml",
// Rust language support
"rust-lang.rust-analyzer"
],
// List of extensions recommended by VS Code that should not be recommended for users of this workspace.
"unwantedRecommendations": []
Expand Down
10 changes: 9 additions & 1 deletion rust/main/hyperlane-base/src/contract_sync/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,14 @@ use cursors::ForwardBackwardSequenceAwareSyncCursor;

const SLEEP_DURATION: Duration = Duration::from_secs(5);

#[derive(Debug, derive_new::new)]
#[allow(dead_code)]
/// Utility struct for pretty-printing indexed items.
struct IndexedTxIdAndSequence {
tx_id: H512,
sequence: Option<u32>,
}

/// Entity that drives the syncing of an agent's db with on-chain data.
/// Extracts chain-specific data (emitted checkpoints, messages, etc) from an
/// `indexer` and fills the agent's db with this data.
Expand Down Expand Up @@ -172,7 +180,7 @@ where
?range,
num_logs = logs_found,
estimated_time_to_sync = fmt_sync_time(eta),
sequences = ?logs.iter().map(|(log, _)| log.sequence).collect::<Vec<_>>(),
sequences = ?logs.iter().map(|(log, meta)| IndexedTxIdAndSequence::new(meta.transaction_id, log.sequence)).collect::<Vec<_>>(),
cursor = ?cursor,
"Found log(s) in index range"
);
Expand Down

0 comments on commit b872d63

Please sign in to comment.