Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/run-tests-on-push-to-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions modules/upstream_chain_fetcher/src/upstream_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ pub struct UpstreamCacheRecord {

pub trait Storage {
fn read_chunk(&mut self, chunk_no: usize) -> Result<Vec<UpstreamCacheRecord>>;
fn write_chunk(&mut self, chunk_no: usize, chunk: &Vec<UpstreamCacheRecord>) -> Result<()>;
fn write_chunk(&mut self, chunk_no: usize, chunk: &[UpstreamCacheRecord]) -> Result<()>;
}

pub struct FileStorage {
Expand Down Expand Up @@ -156,7 +156,7 @@ impl Storage for FileStorage {
}
}

fn write_chunk(&mut self, chunk_no: usize, data: &Vec<UpstreamCacheRecord>) -> 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(())
Expand Down Expand Up @@ -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<UpstreamCacheRecord>) -> 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(())
}
}
Expand Down
4 changes: 2 additions & 2 deletions modules/upstream_chain_fetcher/src/upstream_chain_fetcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {}",
Expand Down
2 changes: 1 addition & 1 deletion modules/upstream_chain_fetcher/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ impl FetcherConfig {
let actual = if config.get_string(keydef.0).is_ok() {
config
.get::<T>(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
};
Expand Down