Skip to content

Commit eb9ef9f

Browse files
authored
chore: update miden-base commit (0xMiden#1339)
1 parent 266ae6a commit eb9ef9f

File tree

10 files changed

+195
-180
lines changed

10 files changed

+195
-180
lines changed

Cargo.lock

Lines changed: 173 additions & 160 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bin/miden-cli/src/commands/account.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -258,10 +258,7 @@ async fn print_summary_table<AUTH>(
258258
Cell::new("Code Commitment"),
259259
Cell::new(account.code().commitment().to_string()),
260260
]);
261-
table.add_row(vec![
262-
Cell::new("Vault Root"),
263-
Cell::new(account.vault().asset_tree().root().to_string()),
264-
]);
261+
table.add_row(vec![Cell::new("Vault Root"), Cell::new(account.vault().root().to_string())]);
265262
table.add_row(vec![
266263
Cell::new("Storage Root"),
267264
Cell::new(account.storage().commitment().to_string()),

crates/rust-client/src/keystore/fs_keystore.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use std::string::ToString;
77
use std::sync::{Arc, RwLock};
88
use std::vec::Vec;
99

10-
use miden_objects::account::AuthSecretKey;
10+
use miden_objects::account::{AuthSecretKey, Signature};
1111
use miden_objects::{Felt, Word};
1212
use miden_tx::AuthenticationError;
1313
use miden_tx::auth::{SigningInputs, TransactionAuthenticator};
@@ -139,7 +139,8 @@ impl<R: Rng + Send + Sync> TransactionAuthenticator for FilesystemKeyStore<R> {
139139
let AuthSecretKey::RpoFalcon512(k) =
140140
secret_key.ok_or(AuthenticationError::UnknownPublicKey(pub_key.to_hex()))?;
141141

142-
miden_tx::auth::signatures::get_falcon_signature(&k, message, &mut *rng)
142+
let signature = Signature::RpoFalcon512(k.sign_with_rng(message, &mut rng));
143+
Ok(signature.to_prepared_signature())
143144
}
144145
}
145146

crates/rust-client/src/lib.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,8 +181,7 @@ pub mod asset {
181181
pub mod auth {
182182
pub use miden_lib::AuthScheme;
183183
pub use miden_lib::account::auth::{AuthRpoFalcon512, NoAuth};
184-
pub use miden_objects::account::AuthSecretKey;
185-
pub use miden_tx::auth::signatures::get_falcon_signature;
184+
pub use miden_objects::account::{AuthSecretKey, Signature};
186185
pub use miden_tx::auth::{BasicAuthenticator, SigningInputs, TransactionAuthenticator};
187186
}
188187

crates/rust-client/src/store/data_store.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -120,11 +120,9 @@ impl DataStore for ClientDataStore {
120120
});
121121
}
122122

123-
AssetWitness::new(vault.asset_tree().open(&vault_key)).map_err(|err| {
124-
DataStoreError::Other {
125-
error_msg: "Failed to open vault asset tree".into(),
126-
source: Some(Box::new(err)),
127-
}
123+
AssetWitness::new(vault.open(vault_key).into()).map_err(|err| DataStoreError::Other {
124+
error_msg: "Failed to open vault asset tree".into(),
125+
source: Some(Box::new(err)),
128126
})
129127
}
130128

crates/rust-client/src/store/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@ pub trait Store: Send + Sync {
393393
return Ok(None);
394394
};
395395

396-
let witness = AssetWitness::new(vault.asset_tree().open(&asset.vault_key()))?;
396+
let witness = AssetWitness::new(vault.open(asset.vault_key()).into())?;
397397

398398
Ok(Some((asset, witness)))
399399
}

crates/rust-client/src/test_utils/common.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ pub async fn wait_for_tx(client: &mut TestClient, transaction_id: TransactionId)
197197
std::thread::sleep(Duration::from_secs(1));
198198
},
199199
TransactionStatus::Discarded(cause) => {
200-
anyhow::bail!("transaction was discarded with cause: {:?}", cause);
200+
anyhow::bail!("transaction was discarded with cause: {cause:?}");
201201
},
202202
}
203203

crates/sqlite-store/src/merkle_store.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ use miden_client::account::{AccountStorage, StorageMap, StorageSlot};
33
use miden_client::asset::{Asset, AssetVault};
44
use miden_client::crypto::{MerklePath, MerkleStore, NodeIndex, SMT_DEPTH, SmtLeaf, SmtProof};
55
use miden_client::store::StoreError;
6+
use miden_objects::crypto::merkle::Smt;
67

78
/// Retrieves the Merkle proof for a specific asset in the merkle store.
89
pub fn get_asset_proof(
@@ -37,7 +38,12 @@ pub fn update_asset_nodes(
3738

3839
/// Inserts the asset vault SMT nodes to the merkle store.
3940
pub fn insert_asset_nodes(merkle_store: &mut MerkleStore, vault: &AssetVault) {
40-
merkle_store.extend(vault.asset_tree().inner_nodes());
41+
// We need to build the SMT from the vault iterable entries as
42+
// we don't have direct access to the vault's SMT nodes.
43+
// Safe unwrap as we are sure that the vault's SMT nodes are valid.
44+
let smt =
45+
Smt::with_entries(vault.assets().map(|asset| (asset.vault_key(), asset.into()))).unwrap();
46+
merkle_store.extend(smt.inner_nodes());
4147
}
4248

4349
/// Retrieves the Merkle proof for a specific storage map item in the merkle store.

crates/testing/miden-client-tests/src/tests.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2011,8 +2011,7 @@ async fn storage_and_vault_proofs() {
20112011
.unwrap()
20122012
.unwrap();
20132013

2014-
let expected_witness =
2015-
AssetWitness::new(vault.asset_tree().open(&asset.vault_key())).unwrap();
2014+
let expected_witness = AssetWitness::new(vault.open(asset.vault_key()).into()).unwrap();
20162015
assert_eq!(witness, expected_witness);
20172016

20182017
// Check that specific map item proof matches the one in the storage

crates/web-client/src/web_keystore.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use alloc::sync::Arc;
33
use alloc::vec::Vec;
44

55
use idxdb_store::auth::{get_account_auth_by_pub_key, insert_account_auth};
6-
use miden_client::auth::{AuthSecretKey, SigningInputs, TransactionAuthenticator};
6+
use miden_client::auth::{AuthSecretKey, Signature, SigningInputs, TransactionAuthenticator};
77
use miden_client::keystore::KeyStoreError;
88
use miden_client::utils::{Deserializable, RwLock, Serializable};
99
use miden_client::{AuthenticationError, Felt, Word};
@@ -78,6 +78,8 @@ impl<R: Rng> TransactionAuthenticator for WebKeyStore<R> {
7878

7979
let AuthSecretKey::RpoFalcon512(k) =
8080
secret_key.ok_or(AuthenticationError::UnknownPublicKey(pub_key.to_hex()))?;
81-
miden_client::auth::get_falcon_signature(&k, message, &mut *rng)
81+
82+
let signature = Signature::RpoFalcon512(k.sign_with_rng(message, &mut rng));
83+
Ok(signature.to_prepared_signature())
8284
}
8385
}

0 commit comments

Comments
 (0)