Repository navigation
Conversation
Deferred UTXO lease cleanup in CommitVirtualPsbts, FundPacket, and FundBurn now uses context.WithoutCancel with a 30s timeout so canceled RPC contexts do not leak lnd wallet leases (taproot-assets#2206). Adds unit tests with mocks and a 0.9.0 release note entry. Co-authored-by: Sadiq Jaffer <SadiqJaf@users.noreply.github.com> (cherry picked from commit d7585e3) (cherry picked from commit d4fdf3c)
When anchor_change_output.add is false and skip_funding is unset, verify the funded anchor PSBT matches the caller template and return a descriptive error referencing issue lightninglabs#2209 if lnd added or altered change outputs. The drift rejection sits after the detached lease-release defer, so a canceled request still releases the leases lnd just took (lightninglabs#2206). Adds unit and regtest coverage, including a canceled-context lease release test, proto documentation, and a v0.9.0 release note entry. Co-authored-by: Sadiq Jaffer <SadiqJaf@users.noreply.github.com> (cherry picked from commit 2d85fe3)
Implements periodic idle supply commitment successors (lightninglabs#1781, lightninglabs#1807): manager block-epoch ticks, state machine transitions, BeginIdleTransition in tapdb, config flags, unit tests, integration test, and validation. Co-authored-by: Sadiq Jaffer <SadiqJaf@users.noreply.github.com> (cherry picked from commit e3a57a8)
Co-authored-by: Sadiq Jaffer <SadiqJaf@users.noreply.github.com> (cherry picked from commit 28eff5d)
A failed block-epoch registration no longer latches Start: the error is returned again and a later Start retries the subscription. Once Start succeeds, further calls stay a no-op. fetchStateMachine now single-flights creation per group. The cache mutex only covered one Get or Set, so two callers (the idle ticker and a normal send, or two sends) could each start a machine from the same durable state. That race was already present on main. The idle loop treats a closed epoch stream as shutdown. A zero height from a closed channel is not a block, so the loop no longer calls sendIdleTicks in a hot loop. Co-authored-by: Sadiq Jaffer <SadiqJaf@users.noreply.github.com> (cherry picked from commit 26d5fc4)
After the block-epoch stream closes or its error channel fires, the idle ticker registers again from the same goroutine. Each attempt waits with a backoff that starts at 200ms and caps at 30s, so a down notifier is not polled in a loop. Quit or context cancel during that wait leaves the ticker. A closed channel is still one end-of-stream signal, not a height of zero. Co-authored-by: Sadiq Jaffer <SadiqJaf@users.noreply.github.com> (cherry picked from commit 376b8a2)
Supply-commitment burn leaves are verified with no prior snapshot. The leaf now embeds the full proof file of every spent input, including the primary input that a proof file would otherwise carry as its prefix. The transfer's own proof file is unchanged. Universe servers reject a duplicate or empty embedded input instead of keeping the last copy. A bare pre-fix burn leaf still fails verification. The block header and merkle proof stay the ones the re-org watcher captured. Rebuild applies them again when the witness context changes. Fixes lightninglabs#2285. Co-authored-by: Sadiq Jaffer <SadiqJaf@users.noreply.github.com> (cherry picked from commit 632a0f6)
Fetch the post-burn supply commitment from the universe server and assert the burn subtree. The issuing node can record the burn while the server still rejects the leaf. Co-authored-by: Sadiq Jaffer <SadiqJaf@users.noreply.github.com> (cherry picked from commit 13720d4)
Retry universe dials and supply-commitment fetches and inserts with capped exponential backoff, and stop when the context is cancelled. A missing commitment is not retried. When a server rejects an insert because it has not seen the spent supply commitment, insert the missing earlier commitments from local history oldest-first, then retry the original insert. Co-authored-by: Sadiq Jaffer <SadiqJaf@users.noreply.github.com> (cherry picked from commit 4e554c0)
Partial upload probe; will be replaced by the full file in the same change if this call is accepted. (cherry picked from commit 7f33611) Co-authored-by: Sadiq Jaffer <SadiqJaf@users.noreply.github.com>
Cover a negative MaxRetries on push, pull, repair, and a cancelled context. These tests fail when the retry loop skips the call and returns success. (cherry picked from commit ce49587)
PublishAndLogTransfer takes an optional idempotency key so a retry after a lost response can be distinguished from a new publish. The key is field 8, request_id. An empty key remains valid. Co-authored-by: Sadiq Jaffer <SadiqJaf@users.noreply.github.com> (cherry picked from commit a11c2b7)
applyPendingParcel inserted a new asset_transfers row on every call, so a retry of the same anchor transaction logged the transfer twice. If a row already exists for that txid, the insert is a no-op. Co-authored-by: Sadiq Jaffer <SadiqJaf@users.noreply.github.com> (cherry picked from commit 5c02bcc)
RequestShipment of a PreAnchoredParcel returns the transfer already logged for that anchor, and concurrent publishes of the same anchor share one shipment. A request id stays bound to its first anchor for the life of the process. Co-authored-by: Sadiq Jaffer <SadiqJaf@users.noreply.github.com> (cherry picked from commit 3472dd4)
A repeat call extracts the final anchor and, when that transfer is already logged, skips input validation that would fail once the inputs are leased or spent. The porter returns the existing transfer and does not publish the anchor again. Co-authored-by: Sadiq Jaffer <SadiqJaf@users.noreply.github.com> (cherry picked from commit 38a49f0)
A transfer row is written before the anchor is broadcast, so a later PublishAndLogTransfer of that anchor was reported as success even when broadcast failed with ErrDoubleSpend. Remember that failure for the process and return it instead of the row. Channel funding uses the same pre-anchored path with no request ID. Co-authored-by: Sadiq Jaffer <SadiqJaf@users.noreply.github.com> (cherry picked from commit f8236f6)
publishRequestIDs kept every distinct request ID for the life of the process. Release every ID bound to an anchor when that publish completes or fails. Reuse for a different anchor is still rejected while the publish is in flight. Co-authored-by: Sadiq Jaffer <SadiqJaf@users.noreply.github.com> (cherry picked from commit 323766c)
The RPC text said a request_id must not be reused for a different anchor, and the release note said that rejection lasts for the life of the process. The binding is not stored, and it is dropped when the publish ends. Say that, instead of persisting every id. Co-authored-by: Sadiq Jaffer <SadiqJaf@users.noreply.github.com> (cherry picked from commit 2c74baa)
CommitVirtualPsbtsRequest gains an optional request_id. Field 11 is already transition_proof_version, so the key is field 12. GetCommitVirtualPsbtsStatus reports unknown, pending, or completed plus the lnd lock ID and leased outpoints. The status RPC requires assets:read. Co-authored-by: Sadiq Jaffer <SadiqJaf@users.noreply.github.com> (cherry picked from commit 641c26a)
Migration 73 adds commit_virtual_psbt_idem, an opaque blob keyed by the caller request ID. LatestMigrationVersion is 73 so the downgrade guard matches the new schema. Co-authored-by: Sadiq Jaffer <SadiqJaf@users.noreply.github.com> (cherry picked from commit f6f0bb7)
A non-empty request_id claims a pending row, funds once, and stores the full response. A repeat of the same request returns that response and does not call FundPsbt. A different body is rejected. An in-progress or unrecorded outcome returns Aborted and does not fund again. An empty request_id keeps the previous stateless path. Co-authored-by: Sadiq Jaffer <SadiqJaf@users.noreply.github.com> (cherry picked from commit 93c0a79)
A crash after funding left the request_id pending. Once the lnd lease expired, a retry was rejected with Aborted. Store the lease deadline with the pending row and let a retry of the same body take that row over when ListLeases shows the outputs are no longer leased. A failed release keeps the row while those outputs are still leased. A crash between FundPsbt and the pending-row write is filled in from ListLeases, and can be retried after the deadline. A different body for the same key stays InvalidArgument. Co-authored-by: Sadiq Jaffer <SadiqJaf@users.noreply.github.com> (cherry picked from commit 61e678c)
insertPendingCommit stored a lock duration that fits in time.Duration but not in UnixNano. The wrapped timestamp decoded as a past deadline, so recovery replaced a still-pending request. Clamp the computed deadline and lnd lease expirations to the representable range, and reject a stored timestamp that does not round-trip. Co-authored-by: Sadiq Jaffer <SadiqJaf@users.noreply.github.com> (cherry picked from commit 016da94)
A pending request_id stays pending after its lnd leases expire, and the same request funds again once those leases are gone. The public comments still said a repeat would not fund. Co-authored-by: Sadiq Jaffer <SadiqJaf@users.noreply.github.com> (cherry picked from commit beb595b)
A delayed attempt whose row a retry replaced skipped ReleaseOutput for every outpoint FundPsbt had just returned. Those leases were never recorded and stayed locked until expiry. The replaced attempt now releases only the outpoints it acquired that the replacement has not recorded. ReleaseOutput stays keyed by the shared lock ID, and funding for that ID is serialized so the replacement cannot be between FundPsbt and onFunded while the old attempt unlocks. inspectPending treated every lease under a caller-chosen lock ID as belonging to the row being read, so backfill stored another request's outpoints. A request now adopts an unrecorded lease only when no other pending row is still funding under that lock ID and the outpoint is not already stored on another request. A crash after onFunded and before onResult is already recovered: the pending row has the outpoints, and once lnd drops those leases CommitVirtualPsbts funds again. TestCommitVirtualPsbtsStalePendingFundsAgain covers that takeover. Co-authored-by: Sadiq Jaffer <SadiqJaf@users.noreply.github.com> (cherry picked from commit f8ea8a6)
Reference-count the process-global commit input lock map and delete an entry once no request holds or waits on it. Derived request_id lock IDs otherwise accumulate one mutex forever. The mutex is still held from FundPsbt until the RPC returns. Delete completed and failed CommitVirtualPsbts rows older than wallet.commit-virtual-psbt-retention (default 24h). Pending rows are kept. Replay of request_id is only guaranteed inside that window. Co-authored-by: Sadiq Jaffer <SadiqJaf@users.noreply.github.com> (cherry picked from commit 659bdd4)
Purge of CommitVirtualPsbts outcomes older than the retention window now skips a finished row whose recorded outpoints are still leased under its lock ID. A short window can no longer drop the stored response while lnd holds those inputs. Once ListLeases no longer reports them, the next purge deletes the row. Co-authored-by: Sadiq Jaffer <SadiqJaf@users.noreply.github.com> (cherry picked from commit e296a53)
A pending row whose leases have expired is deleted and the same request_id funds again. Only a completed or failed stored response is returned as-is, and only inside the retention window. Regenerated stubs keep protoc import order so make rpc is a no-op. Co-authored-by: Sadiq Jaffer <SadiqJaf@users.noreply.github.com> (cherry picked from commit 51fa7f9)
Co-authored-by: Sadiq Jaffer <SadiqJaf@users.noreply.github.com> (cherry picked from commit 7d47d88)
Co-authored-by: Sadiq Jaffer <SadiqJaf@users.noreply.github.com> (cherry picked from commit a1b9965)
Co-authored-by: Sadiq Jaffer <SadiqJaf@users.noreply.github.com> (cherry picked from commit fd298d3)
Co-authored-by: Sadiq Jaffer <SadiqJaf@users.noreply.github.com> (cherry picked from commit 80bc32e)
The automated conflict resolver truncated syncer.go during PR #6 cherry-pick; restore the file from ta/1808-supply-verifier-syncer. Co-authored-by: Sadiq Jaffer <SadiqJaf@users.noreply.github.com>
Replace fork-main idle tick (e3a57a8) with the v0.8.0-style backport (64b4e00) so supplycommit idle tick does not depend on tapreorg. Restore v0.8.5 tapcfg/server, chain_porter, and tapconfig wiring; normalize btcd /v2 import paths introduced by fork-main cherry-picks. Co-authored-by: Sadiq Jaffer <SadiqJaf@users.noreply.github.com>
Co-authored-by: Sadiq Jaffer <SadiqJaf@users.noreply.github.com>
Co-authored-by: Sadiq Jaffer <SadiqJaf@users.noreply.github.com>
Co-authored-by: Sadiq Jaffer <SadiqJaf@users.noreply.github.com>
A failed block-epoch registration no longer latches Start: the error is returned again and a later Start retries the subscription. Once Start succeeds, further calls stay a no-op. fetchStateMachine now single-flights creation per group. The cache mutex only covered one Get or Set, so two callers (the idle ticker and a normal send, or two sends) could each start a machine from the same durable state. That race was already present on main. The idle loop treats a closed epoch stream as shutdown. A zero height from a closed channel is not a block, so the loop no longer calls sendIdleTicks in a hot loop. Co-authored-by: Sadiq Jaffer <SadiqJaf@users.noreply.github.com> (cherry picked from commit 26d5fc4)
After the block-epoch stream closes or its error channel fires, the idle ticker registers again from the same goroutine. Each attempt waits with a backoff that starts at 200ms and caps at 30s, so a down notifier is not polled in a loop. Quit or context cancel during that wait leaves the ticker. A closed channel is still one end-of-stream signal, not a height of zero. Co-authored-by: Sadiq Jaffer <SadiqJaf@users.noreply.github.com> (cherry picked from commit 376b8a2)
- Strip tapreorg hooks from supplycommit manager; keep 64b4e00 idle tick plus 26d5fc4/376b8a23 epoch resubscribe logic on tapgarden.ChainBridge. - Drop fork-main freighter_anchoring/supply_anchoring (not in stock v0.8.5); burn-leaf provenance and supply_anchoring_log remain blocked. - Revert partial 721-slim; custom genesis PSBT blocked without tapnode port. - Fix BatchedCommitVirtualPsbtStore to require only BatchedTx. Co-authored-by: Sadiq Jaffer <SadiqJaf@users.noreply.github.com>
Wire fundAndCommitVirtualPsbts, local taprpc replace, supply syncer FetchPushedServers, publish pre-anchor idempotency without tapreorg, idle tick test fixes, and protoc-regenerated assetwallet stubs. Co-authored-by: Sadiq Jaffer <SadiqJaf@users.noreply.github.com>
Wire supply syncer history queries and re-push absorb in the supply verifier. Short-circuit PublishAndLogTransfer and LogPendingParcel for logged anchors; release funded UTXOs with a detached context on commit failure. Embed burn input provenance in supply-commitment burn leaves. Co-authored-by: Sadiq Jaffer <SadiqJaf@users.noreply.github.com>
Migrations 000073 and 000074 were added in 980031e but LatestMigrationVersion stayed at 60. On a tapd restart the downgrade guard rejected db_version=74 and tapd exited before serving RPC, which broke mint_batch_resume and every other restart-heavy itest. Co-authored-by: Sadiq Jaffer <SadiqJaf@users.noreply.github.com>
Enable ResumeInterruptedOnStart in tapcfg so tapd reloads local supply- commit state machines at startup. Without this, a broadcast interrupted by restart only resumes on the next block epoch. Co-authored-by: Sadiq Jaffer <SadiqJaf@users.noreply.github.com>
Add PrepareBatch and caller-funded anchor funding on the existing ChainPlanter/BatchCaretaker path: custom PSBT fund+lease, prepare via caretaker frozen step, finalize with externally signed PSBT, and wallet batch leases in lndservices. Includes unit tests and mint_custom_anchor_psbt itest. Co-authored-by: Sadiq Jaffer <SadiqJaf@users.noreply.github.com>
Scan recent chain blocks when a commitment transaction already confirmed while tapd was down, and finalize the in-flight broadcast state without tapreorg. Hook recovery on BroadcastEvent and CommitTickEvent in CommitBroadcastState. Co-authored-by: Sadiq Jaffer <SadiqJaf@users.noreply.github.com>
Keep the tapd data directory when stop requests deletion but start follows on the same harness. Purge on harness teardown so supply-commit resume itests retain FSM state without -nodelete. Co-authored-by: Sadiq Jaffer <SadiqJaf@users.noreply.github.com>
Skip unavailable blocks during chain lookback and extend FSM test mocks for GetBlockByHeight. Deep-copy PSBT unknowns in FundedMintAnchorPsbt.Copy. Co-authored-by: Sadiq Jaffer <SadiqJaf@users.noreply.github.com>
supplycommit: burial-depth finalize, recovery hardening, conf_finalize shared path tapgarden: custom-anchor prepare/restart, sighash/fee checks, lease renew itest: revert deferred data-dir deletion; idle-tick stop(false); restart itest WIP supplyverifier: restore burn-leaf negative tests See PAUSED-STATUS.md for blocking/non-blocking checklist and test state. Co-authored-by: Sadiq Jaffer <SadiqJaf@users.noreply.github.com>
Add caretaker tests for wallet-sign skip, anchor conf script, and cancel after prepare. Record conf pkScript in MockChainBridge. Add supply-commit reorg-before-burial recovery unit test. Co-authored-by: Sadiq Jaffer <SadiqJaf@users.noreply.github.com>
Seed caretaker anchorOutputIndex from funded PSBT on create so restart finalize watches the correct output. Reset harness process state on stop and guard against double start. Simplify restart itest to anchor index 0. docs: add PR10 rebase overlap notes for planned supply-commit stack. Co-authored-by: Sadiq Jaffer <SadiqJaf@users.noreply.github.com>
Use inclusion block hash/height after UpdateAndMineSupplyCommit mines burial depth, and mine burial blocks in supply_commit_ignore_asset so FetchSupplyCommit has commitment block info. Co-authored-by: Sadiq Jaffer <SadiqJaf@users.noreply.github.com>
Co-authored-by: Sadiq Jaffer <SadiqJaf@users.noreply.github.com>
Add supply_commit_burial_threshold itest and unit test that buried conf enters CommitFinalizeState. Documents review item 2 behavior. Co-authored-by: Sadiq Jaffer <SadiqJaf@users.noreply.github.com>
Wait for lnd GetInfo before starting tapd, allow 60s for tapd RPC listener after migrations, and run all tranches with a concurrency limit in itest_parallel.sh (enables make itest-parallel parallel=4). Co-authored-by: Sadiq Jaffer <SadiqJaf@users.noreply.github.com>
cursor
Bot
force-pushed
the
satscrip/v0.8.5-candidate
branch
from
October 10, 2026 13:11
c03fca6 to
bb79efa
Compare
Keep parallel scheduler-only changes in itest_parallel.sh; restore stock-equivalent 10s tapd RPC wait per review policy. Co-authored-by: Sadiq Jaffer <SadiqJaf@users.noreply.github.com>
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.
Issue #9 (721) — custom genesis PSBT on v0.8.5 (native)
Independent review fixes (blocking)
All six blocking items implemented (see prior table): custom anchor restart safety, burial-before-finalize supply commits, regression unit tests, itest harness
stop(false)semantics.Supply commit itest alignment (
d5ab2d57/fee8a2c5)Burial-depth finalization means
FetchSupplyCommitreports the inclusion block hash/height, whileUpdateAndMineSupplyCommitalso mines burial confs so chain tip advances. Itests were updated to assert inclusion block metadata (not tip) and to mine burial insupply_commit_ignore_asset. Newsupply_commit_burial_thresholditest +TestTransitionForBuriedConfEntersFinalizeStateunit test pin review item 2.Itest-edit justification (no loosening):
supply_commit_mint_burn: still asserts finalized commit chain data; only compares block hash to the inclusion block mined with the commit (notGetBestBlock()tip after burial confs).supply_commit_ignore_asset: usesUpdateAndMineSupplyCommitso burial depth is mined before finalize; assertions on ignore tuples / supply leaves unchanged.supply_commit_burial_threshold(3d2b4538): explicit review item 2 — unfinalized before burial (no block info available, no universe push), finalized + universe sync after burial.Validation (
8f7b934dHEAD)make unit×3mint_burn,ignore_asset,burial_thresholdv0.8.5-supplycommit-base(bb3f1c6b) serialsupply_commit_mint_burn,supply_commit_ignore_asset(stock itest code)make itest-paralleltapd-itestSHA256 (current HEAD):f5f5f976fd7844c610ee098f6c8130ec73cb561382da4b6e1ed2d6982a337735Planned stack
satscrip/v0.8.5-supplycommit-base→supplycommit-anchor-fix→supplycommit-burn-provenance— seedocs/PR10-REBASE-OVERLAP.md. On resume: rebase this branch ontosatscrip/supplycommit-burn-provenanceas layer 3.PAUSED (2026-10-10) — single workstream cutover
Agent stopped all active parallel itest work (including
itest-stock-pristinetmux and straytapd/btcd/lnditest processes). Branch pushed:8f7b934d(itest: revert tapd startup timeout and lnd wait).Stock vs candidate parallel load (findings so far)
Goal: same
make itest-parallel parallel=4(scheduler-onlyscripts/itest_parallel.sh, no raised tapd startup timeouts per review policy).retry2(fee8a2c5,/tmp/itest-parallel-retry2.log)psbt_stxo_exclusion_proofs,mint_batch_and_transfer,offline_receiver_eventually_receives_hashmail_courier,collectible_send— allerror waiting for tapd to start: dial tcp … connection refused(~52s), not assertion regressions.bb3f1c6b,/tmp/stock-parallel-load.log, overlapped with candidate build)rfq_asset_buy_htlc_intercept,re-org_mint_and_send). Same connection refused class on other tranches (unknown_TLV_type).retry4(bb79efaa, with since-reverted 60s tapd wait)connection refused/shutdown timeout— invalid for classification; discarded./tmp/stock-parallel-pristine.log)assert shutdown failed, macaroon missing after abort) — need a single uncontended rerun.Interim conclusion: Failures look like parallel-harness / resource contention (
tapdRPC not listening within stock 10s dial wait), not supply-commit assertion bugs. Not yet closed: one pristine stock-alone then candidate-aloneparallel=4run (no overlapping tmux suites) to confirm whether candidate is worse than stock on tranches 0–3.Harness policy:
8f7b934drevertsbb79efaatapd/LND startup timeout bumps; keeps worker-poolitest_parallel.shonly.Open review items
satscrip/supplycommit-burn-provenanceas layer 3 after parallel matrix is understood.Resume checklist
rm -rf itest/regteston stock worktree (/tmp/v085-sc-base@bb3f1c6b) →make itest-parallel parallel=4→ log/tmp/stock-parallel-pristine.log.satscrip/v0.8.5-candidate@ HEAD →/tmp/candidate-parallel-pristine.log.tapd-itestSHA256; then rebase ontosatscrip/supplycommit-burn-provenance.