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
10 changes: 5 additions & 5 deletions crates/rpc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,19 +86,19 @@ Returns nullifier synchronization data for a set of prefixes within a given bloc
clients to efficiently track nullifier creation by retrieving only the nullifiers produced between two blocks.

Caller specifies the `prefix_len` (currently only 16), the list of prefix values (`nullifiers`), and the block
range (`block_from`, optional `block_to`). The response includes all matching nullifiers created within that
range (`from_start_block`, optional `to_end_block`). The response includes all matching nullifiers created within that
range, the last block included in the response (`block_num`), and the current chain tip (`chain_tip`).

If the response is chunked (i.e., `block_num < block_to`), continue by issuing another request with
`block_from = block_num + 1` to retrieve subsequent updates.
If the response is chunked due to exceeding the maximum returned entries, continue by issuing another request with
consecutive block number to retrieve subsequent updates.

---

### SyncAccountVault

Returns information that allows clients to sync asset values for specific public accounts within a block range.

For any `[block_from..block_to]` range, the latest known set of assets is returned for the requested account ID.
For any `block_range`, the latest known set of assets is returned for the requested account ID.
The data can be split and a cutoff block may be selected if there are too many assets to sync. The response contains
the chain tip so that the caller knows when it has been reached.

Expand Down Expand Up @@ -139,7 +139,7 @@ notes, client can make additional filtering of that data on its side.

Returns storage map synchronization data for a specified public account within a given block range. This method allows clients to efficiently sync the storage map state of an account by retrieving only the changes that occurred between two blocks.

Caller specifies the `account_id` of the public account and the block range (`block_from`, `block_to`) for which to retrieve storage updates. The response includes all storage map key-value updates that occurred within that range, along with the last block included in the sync and the current chain tip.
Caller specifies the `account_id` of the public account and the block range `block_range` for which to retrieve storage updates. The response includes all storage map key-value updates that occurred within that range, along with the last block included in the sync and the current chain tip.

This endpoint enables clients to maintain an updated view of account storage.

Expand Down
8 changes: 4 additions & 4 deletions crates/store/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,9 @@ Returns nullifier synchronization data for a set of prefixes within a given bloc

Caller specifies the `prefix_len` (currently only 16), the list of prefix values (`nullifiers`), and the block
range (`block_from`, optional `block_to`). The response includes all matching nullifiers created within that
range, the last block included in the response (`block_num`), and the current chain tip (`chain_tip`).
range, the last block included in the response (`resp.block_num`), and the current chain tip (`chain_tip`).

If the response is chunked (i.e., `block_num < block_to`), continue by issuing another request with
If the response is chunked (i.e., `resp.block_num < block_to`), continue by issuing another request with
`block_from = block_num + 1` to retrieve subsequent updates.

---
Expand All @@ -118,7 +118,7 @@ If the response is chunked (i.e., `block_num < block_to`), continue by issuing a

Returns information that allows clients to sync asset values for specific public accounts within a block range.

For any `[block_from..block_to]` range, the latest known set of assets is returned for the requested account ID.
For any `block_range`, the latest known set of assets is returned for the requested account ID.
The data can be split and a cutoff block may be selected if there are too many assets to sync. The response contains
the chain tip so that the caller knows when it has been reached.

Expand Down Expand Up @@ -159,7 +159,7 @@ data contains excessive notes and nullifiers, client can make additional filteri

Returns storage map synchronization data for a specified public account within a given block range. This method allows clients to efficiently sync the storage map state of an account by retrieving only the changes that occurred between two blocks.

Caller specifies the `account_id` of the public account and the block range (`block_from`, `block_to`) for which to retrieve storage updates. The response includes all storage map key-value updates that occurred within that range, along with the last block included in the sync and the current chain tip.
Caller specifies the `account_id` of the public account and the block range `block_range` for which to retrieve storage updates. The response includes all storage map key-value updates that occurred within that range, along with the last block included in the sync and the current chain tip.

This endpoint enables clients to maintain an updated view of account storage.

Expand Down
23 changes: 9 additions & 14 deletions crates/store/src/db/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use std::collections::{BTreeMap, BTreeSet, HashSet};
use std::ops::RangeInclusive;
use std::path::PathBuf;

use anyhow::Context;
Expand Down Expand Up @@ -283,8 +284,7 @@ impl Db {
&self,
prefix_len: u32,
nullifier_prefixes: Vec<u32>,
block_from: BlockNumber,
block_to: BlockNumber,
block_range: RangeInclusive<BlockNumber>,
) -> Result<(Vec<NullifierInfo>, BlockNumber)> {
assert_eq!(prefix_len, 16, "Only 16-bit prefixes are supported");

Expand All @@ -295,8 +295,7 @@ impl Db {
conn,
prefix_len as u8,
&nullifier_prefixes[..],
block_from,
block_to,
block_range,
)
})
.await
Expand Down Expand Up @@ -474,18 +473,15 @@ impl Db {

/// Selects storage map values for syncing storage maps for a specific account ID.
///
/// The returned values are the latest known values up to `block_to`, and no values earlier
/// than `block_from` are returned.
/// The returned values are the latest known values up to `block_range.end()`, and no values
/// earlier than `block_range.start()` are returned.
pub(crate) async fn select_storage_map_sync_values(
&self,
account_id: AccountId,
block_from: BlockNumber,
block_to: BlockNumber,
block_range: RangeInclusive<BlockNumber>,
) -> Result<StorageMapValuesPage> {
self.transact("select storage map sync values", move |conn| {
models::queries::select_account_storage_map_values(
conn, account_id, block_from, block_to,
)
models::queries::select_account_storage_map_values(conn, account_id, block_range)
})
.await
}
Expand Down Expand Up @@ -539,11 +535,10 @@ impl Db {
pub async fn get_account_vault_sync(
&self,
account_id: AccountId,
block_from: BlockNumber,
block_to: BlockNumber,
block_range: RangeInclusive<BlockNumber>,
) -> Result<(BlockNumber, Vec<AccountVaultValue>)> {
self.transact("account vault sync", move |conn| {
queries::select_account_vault_assets(conn, account_id, block_from, block_to)
queries::select_account_vault_assets(conn, account_id, block_range)
})
.await
}
Expand Down
Loading