Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implemented function for computing of old account states based on deltas #563

Open
wants to merge 34 commits into
base: next
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 32 commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
25a82ff
feat: prepare DB structure for new delta format
polydez Nov 25, 2024
ea8898c
chore: remove unused dependencies
polydez Nov 25, 2024
5c0f4d8
fix: delta merging bugs
polydez Nov 25, 2024
209ee7b
fix: remove obsolete check in test
polydez Nov 25, 2024
97389f2
fix: update directory name to correspond common format
polydez Nov 26, 2024
1dfa146
feat: compute old account states by deltas in DB
polydez Nov 28, 2024
419f871
refactor: rename DB tables
polydez Nov 29, 2024
3b10b3c
refactor: add `WITHOUT ROWID` to tables where ROWID is unnecessary
polydez Nov 29, 2024
4b5cfd8
refactor: don't require allocations and clones for `bulk_insert`
polydez Dec 2, 2024
8552b12
fix: get rid of `unsafe` in `NonFungibleAsset` construction from `Word`
polydez Dec 2, 2024
560d00d
Merge branch 'refs/heads/next' into polydez-refactor-deltas-in-db
polydez Dec 2, 2024
9b83153
refactor: extract utils to separate module inside `sql`
polydez Dec 2, 2024
8945b7f
refactor: rename `account_nonce_updates` table to `account_deltas`
polydez Dec 2, 2024
9ea1f17
docs: improve function description for `select_account_state_delta`
polydez Dec 2, 2024
45ce1b6
Merge branch 'next' into polydez-refactor-deltas-in-db
polydez Dec 2, 2024
98fc38d
fix: compilation errors
polydez Dec 2, 2024
c153a52
Merge branch 'polydez-refactor-deltas-in-db' into polydez-compute-old…
polydez Dec 2, 2024
3203526
fix: table names
polydez Dec 3, 2024
8099914
fix: get rid of `unsafe`
polydez Dec 3, 2024
9a54663
tests: implement test, fix bugs
polydez Dec 4, 2024
aa6d939
refactor: rename `account_hash_update_from_row` to `account_summary_f…
polydez Dec 4, 2024
bb22838
refactor: rename `account_hash_update_from_row` to `account_summary_f…
polydez Dec 4, 2024
8fd5bb1
refactor: get rid of `u32_to_value`
polydez Dec 4, 2024
42267e5
refactor: remove unnecessary indexes
polydez Dec 4, 2024
431eb5a
refactor: multiple inserts instead of `bulk_insert`
polydez Dec 4, 2024
dbffa9a
refactor: multiple queries instead of single query with unions
polydez Dec 4, 2024
a4f4ed3
Merge branch 'polydez-refactor-deltas-in-db' into polydez-compute-old…
polydez Dec 4, 2024
ab3a196
refactor: multiple queries instead of single query with unions
polydez Dec 4, 2024
f075699
Merge branch 'next' into polydez-compute-old-acc-states
polydez Dec 5, 2024
064aaf3
docs: fix example test for `insert_sql` macro
polydez Dec 6, 2024
8b5cacb
formatting: apply rustfmt
polydez Dec 6, 2024
c2e387e
refactor: address review comments
polydez Dec 9, 2024
9e15f5b
Merge branch 'refs/heads/next' into polydez-compute-old-acc-states
polydez Dec 26, 2024
76c68b4
refactor: update to the latest `next`
polydez Dec 26, 2024
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
2 changes: 1 addition & 1 deletion bin/faucet/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ impl FaucetClient {
&self.data_store
}

/// Returns the id of the faucet account.
/// Returns the ID of the faucet account.
pub fn get_faucet_id(&self) -> AccountId {
self.id
}
Expand Down
2 changes: 1 addition & 1 deletion bin/faucet/src/handlers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ pub async fn get_tokens(

let mut client = state.client.lock().await;

// Receive and hex user account id
// Receive and hex user account ID
let target_account_id = AccountId::from_hex(req.account_id.as_str())
.map_err(|err| HandlerError::BadRequest(err.to_string()))?;

Expand Down
4 changes: 2 additions & 2 deletions crates/block-producer/src/test_utils/store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ impl MockStoreSuccessBuilder {
}

pub struct MockStoreSuccess {
/// Map account id -> account hash
/// Map account ID -> account hash
pub accounts: Arc<RwLock<SimpleSmt<ACCOUNT_TREE_DEPTH>>>,

/// Stores the nullifiers of the notes that were consumed
Expand All @@ -175,7 +175,7 @@ pub struct MockStoreSuccess {
/// The number of times `apply_block()` was called
pub num_apply_block_called: Arc<RwLock<u32>>,

/// Maps note id -> note inclusion proof for all created notes
/// Maps note ID -> note inclusion proof for all created notes
pub notes: Arc<RwLock<BTreeMap<NoteId, NoteInclusionProof>>>,
}

Expand Down
4 changes: 2 additions & 2 deletions crates/proto/src/generated/account.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
#[prost(skip_debug)]
pub struct AccountId {
/// A miden account is defined with a little bit of proof-of-work, the id itself is defined as
/// the first word of a hash digest. For this reason account ids can be considered as random
/// A miden account is defined with a little bit of proof-of-work, the ID itself is defined as
/// the first word of a hash digest. For this reason account IDs can be considered as random
/// values, because of that the encoding below uses fixed 64 bits, instead of zig-zag encoding.
#[prost(fixed64, tag = "1")]
pub id: u64,
Expand Down
4 changes: 2 additions & 2 deletions crates/rpc-proto/proto/account.proto
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ package account;
import "digest.proto";

message AccountId {
// A miden account is defined with a little bit of proof-of-work, the id itself is defined as
// the first word of a hash digest. For this reason account ids can be considered as random
// A miden account is defined with a little bit of proof-of-work, the ID itself is defined as
// the first word of a hash digest. For this reason account IDs can be considered as random
// values, because of that the encoding below uses fixed 64 bits, instead of zig-zag encoding.
fixed64 id = 1;
}
Expand Down
2 changes: 1 addition & 1 deletion crates/rpc/src/server/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ impl api_server::Api for RpcApi {
self.block_producer.clone().submit_proven_transaction(request).await
}

/// Returns details for public (public) account by id.
/// Returns details for public account by ID.
Copy link
Collaborator

@igamigo igamigo Dec 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is a bit misleading. This method still works for non-public accounts, right? It just doesn't return details for them (ie, it just returns the stored hash). There are some other related functions that have the same problem IIRC (like select_accounts_by_ids which get_account_proofs uses, both for private and public accounts).

#[instrument(
target = "miden-rpc",
name = "rpc:get_account_details",
Expand Down
Loading