@@ -11,6 +11,7 @@ use miden_node_utils::tracing::OpenTelemetrySpanExt;
1111use miden_protocol:: Word ;
1212use miden_protocol:: account:: {
1313 Account ,
14+ AccountDelta ,
1415 AccountId ,
1516 AccountStorageHeader ,
1617 PartialAccount ,
@@ -120,10 +121,18 @@ fn log_transient_retry<E: std::error::Error>(operation: &'static str, err: &E, s
120121}
121122
122123/// The result of a successful transaction execution.
123- ///
124- /// Contains the transaction ID, any notes that failed during filtering, and note scripts fetched
125- /// from the remote RPC service that should be persisted to the local DB cache.
126- pub type NtxExecutionResult = ( TransactionId , Vec < FailedNote > , Vec < ( Word , NoteScript ) > ) ;
124+ pub struct NtxExecutionResult {
125+ /// ID of the submitted transaction.
126+ pub tx_id : TransactionId ,
127+ /// The account delta the transaction produced, applied to the actor's in-memory account once
128+ /// the transaction lands.
129+ pub account_delta : AccountDelta ,
130+ /// Notes that failed during consumability filtering.
131+ pub failed_notes : Vec < FailedNote > ,
132+ /// Note scripts fetched from the remote RPC service that should be persisted to the local DB
133+ /// cache.
134+ pub fetched_scripts : Vec < ( Word , NoteScript ) > ,
135+ }
127136
128137// NETWORK TRANSACTION CONTEXT
129138// ================================================================================================
@@ -230,9 +239,9 @@ impl NtxContext {
230239 ///
231240 /// # Returns
232241 ///
233- /// On success, returns an [`NtxExecutionResult`] containing the transaction ID, any notes
234- /// that failed during filtering, and note scripts fetched from the remote RPC service that
235- /// should be persisted to the local DB cache.
242+ /// On success, returns an [`NtxExecutionResult`] containing the transaction ID, the account
243+ /// delta the transaction produced, any notes that failed during filtering, and note scripts
244+ /// fetched from the remote RPC service that should be persisted to the local DB cache.
236245 ///
237246 /// # Errors
238247 ///
@@ -297,14 +306,23 @@ impl NtxContext {
297306 . await
298307 . unwrap_or_else ( |err| std:: panic:: resume_unwind ( err. into_panic ( ) ) ) ?;
299308
309+ // Capture the account delta before the executed tx is consumed; the actor applies
310+ // it to its in-memory account once this transaction lands in a committed block.
311+ let account_delta = executed_tx. account_delta ( ) . clone ( ) ;
312+
300313 // Prove transaction.
301314 let tx_inputs: TransactionInputs = executed_tx. into ( ) ;
302315 let proven_tx = Box :: pin ( self . prove ( & tx_inputs) ) . await ?;
303316
304317 // Submit transaction through the RPC service.
305318 self . submit ( & proven_tx, & tx_inputs) . await ?;
306319
307- Ok ( ( proven_tx. id ( ) , failed_notes, scripts_to_cache) )
320+ Ok ( NtxExecutionResult {
321+ tx_id : proven_tx. id ( ) ,
322+ account_delta,
323+ failed_notes,
324+ fetched_scripts : scripts_to_cache,
325+ } )
308326 } )
309327 . in_current_span ( )
310328 . await
0 commit comments