feat(wallet-toolbox): plan noSend batches locally and commit atomically#289
Open
ty-everett wants to merge 3 commits into
Open
feat(wallet-toolbox): plan noSend batches locally and commit atomically#289ty-everett wants to merge 3 commits into
ty-everett wants to merge 3 commits into
Conversation
|
Collaborator
|
So much good stuff here :-) |
BraydenLangley
marked this pull request as ready for review
July 17, 2026 15:36
BraydenLangley
requested review from
BraydenLangley,
sirdeggen and
tonesnotes
as code owners
July 17, 2026 15:36
ty-everett
force-pushed
the
codex/transaction-pipeline-performance
branch
from
July 20, 2026 02:27
29ae61e to
9f00a94
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Summary
Add an automatically negotiated Wallet Toolbox fast path for high-volume
noSendtransaction sequences:sendWith;The BRC-100 wallet interface,
CreateActionArgs,SignActionArgs,noSend,noSendChange,sendWith, and result shapes are unchanged. Providers that do not advertiseactionBatch: 1retain the legacy path before a workspace begins.Why
The existing behavior is correct but latency-bound for long transaction sequences. Every signed
noSendaction performs a storagecreateActioncall followed byprocessAction; the finalsendWithadds another call. A 250-action sequence therefore serializes 501 storage control calls.That cost is modest against a local database but dominates against remote storage. At 100 ms RTT, the storage-control component alone is approximately 50.1 seconds before transaction planning, signing, validation, payload transfer, persistence, or broadcast.
This change moves the middle of the workflow to the wallet process, where the keys and staged transactions already live, while preserving storage authority and an atomic remote durability boundary.
Stack status
This draft intentionally targets
codex/transaction-pipeline-performance, the head of #285, so its diff contains only the batching work. It reuses the transaction/BEEF performance foundations in #285 and complements the scalable storage work in #283.After #285 merges, this branch should be rebased or retargeted to
main.Design
Capability negotiation and compatibility
actionBatch: 1.WalletArgs.actionBatchMode?: 'auto' | 'legacy', defaulting toauto.In-memory planning
returnTXIDOnly,knownTxids, commissions, custom inputs, two-step signing, deterministic output order, andnoSendChange.Reservations and lifecycle
Atomic commit and validation
Before persistence, validate:
noSendChange, and storage-controlled outputs.Persist transactions, outputs, labels, tags, mappings, and proof requests in one storage transaction. Consume reserved inputs and release unused reservations in that same transaction.
Broadcast remains outside the database transaction. Persistence is idempotent by user, batch ID, and semantic manifest digest; retries reconcile the committed result without duplicating wallet state.
Large payload transport
Main changes
Benchmarks
Command:
Environment: local SQLite provider, Node v25.9.0, pnpm 10.33.2. The measured representative workload is a 250-action dependent chain with 1 KiB scripts and deterministic randomness.
Peak heap is GC-sensitive; the structural assertions are the stronger memory regression gate. They verify that staged records do not retain duplicate source transactions or locking scripts.
The modeled storage-control component for the same 250-action sequence is:
The benchmark retains 192 modeled cases across dependent, independent, mixed explicit-input, and two-step workloads; 1, 10, 50, and 250 actions; 1 KiB, 64 KiB, 1 MiB, and 4 MiB scripts; and 25/100/250 ms RTT.
It also physically executes 64 KiB, 1 MiB, and 4 MiB scripts. The 4 MiB one-action batch exercises the prepare/upload/commit path successfully. It is intentionally not presented as a local one-action speedup: on the measured machine, batch stage plus commit was about 2.53 seconds versus 1.47 seconds for legacy because validation and blob staging outweigh avoided local latency. The target benefit is long and/or remote sequences.
Validation
Completed locally:
pnpm install --frozen-lockfileNot yet completed:
CIworkflow does not run while this stacked draft targetscodex/transaction-pipeline-performance; the workflow is limited to pull requests targetingmain. Socket security checks do run. Full hosted CI will start after the PR is retargeted tomain; the equivalent local build and test matrix is listed above.Reviewer notes
Suggested review order:
Wallet.ts,WalletStorageManager.ts, and the storage interfaces leave public BRC-100 behavior unchanged.returnTXIDOnly,knownTxids, two-step signing, andnoSendChangebehavior.[userId, batchId]key.Rollout considerations
A server-first rollout is safe:
automode;actionBatchMode: 'legacy'for controlled comparison or rollback.Intermediate workspaces are intentionally session-scoped. The final commit is the remote durability boundary.