From bb5bd05447955cb10c3da86a370f51eafc021873 Mon Sep 17 00:00:00 2001 From: Zelimir Fedoran Date: Mon, 1 Sep 2025 20:23:45 -0400 Subject: [PATCH] sneaky bug fixes --- network/src/archive/pack.rs | 30 +++++++++++++++--------------- network/src/archive/sync.rs | 6 +++--- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/network/src/archive/pack.rs b/network/src/archive/pack.rs index b0c232c1..be4d2561 100644 --- a/network/src/archive/pack.rs +++ b/network/src/archive/pack.rs @@ -39,14 +39,6 @@ pub async fn run(rpc: Arc, mut rx: Rx, miner: Pubkey, store: Arc, miner_address: &Pubkey, tape_address: &Pubkey, @@ -116,7 +116,7 @@ pub fn update_merkle_canopy_for_segment( } /// Updates the Merkle canopy for the provided sector number. -pub fn update_merkle_canopy_for_sector( +fn update_merkle_canopy_for_sector( store: &Arc, miner_address: &Pubkey, tape_address: &Pubkey, @@ -215,7 +215,7 @@ pub fn get_tape_root( } /// Computes packed leaves (stored solution bytes). -pub fn compute_sector_leaves_packed( +fn compute_sector_leaves_packed( store: &Arc, tape_address: &Pubkey, sector_number: u64, @@ -238,7 +238,7 @@ pub fn compute_sector_leaves_packed( } /// Computes unpacked leaves (reconstructed 128-byte data from solutions). -pub fn compute_sector_leaves_unpacked( +fn compute_sector_leaves_unpacked( store: &Arc, miner_address: &Pubkey, tape_address: &Pubkey, @@ -270,7 +270,7 @@ pub fn compute_sector_leaves_unpacked( } /// Computes the root node for a sector at the specified layer. -pub fn compute_sector_root( +fn compute_sector_root( leaves: &[Leaf], empty_hashes: &[Hash], ) -> Result { @@ -299,7 +299,7 @@ pub fn compute_sector_root( } /// Helper to update a specific MerkleCacheKey layer with the new sector root. -pub fn update_sector_canopy_with_key( +fn update_sector_canopy_with_key( store: &TapeStore, sector_number: u64, root: Hash, @@ -320,7 +320,7 @@ pub fn update_sector_canopy_with_key( } /// Helper to create or init the zero values for a tape -pub fn get_or_create_empty_hashes( +fn get_or_create_empty_hashes( store: &Arc, tape_address: &Pubkey, ) -> Result> { diff --git a/network/src/archive/sync.rs b/network/src/archive/sync.rs index aba5648e..8645d1ad 100644 --- a/network/src/archive/sync.rs +++ b/network/src/archive/sync.rs @@ -194,6 +194,9 @@ pub async fn sync_from_block( let mut visited: HashSet = HashSet::new(); let mut stack: Vec = Vec::new(); + let miner_bytes = miner_address.to_bytes(); + let mem = Arc::new(packx::build_memory(&miner_bytes)); + // Ensure the tape address is stored if finalized let (tape, _) = get_tape_account(client, tape_address).await?; if tape.state == u64::from(TapeState::Finalized) { @@ -256,9 +259,6 @@ pub async fn sync_from_block( .await .map_err(|e| anyhow!("Failed to get epoch account: {}", e))?.0; - let miner_bytes = miner_address.to_bytes(); - let mem = Arc::new(packx::build_memory(&miner_bytes)); - for (key, data) in segment_writes { if key.address != *tape_address { continue;