Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
264dc48
rpcserver: release lnd leases on detached bounded context
cursoragent Oct 1, 2026
d09e4d3
rpcserver: fail closed on CommitVirtualPsbts add=false funding drift
cursoragent Oct 4, 2026
4cfa8c9
supplycommit: idle tick for empty successor commitments
cursoragent Oct 9, 2026
e3d1a07
itest: add supply commit idle tick regression test
cursoragent Oct 1, 2026
7a19943
supplycommit: fix idle ticker startup races
cursoragent Oct 4, 2026
71fed05
supplycommit: resubscribe idle ticker when the epoch stream ends
cursoragent Oct 4, 2026
2f3a123
tapdb: embed input provenance in burn leaf proofs
cursoragent Oct 4, 2026
bbbc2e1
itest: verify burn supply commit on universe server only
cursoragent Oct 4, 2026
a55d430
supplyverifier: retry supply sync and backfill missing commits
cursoragent Oct 4, 2026
2dc2bb8
supplyverifier: attempt supply sync when retry budget is negative
SadiqJaf Oct 4, 2026
fa2da5a
supplyverifier: test negative supply sync retry budgets
SadiqJaf Oct 4, 2026
b1155de
taprpc: add request_id to PublishAndLogRequest
cursoragent Oct 4, 2026
714f5c8
tapdb: skip a second transfer row for one anchor
cursoragent Oct 4, 2026
5308f95
tapfreighter: reconcile a repeated pre-anchored publish
cursoragent Oct 4, 2026
f3c2191
rpcserver: return a logged transfer from PublishAndLogTransfer
cursoragent Oct 4, 2026
b43dda7
tapfreighter: return double-spend failures on publish retry
cursoragent Oct 4, 2026
4e8c44b
tapfreighter: drop publish request IDs when the publish ends
cursoragent Oct 4, 2026
e5f8b23
docs: state publish request IDs are process-local and in-flight
cursoragent Oct 4, 2026
51c88ea
taprpc: add CommitVirtualPsbts request_id and status RPC
cursoragent Oct 4, 2026
980031e
tapdb: store CommitVirtualPsbts idempotency records
cursoragent Oct 4, 2026
a3dee83
rpcserver: make CommitVirtualPsbts idempotent
cursoragent Oct 4, 2026
d4a310a
rpcserver: recover stale CommitVirtualPsbts requests
cursoragent Oct 4, 2026
988ee84
rpcserver: keep commit lease deadlines inside UnixNano
cursoragent Oct 4, 2026
7201882
taprpc: document CommitVirtualPsbts retry after lease expiry
cursoragent Oct 4, 2026
cab7e31
rpcserver: keep commit leases with the attempt that took them
cursoragent Oct 4, 2026
7c0ffe6
rpcserver: bound commit locks and response retention
cursoragent Oct 5, 2026
87e4403
rpcserver: keep finished commit rows while their leases are live
cursoragent Oct 5, 2026
aa2032a
taprpc: correct CommitVirtualPsbts request_id replay docs
cursoragent Oct 5, 2026
1bd324d
cmd: fix release-notes link and the FIFO unit-cover race
cursoragent Oct 7, 2026
3d418b7
taprpc: add PrepareBatch and custom anchor fields
cursoragent Oct 7, 2026
2cb8e01
tapdb: persist a signed genesis PSBT on the existing batch row
cursoragent Oct 7, 2026
378dad6
lndservices: lease custom-anchor inputs for one batch
cursoragent Oct 7, 2026
0761253
supplyverifier: restore syncer.go after cherry-pick conflict resolution
cursoragent Oct 9, 2026
57e8b35
satscrip: port fork commits to v0.8.5 import paths and idle tick
cursoragent Oct 9, 2026
92ad02c
satscrip: drop partial 721-slim tapnode/lndservices slice
cursoragent Oct 9, 2026
7c2ce06
satscrip: revert partial 721-slim (blocked on tapnode/cultivator port)
cursoragent Oct 9, 2026
cbf5b2a
rpcserver: drop fork-main tapcustody/tapreorg RPC bleed-through
cursoragent Oct 9, 2026
f3cefdc
supplycommit: fix idle ticker startup races
cursoragent Oct 4, 2026
cd966d8
supplycommit: resubscribe idle ticker when the epoch stream ends
cursoragent Oct 9, 2026
612afba
satscrip: v0.8.5 port fixes (manager, sqlc, anchoring scope)
cursoragent Oct 9, 2026
f00bfb4
rpcserver: merge CommitVirtualPsbts idempotency entrypoint
cursoragent Oct 9, 2026
893be4f
tapdb,rpcserver,tapfreighter: history, publish idempotency, burn leaves
cursoragent Oct 9, 2026
b3ccda3
tapdb: bump LatestMigrationVersion for idempotency migrations
cursoragent Oct 9, 2026
520fd56
supplycommit: resume in-flight commits on manager start
cursoragent Oct 9, 2026
1005c61
tapgarden: native custom genesis PSBT mint on v0.8.5
cursoragent Oct 9, 2026
b69364c
supplycommit: recover confirmed broadcasts after restart
cursoragent Oct 9, 2026
cb4d6e3
itest: defer tapd data deletion across restarts
cursoragent Oct 9, 2026
eba5bb5
supplycommit: harden broadcast recovery in unit tests
cursoragent Oct 9, 2026
06c6bb3
WIP: PR #10 review fixes (paused)
cursoragent Oct 9, 2026
f8c17d3
tapgarden: regression tests for custom-anchor safety
cursoragent Oct 10, 2026
5dd6640
itest: fix tapd restart harness and custom-anchor caretaker index
cursoragent Oct 10, 2026
d5ab2d5
itest: align supply commit tests with burial finalize
cursoragent Oct 10, 2026
fee8a2c
itest: fix supply commit inclusion height assertion
cursoragent Oct 10, 2026
3d2b453
itest,supplycommit: assert burial threshold before finalize
cursoragent Oct 10, 2026
bb79efa
itest: harden parallel harness startup
cursoragent Oct 10, 2026
8f7b934
itest: revert tapd startup timeout and lnd wait
cursoragent Oct 10, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions docs/PR10-REBASE-OVERLAP.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# PR #10 rebase overlap (planned stack)

PR #10 (`satscrip/v0.8.5-candidate`) is intended as **layer 3** atop:

1. `satscrip/v0.8.5-supplycommit-base` (stock v0.8.5)
2. `satscrip/supplycommit-anchor-fix` — `genesis_points.anchor_tx_id` / transfer-proof anchor retarget
3. `satscrip/supplycommit-burn-provenance` — upstream #2331 burn provenance

**Do not rebase #10 onto that stack yet.** This file lists touch points to reconcile during a later rebase.

## `genesis_points` / `AnchorGenesisPoint` / `upsertAssetGen`

| Area | #10 involvement |
|------|-----------------|
| `tapdb/universe.go` | `upsertAssetGen`, `AnchorGenesisPoint` on universe leaf insert (existing v0.8.5 path; unchanged by custom-anchor mint) |
| `tapdb/asset_minting.go` | `AnchorGenesisPoint` when committing mint batches to DB |
| Custom-anchor mint | Uses same `CommitMintingBatch` / genesis outpoint persistence as stock mint; anchor **output index** stored via `FundedMintAnchorPsbt.AssetAnchorOutIdx` and caretaker `anchorOutputIndex` |

**Conflict risk with anchor-fix branch:** any change to when/how `anchor_tx_id` is written on transfer must stay consistent with custom-anchor genesis outpoint selection (non-zero `asset_anchor_output_index`).

## Mint pre-commitment outputs

| Area | #10 involvement |
|------|-----------------|
| `tapgarden/planter.go` | `PreCommitOutputIndex`, `sealBatchPreCommit`, `fetchPreCommitGroupKey`, `PreCommitTxOut` in custom `customGenesisPsbt` |
| `tapgarden/custom_anchor.go` | Validates pre-commit output index vs delegation key for supply-commitment batches |
| `rpcserver` / `mintrpc` | `FundBatchRequest.pre_commit_output_index` |

**Overlap:** supply-commit stack may alter pre-commit / genesis anchoring semantics; rebase must re-run `custom_anchor_test.go` supply pre-commit cases and supply itests.

## Supply-commit FSM (`universe/supplycommit`)

| Area | #10 involvement |
|------|-----------------|
| `conf_finalize.go` | Burial-gated finalize (shared with recovery); not full `tapreorg` |
| `broadcast_recovery.go` | Scan + buried-only recovery |
| `transitions.go` | `RegisterConf` uses `commitBurialDepth`; `ConfEvent` → `transitionForBuriedConf` |
| `manager.go` | `CommitFinalizeState` resume via `FinalizeEvent`; broadcast resume comment |
| `itest/supply_commit_test.go` | `MineSupplyCommitBurial`, idle interval vs burial depth |
| `itest/assertions.go` | `UpdateAndMineSupplyCommit` + burial helper |

**Overlap:** anchor-fix and burn-provenance branches may change commitment creation, proof binding, or FSM inputs; burial/recovery paths must be merged with any upstream `tapreorg` work on the stack.

## Migrations

Fork migrations **000073** / **000074** (custom anchor PSBT) **collide in number** with upstream `main` if ever upstreamed — noted in PR #10 body.
8 changes: 8 additions & 0 deletions docs/release-notes/release-notes-0.9.0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Release Notes

## RPC Updates

- `PublishAndLogTransfer` and related publish paths document that
`request_id` deduplication is **process-local and in-flight only**:
it is released when the publish attempt finishes and is not retained
across daemon restarts.
3 changes: 3 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -227,3 +227,6 @@ replace github.com/golang-migrate/migrate/v4 => github.com/lightninglabs/migrate
replace github.com/prometheus/common => github.com/prometheus/common v0.26.0

replace github.com/lightningnetwork/lnd/tor => github.com/lightningnetwork/lnd/tor v1.1.6

// Local taprpc carries idempotency RPCs until tagged.
replace github.com/lightninglabs/taproot-assets/taprpc => ./taprpc
11 changes: 11 additions & 0 deletions itest/assertions.go
Original file line number Diff line number Diff line change
Expand Up @@ -2838,9 +2838,20 @@ func UpdateAndMineSupplyCommit(t *testing.T, ctx context.Context,
minedBlocks := MineBlocks(t, miner, 1, expectedTxsInBlock)
require.Len(t, minedBlocks, 1)

MineSupplyCommitBurial(t, miner)

return minedBlocks
}

// MineSupplyCommitBurial mines the empty blocks required after a supply
// commitment transaction is included so tapd can finalize at burial depth.
func MineSupplyCommitBurial(t *testing.T, miner *miner.HarnessMiner) {
const supplyCommitBurialDepth = 6
if supplyCommitBurialDepth > 1 {
MineBlocks(t, miner, supplyCommitBurialDepth-1, 0)
}
}

// WaitForSupplyCommit waits for a supply commitment to be available and returns
// it when the specified condition is met.
func WaitForSupplyCommit(t *testing.T, ctx context.Context,
Expand Down
192 changes: 192 additions & 0 deletions itest/commit_virtual_psbts_no_change_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,192 @@
//go:build itest

package itest

import (
"bytes"
"context"
"fmt"
"testing"

"github.com/btcsuite/btcd/btcutil/psbt"
"github.com/lightninglabs/taproot-assets/address"
"github.com/lightninglabs/taproot-assets/asset"
"github.com/lightninglabs/taproot-assets/fn"
"github.com/lightninglabs/taproot-assets/tappsbt"
wrpc "github.com/lightninglabs/taproot-assets/taprpc/assetwalletrpc"
"github.com/lightninglabs/taproot-assets/taprpc/mintrpc"
"github.com/lightninglabs/taproot-assets/tapsend"
"github.com/stretchr/testify/require"
"google.golang.org/grpc/status"
)

// testCommitVirtualPsbtsNoNewChange covers
// lightninglabs/taproot-assets#2209 (Satscrip #103 consumer).
//
// It builds a caller-exact BTC anchor template
// (tapsend.PrepareAnchoringTemplate) for a full-value interactive send,
// then calls CommitVirtualPsbts with skip_funding=false so that lnd must
// add a wallet fee input, twice:
//
// 1. Add{Add: true} (control): lnd appends a change output and
// change_output_index points at it.
// 2. Add{Add: false} (the #2209 case): lnd ignores the bool and would append
// the same change output, so tapd must fail closed with the exact error
// below and must release the wallet leases it just took.
func testCommitVirtualPsbtsNoNewChange(t *harnessTest) {
ctx := context.Background()

rpcAssets := MintAssetsConfirmBatch(
t.t, t.lndHarness.Miner(), t.tapd,
[]*mintrpc.MintAssetRequest{simpleAssets[0]},
)
minted := rpcAssets[0]
genInfo := minted.AssetGenesis

lndBob := t.lndHarness.NewNodeWithCoins("Bob", nil)
bob := setupTapdHarness(t.t, t, lndBob, t.universeServer)
defer func() {
require.NoError(t.t, bob.stop(!*noDelete))
}()

var id [32]byte
copy(id[:], genInfo.AssetId)

buildCommitReq := func(changeAdd bool) (*wrpc.CommitVirtualPsbtsRequest,
*psbt.Packet) {

scriptKey, anchorIntKey := DeriveKeys(t.t, bob)
vPkt := tappsbt.ForInteractiveSend(
id, minted.Amount, scriptKey, 0, 0, 0, anchorIntKey,
asset.V0, &address.RegressionNetTap,
)
fundResp := fundPacket(t, t.tapd, vPkt)
signResp, err := t.tapd.SignVirtualPsbt(
ctx, &wrpc.SignVirtualPsbtRequest{
FundedPsbt: fundResp.FundedPsbt,
},
)
require.NoError(t.t, err)

signed := deserializeVPacket(t.t, signResp.SignedPsbt)
all := []*tappsbt.VPacket{signed}
for _, p := range fundResp.PassiveAssetPsbts {
ps, err := t.tapd.SignVirtualPsbt(
ctx, &wrpc.SignVirtualPsbtRequest{
FundedPsbt: p,
},
)
require.NoError(t.t, err)
passive := deserializeVPacket(t.t, ps.SignedPsbt)
all = append(all, passive)
}

tmpl, err := tapsend.PrepareAnchoringTemplate(all)
require.NoError(t.t, err)
tmplBytes, err := fn.Serialize(tmpl)
require.NoError(t.t, err)

req := &wrpc.CommitVirtualPsbtsRequest{
AnchorPsbt: tmplBytes,
Fees: &wrpc.CommitVirtualPsbtsRequest_SatPerVbyte{
SatPerVbyte: uint64(feeRateSatPerKVByte / 1000),
},
AnchorChangeOutput: &wrpc.CommitVirtualPsbtsRequest_Add{
Add: changeAdd,
},
SkipFunding: false,
}
req.VirtualPsbts = [][]byte{signResp.SignedPsbt}
for _, p := range all[1:] {
enc, err := tappsbt.Encode(p)
require.NoError(t.t, err)
req.PassiveAssetPsbts = append(
req.PassiveAssetPsbts, enc,
)
}

return req, tmpl
}

// Fund/sign the virtual packets exactly once (the asset input stays
// reserved by FundVirtualPsbt); only the anchor change policy differs
// between the two CommitVirtualPsbts calls.
baseReq, tmpl := buildCommitReq(true)

commit := func(changeAdd bool) (*wrpc.CommitVirtualPsbtsResponse,
*psbt.Packet, *psbt.Packet, error) {

req := baseReq
req.AnchorChangeOutput = &wrpc.CommitVirtualPsbtsRequest_Add{
Add: changeAdd,
}
resp, err := t.tapd.CommitVirtualPsbts(ctx, req)
if err != nil {
return nil, tmpl, nil, err
}
out, err := psbt.NewFromRawBytes(
bytes.NewReader(resp.AnchorPsbt), false,
)
require.NoError(t.t, err)

return resp, tmpl, out, nil
}

t.t.Run("control add=true appends change", func(tt *testing.T) {
resp, _, out, err := commit(true)
require.NoError(tt, err)
require.Greater(
tt, len(out.UnsignedTx.TxIn), len(tmpl.UnsignedTx.TxIn),
"lnd must add a wallet fee input",
)
require.Equal(
tt, len(tmpl.UnsignedTx.TxOut)+1,
len(out.UnsignedTx.TxOut),
"add=true: one P2TR change output is appended",
)
require.GreaterOrEqual(tt, resp.ChangeOutputIndex, int32(0))
releaseLeases(t, resp)
})

t.t.Run("add=false fails closed and releases leases (#2209)",
func(tt *testing.T) {
lnd := t.tapd.cfg.LndNode
leasesBefore := len(lnd.RPC.ListLeases().LockedUtxos)

resp, _, _, err := commit(false)
require.Nil(tt, resp)
require.Error(tt, err)

// lnd appends the change output after the template
// outputs, so the change index equals the template
// output count.
numTmplOuts := len(tmpl.UnsignedTx.TxOut)
expected := fmt.Sprintf("unexpected anchor change "+
"output: anchor_change_output add=false "+
"cannot be honored, lnd changed the anchor "+
"output set (change output index %d, outputs "+
"%d -> %d); use skip_funding=true with "+
"caller-supplied inputs or add=true (see "+
"lightninglabs/taproot-assets#2209)",
numTmplOuts, numTmplOuts, numTmplOuts+1)
require.Equal(
tt, expected, status.Convert(err).Message(),
)

// The failed call must not leak any lnd lease.
leasesAfter := len(lnd.RPC.ListLeases().LockedUtxos)
require.Equal(tt, leasesBefore, leasesAfter)
},
)
}

// releaseLeases unlocks the wallet inputs lnd leased while funding, so the
// draft test leaves the harness wallet usable.
func releaseLeases(t *harnessTest, resp *wrpc.CommitVirtualPsbtsResponse) {
if resp == nil || len(resp.LndLockedUtxos) == 0 {
return
}
// Best effort only: the harness is torn down after the test.
t.Logf("leaving %d lnd leases to harness teardown",
len(resp.LndLockedUtxos))
}
Loading
Loading