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 CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
- RPC client now correctly sets `genesis` value in `ACCEPT` header if `version` is unspecified ([#1370](https://github.com/0xMiden/miden-node/pull/1370)).
- Pin protobuf (`protox`) dependencies to avoid breaking changes in transitive dependency ([#1403](https://github.com/0xMiden/miden-node/pull/1403)).
- Fixed no-std compatibility for remote prover clients ([#1407](https://github.com/0xMiden/miden-node/pull/1407)).
- Fixed `AccountProofRequest` to retrieve the latest known state in case specified block number (or chain tip) does not contain account updates ([#1422](https://github.com/0xMiden/miden-node/issues/1422)).

## v0.12.6

Expand Down
5 changes: 3 additions & 2 deletions crates/proto/src/generated/rpc_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@ pub struct AccountProofRequest {
/// ID of the account for which we want to get data
#[prost(message, optional, tag = "1")]
pub account_id: ::core::option::Option<super::account::AccountId>,
/// Block at which we'd like to get this data. If present, must be close to the chain tip.
/// If not present, data from the latest block will be returned.
/// Optional block height at which to return the proof.
///
/// Defaults to current chain tip if unspecified.
#[prost(message, optional, tag = "2")]
pub block_num: ::core::option::Option<super::blockchain::BlockNumber>,
/// Request for additional account details; valid only for public accounts.
Expand Down
13 changes: 9 additions & 4 deletions crates/store/src/db/models/queries/accounts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,7 @@ pub(crate) fn select_account(
Ok(info)
}

/// Select account details at a specific block number from the DB using the given
/// [`SqliteConnection`].
/// Select account details as they are at the given block height.
///
/// # Returns
///
Expand All @@ -118,7 +117,11 @@ pub(crate) fn select_account(
/// account_codes ON accounts.code_commitment = account_codes.code_commitment
/// WHERE
/// account_id = ?1
/// AND block_num = ?2
/// AND block_num <= ?2
/// ORDER BY
/// block_num DESC
/// LIMIT
/// 1
/// ```
pub(crate) fn select_historical_account_at(
conn: &mut SqliteConnection,
Expand All @@ -134,8 +137,10 @@ pub(crate) fn select_historical_account_at(
.filter(
schema::accounts::account_id
.eq(account_id.to_bytes())
.and(schema::accounts::block_num.eq(block_num.to_raw_sql())),
.and(schema::accounts::block_num.le(block_num.to_raw_sql())),
)
.order_by(schema::accounts::block_num.desc())
.limit(1)
.get_result::<(AccountRaw, Option<Vec<u8>>)>(conn)
.optional()?
.ok_or(DatabaseError::AccountNotFoundInDb(account_id))?;
Expand Down
5 changes: 3 additions & 2 deletions proto/proto/store/rpc.proto
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,9 @@ message AccountProofRequest {
// ID of the account for which we want to get data
account.AccountId account_id = 1;

// Block at which we'd like to get this data. If present, must be close to the chain tip.
// If not present, data from the latest block will be returned.
// Optional block height at which to return the proof.
//
// Defaults to current chain tip if unspecified.
optional blockchain.BlockNumber block_num = 2;

// Request for additional account details; valid only for public accounts.
Expand Down
Loading