Skip to content
Open
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
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@
- [BREAKING] Refactored `TransferPolicy`, `MintPolicyConfig`, and `BurnPolicyConfig` from enums into structs ([#2974](https://github.com/0xMiden/protocol/pull/2974)).
- Added `AccountComponent::has_procedure(root)` helper ([#2974](https://github.com/0xMiden/protocol/pull/2974)).
- Optimized protocol MASM stack-cleaning sequences, saving 1 cycle per occurrence across 9 single-element-extraction procedures ([#3041](https://github.com/0xMiden/protocol/pull/3041)).
- [BREAKING] Removed `AuthMethod` enum, `AccountAuthComponent` / `AccountAuthScheme`, and the `AccessControl::AuthControlled` variant. Faucet and wallet factories now take concrete auth-component types so invalid configurations are rejected at compile time ([#2944](https://github.com/0xMiden/protocol/pull/2944)).
- [BREAKING] Split `create_fungible_faucet` into `create_user_fungible_faucet(auth_component: AuthSingleSigAcl, ...)` (installs `Authority::AuthControlled` directly) and the opinionated `create_network_fungible_faucet(access_control, ...)` (always `AccountType::Public`, builds the `AuthNetworkAccount` allowlist internally from `MintNote` + `BurnNote` script roots with an empty tx-script allowlist). Other auth schemes / shapes are no longer supported through these helpers — fall back to `AccountBuilder` directly. A `user_faucet_single_sig_acl` testing helper is provided behind the `testing` feature ([#2944](https://github.com/0xMiden/protocol/pull/2944)).
- Added `create_multisig_wallet` and `create_guarded_wallet` helpers for `BasicWallet` accounts authenticated by `AuthMultisig` and `AuthGuardedMultisig` respectively ([#2944](https://github.com/0xMiden/protocol/pull/2944)).
- [BREAKING] `create_basic_wallet` now takes `AuthSingleSig` directly and returns `AccountError` instead of the removed `BasicWalletError` ([#2944](https://github.com/0xMiden/protocol/pull/2944)).
- [BREAKING] Removed `AccountInterface::auth()` and `AccountComponentInterface::auth_scheme()`. Auth components are now discovered via `AccountInterface::auth_components()`, which iterates `AccountComponentInterface` variants flagged by `is_auth_component()` ([#2944](https://github.com/0xMiden/protocol/pull/2944)).
- [BREAKING] `FungibleFaucet` no longer installs the `is_paused` storage slot itself. Faucet factories (`create_user_fungible_faucet` / `create_network_fungible_faucet`) now bundle the `Pausable` component (slot + `is_paused()` view procedure) alongside `PausableManager`. Callers using `AccountBuilder` directly must also install `Pausable` or the faucet's mint / burn / transfer / metadata-setter procedures will panic at runtime ([#2944](https://github.com/0xMiden/protocol/pull/2944)).
- [BREAKING] Refactored `TokenPolicyManager` by adding `invoke_send_policy` / `invoke_receive_policy` wrappers (stored in the protocol reserved asset callback slots) that read the active policy root from the new `active_send_policy_proc_root` / `active_receive_policy_proc_root` storage slots ([#3047](https://github.com/0xMiden/protocol/pull/3047)).
- Added a definition of the Miden operator on the architecture overview page and linked it from the note lifecycle ([#3017](https://github.com/0xMiden/protocol/pull/3017)).
- Clarified Miden's operational roles on the architecture overview page and linked them from the note lifecycle ([#3017](https://github.com/0xMiden/protocol/pull/3017)).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
# `Authority` component via `exec.authority::assert_authorized`.
#
# Companion components required:
# - `Authority` (installed via `AccessControl::Ownable2Step` / `AccessControl::Rbac` /
# `AccessControl::AuthControlled`).
# - `Authority` (installed via `AccessControl::Ownable2Step` / `AccessControl::Rbac`, or
# `Authority::AuthControlled` directly by `create_user_fungible_faucet`).
# - `Pausable` — provides the `is_paused` storage slot.

pub use ::miden::standards::access::pausable::manager::pause
Expand Down
10 changes: 2 additions & 8 deletions crates/miden-standards/src/account/access/authority.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,19 +58,13 @@ const RBAC_CONTROLLED: u8 = 2;
#[derive(Debug, Clone, PartialEq, Eq)]
#[non_exhaustive]
pub enum Authority {
/// Authority is the account's auth component; no extra check is performed by
/// `authority::assert_authorized`.
/// Authority is the account's auth component.
AuthControlled = AUTH_CONTROLLED,
/// Authority is the [`Ownable2Step`][crate::account::access::Ownable2Step] owner; the call
/// must be sent by the registered owner.
/// Authority is the [`Ownable2Step`][crate::account::access::Ownable2Step] owner.
OwnerControlled = OWNER_CONTROLLED,
/// Authority is membership in a specific RBAC role. The call must be sent by an account that
/// holds `role` in the
/// [`RoleBasedAccessControl`][crate::account::access::RoleBasedAccessControl] component.
///
/// Requires the [`RoleBasedAccessControl`][crate::account::access::RoleBasedAccessControl]
/// component to be installed on the account; the MASM helper calls into
/// `rbac::assert_sender_has_role` and will fail to link otherwise.
RbacControlled { role: RoleSymbol } = RBAC_CONTROLLED,
}

Expand Down
48 changes: 14 additions & 34 deletions crates/miden-standards/src/account/access/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,52 +7,33 @@ pub mod ownable2step;
pub mod pausable;
pub mod rbac;

/// Access control configuration for account components.
/// Access control configuration for network-style accounts whose authority-gated setters are
/// gated by an owner / role check rather than by the account's auth component.
///
/// Each variant expands into the set of [`AccountComponent`]s that implement that access
/// control choice **plus** the matching [`Authority`] component. The [`Authority`] is
/// auto-yielded so callers don't need to remember to install it separately and so that the
/// authority discriminator stays in sync with the chosen access mode.
/// User-account faucets (where the auth component is itself the setter gate) install
/// [`Authority::AuthControlled`] directly via factories like
/// [`create_user_fungible_faucet`][crate::account::faucets::create_user_fungible_faucet]; they
/// do not need this enum.
///
/// - [`AccessControl::AuthControlled`] yields just [`Authority::AuthControlled`].
/// - [`AccessControl::Ownable2Step`] yields [`Ownable2Step`] + [`Authority::OwnerControlled`].
/// - [`AccessControl::Rbac`] yields [`Ownable2Step`] + [`RoleBasedAccessControl`] + an
/// [`Authority`]. The `authority_role` field selects which authority kind is installed:
/// - [`AccessControl::Ownable2Step`] → [`Ownable2Step`] + [`Authority::OwnerControlled`]. The
/// setter gate enforces `sender == owner`.
/// - [`AccessControl::Rbac`] [`Ownable2Step`] + [`RoleBasedAccessControl`] + an [`Authority`].
/// The `authority_role` field selects which authority kind is installed:
/// - `None` → [`Authority::OwnerControlled`] (the top-level owner gates `set_*` operations).
/// - `Some(role)` → [`Authority::RbacControlled { role }`] (any holder of `role` gates `set_*`
/// operations).
///
/// Pass to
/// [`AccountBuilder::with_components`][miden_protocol::account::AccountBuilder::with_components]
/// to install the access control components on the account:
///
/// ```no_run
/// use miden_protocol::account::AccountBuilder;
/// use miden_standards::account::access::AccessControl;
/// # let owner: miden_protocol::account::AccountId = unimplemented!();
/// # let init_seed = [0u8; 32];
/// AccountBuilder::new(init_seed)
/// .with_components(AccessControl::Rbac { owner, authority_role: None });
/// ```
///
/// For accounts that don't use the [`AccessControl`] convenience but want to install the
/// [`Authority`] component directly, the [`Authority`] enum can be passed via
/// [`AccountBuilder::with_component`][miden_protocol::account::AccountBuilder::with_component].
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum AccessControl {
/// No external access control component is installed; access decisions are gated solely
/// by the account's auth component.
AuthControlled,
/// Two-step ownership transfer with the provided initial owner. Authority for `set_*`
/// operations is fixed to the registered owner.
/// Two-step ownership transfer with the provided initial owner. The setter gate enforces
/// `sender == owner`.
Ownable2Step { owner: AccountId },
/// Role-based access control. Includes [`Ownable2Step`] internally; the provided `owner`
/// Role-based access control. Includes [`Ownable2Step`] internally. The provided `owner`
/// becomes the top-level RBAC authority (the account's owner).
///
/// `authority_role` controls which authority is installed alongside RBAC:
/// - `None` (default) → [`Authority::OwnerControlled`]: the top-level `owner` is the sole
/// authority for `set_*` operations (`set_mint_policy`, `set_burn_policy`, metadata setters).
/// RBAC roles can still be granted/revoked but they do not directly gate the
/// RBAC roles can still be granted and revoked but they do not directly gate the
/// authority-protected procedures.
/// - `Some(role)` → [`Authority::RbacControlled { role }`]: any account holding `role` becomes
/// a valid authority for `set_*` operations. Role membership is managed through the standard
Expand All @@ -72,7 +53,6 @@ impl IntoIterator for AccessControl {
/// always included.
fn into_iter(self) -> Self::IntoIter {
match self {
AccessControl::AuthControlled => vec![Authority::AuthControlled.into()].into_iter(),
AccessControl::Ownable2Step { owner } => {
vec![Ownable2Step::new(owner).into(), Authority::OwnerControlled.into()].into_iter()
},
Expand Down
8 changes: 4 additions & 4 deletions crates/miden-standards/src/account/access/pausable/manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ procedure_root!(
/// [`crate::account::access::Authority`] component via `exec.authority::assert_authorized`.
///
/// `PausableManager` works uniformly with every standard access scheme:
/// - [`crate::account::access::AccessControl::AuthControlled`]
/// [`crate::account::access::Authority::AuthControlled`] gates pause / unpause via the account's
/// own auth component.
/// - [`crate::account::access::Authority::AuthControlled`] — installed directly by
/// [`crate::account::faucets::create_user_fungible_faucet`]; gates pause / unpause via the
/// account's own auth component.
/// - [`crate::account::access::AccessControl::Ownable2Step`] →
/// [`crate::account::access::Authority::OwnerControlled`] requires the Ownable2Step owner.
/// - [`crate::account::access::AccessControl::Rbac`] →
Expand All @@ -39,7 +39,7 @@ procedure_root!(
///
/// Companion components required:
/// - [`crate::account::access::Authority`] — installed automatically by the
/// [`crate::account::access::AccessControl`] enum.
/// [`crate::account::access::AccessControl`] enum (or directly by user-faucet factories).
/// - [`super::Pausable`] — provides the `is_paused` storage slot that pause / unpause write to.
#[derive(Debug, Clone, Copy, Default)]
pub struct PausableManager;
Expand Down
Loading
Loading