diff --git a/.github/workflows/run-tests-on-push-to-main.yml b/.github/workflows/run-tests-on-push-to-main.yml index 8453cda2..27fd5c2c 100644 --- a/.github/workflows/run-tests-on-push-to-main.yml +++ b/.github/workflows/run-tests-on-push-to-main.yml @@ -38,6 +38,7 @@ jobs: --package acropolis_module_snapshot_bootstrapper \ --package acropolis_module_spdd_state \ --package acropolis_module_stake_delta_filter \ + --package acropolis_module_upstream_chain_fetcher \ --package acropolis_module_utxo_state - name: Run Build diff --git a/modules/upstream_chain_fetcher/src/upstream_cache.rs b/modules/upstream_chain_fetcher/src/upstream_cache.rs index 6012cc70..64838fbe 100644 --- a/modules/upstream_chain_fetcher/src/upstream_cache.rs +++ b/modules/upstream_chain_fetcher/src/upstream_cache.rs @@ -15,7 +15,7 @@ pub struct UpstreamCacheRecord { pub trait Storage { fn read_chunk(&mut self, chunk_no: usize) -> Result>; - fn write_chunk(&mut self, chunk_no: usize, chunk: &Vec) -> Result<()>; + fn write_chunk(&mut self, chunk_no: usize, chunk: &[UpstreamCacheRecord]) -> Result<()>; } pub struct FileStorage { @@ -156,7 +156,7 @@ impl Storage for FileStorage { } } - fn write_chunk(&mut self, chunk_no: usize, data: &Vec) -> Result<()> { + fn write_chunk(&mut self, chunk_no: usize, data: &[UpstreamCacheRecord]) -> Result<()> { let mut file = File::create(self.get_file_name(chunk_no))?; file.write_all(serde_json::to_string(data)?.as_bytes())?; Ok(()) @@ -204,8 +204,8 @@ mod test { Ok(self.rec.get(&chunk_no).unwrap_or(&vec![]).clone()) } - fn write_chunk(&mut self, chunk_no: usize, chunk: &Vec) -> Result<()> { - self.rec.insert(chunk_no, chunk.clone()); + fn write_chunk(&mut self, chunk_no: usize, chunk: &[UpstreamCacheRecord]) -> Result<()> { + self.rec.insert(chunk_no, chunk.to_vec()); Ok(()) } } diff --git a/modules/upstream_chain_fetcher/src/upstream_chain_fetcher.rs b/modules/upstream_chain_fetcher/src/upstream_chain_fetcher.rs index 157b5b48..71322189 100644 --- a/modules/upstream_chain_fetcher/src/upstream_chain_fetcher.rs +++ b/modules/upstream_chain_fetcher/src/upstream_chain_fetcher.rs @@ -242,11 +242,11 @@ impl UpstreamChainFetcher { "Waiting for snapshot completion on {}", cfg.snapshot_completion_topic ); - let mut completion_subscription = snapshot_complete + let completion_subscription = snapshot_complete .as_mut() .ok_or_else(|| anyhow!("Snapshot topic subscription missing"))?; - match Self::wait_snapshot_completion(&mut completion_subscription).await? { + match Self::wait_snapshot_completion(completion_subscription).await? { Some(block) => { info!( "Notified snapshot complete at slot {} block number {}", diff --git a/modules/upstream_chain_fetcher/src/utils.rs b/modules/upstream_chain_fetcher/src/utils.rs index 5c538014..415ed1c8 100644 --- a/modules/upstream_chain_fetcher/src/utils.rs +++ b/modules/upstream_chain_fetcher/src/utils.rs @@ -73,7 +73,7 @@ impl FetcherConfig { let actual = if config.get_string(keydef.0).is_ok() { config .get::(keydef.0) - .or_else(|e| Err(anyhow!("cannot parse {} value: {e}", keydef.0)))? + .map_err(|e| anyhow!("cannot parse {} value: {e}", keydef.0))? } else { keydef.1 };