Skip to content

Commit

Permalink
Updated to the latest next branch of miden-objects (#494)
Browse files Browse the repository at this point in the history
* fix: update to the latest `miden-objects`

* refactor: remove use of `std::iter`
  • Loading branch information
polydez authored Sep 13, 2024
1 parent a680949 commit 2b24ef7
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 15 deletions.
6 changes: 3 additions & 3 deletions Cargo.lock

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

14 changes: 7 additions & 7 deletions bin/faucet/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@ use miden_objects::{
BlockHeader, Felt, Word,
};
use miden_tx::{
auth::BasicAuthenticator, utils::Serializable, DataStore, DataStoreError, ProvingOptions,
TransactionExecutor, TransactionInputs, TransactionProver,
auth::BasicAuthenticator, utils::Serializable, DataStore, DataStoreError,
LocalTransactionProver, ProvingOptions, TransactionExecutor, TransactionInputs,
TransactionProver,
};
use rand::{rngs::StdRng, thread_rng, Rng};
use rand_chacha::{rand_core::SeedableRng, ChaCha20Rng};
Expand Down Expand Up @@ -123,14 +124,13 @@ impl FaucetClient {
&mut self,
executed_tx: ExecutedTransaction,
) -> Result<u32, FaucetError> {
let transaction_prover = TransactionProver::new(ProvingOptions::default());
let transaction_prover = LocalTransactionProver::new(ProvingOptions::default());

let delta = executed_tx.account_delta().clone();

let proven_transaction =
transaction_prover.prove_transaction(executed_tx).map_err(|err| {
FaucetError::InternalServerError(format!("Failed to prove transaction: {}", err))
})?;
let proven_transaction = transaction_prover.prove(executed_tx).map_err(|err| {
FaucetError::InternalServerError(format!("Failed to prove transaction: {}", err))
})?;

let request = SubmitProvenTransactionRequest {
transaction: proven_transaction.to_bytes(),
Expand Down
11 changes: 6 additions & 5 deletions crates/store/src/db/tests.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
use std::collections::BTreeMap;

use miden_lib::transaction::TransactionKernel;
use miden_node_proto::domain::accounts::AccountSummary;
use miden_objects::{
Expand All @@ -11,7 +9,7 @@ use miden_objects::{
},
delta::AccountUpdateDetails,
Account, AccountCode, AccountDelta, AccountId, AccountStorage, AccountStorageDelta,
AccountVaultDelta,
AccountVaultDelta, StorageSlot,
},
assets::{Asset, AssetVault, FungibleAsset, NonFungibleAsset, NonFungibleAssetDetails},
block::{BlockAccountUpdate, BlockNoteIndex, BlockNoteTree},
Expand Down Expand Up @@ -335,7 +333,10 @@ fn test_sql_public_account_details() {
let non_fungible_faucet_id =
AccountId::try_from(ACCOUNT_ID_NON_FUNGIBLE_FAUCET_ON_CHAIN).unwrap();

let mut storage = AccountStorage::new(vec![], BTreeMap::new()).unwrap();
let mut storage = AccountStorage::new(
std::iter::repeat(StorageSlot::Value(Word::default())).take(6).collect(),
)
.unwrap();
storage.set_item(1, num_to_word(1)).unwrap();
storage.set_item(3, num_to_word(3)).unwrap();
storage.set_item(5, num_to_word(5)).unwrap();
Expand Down Expand Up @@ -431,7 +432,7 @@ fn test_sql_public_account_details() {
assert_eq!(account_read.nonce(), account.nonce());

// Cleared item was not serialized, check it and apply delta only with clear item second time:
assert_eq!(account_read.storage().get_item(3), RpoDigest::default());
assert_eq!(account_read.storage().get_item(3), Ok(RpoDigest::default()));

let storage_delta = AccountStorageDelta::from_iters([3], [], []);
account_read
Expand Down

0 comments on commit 2b24ef7

Please sign in to comment.