From d09a78e8674f983f30e38b5e4a2d21bed592bc95 Mon Sep 17 00:00:00 2001 From: Santiago Pittella <87827390+SantiagoPittella@users.noreply.github.com> Date: Wed, 15 Jan 2025 13:21:19 -0300 Subject: [PATCH 1/2] feat: make AccountIdError public (#1067) * feat: make AccountIdError public --- CHANGELOG.md | 1 + objects/src/lib.rs | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3892b7fd1..588ffa4ef 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -27,6 +27,7 @@ - Introduce `AccountIdError` and make account ID byte representations (`u128`, `[u8; 15]`) consistent (#1055). - Refactor `AccountId` and `AccountIdPrefix` into version wrappers (#1058). - Remove multi-threaded account seed generation due to single-threaded generation being faster (#1061). +- Made `AccountIdError` public (#1067). ## 0.6.2 (2024-11-20) diff --git a/objects/src/lib.rs b/objects/src/lib.rs index 12682c709..a848d227b 100644 --- a/objects/src/lib.rs +++ b/objects/src/lib.rs @@ -25,9 +25,9 @@ mod errors; pub use block::BlockHeader; pub use constants::*; pub use errors::{ - AccountDeltaError, AccountError, AssetError, AssetVaultError, BlockError, ChainMmrError, - NoteError, ProvenTransactionError, TransactionInputError, TransactionOutputError, - TransactionScriptError, + AccountDeltaError, AccountError, AccountIdError, AssetError, AssetVaultError, BlockError, + ChainMmrError, NoteError, ProvenTransactionError, TransactionInputError, + TransactionOutputError, TransactionScriptError, }; pub use miden_crypto::hash::rpo::{Rpo256 as Hasher, RpoDigest as Digest}; pub use vm_core::{Felt, FieldElement, StarkField, Word, EMPTY_WORD, ONE, WORD_SIZE, ZERO}; From ff3d01e010c0ecfc8f4d57dbc40e64c3e1feed8a Mon Sep 17 00:00:00 2001 From: Santiago Pittella <87827390+SantiagoPittella@users.noreply.github.com> Date: Wed, 15 Jan 2025 15:50:52 -0300 Subject: [PATCH 2/2] feat: make MAX_DECIMALS public (#1063) * feat: make MAX_DECIMALS and MAX_MAX_SUPPLY public * docs: update changelog * review: remove MAX_MAX_SUPPLY --- CHANGELOG.md | 1 + miden-lib/src/accounts/faucets/mod.rs | 11 ++++++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 588ffa4ef..d959d5884 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,6 +28,7 @@ - Refactor `AccountId` and `AccountIdPrefix` into version wrappers (#1058). - Remove multi-threaded account seed generation due to single-threaded generation being faster (#1061). - Made `AccountIdError` public (#1067). +- Made `BasicFungibleFaucet::MAX_DECIMALS` public (#1063). ## 0.6.2 (2024-11-20) diff --git a/miden-lib/src/accounts/faucets/mod.rs b/miden-lib/src/accounts/faucets/mod.rs index e763cf8fe..e8045aad1 100644 --- a/miden-lib/src/accounts/faucets/mod.rs +++ b/miden-lib/src/accounts/faucets/mod.rs @@ -3,7 +3,7 @@ use miden_objects::{ Account, AccountBuilder, AccountComponent, AccountIdAnchor, AccountStorageMode, AccountType, StorageSlot, }, - assets::TokenSymbol, + assets::{FungibleAsset, TokenSymbol}, AccountError, Felt, FieldElement, Word, }; @@ -33,8 +33,9 @@ pub struct BasicFungibleFaucet { impl BasicFungibleFaucet { // CONSTANTS // -------------------------------------------------------------------------------------------- - const MAX_MAX_SUPPLY: u64 = (1 << 63) - 1; - const MAX_DECIMALS: u8 = 12; + + /// The maximum number of decimals supported by the component. + pub const MAX_DECIMALS: u8 = 12; // CONSTRUCTORS // -------------------------------------------------------------------------------------------- @@ -47,10 +48,10 @@ impl BasicFungibleFaucet { actual: decimals, max: Self::MAX_DECIMALS, }); - } else if max_supply.as_int() > Self::MAX_MAX_SUPPLY { + } else if max_supply.as_int() > FungibleAsset::MAX_AMOUNT { return Err(AccountError::FungibleFaucetMaxSupplyTooLarge { actual: max_supply.as_int(), - max: Self::MAX_MAX_SUPPLY, + max: FungibleAsset::MAX_AMOUNT, }); }