Skip to content

chore: re-add execution of network transactions and add expiration#2148

Open
SantiagoPittella wants to merge 5 commits into
nextfrom
santiagopittella-ntx-builder-block-sub-phase-3
Open

chore: re-add execution of network transactions and add expiration#2148
SantiagoPittella wants to merge 5 commits into
nextfrom
santiagopittella-ntx-builder-block-sub-phase-3

Conversation

@SantiagoPittella
Copy link
Copy Markdown
Collaborator

Third and final PR of the ntx-builder block-subscription refactor (follows #2120 and #2144). This PR reconnects the execution path so the ntx-builder actually builds and submits network transactions again.

After catch-up, an account actor with pending notes selects a candidate, executes/proves/submits it, then enters a WaitForBlock state and detects landing purely from local state. If the transaction doesn't land within tx_expiration_delta blocks, the actor resubmits.

Submitted transactions also carry an on-chain expiration: a pre-compiled transaction script (update_expiration_block_delta) is injected via TransactionArgs, so a stale tx is rejected by the chain rather than landing late.

@SantiagoPittella SantiagoPittella force-pushed the santiagopittella-ntx-builder-block-sub-phase-3 branch from 8b4366b to b446bbd Compare May 27, 2026 16:38
Comment thread bin/ntx-builder/src/commands/mod.rs Outdated
Comment thread bin/ntx-builder/src/db/models/queries/notes.rs Outdated
Copy link
Copy Markdown
Collaborator

@Mirko-von-Leipzig Mirko-von-Leipzig left a comment

Choose a reason for hiding this comment

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

Some suggestions, but looks good otherwise.

Comment on lines +27 to +30
-- TransactionId (32 bytes) of the latest transaction that updated this account in a committed
-- block. NULL until the first transaction lands. Actors compare their own submitted tx id
-- against this to confirm landing without an RPC roundtrip.
last_tx_id BLOB
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Could be NOT NULL since this will be filled in as the blocks are applied during sync?

Comment on lines +67 to +71
pub fn set_account_last_tx(
conn: &mut SqliteConnection,
account_id: AccountId,
tx_id: TransactionId,
) -> Result<(), DatabaseError> {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think this could be folded into upsert_account since we should always be able to determine the last tx in a block that updated this?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Address both comments in 3db92c1

Comment thread bin/ntx-builder/src/actor/mod.rs Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants