Skip to content

Commit b4b56e3

Browse files
fix(ntx): accounts are never unlocked (#1086)
1 parent 02c00a9 commit b4b56e3

File tree

3 files changed

+45
-26
lines changed

3 files changed

+45
-26
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Changelog
22

3+
## v0.10.1 (2025-07-14)
4+
5+
### Fixes
6+
7+
- Network accounts are disabled after one transaction (#1086).
8+
39
## v0.10.0 (2025-07-10)
410

511
### Enhancements

crates/ntx-builder/src/state/mod.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,9 @@ impl State {
235235
},
236236
}
237237

238+
// If this account was in-progress, then it should no longer be as this update is the
239+
// result of our own network transaction.
240+
self.in_progress.remove(&prefix);
238241
tx_impact.account_delta = Some(prefix);
239242
}
240243
for note in network_notes {

crates/ntx-builder/src/transaction.rs

Lines changed: 36 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use std::{collections::BTreeSet, sync::Arc};
22

33
use futures::TryFutureExt;
4-
use miden_node_utils::{ErrorReport, FlattenResult, tracing::OpenTelemetrySpanExt};
4+
use miden_node_utils::{ErrorReport, tracing::OpenTelemetrySpanExt};
55
use miden_objects::{
66
TransactionInputError, Word,
77
account::{Account, AccountId},
@@ -20,7 +20,7 @@ use miden_tx::{
2020
};
2121
use rand::seq::SliceRandom;
2222
use tokio::task::JoinError;
23-
use tracing::instrument;
23+
use tracing::{Instrument, instrument, instrument::Instrumented};
2424

2525
use crate::{COMPONENT, block_producer::BlockProducerClient, state::TransactionCandidate};
2626

@@ -71,32 +71,42 @@ impl NtxContext {
7171

7272
// Work-around for `TransactionExecutor` not being `Send`.
7373
tokio::task::spawn_blocking(move || {
74-
let rt = tokio::runtime::Builder::new_current_thread()
75-
.enable_all()
76-
.build()
77-
.expect("runtime should be built");
78-
79-
rt.block_on(async move {
80-
let mut notes = notes
81-
.into_iter()
82-
.map(|note| InputNote::Unauthenticated { note: note.into() })
83-
.collect::<Vec<_>>();
84-
// We shuffle the notes here to prevent having a failing note always in front.
85-
notes.shuffle(&mut rand::rng());
86-
let notes = InputNotes::new(notes).map_err(NtxError::InputNotes)?;
87-
88-
let data_store = NtxDataStore::new(account, self.genesis_header.clone());
89-
90-
self.filter_notes(&data_store, notes)
91-
.and_then(|notes| self.execute(&data_store, notes))
92-
.and_then(|tx| self.prove(tx))
93-
.and_then(|tx| self.submit(tx))
94-
.await
95-
})
74+
{
75+
{
76+
let rt = tokio::runtime::Builder::new_current_thread()
77+
.enable_all()
78+
.build()
79+
.expect("runtime should be built");
80+
81+
rt.block_on(
82+
async move {
83+
let mut notes = notes
84+
.into_iter()
85+
.map(|note| InputNote::Unauthenticated { note: note.into() })
86+
.collect::<Vec<_>>();
87+
// We shuffle the notes here to prevent having a failing note always in
88+
// front.
89+
notes.shuffle(&mut rand::rng());
90+
let notes = InputNotes::new(notes).map_err(NtxError::InputNotes)?;
91+
92+
let data_store =
93+
NtxDataStore::new(account, self.genesis_header.clone());
94+
95+
self.filter_notes(&data_store, notes)
96+
.and_then(|notes| self.execute(&data_store, notes))
97+
.and_then(|tx| self.prove(tx))
98+
.and_then(|tx| self.submit(tx))
99+
.await
100+
}
101+
.in_current_span(),
102+
)
103+
}
104+
}
105+
.in_current_span()
96106
})
97-
.map_err(NtxError::Panic)
98107
.await
99-
.flatten_result()
108+
.map_err(NtxError::Panic)
109+
.and_then(Instrumented::into_inner)
100110
.inspect_err(|err| tracing::Span::current().set_error(err))
101111
}
102112

0 commit comments

Comments
 (0)