Skip to content

Commit 1166644

Browse files
authored
Update AuthRequest event to carry either signature or TX summary (#3157)
* refactor: update AuthRequest event to carry either signature or tx summary * chore: update changelog
1 parent ee3ae1a commit 1166644

5 files changed

Lines changed: 71 additions & 38 deletions

File tree

CHANGELOG.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
## v0.16.0 (TBD)
44

55
### Changes
6+
67
- [BREAKING] Replaced the `P2idNote` marker type and its `P2idNote::create` factory with a `P2idNote` struct built via a `bon` typestate builder (`P2idNote::builder()`). P2ID notes must now carry at least one asset; a `P2idNote` converts into a `Note` via `Note::from`, and the builder offers `.asset()`/`.assets()`, `.attachment()`/`.attachments()`, and `.generate_serial_number()` ([#2283](https://github.com/0xMiden/protocol/issues/2283)).
78
- [BREAKING] Replaced the `MintNote` marker type and its `MintNote::create` factory with a struct built via a `bon` typestate builder (`MintNote::builder()`); a `MintNote` converts into a `Note` via `Note::from` ([#2283](https://github.com/0xMiden/protocol/issues/2283)).
89
- [BREAKING] Replaced the `BurnNote` marker type and its `BurnNote::create` factory with a struct built via a `bon` typestate builder (`BurnNote::builder()`); a `BurnNote` converts into a `Note` via `Note::from` ([#2283](https://github.com/0xMiden/protocol/issues/2283)).
@@ -59,22 +60,24 @@
5960
- Refactored `is_max_supply_mutable_internal` in the fungible faucet to read the mutability config through the `get_mutability_config_word` getter instead of accessing the storage slot directly ([#3120](https://github.com/0xMiden/protocol/pull/3120)).
6061
- Added a zero-root check before dispatching the active mint and burn policy in `TokenPolicyManager`, failing with a descriptive error ([#3121](https://github.com/0xMiden/protocol/pull/3121)).
6162
- [BREAKING] Renamed `create_user_fungible_faucet` to `create_singlesig_user_fungible_faucet` and added the `create_multisig_user_fungible_faucet(auth_component: AuthMultisig, ...)` and `create_guarded_user_fungible_faucet(auth_component: AuthGuardedMultisig, ...)`. `create_network_fungible_faucet` now allowlists the canonical `ExpirationTransactionScript` in its tx-script allowlist ([#3143](https://github.com/0xMiden/protocol/pull/3143)).
63+
- Updated `AuthRequest` event to carry either signature of TX summary, but not both ([#3157](https://github.com/0xMiden/protocol/pull/3157)).
6264

6365
### Fixes
66+
6467
- Fixed `update_ger` to explicitly reject duplicate GER insertions with `ERR_GER_ALREADY_REGISTERED` instead of silently accepting them ([#2983](https://github.com/0xMiden/protocol/pull/2983)).
6568
- AggLayer `bridge_out` now rejects B2AGG notes whose `NoteType` is not `Public`, preventing a recipient-identical private note from desyncing the Local Exit Tree from AggLayer's off-chain mirror ([#2988](https://github.com/0xMiden/protocol/pull/2988)).
6669
- Fixed `pausable::assert_not_paused` to guard its storage read with `active_account::has_storage_slot`, making it a no-op on accounts without the `Pausable` component instead of panicking on the missing `is_paused` slot ([#3047](https://github.com/0xMiden/protocol/pull/3047)).
6770
- [BREAKING] Fixed batch ID being serialized/deserialized and potentially not matching the serialized transaction headers ([#3061](https://github.com/0xMiden/protocol/pull/3061)).
6871

69-
## v0.15.2 (TBD)
72+
## v0.15.2 (2026-06-05)
7073

7174
### Changes
7275

7376
- [BREAKING] `AuthNetworkAccount` now gates transaction scripts with a root allowlist instead of banning them outright, enabling network accounts to run approved tx scripts such as setting the expiration delta ([#3028](https://github.com/0xMiden/protocol/pull/3028)).
7477
- [BREAKING] `TransactionScript::root()` now returns `TransactionScriptRoot` instead of `Word` ([#3028](https://github.com/0xMiden/protocol/pull/3028)).
7578
- Renamed `AuthNetworkAccount::with_allowlist` to `with_allowed_notes` and aligned the component's internal allowlist field names, for consistency with `with_allowed_tx_scripts` ([#3049](https://github.com/0xMiden/protocol/pull/3049)).
7679

77-
## v0.15.1 (TBD)
80+
## v0.15.0 (2026-05-22)
7881

7982
### Changes
8083

crates/miden-tx/src/executor/exec_host.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ use crate::host::{
4949
TransactionEvent,
5050
TransactionProgress,
5151
TransactionProgressEvent,
52+
TxSummaryOrSignature,
5253
};
5354
use crate::{AccountProcedureIndexMap, DataStore};
5455

@@ -580,14 +581,14 @@ where
580581

581582
TransactionEvent::AuthRequest {
582583
pub_key_commitment,
583-
tx_summary,
584-
signature,
585-
} => {
586-
if let Some(signature) = signature {
584+
tx_summary_or_signature,
585+
} => match tx_summary_or_signature {
586+
TxSummaryOrSignature::Signature(signature) => {
587587
Ok(self.base_host.on_auth_requested(signature))
588-
} else {
588+
},
589+
TxSummaryOrSignature::TxSummary(tx_summary) => {
589590
self.on_auth_requested(pub_key_commitment, tx_summary).await
590-
}
591+
},
591592
},
592593

593594
// This always returns an error to abort the transaction.

crates/miden-tx/src/host/mod.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,12 @@ use miden_protocol::transaction::{
6060
TransactionMeasurements,
6161
TransactionSummary,
6262
};
63-
pub(crate) use tx_event::{RecipientData, TransactionEvent, TransactionProgressEvent};
63+
pub(crate) use tx_event::{
64+
RecipientData,
65+
TransactionEvent,
66+
TransactionProgressEvent,
67+
TxSummaryOrSignature,
68+
};
6469
pub use tx_progress::TransactionProgress;
6570

6671
use crate::errors::TransactionKernelError;

crates/miden-tx/src/host/tx_event.rs

Lines changed: 44 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,7 @@ pub(crate) enum TransactionEvent {
147147
/// The data necessary to handle an auth request.
148148
AuthRequest {
149149
pub_key_commitment: PublicKeyCommitment,
150-
tx_summary: TransactionSummary,
151-
signature: Option<Vec<Felt>>,
150+
tx_summary_or_signature: TxSummaryOrSignature,
152151
},
153152

154153
Unauthorized {
@@ -165,21 +164,6 @@ pub(crate) enum TransactionEvent {
165164
Progress(TransactionProgressEvent),
166165
}
167166

168-
#[derive(Debug)]
169-
pub(crate) struct AssetPatch {
170-
pub asset_key: AssetVaultKey,
171-
/// The absolute value of `asset_key` in the vault before the operation.
172-
pub initial_vault_value: Word,
173-
/// The absolute value of `asset_key` in the vault after the operation.
174-
pub final_vault_value: Word,
175-
}
176-
177-
#[derive(Debug, Clone)]
178-
pub(crate) struct AssetDelta {
179-
pub delta_op: AssetDeltaOperation,
180-
pub asset: Asset,
181-
}
182-
183167
impl TransactionEvent {
184168
/// Extracts the [`TransactionEventId`] from the stack as well as the data necessary to handle
185169
/// it.
@@ -494,18 +478,24 @@ impl TransactionEvent {
494478
let pub_key_commitment = PublicKeyCommitment::from(process.get_stack_word(5));
495479
let signature_key = Hasher::merge(&[pub_key_commitment.into(), message]);
496480

497-
let signature = process
481+
let auth_request = if let Some(signature) = process
498482
.advice_provider()
499483
.get_mapped_values(&signature_key)
500-
.map(|slice| slice.to_vec());
501-
502-
let tx_summary = extract_tx_summary(base_host, process, message)?;
484+
.map(|slice| slice.to_vec())
485+
{
486+
TransactionEvent::AuthRequest {
487+
pub_key_commitment,
488+
tx_summary_or_signature: TxSummaryOrSignature::Signature(signature),
489+
}
490+
} else {
491+
let tx_summary = extract_tx_summary(base_host, process, message)?;
492+
TransactionEvent::AuthRequest {
493+
pub_key_commitment,
494+
tx_summary_or_signature: TxSummaryOrSignature::TxSummary(tx_summary),
495+
}
496+
};
503497

504-
Some(TransactionEvent::AuthRequest {
505-
pub_key_commitment,
506-
tx_summary,
507-
signature,
508-
})
498+
Some(auth_request)
509499
},
510500

511501
TransactionEventId::Unauthorized => {
@@ -581,6 +571,34 @@ impl TransactionEvent {
581571
}
582572
}
583573

574+
// TX SUMMARY OR SIGNATURE
575+
// ================================================================================================
576+
577+
#[expect(clippy::large_enum_variant)]
578+
#[derive(Debug)]
579+
pub(crate) enum TxSummaryOrSignature {
580+
TxSummary(TransactionSummary),
581+
Signature(Vec<Felt>),
582+
}
583+
584+
// ASSET PATCH AND DELTA
585+
// ================================================================================================
586+
587+
#[derive(Debug)]
588+
pub(crate) struct AssetPatch {
589+
pub asset_key: AssetVaultKey,
590+
/// The absolute value of `asset_key` in the vault before the operation.
591+
pub initial_vault_value: Word,
592+
/// The absolute value of `asset_key` in the vault after the operation.
593+
pub final_vault_value: Word,
594+
}
595+
596+
#[derive(Debug, Clone)]
597+
pub(crate) struct AssetDelta {
598+
pub delta_op: AssetDeltaOperation,
599+
pub asset: Asset,
600+
}
601+
584602
// RECIPIENT DATA
585603
// ================================================================================================
586604

crates/miden-tx/src/prover/prover_host.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,13 @@ use miden_protocol::assembly::{SourceFile, SourceSpan};
1212
use miden_protocol::transaction::{InputNote, InputNotes, RawOutputNote};
1313
use miden_protocol::vm::{EventId, EventName};
1414

15-
use crate::host::{RecipientData, ScriptMastForestStore, TransactionBaseHost, TransactionEvent};
15+
use crate::host::{
16+
RecipientData,
17+
ScriptMastForestStore,
18+
TransactionBaseHost,
19+
TransactionEvent,
20+
TxSummaryOrSignature,
21+
};
1622
use crate::{AccountProcedureIndexMap, TransactionKernelError};
1723

1824
/// The transaction prover host is responsible for handling [`Host`] requests made by the
@@ -185,8 +191,8 @@ where
185191
.on_note_before_add_attachment(note_idx, attachment)
186192
.map(|_| Vec::new()),
187193

188-
TransactionEvent::AuthRequest { signature, .. } => {
189-
if let Some(signature) = signature {
194+
TransactionEvent::AuthRequest { tx_summary_or_signature, .. } => {
195+
if let TxSummaryOrSignature::Signature(signature) = tx_summary_or_signature {
190196
Ok(self.base_host.on_auth_requested(signature))
191197
} else {
192198
Err(TransactionKernelError::other(

0 commit comments

Comments
 (0)