From 4b463ea7b9a2eaff27b1635177fe6ff03ef4336e Mon Sep 17 00:00:00 2001 From: Michal Nazarewicz Date: Tue, 20 Aug 2024 03:14:27 +0200 Subject: [PATCH] fmt --- solana/trie-geyser/src/plugin.rs | 9 +++++---- solana/trie-geyser/src/proof.rs | 3 ++- solana/trie-geyser/src/worker.rs | 13 ++++++------- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/solana/trie-geyser/src/plugin.rs b/solana/trie-geyser/src/plugin.rs index 3da04d10..dd419d70 100644 --- a/solana/trie-geyser/src/plugin.rs +++ b/solana/trie-geyser/src/plugin.rs @@ -58,10 +58,11 @@ impl GeyserPlugin for Plugin { return Err(utils::custom_err(msg)); } - let cfg = config::Config::load(config_file.as_ref()).map_err(|err| { - log::error!("{config_file}: {err}"); - err - })?; + let cfg = + config::Config::load(config_file.as_ref()).map_err(|err| { + log::error!("{config_file}: {err}"); + err + })?; let (sender, receiver) = crossbeam_channel::unbounded(); let thread = std::thread::Builder::new() .name("witnessed-trie-worker".into()) diff --git a/solana/trie-geyser/src/proof.rs b/solana/trie-geyser/src/proof.rs index 6cdce061..26d19cc0 100644 --- a/solana/trie-geyser/src/proof.rs +++ b/solana/trie-geyser/src/proof.rs @@ -81,7 +81,8 @@ impl MerkleProof { } else { accounts.par_sort_unstable_by(|a, b| a.0.cmp(&b.0)); } - let pos = accounts.binary_search_by_key(&pubkey, |item| &item.0).ok()?; + let pos = + accounts.binary_search_by_key(&pubkey, |item| &item.0).ok()?; let root = compute_merkle_root(accounts); let proof = generate_merkle_proof(accounts, pos); Some((root, proof)) diff --git a/solana/trie-geyser/src/worker.rs b/solana/trie-geyser/src/worker.rs index f0851bc1..e5388ff1 100644 --- a/solana/trie-geyser/src/worker.rs +++ b/solana/trie-geyser/src/worker.rs @@ -1,11 +1,10 @@ use std::collections::{BTreeMap, HashMap}; +use cf_solana::proof::AccountHashData; use solana_accounts_db::accounts_hash::AccountHash; use solana_sdk::hash::Hash; use solana_sdk::pubkey::Pubkey; -use cf_solana::proof::AccountHashData; - use crate::{config, proof, types, utils}; /// Message sent from the plugin to the worker thread. @@ -167,11 +166,11 @@ impl Worker { // Calculate Account Delta Hash (Merkle Root) and Merkle proofs for // witness account. - let (accounts_delta_hash, account_proof) = - proof::MerkleProof::new( - &mut account_hashes, - &self.config.witness_account, - ).unwrap(); + let (accounts_delta_hash, account_proof) = proof::MerkleProof::new( + &mut account_hashes, + &self.config.witness_account, + ) + .unwrap(); // Calculate BankHash based on accounts_delta_hash and information // extracted in Step 2