chore: include txids in indexing logs; add vscode config for rust-ana… (#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
pull/4540/head
Daniel Savu 2 months ago committed by GitHub
parent aef3dbf4d6
commit b872d635e1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 11
      mono.code-workspace
  2. 10
      rust/main/hyperlane-base/src/contract_sync/mod.rs

@ -20,6 +20,10 @@
"cSpell.words": [ "cSpell.words": [
"hyperlane" "hyperlane"
], ],
"rust-analyzer.linkedProjects": [
"./rust/main/Cargo.toml",
"./rust/sealevel/Cargo.toml",
],
}, },
"folders": [ "folders": [
{ {
@ -33,7 +37,10 @@
"path": "./solidity" "path": "./solidity"
}, },
{ {
"path": "./rust" "path": "./rust/main"
},
{
"path": "./rust/sealevel"
} }
], ],
"extensions": { "extensions": {
@ -66,6 +73,8 @@
"yoavbls.pretty-ts-errors", "yoavbls.pretty-ts-errors",
// Yaml language support // Yaml language support
"redhat.vscode-yaml", "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. // List of extensions recommended by VS Code that should not be recommended for users of this workspace.
"unwantedRecommendations": [] "unwantedRecommendations": []

@ -31,6 +31,14 @@ use cursors::ForwardBackwardSequenceAwareSyncCursor;
const SLEEP_DURATION: Duration = Duration::from_secs(5); 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. /// Entity that drives the syncing of an agent's db with on-chain data.
/// Extracts chain-specific data (emitted checkpoints, messages, etc) from an /// Extracts chain-specific data (emitted checkpoints, messages, etc) from an
/// `indexer` and fills the agent's db with this data. /// `indexer` and fills the agent's db with this data.
@ -172,7 +180,7 @@ where
?range, ?range,
num_logs = logs_found, num_logs = logs_found,
estimated_time_to_sync = fmt_sync_time(eta), 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, cursor = ?cursor,
"Found log(s) in index range" "Found log(s) in index range"
); );

Loading…
Cancel
Save