Skip to content

Comments

refactor(ntx-builder): simplify coordinator-actor messaging with Notify#1699

Open
SantiagoPittella wants to merge 7 commits intonextfrom
santiagopittella-ntx-simplify-actor-messages
Open

refactor(ntx-builder): simplify coordinator-actor messaging with Notify#1699
SantiagoPittella wants to merge 7 commits intonextfrom
santiagopittella-ntx-simplify-actor-messages

Conversation

@SantiagoPittella
Copy link
Collaborator

First task of #1694

  • Replace per-actor mpsc<Arc<MempoolEvent>> channels with Arc<Notify>. The DB is already the source of truth (since chore(ntx): replace in memory with sqlite database #1662), so actors only need a "re-check your state" signal and not the event payload. This removes all SendError handling, failed-actor cleanup, and the send() helper from the coordinator.
  • In TransactionInflight mode, actors now query the DB (is_transaction_resolved) to check if their awaited transaction was committed/reverted, since Notify doesn't carry payload.
  • Unify actor -> coordinator communication into a single ActorRequest enum over one mpsc channel. NotesFailed carries a oneshot ack to prevent a race condition where the actor could re-select notes before failure counts are persisted (context). CacheNoteScript remains fire-and-forget.

@SantiagoPittella SantiagoPittella added the no changelog This PR does not require an entry in the `CHANGELOG.md` file label Feb 23, 2026
let resolved = self.db
.is_transaction_resolved(account_id, awaited_id)
.await
.expect("should be able to check tx status");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we really want to stop everything if a single actor fails on this basis?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If an actor panics, the coordinator catches the error in coordinator.next() and logs it, but the system keeps running without the actor. Though know that you mentioned this, probably the best would be to return an specific error for this Db fail case.

/// before the failure counts are updated in the database.
async fn mark_notes_failed(&self, nullifiers: &[Nullifier], block_num: BlockNumber) {
let (ack_tx, ack_rx) = tokio::sync::oneshot::channel();
let _ = self
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

_ is type Result<(), SendError<ActorRequest>>. Are we sure we don't want to be handling that error here?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same with let _ = ack_rx.await; below

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replaced them with .is_err checks

Copy link
Collaborator

@sergerad sergerad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM just a few questions on errors we don't handle

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no changelog This PR does not require an entry in the `CHANGELOG.md` file

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants