Skip to content

Commit

Permalink
Merge branch 'main' into next
Browse files Browse the repository at this point in the history
  • Loading branch information
bobbinth authored Jan 24, 2025
2 parents 89f54bc + 99fa9d5 commit fb2284b
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 9 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@

- [BREAKING] Incremented minimum supported Rust version to 1.84.

## 0.7.1 (2025-01-24) - `miden-objects` crate only

### Fixes

- Added missing doc comments (#1100).
- Fixed setting of supporting types when instantiating `AccountComponent` from templates (#1103).


## 0.7.0 (2025-01-22)

### Highlights
Expand Down
12 changes: 6 additions & 6 deletions Cargo.lock

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

Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ pub(super) const NON_FUNGIBLE_FAUCET: u8 = 0b11;
pub(super) const REGULAR_ACCOUNT_IMMUTABLE_CODE: u8 = 0b00;
pub(super) const REGULAR_ACCOUNT_UPDATABLE_CODE: u8 = 0b01;

/// Represents the different account types recognized by the protocol.
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
#[repr(u8)]
pub enum AccountType {
Expand Down
3 changes: 3 additions & 0 deletions crates/miden-objects/src/account/account_id/storage_mode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,13 @@ use crate::errors::AccountIdError;
pub(super) const PUBLIC: u8 = 0b00;
pub(super) const PRIVATE: u8 = 0b10;

/// Describes where the state of the account is stored.
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[repr(u8)]
pub enum AccountStorageMode {
/// The account's full state is stored on-chain.
Public = PUBLIC,
/// The account's state is stored off-chain, and only a commitment to it is stored on-chain.
Private = PRIVATE,
}

Expand Down
3 changes: 2 additions & 1 deletion crates/miden-objects/src/account/component/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,8 @@ impl AccountComponent {
storage_slots.extend(entry_storage_slots);
}

AccountComponent::new(template.library().clone(), storage_slots)
Ok(AccountComponent::new(template.library().clone(), storage_slots)?
.with_supported_types(template.metadata().targets().clone()))
}

// ACCESSORS
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,7 @@ mod tests {
name = "Test Component"
description = "This is a test component"
version = "1.0.1"
targets = ["FungibleFaucet"]
targets = ["FungibleFaucet", "RegularAccountImmutableCode"]
[[storage]]
name = "map"
Expand Down Expand Up @@ -536,6 +536,13 @@ mod tests {

let component = AccountComponent::from_template(&template, &storage_placeholders).unwrap();

assert_eq!(
component.supported_types(),
&[AccountType::FungibleFaucet, AccountType::RegularAccountImmutableCode]
.into_iter()
.collect()
);

let storage_map = component.storage_slots.first().unwrap();
match storage_map {
StorageSlot::Map(storage_map) => assert_eq!(storage_map.entries().count(), 3),
Expand Down
2 changes: 2 additions & 0 deletions crates/miden-objects/src/account/delta/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ impl AccountDelta {
}
}

/// Describes the details of an account state transition resulting from applying a transaction to
/// the account.
#[derive(Clone, Debug, PartialEq, Eq)]
pub enum AccountUpdateDetails {
/// Account is private (no on-chain state change).
Expand Down
7 changes: 6 additions & 1 deletion crates/miden-objects/src/account/storage/slot/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,12 @@ pub use r#type::StorageSlotType;
// STORAGE SLOT
// ================================================================================================

/// An object that represents the type of a storage slot.
/// An object representing the contents of an account's storage slot.
///
/// An account storage slot can be of two types:
/// - A simple value which contains a single word (4 field elements or ~32 bytes).
/// - A key value map where both keys and values are words. The capacity of such storage slot is
/// theoretically unlimited.
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum StorageSlot {
Value(Word),
Expand Down

0 comments on commit fb2284b

Please sign in to comment.