Skip to content

Commit

Permalink
Move crates into crates/ and rename plural modules to singular (#1091)
Browse files Browse the repository at this point in the history
  • Loading branch information
PhilippGackstatter authored Jan 22, 2025
1 parent 1bb0e9e commit 8295806
Show file tree
Hide file tree
Showing 196 changed files with 274 additions and 269 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
- [BREAKING] Removed `GENESIS_BLOCK` public constant (#1088).
- Add CI check for unused dependencies (#1075).
- Added storage placeholder types and support for templated map (#1074).
- [BREAKING] Move crates into `crates/` and rename plural modules to singular (#1091).

## 0.6.2 (2024-11-20)

Expand Down
14 changes: 7 additions & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
[workspace]
resolver = "2"
members = [
"miden-lib",
"miden-tx",
"miden-proving-service-client",
"objects",
"crates/miden-lib",
"crates/miden-tx",
"crates/miden-proving-service-client",
"crates/miden-objects",
"bin/bench-tx",
"bin/proving-service",
]
Expand Down Expand Up @@ -36,11 +36,11 @@ lto = true
assembly = { package = "miden-assembly", version = "0.12", default-features = false }
assert_matches = { version = "1.5", default-features = false }
miden-crypto = { version = "0.13", default-features = false }
miden-lib = { path = "miden-lib", version = "0.7", default-features = false }
miden-objects = { path = "objects", version = "0.7", default-features = false }
miden-lib = { path = "crates/miden-lib", version = "0.7", default-features = false }
miden-objects = { path = "crates/miden-objects", version = "0.7", default-features = false }
miden-prover = { version = "0.12", default-features = false }
miden-stdlib = { version = "0.12", default-features = false }
miden-tx = { path = "miden-tx", version = "0.7", default-features = false }
miden-tx = { path = "crates/miden-tx", version = "0.7", default-features = false }
miden-verifier = { version = "0.12", default-features = false }
rand = { version = "0.8", default-features = false }
thiserror = { version = "2.0", default-features = false }
Expand Down
8 changes: 4 additions & 4 deletions bin/bench-tx/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ use std::{
path::Path,
};

use miden_lib::{notes::create_p2id_note, transaction::TransactionKernel};
use miden_lib::{note::create_p2id_note, transaction::TransactionKernel};
use miden_objects::{
accounts::{AccountId, AccountStorageMode, AccountType},
assets::{Asset, FungibleAsset},
account::{AccountId, AccountStorageMode, AccountType},
asset::{Asset, FungibleAsset},
crypto::rand::RpoRandomCoin,
notes::NoteType,
note::NoteType,
transaction::{TransactionArgs, TransactionMeasurements, TransactionScript},
Felt,
};
Expand Down
6 changes: 3 additions & 3 deletions bin/bench-tx/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ extern crate alloc;
pub use alloc::{collections::BTreeMap, string::String};
use std::sync::Arc;

use miden_lib::accounts::{auth::RpoFalcon512, wallets::BasicWallet};
use miden_lib::account::{auth::RpoFalcon512, wallets::BasicWallet};
use miden_objects::{
accounts::{Account, AccountBuilder, AccountStorageMode, AccountType, AuthSecretKey},
assets::Asset,
account::{Account, AccountBuilder, AccountStorageMode, AccountType, AuthSecretKey},
asset::Asset,
crypto::dsa::rpo_falcon512::{PublicKey, SecretKey},
transaction::TransactionMeasurements,
};
Expand Down
4 changes: 2 additions & 2 deletions bin/proving-service/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ mod test {

use miden_lib::transaction::TransactionKernel;
use miden_objects::{
assets::{Asset, FungibleAsset},
notes::NoteType,
asset::{Asset, FungibleAsset},
note::NoteType,
testing::{
account_code::DEFAULT_AUTH_SCRIPT,
account_id::{ACCOUNT_ID_FUNGIBLE_FAUCET_ON_CHAIN, ACCOUNT_ID_SENDER},
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use miden_objects::{
accounts::{AccountComponent, StorageSlot},
account::{AccountComponent, StorageSlot},
crypto::dsa::rpo_falcon512::PublicKey,
};

use crate::accounts::components::rpo_falcon_512_library;
use crate::account::components::rpo_falcon_512_library;

/// An [`AccountComponent`] implementing the RpoFalcon512 signature scheme for authentication of
/// transactions.
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
use miden_objects::{
accounts::{
account::{
Account, AccountBuilder, AccountComponent, AccountIdAnchor, AccountStorageMode,
AccountType, StorageSlot,
},
assets::{FungibleAsset, TokenSymbol},
asset::{FungibleAsset, TokenSymbol},
AccountError, Felt, FieldElement, Word,
};

use super::AuthScheme;
use crate::accounts::{auth::RpoFalcon512, components::basic_fungible_faucet_library};
use crate::account::{auth::RpoFalcon512, components::basic_fungible_faucet_library};

// BASIC FUNGIBLE FAUCET ACCOUNT COMPONENT
// ================================================================================================
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
use alloc::string::ToString;

use miden_objects::{
accounts::{
account::{
Account, AccountBuilder, AccountComponent, AccountIdAnchor, AccountStorageMode, AccountType,
},
AccountError, Word,
};

use super::AuthScheme;
use crate::accounts::{auth::RpoFalcon512, components::basic_wallet_library};
use crate::account::{auth::RpoFalcon512, components::basic_wallet_library};

// BASIC WALLET
// ================================================================================================
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions miden-lib/src/lib.rs → crates/miden-lib/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ use miden_objects::{
mod auth;
pub use auth::AuthScheme;

pub mod accounts;
pub mod account;
pub mod errors;
pub mod notes;
pub mod note;
pub mod transaction;

// RE-EXPORTS
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
use alloc::vec::Vec;

use miden_objects::{
accounts::AccountId,
assets::Asset,
account::AccountId,
asset::Asset,
block::BlockNumber,
crypto::rand::FeltRng,
notes::{
note::{
Note, NoteAssets, NoteDetails, NoteExecutionHint, NoteExecutionMode, NoteInputs,
NoteMetadata, NoteRecipient, NoteTag, NoteType,
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use miden_objects::{
notes::NoteScript,
note::NoteScript,
utils::{sync::LazyLock, Deserializable},
vm::Program,
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
use miden_objects::{
accounts::AccountId,
assets::Asset,
notes::{NoteExecutionMode, NoteInputs, NoteRecipient, NoteTag, NoteType},
account::AccountId,
asset::Asset,
note::{NoteExecutionMode, NoteInputs, NoteRecipient, NoteTag, NoteType},
NoteError, Word,
};

use crate::notes::scripts;
use crate::note::scripts;

/// Creates a [NoteRecipient] for the P2ID note.
///
Expand Down Expand Up @@ -56,8 +56,8 @@ pub fn build_swap_tag(
mod tests {
use miden_objects::{
self,
accounts::{AccountIdVersion, AccountStorageMode, AccountType},
assets::{FungibleAsset, NonFungibleAsset, NonFungibleAssetDetails},
account::{AccountIdVersion, AccountStorageMode, AccountType},
asset::{FungibleAsset, NonFungibleAsset, NonFungibleAssetDetails},
};

use super::*;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use alloc::{boxed::Box, vec::Vec};
use core::error::Error;

use miden_objects::{notes::NoteMetadata, AccountDeltaError, AssetError, Digest, Felt, NoteError};
use miden_objects::{note::NoteMetadata, AccountDeltaError, AssetError, Digest, Felt, NoteError};
use thiserror::Error;

// TRANSACTION KERNEL ERROR
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use alloc::vec::Vec;

use miden_objects::{
accounts::{Account, StorageSlot},
account::{Account, StorageSlot},
transaction::{ChainMmr, InputNote, TransactionArgs, TransactionInputs, TransactionScript},
vm::AdviceInputs,
Digest, Felt, FieldElement, Word, EMPTY_WORD, WORD_SIZE, ZERO,
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use alloc::{string::ToString, sync::Arc, vec::Vec};

use miden_objects::{
accounts::{AccountCode, AccountHeader, AccountId, AccountStorageHeader},
account::{AccountCode, AccountHeader, AccountId, AccountStorageHeader},
assembly::{Assembler, DefaultSourceManager, KernelLibrary},
block::BlockNumber,
crypto::merkle::{MerkleError, MerklePath},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use miden_objects::{
accounts::{AccountHeader, AccountId},
account::{AccountHeader, AccountId},
AccountError, Felt, Word, WORD_SIZE,
};

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::time::Duration;

use criterion::{criterion_group, criterion_main, Criterion};
use miden_objects::{
accounts::{AccountId, AccountIdVersion, AccountStorageMode, AccountType},
account::{AccountId, AccountIdVersion, AccountStorageMode, AccountType},
Digest,
};
use rand::{Rng, SeedableRng};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use crate::{
// ACCOUNT ID ANCHOR
// ================================================================================================

/// The anchor of an [`AccountId`](crate::accounts::AccountId). See the type's documentation for
/// The anchor of an [`AccountId`](crate::account::AccountId). See the type's documentation for
/// details on anchors.
///
/// This type is recommended to be created from a reference to a [`BlockHeader`] via the `TryFrom`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use vm_processor::DeserializationError;

use super::v0;
use crate::{
accounts::{
account::{
account_id::AccountIdPrefixV0, AccountIdV0, AccountIdVersion, AccountStorageMode,
AccountType,
},
Expand All @@ -27,7 +27,7 @@ use crate::{
/// The serialization formats of [`AccountIdPrefix`] and [`AccountId`][id] are compatible. In
/// particular, a prefix can be deserialized from the serialized bytes of a full id.
///
/// [id]: crate::accounts::AccountId
/// [id]: crate::account::AccountId
#[derive(Debug, Copy, Clone, Eq, PartialEq)]
pub enum AccountIdPrefix {
V0(AccountIdPrefixV0),
Expand Down Expand Up @@ -56,7 +56,7 @@ impl AccountIdPrefix {
///
/// If debug_assertions are enabled (e.g. in debug mode), this function panics if the given
/// felt is invalid according to the constraints in the
/// [`AccountId`](crate::accounts::AccountId) documentation.
/// [`AccountId`](crate::account::AccountId) documentation.
pub fn new_unchecked(prefix: Felt) -> Self {
// The prefix contains the metadata.
// If we add more versions in the future, we may need to generalize this.
Expand Down Expand Up @@ -296,7 +296,7 @@ impl Deserializable for AccountIdPrefix {
#[cfg(test)]
mod tests {
use super::*;
use crate::accounts::AccountIdV0;
use crate::account::AccountIdV0;

#[test]
fn account_id_prefix_construction() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use crate::errors::AccountIdError;

const VERSION_0_NUMBER: u8 = 0;

/// The version of an [`AccountId`](crate::accounts::AccountId).
/// The version of an [`AccountId`](crate::account::AccountId).
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[repr(u8)]
pub enum AccountIdVersion {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ use vm_processor::{DeserializationError, Digest};

use crate::{errors::AccountIdError, AccountError, ACCOUNT_TREE_DEPTH};

/// The identifier of an [`Account`](crate::accounts::Account).
/// The identifier of an [`Account`](crate::account::Account).
///
/// This enum is a wrapper around concrete versions of IDs. The following documents version 0.
///
Expand Down Expand Up @@ -89,8 +89,8 @@ use crate::{errors::AccountIdError, AccountError, ACCOUNT_TREE_DEPTH};
/// than [`u16::MAX`] so that at least one of the upper 16 bits is always zero. This ensures that
/// the entire suffix is valid even if the remaining bits of the felt are one.
/// - The lower 8 bits of the suffix may be overwritten when the ID is encoded in other layouts such
/// as the [`NoteMetadata`](crate::notes::NoteMetadata). In such cases, it can happen that all
/// bits of the encoded suffix would be one, so having the epoch constraint is important.
/// as the [`NoteMetadata`](crate::note::NoteMetadata). In such cases, it can happen that all bits
/// of the encoded suffix would be one, so having the epoch constraint is important.
/// - The ID is dependent on the hash of an epoch block. This is a block whose number is a multiple
/// of 2^[`BlockNumber::EPOCH_LENGTH_EXPONENT`][epoch_len_exp], e.g. `0`, `65536`, `131072`, ...
/// These are the first blocks of epoch 0, 1, 2, ... We call this dependence _anchoring_ because
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use vm_core::{Felt, Word};
use vm_processor::Digest;

use crate::{
accounts::{
account::{
account_id::{
v0::{compute_digest, validate_prefix},
AccountIdVersion,
Expand Down Expand Up @@ -100,7 +100,7 @@ mod log {
use vm_processor::Digest;

use super::AccountType;
use crate::accounts::AccountStorageMode;
use crate::account::AccountStorageMode;

/// Keeps track of the best digest found so far and count how many iterations have been done.
pub struct Log {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use vm_core::{
use vm_processor::{DeserializationError, Digest};

use crate::{
accounts::{
account::{
account_id::{
account_type::{
FUNGIBLE_FAUCET, NON_FUNGIBLE_FAUCET, REGULAR_ACCOUNT_IMMUTABLE_CODE,
Expand All @@ -31,7 +31,7 @@ use crate::{
// ACCOUNT ID VERSION 0
// ================================================================================================

/// Version 0 of the [`Account`](crate::accounts::Account) identifier.
/// Version 0 of the [`Account`](crate::account::Account) identifier.
///
/// See the [`AccountId`](super::AccountId) type's documentation for details.
#[derive(Debug, Copy, Clone, Eq, PartialEq)]
Expand Down Expand Up @@ -154,7 +154,7 @@ impl AccountIdV0 {
storage_commitment: Digest,
anchor_block_hash: Digest,
) -> Result<Word, AccountError> {
crate::accounts::account_id::seed::compute_account_seed(
crate::account::account_id::seed::compute_account_seed(
init_seed,
account_type,
storage_mode,
Expand Down Expand Up @@ -504,7 +504,7 @@ mod tests {

use super::*;
use crate::{
accounts::AccountIdPrefix,
account::AccountIdPrefix,
testing::account_id::{
ACCOUNT_ID_FUNGIBLE_FAUCET_ON_CHAIN, ACCOUNT_ID_NON_FUNGIBLE_FAUCET_OFF_CHAIN,
ACCOUNT_ID_OFF_CHAIN_SENDER, ACCOUNT_ID_REGULAR_ACCOUNT_IMMUTABLE_CODE_ON_CHAIN,
Expand Down
Loading

0 comments on commit 8295806

Please sign in to comment.