Skip to content
Closed
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
990 changes: 843 additions & 147 deletions Cargo.lock

Large diffs are not rendered by default.

46 changes: 23 additions & 23 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ license = "MIT"
readme = "README.md"
repository = "https://github.com/0xMiden/node"
rust-version = "1.91"
version = "0.14.0-alpha.1"
version = "0.14.0-alpha.2"

# Optimize the cryptography for faster tests involving account creation.
[profile.test.package.miden-crypto]
Expand All @@ -46,35 +46,35 @@ debug = true

[workspace.dependencies]
# Workspace crates.
miden-large-smt-backend-rocksdb = { path = "crates/large-smt-backend-rocksdb", version = "=0.14.0-alpha.1" }
miden-node-block-producer = { path = "crates/block-producer", version = "=0.14.0-alpha.1" }
miden-node-db = { path = "crates/db", version = "=0.14.0-alpha.1" }
miden-node-grpc-error-macro = { path = "crates/grpc-error-macro", version = "=0.14.0-alpha.1" }
miden-node-ntx-builder = { path = "crates/ntx-builder", version = "=0.14.0-alpha.1" }
miden-node-proto = { path = "crates/proto", version = "=0.14.0-alpha.1" }
miden-node-proto-build = { path = "proto", version = "=0.14.0-alpha.1" }
miden-node-rpc = { path = "crates/rpc", version = "=0.14.0-alpha.1" }
miden-node-store = { path = "crates/store", version = "=0.14.0-alpha.1" }
miden-large-smt-backend-rocksdb = { path = "crates/large-smt-backend-rocksdb", version = "=0.14.0-alpha.2" }
miden-node-block-producer = { path = "crates/block-producer", version = "=0.14.0-alpha.2" }
miden-node-db = { path = "crates/db", version = "=0.14.0-alpha.2" }
miden-node-grpc-error-macro = { path = "crates/grpc-error-macro", version = "=0.14.0-alpha.2" }
miden-node-ntx-builder = { path = "crates/ntx-builder", version = "=0.14.0-alpha.2" }
miden-node-proto = { path = "crates/proto", version = "=0.14.0-alpha.2" }
miden-node-proto-build = { path = "proto", version = "=0.14.0-alpha.2" }
miden-node-rpc = { path = "crates/rpc", version = "=0.14.0-alpha.2" }
miden-node-store = { path = "crates/store", version = "=0.14.0-alpha.2" }
miden-node-test-macro = { path = "crates/test-macro" }
miden-node-utils = { path = "crates/utils", version = "=0.14.0-alpha.1" }
miden-node-validator = { path = "crates/validator", version = "=0.14.0-alpha.1" }
miden-remote-prover-client = { path = "crates/remote-prover-client", version = "=0.14.0-alpha.1" }
miden-node-utils = { path = "crates/utils", version = "=0.14.0-alpha.2" }
miden-node-validator = { path = "crates/validator", version = "=0.14.0-alpha.2" }
miden-remote-prover-client = { path = "crates/remote-prover-client", version = "=0.14.0-alpha.2" }
# Temporary workaround until <https://github.com/rust-rocksdb/rust-rocksdb/pull/1029>
# is part of `rocksdb-rust` release
miden-node-rocksdb-cxx-linkage-fix = { path = "crates/rocksdb-cxx-linkage-fix", version = "=0.14.0-alpha.1" }
miden-node-rocksdb-cxx-linkage-fix = { path = "crates/rocksdb-cxx-linkage-fix", version = "=0.14.0-alpha.2" }

# miden-base aka protocol dependencies. These should be updated in sync.
miden-block-prover = { version = "=0.14.0-alpha.1" }
miden-protocol = { default-features = false, version = "=0.14.0-alpha.1" }
miden-standards = { version = "=0.14.0-alpha.1" }
miden-testing = { version = "=0.14.0-alpha.1" }
miden-tx = { default-features = false, version = "=0.14.0-alpha.1" }
miden-tx-batch-prover = { version = "=0.14.0-alpha.1" }
# miden protocol dependencies. These should be updated in sync.
miden-block-prover = { git = "https://github.com/0xMiden/protocol", branch = "next" }
miden-protocol = { default-features = false, git = "https://github.com/0xMiden/protocol", branch = "next" }
miden-standards = { git = "https://github.com/0xMiden/protocol", branch = "next" }
miden-testing = { git = "https://github.com/0xMiden/protocol", branch = "next" }
miden-tx = { default-features = false, git = "https://github.com/0xMiden/protocol", branch = "next" }
miden-tx-batch-prover = { git = "https://github.com/0xMiden/protocol", branch = "next" }

# Other miden dependencies. These should align with those expected by miden-base.
miden-air = { features = ["std", "testing"], version = "0.20" }
miden-air = { features = ["std", "testing"], version = "0.21" }

miden-crypto = { version = "0.19.7" }
miden-crypto = { version = "0.22" }

# External dependencies
anyhow = { version = "1.0" }
Expand Down
9 changes: 5 additions & 4 deletions bin/network-monitor/src/counter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ use miden_protocol::note::{
NoteType,
};
use miden_protocol::transaction::{InputNotes, PartialBlockchain, TransactionArgs};
use miden_protocol::utils::Deserializable;
use miden_protocol::utils::serde::Deserializable;
use miden_protocol::{Felt, Word};
use miden_standards::account::interface::{AccountInterface, AccountInterfaceExt};
use miden_standards::code_builder::CodeBuilder;
Expand Down Expand Up @@ -130,7 +130,7 @@ async fn fetch_counter_value(
.try_into()
.context("failed to convert slot value to word")?;

let value = slot_value.as_elements().last().expect("Word has 4 elements").as_int();
let value = slot_value.as_elements().last().expect("Word has 4 elements").as_canonical_u64();

Ok(Some(value))
}
Expand Down Expand Up @@ -321,7 +321,7 @@ async fn setup_increment_task(
.await?
.unwrap_or(wallet_account_file.account.clone());

let AuthSecretKey::Falcon512Rpo(secret_key) = wallet_account_file
let AuthSecretKey::Falcon512Poseidon2(secret_key) = wallet_account_file
.auth_secret_keys
.first()
.expect("wallet account file should have one auth secret key")
Expand Down Expand Up @@ -821,7 +821,8 @@ async fn create_and_submit_network_note(
rng: &mut ChaCha20Rng,
) -> Result<(String, AccountHeader, BlockNumber)> {
// Create authenticator for transaction signing
let authenticator = BasicAuthenticator::new(&[AuthSecretKey::Falcon512Rpo(secret_key.clone())]);
let authenticator =
BasicAuthenticator::new(&[AuthSecretKey::Falcon512Poseidon2(secret_key.clone())]);

let account_interface = AccountInterface::from_account(wallet_account);

Expand Down
4 changes: 2 additions & 2 deletions bin/network-monitor/src/deploy/wallet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ pub fn create_wallet_account() -> Result<(Account, SecretKey)> {
let mut rng = ChaCha20Rng::from_seed(rand::random());
let secret_key = SecretKey::with_rng(&mut get_rpo_random_coin(&mut rng));
let auth = AuthMethod::SingleSig {
approver: (secret_key.public_key().into(), AuthScheme::Falcon512Rpo),
approver: (secret_key.public_key().into(), AuthScheme::Falcon512Poseidon2),
};
let init_seed: [u8; 32] = rng.random();

Expand All @@ -43,7 +43,7 @@ pub fn save_wallet_account(
secret_key: &SecretKey,
file_path: &Path,
) -> Result<()> {
let auth_secret_key = AuthSecretKey::Falcon512Rpo(secret_key.clone());
let auth_secret_key = AuthSecretKey::Falcon512Poseidon2(secret_key.clone());
let account_file = AccountFile::new(account.clone(), vec![auth_secret_key]);
account_file.write(file_path)?;
Ok(())
Expand Down
4 changes: 3 additions & 1 deletion bin/network-monitor/src/remote_prover.rs
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,9 @@ pub async fn generate_mock_transaction() -> anyhow::Result<TransactionInputs> {

// Create an account with basic authentication
let account = mock_chain_builder
.add_existing_wallet(Auth::BasicAuth { auth_scheme: AuthScheme::Falcon512Rpo })
.add_existing_wallet(Auth::BasicAuth {
auth_scheme: AuthScheme::Falcon512Poseidon2,
})
.context("Failed to add wallet to mock chain")?;

// Create a fungible asset
Expand Down
2 changes: 1 addition & 1 deletion bin/node/src/commands/bundled.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use miden_node_utils::clap::GrpcOptionsExternal;
use miden_node_utils::grpc::UrlExt;
use miden_node_validator::{Validator, ValidatorSigner};
use miden_protocol::crypto::dsa::ecdsa_k256_keccak::SecretKey;
use miden_protocol::utils::Deserializable;
use miden_protocol::utils::serde::Deserializable;
use tokio::net::TcpListener;
use tokio::task::JoinSet;
use url::Url;
Expand Down
2 changes: 1 addition & 1 deletion bin/node/src/commands/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use miden_node_block_producer::{
use miden_node_utils::clap::duration_to_human_readable_string;
use miden_node_validator::ValidatorSigner;
use miden_protocol::crypto::dsa::ecdsa_k256_keccak::SecretKey;
use miden_protocol::utils::Deserializable;
use miden_protocol::utils::serde::Deserializable;
use tokio::net::TcpListener;
use url::Url;

Expand Down
2 changes: 1 addition & 1 deletion bin/node/src/commands/validator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use miden_node_utils::clap::GrpcOptionsInternal;
use miden_node_utils::grpc::UrlExt;
use miden_node_validator::{Validator, ValidatorSigner};
use miden_protocol::crypto::dsa::ecdsa_k256_keccak::SecretKey;
use miden_protocol::utils::Deserializable;
use miden_protocol::utils::serde::Deserializable;
use url::Url;

use crate::commands::{
Expand Down
4 changes: 2 additions & 2 deletions bin/remote-prover/src/server/prover.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ trait ProveRequest {

#[instrument(target=COMPONENT, skip_all, err)]
fn decode_request(request: proto::ProofRequest) -> Result<Self::Input, tonic::Status> {
use miden_protocol::utils::Deserializable;
use miden_protocol::utils::serde::Deserializable;

Self::Input::read_from_bytes(&request.payload).map_err(|e| {
tonic::Status::invalid_argument(e.as_report_context("failed to decode request"))
Expand All @@ -83,7 +83,7 @@ trait ProveRequest {

#[instrument(target=COMPONENT, skip_all)]
fn encode_response(output: Self::Output) -> proto::Proof {
use miden_protocol::utils::Serializable;
use miden_protocol::utils::serde::Serializable;

proto::Proof { payload: output.to_bytes() }
}
Expand Down
8 changes: 6 additions & 2 deletions bin/remote-prover/src/server/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@ impl ProofRequest {
// Create a mock transaction to send to the server
let mut mock_chain_builder = MockChainBuilder::new();
let account = mock_chain_builder
.add_existing_wallet(Auth::BasicAuth { auth_scheme: AuthScheme::Falcon512Rpo })
.add_existing_wallet(Auth::BasicAuth {
auth_scheme: AuthScheme::Falcon512Poseidon2,
})
.unwrap();

let fungible_asset_1: Asset =
Expand Down Expand Up @@ -96,7 +98,9 @@ impl ProofRequest {
// Create a mock transaction to send to the server
let mut mock_chain_builder = MockChainBuilder::new();
let account = mock_chain_builder
.add_existing_wallet(Auth::BasicAuth { auth_scheme: AuthScheme::Falcon512Rpo })
.add_existing_wallet(Auth::BasicAuth {
auth_scheme: AuthScheme::Falcon512Poseidon2,
})
.unwrap();

let fungible_asset_1: Asset =
Expand Down
6 changes: 3 additions & 3 deletions bin/stress-test/src/seeding/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ use miden_protocol::transaction::{
ProvenTransactionBuilder,
TransactionHeader,
};
use miden_protocol::utils::Serializable;
use miden_protocol::utils::serde::Serializable;
use miden_protocol::{Felt, ONE, Word};
use miden_standards::account::auth::AuthSingleSig;
use miden_standards::account::faucets::BasicFungibleFaucet;
Expand Down Expand Up @@ -327,7 +327,7 @@ fn create_account(public_key: PublicKey, index: u64, storage_mode: AccountStorag
AccountBuilder::new(init_seed.try_into().unwrap())
.account_type(AccountType::RegularAccountImmutableCode)
.storage_mode(storage_mode)
.with_auth_component(AuthSingleSig::new(public_key.into(), AuthScheme::Falcon512Rpo))
.with_auth_component(AuthSingleSig::new(public_key.into(), AuthScheme::Falcon512Poseidon2))
.with_component(BasicWallet)
.build()
.unwrap()
Expand All @@ -347,7 +347,7 @@ fn create_faucet() -> Account {
.with_component(BasicFungibleFaucet::new(token_symbol, 2, Felt::new(u64::MAX)).unwrap())
.with_auth_component(AuthSingleSig::new(
key_pair.public_key().into(),
AuthScheme::Falcon512Rpo,
AuthScheme::Falcon512Poseidon2,
))
.build()
.unwrap()
Expand Down
2 changes: 1 addition & 1 deletion bin/stress-test/src/store/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use miden_node_store::state::State;
use miden_node_utils::tracing::grpc::OtelInterceptor;
use miden_protocol::account::AccountId;
use miden_protocol::note::{NoteDetails, NoteTag};
use miden_protocol::utils::{Deserializable, Serializable};
use miden_protocol::utils::serde::{Deserializable, Serializable};
use rand::Rng;
use rand::seq::SliceRandom;
use tokio::fs;
Expand Down
2 changes: 1 addition & 1 deletion crates/block-producer/src/store/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use miden_protocol::batch::OrderedBatches;
use miden_protocol::block::{BlockHeader, BlockInputs, BlockNumber, SignedBlock};
use miden_protocol::note::Nullifier;
use miden_protocol::transaction::ProvenTransaction;
use miden_protocol::utils::Serializable;
use miden_protocol::utils::serde::Serializable;
use tracing::{debug, info, instrument};
use url::Url;

Expand Down
2 changes: 1 addition & 1 deletion crates/block-producer/src/validator/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use miden_node_proto::clients::{Builder, ValidatorClient};
use miden_node_proto::generated as proto;
use miden_protocol::block::ProposedBlock;
use miden_protocol::crypto::dsa::ecdsa_k256_keccak::Signature;
use miden_protocol::utils::{Deserializable, DeserializationError, Serializable};
use miden_protocol::utils::serde::{Deserializable, DeserializationError, Serializable};
use thiserror::Error;
use tracing::{info, instrument};
use url::Url;
Expand Down
2 changes: 1 addition & 1 deletion crates/db/src/conv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ pub(crate) fn raw_sql_to_nonce(raw: i64) -> Felt {
}
#[inline(always)]
pub(crate) fn nonce_to_raw_sql(nonce: Felt) -> i64 {
nonce.as_int() as i64
nonce.as_canonical_u64() as i64
}

#[inline(always)]
Expand Down
2 changes: 1 addition & 1 deletion crates/large-smt-backend-rocksdb/src/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use miden_crypto::merkle::smt::{MAX_LEAF_ENTRIES, SmtLeaf, SmtLeafError};
use miden_crypto::word::LexicographicWord;
use rocksdb::Error as RocksDbError;

use crate::{StorageError, Word};
use crate::Word;

pub(crate) fn map_rocksdb_err(err: RocksDbError) -> StorageError {
StorageError::Backend(Box::new(err))
Expand Down
6 changes: 4 additions & 2 deletions crates/large-smt-backend-rocksdb/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,15 @@ pub use miden_protocol::crypto::merkle::smt::{
SmtLeafError,
SmtProof,
SmtStorage,
StorageError,
StorageUpdateParts,
StorageUpdates,
Subtree,
SubtreeError,
SubtreeUpdate,
};

// Re-export from miden-crypto
pub use miden_crypto::merkle::smt::{StorageError, SubtreeUpdate};

// Also re-export commonly used types for convenience
pub use miden_protocol::{
EMPTY_WORD,
Expand Down
2 changes: 1 addition & 1 deletion crates/large-smt-backend-rocksdb/src/rocksdb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use rocksdb::{
ReadOptions,
WriteBatch,
};
use winter_utils::{Deserializable, Serializable};
use miden_protocol::utils::serde::{Deserializable, Serializable};

use super::{SmtStorage, StorageError, StorageUpdateParts, StorageUpdates, SubtreeUpdate};
use crate::helpers::{insert_into_leaf, map_rocksdb_err, remove_from_leaf};
Expand Down
2 changes: 1 addition & 1 deletion crates/ntx-builder/src/db/models/queries/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -566,7 +566,7 @@ fn mock_account(_account_id: NetworkAccountId) -> miden_protocol::account::Accou
.with_component(component)
.with_auth_component(AuthSingleSig::new(
PublicKeyCommitment::from(Word::default()),
AuthScheme::Falcon512Rpo,
AuthScheme::Falcon512Poseidon2,
))
.build_existing()
.unwrap()
Expand Down
24 changes: 16 additions & 8 deletions crates/proto/src/domain/account.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use miden_protocol::block::account_tree::AccountWitness;
use miden_protocol::crypto::merkle::SparseMerklePath;
use miden_protocol::crypto::merkle::smt::SmtProof;
use miden_protocol::note::NoteAttachment;
use miden_protocol::utils::{Deserializable, DeserializationError, Serializable};
use miden_protocol::utils::serde::{Deserializable, DeserializationError, Serializable};
use miden_standards::note::{NetworkAccountTarget, NetworkAccountTargetError};
use thiserror::Error;

Expand Down Expand Up @@ -298,7 +298,7 @@ impl From<AccountHeader> for proto::account::AccountHeader {
vault_root: Some(header.vault_root().into()),
storage_commitment: Some(header.storage_commitment().into()),
code_commitment: Some(header.code_commitment().into()),
nonce: header.nonce().as_int(),
nonce: header.nonce().as_canonical_u64(),
}
}
}
Expand Down Expand Up @@ -375,11 +375,18 @@ impl TryFrom<proto::rpc::AccountVaultDetails> for AccountVaultDetails {
} else {
let parsed_assets =
Result::<Vec<_>, ConversionError>::from_iter(assets.into_iter().map(|asset| {
let asset = asset
.asset
.ok_or(proto::primitives::Asset::missing_field(stringify!(asset)))?;
let asset = Word::try_from(asset)?;
Asset::try_from(asset).map_err(ConversionError::AssetError)
let key = asset
.key
.ok_or(proto::primitives::Asset::missing_field(stringify!(key)))?;
let asset_key = Word::try_from(key)?;

let value = asset
.value
.ok_or(proto::primitives::Asset::missing_field(stringify!(value)))?;

let asset_value = Word::try_from(value)?;

Asset::from_key_value_words(asset_key, asset_value).map_err(ConversionError::AssetError)
}))?;
Ok(Self::Assets(parsed_assets))
}
Expand All @@ -396,7 +403,8 @@ impl From<AccountVaultDetails> for proto::rpc::AccountVaultDetails {
AccountVaultDetails::Assets(assets) => Self {
too_many_assets: false,
assets: Vec::from_iter(assets.into_iter().map(|asset| proto::primitives::Asset {
asset: Some(proto::primitives::Digest::from(Word::from(asset))),
key: Some(proto::primitives::Digest::from(asset.to_key_word())),
value: Some(proto::primitives::Digest::from(asset.to_value_word())),
})),
},
}
Expand Down
2 changes: 1 addition & 1 deletion crates/proto/src/domain/batch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::collections::BTreeMap;
use miden_protocol::block::BlockHeader;
use miden_protocol::note::{NoteId, NoteInclusionProof};
use miden_protocol::transaction::PartialBlockchain;
use miden_protocol::utils::{Deserializable, Serializable};
use miden_protocol::utils::serde::{Deserializable, Serializable};

use crate::errors::{ConversionError, MissingFieldHelper};
use crate::generated as proto;
Expand Down
2 changes: 1 addition & 1 deletion crates/proto/src/domain/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use miden_protocol::block::{
use miden_protocol::crypto::dsa::ecdsa_k256_keccak::{PublicKey, Signature};
use miden_protocol::note::{NoteId, NoteInclusionProof};
use miden_protocol::transaction::PartialBlockchain;
use miden_protocol::utils::{Deserializable, Serializable};
use miden_protocol::utils::serde::{Deserializable, Serializable};
use thiserror::Error;

use crate::errors::{ConversionError, MissingFieldHelper};
Expand Down
Loading
Loading