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
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- Partially backported PR#4785 to improve performance of shielded sync.
([\#4966](https://github.com/anoma/namada/pull/4966))
16 changes: 0 additions & 16 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,6 @@ ics23 = "0.12"
usize-set = { version = "0.10", features = ["serialize-borsh", "serialize-serde"] }
impl-num-traits = "0.2"
indexmap = { package = "nam-indexmap", version = "2.7.1-nam.0", features = ["borsh-schema", "serde"] }
init-once = "0.6"
itertools = "0.14"
jubjub = { package = "nam-jubjub", version = "0.10.1-nam.0" }
k256 = { version = "0.13", default-features = false, features = ["ecdsa", "pkcs8", "precomputed-tables", "serde", "std"]}
Expand Down
1 change: 0 additions & 1 deletion crates/sdk/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@ ethers.workspace = true
eyre.workspace = true
fd-lock = { workspace = true, optional = true }
futures.workspace = true
init-once.workspace = true
itertools.workspace = true
jubjub = { workspace = true, optional = true }
lazy_static.workspace = true
Expand Down
24 changes: 8 additions & 16 deletions crates/sdk/src/masp/utilities.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use namada_token::masp::utils::{
};
use namada_tx::event::MaspEvent;
use namada_tx::{IndexedTx, Tx};
use tokio::sync::Semaphore;
use tokio::sync::{OnceCell, Semaphore};

use crate::error::{Error, QueryError};
use crate::masp::{extract_masp_tx, get_indexed_masp_events_at_height};
Expand Down Expand Up @@ -234,7 +234,7 @@ struct IndexerMaspClientShared {
indexer_api: reqwest::Url,
/// Bloom filter to help avoid fetching block heights
/// with no MASP notes.
block_index: init_once::InitOnce<Option<(BlockHeight, xorf::BinaryFuse16)>>,
block_index: OnceCell<Option<(BlockHeight, xorf::BinaryFuse16)>>,
/// Maximum number of concurrent fetches.
max_concurrent_fetches: usize,
}
Expand Down Expand Up @@ -273,13 +273,9 @@ impl IndexerMaspClient {
indexer_api,
max_concurrent_fetches,
semaphore: Semaphore::new(max_concurrent_fetches),
block_index: {
let mut index = init_once::InitOnce::new();
if !using_block_index {
index.init(|| None);
}
index
},
block_index: OnceCell::new_with(
(!using_block_index).then_some(None),
),
});
Self { client, shared }
}
Expand Down Expand Up @@ -428,15 +424,11 @@ impl MaspClient for IndexerMaspClient {
)));
}

let maybe_block_index = self
let maybe_block_index: &Option<_> = self
.shared
.block_index
.try_init_async(async {
let _permit = self.shared.semaphore.acquire().await.unwrap();
self.last_block_index().await.ok()
})
.await
.and_then(Option::as_ref);
.get_or_init(|| async { self.last_block_index().await.ok() })
.await;

let mut fetches = vec![];
loop {
Expand Down
16 changes: 0 additions & 16 deletions wasm/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading