Skip to content

itest: run lnd backend in remote-signing mode #1694

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
43 changes: 43 additions & 0 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,49 @@ jobs:
format: 'golang'
parallel: true

########################
# run integration tests with lnd remote-signer
########################
integration-test-lnd-remote-signer:
name: run itests with lnd remote-signer
runs-on: ubuntu-latest
steps:
- name: cleanup space
run: rm -rf /opt/hostedtoolcache

- name: git checkout
uses: actions/checkout@v4

- name: Setup go ${{ env.GO_VERSION }}
uses: actions/setup-go@v5
with:
go-version: '${{ env.GO_VERSION }}'

- name: run itest
run: make itest-parallel remote-signing=1

- name: Zip log files on failure
if: ${{ failure() }}
run: 7z a logs-itest-lnd-remotesigner.zip itest/**/*.log

- name: Upload log files on failure
uses: actions/upload-artifact@v4
if: ${{ failure() }}
with:
name: logs-itest-lnd-remotesigner
path: logs-itest-lnd-remotesigner.zip
retention-days: 5

- name: Send coverage
uses: coverallsapp/github-action@v2
if: ${{ success() }}
continue-on-error: true
with:
file: itest/coverage.txt
flag-name: 'itest'
format: 'golang'
parallel: true

########################
# run integration tests with Postgres backend
########################
Expand Down
13 changes: 12 additions & 1 deletion docs/release-notes/release-notes-0.7.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,12 @@
[related PR](https://github.com/lightninglabs/taproot-assets/pull/1613) for
more info.

- A [bug in `btcwallet` and `lnd` was fixed that prevented `tapd` from running
properly when connected to an `lnd` node that is running in remote-signing
mode](https://github.com/lightninglabs/taproot-assets/pull/1694). A new
integration test suite now asserts that `tapd` fully supports remote-signing
`lnd` backends.

## RPC Additions

- The [price oracle RPC calls now have an intent, optional peer ID and metadata
Expand All @@ -92,12 +98,15 @@
when requesting quotes. The field can contain optional user or authentication
information that helps the price oracle to decide on the optimal price rate to
return.

- [Rename](https://github.com/lightninglabs/taproot-assets/pull/1682) the
`MintAsset` RPC message field from `universe_commitments` to
`enable_supply_commitments`.

- The `SubscribeSendEvents` RPC now supports [historical event replay of
completed sends with efficient database-level
filtering](https://github.com/lightninglabs/taproot-assets/pull/1685).

- [Add universe RPC endpoint FetchSupplyLeaves](https://github.com/lightninglabs/taproot-assets/pull/1693)
that allows users to fetch the supply leaves of a universe supply commitment.
This is useful for verification.
Expand Down Expand Up @@ -142,7 +151,9 @@
the default "all script key types" [to the value
`bip86`](https://github.com/lightninglabs/taproot-assets/pull/1690) to match
the default value of the RPC interface.
- [Add universe supply commit subcommand fetchleaves](https://github.com/lightninglabs/taproot-assets/pull/1693)

- [Add universe supply commit subcommand
`fetchleaves`](https://github.com/lightninglabs/taproot-assets/pull/1693)
that allows users to fetch the supply leaves of a universe supply commitment.
This is useful for verification.

Expand Down
8 changes: 4 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ require (
github.com/btcsuite/btcd/btcutil/psbt v1.1.10
github.com/btcsuite/btcd/chaincfg/chainhash v1.1.0
github.com/btcsuite/btclog v0.0.0-20241003133417-09c4e92e319c
github.com/btcsuite/btclog/v2 v2.0.1-0.20250602222548-9967d19bb084
github.com/btcsuite/btcwallet v0.16.14
github.com/btcsuite/btclog/v2 v2.0.1-0.20250728225537-6090e87c6c5b
github.com/btcsuite/btcwallet v0.16.15-0.20250805011126-a3632ae48ab3
github.com/btcsuite/btcwallet/wallet/txsizes v1.2.5
github.com/btcsuite/btcwallet/wtxmgr v1.5.6
github.com/caddyserver/certmagic v0.17.2
Expand All @@ -27,10 +27,10 @@ require (
github.com/lib/pq v1.10.9
github.com/lightninglabs/aperture v0.3.13-beta
github.com/lightninglabs/lightning-node-connect/hashmailrpc v1.0.3
github.com/lightninglabs/lndclient v0.19.0-9
github.com/lightninglabs/lndclient v0.19.0-11
github.com/lightninglabs/neutrino/cache v1.1.2
github.com/lightninglabs/taproot-assets/taprpc v1.0.9
github.com/lightningnetwork/lnd v0.19.2-beta
github.com/lightningnetwork/lnd v0.19.3-beta.rc1
github.com/lightningnetwork/lnd/cert v1.2.2
github.com/lightningnetwork/lnd/clock v1.1.1
github.com/lightningnetwork/lnd/fn/v2 v2.0.8
Expand Down
16 changes: 8 additions & 8 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -666,11 +666,11 @@ github.com/btcsuite/btcd/chaincfg/chainhash v1.1.0/go.mod h1:7SFka0XMvUgj3hfZtyd
github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA=
github.com/btcsuite/btclog v0.0.0-20241003133417-09c4e92e319c h1:4HxD1lBUGUddhzgaNgrCPsFWd7cGYNpeFUgd9ZIgyM0=
github.com/btcsuite/btclog v0.0.0-20241003133417-09c4e92e319c/go.mod h1:w7xnGOhwT3lmrS4H3b/D1XAXxvh+tbhUm8xeHN2y3TQ=
github.com/btcsuite/btclog/v2 v2.0.1-0.20250602222548-9967d19bb084 h1:y3bvkt8ki0KX35eUEU8XShRHusz1S+55QwXUTmxn888=
github.com/btcsuite/btclog/v2 v2.0.1-0.20250602222548-9967d19bb084/go.mod h1:XItGUfVOxotJL8kkuk2Hj3EVow5KCugXl3wWfQ6K0AE=
github.com/btcsuite/btclog/v2 v2.0.1-0.20250728225537-6090e87c6c5b h1:MQ+Q6sDy37V1wP1Yu79A5KqJutolqUGwA99UZWQDWZM=
github.com/btcsuite/btclog/v2 v2.0.1-0.20250728225537-6090e87c6c5b/go.mod h1:XItGUfVOxotJL8kkuk2Hj3EVow5KCugXl3wWfQ6K0AE=
github.com/btcsuite/btcutil v0.0.0-20190425235716-9e5f4b9a998d/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg=
github.com/btcsuite/btcwallet v0.16.14 h1:CofysgmI1ednkLsXontAdBoXJkbiim7unXnFKhLLjnE=
github.com/btcsuite/btcwallet v0.16.14/go.mod h1:H6dfoZcWPonM2wbVsR2ZBY0PKNZKdQyLAmnX8vL9JFA=
github.com/btcsuite/btcwallet v0.16.15-0.20250805011126-a3632ae48ab3 h1:MAjNRpj3XhCOrhchq4wq0qI34TIBX/DCnT6OLWejx68=
github.com/btcsuite/btcwallet v0.16.15-0.20250805011126-a3632ae48ab3/go.mod h1:H6dfoZcWPonM2wbVsR2ZBY0PKNZKdQyLAmnX8vL9JFA=
github.com/btcsuite/btcwallet/wallet/txauthor v1.3.5 h1:Rr0njWI3r341nhSPesKQ2JF+ugDSzdPoeckS75SeDZk=
github.com/btcsuite/btcwallet/wallet/txauthor v1.3.5/go.mod h1:+tXJ3Ym0nlQc/iHSwW1qzjmPs3ev+UVWMbGgfV1OZqU=
github.com/btcsuite/btcwallet/wallet/txrules v1.2.2 h1:YEO+Lx1ZJJAtdRrjuhXjWrYsmAk26wLTlNzxt2q0lhk=
Expand Down Expand Up @@ -1137,8 +1137,8 @@ github.com/lightninglabs/lightning-node-connect/hashmailrpc v1.0.3 h1:NuDp6Z+QNM
github.com/lightninglabs/lightning-node-connect/hashmailrpc v1.0.3/go.mod h1:bDnEKRN1u13NFBuy/C+bFLhxA5bfd3clT25y76QY0AM=
github.com/lightninglabs/lightning-node-connect/mailbox v1.0.1 h1:RWmohykp3n/DTMWY8b18RNTEcLDf+KT/AZHKYdOObkM=
github.com/lightninglabs/lightning-node-connect/mailbox v1.0.1/go.mod h1:NYtNexZE9gO1eOeegTxmIW9fqanl7eZ9cOrE9yewSAk=
github.com/lightninglabs/lndclient v0.19.0-9 h1:ell27omDoks79upoAsO/7QY40O93ud4tAtBXXZilqok=
github.com/lightninglabs/lndclient v0.19.0-9/go.mod h1:35d50tEMFxlJlKTZGYA6EdOllPsbxS4FUmEVbETUx+Q=
github.com/lightninglabs/lndclient v0.19.0-11 h1:/WwowlNff19lb7DXzq3c6L4nRMvwBZjbjLOy1/u4a5Y=
github.com/lightninglabs/lndclient v0.19.0-11/go.mod h1:cicoJY1AwZuRVXGD8Knp50TRT7TGBmw1k37uPQsGQiw=
github.com/lightninglabs/migrate/v4 v4.18.2-9023d66a-fork-pr-2 h1:eFjp1dIB2BhhQp/THKrjLdlYuPugO9UU4kDqu91OX/Q=
github.com/lightninglabs/migrate/v4 v4.18.2-9023d66a-fork-pr-2/go.mod h1:99BKpIi6ruaaXRM1A77eqZ+FWPQ3cfRa+ZVy5bmWMaY=
github.com/lightninglabs/neutrino v0.16.1 h1:5Kz4ToxncEVkpKC6fwUjXKtFKJhuxlG3sBB3MdJTJjs=
Expand All @@ -1149,8 +1149,8 @@ github.com/lightninglabs/protobuf-go-hex-display v1.34.2-hex-display h1:w7FM5LH9
github.com/lightninglabs/protobuf-go-hex-display v1.34.2-hex-display/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw=
github.com/lightningnetwork/lightning-onion v1.2.1-0.20240712235311-98bd56499dfb h1:yfM05S8DXKhuCBp5qSMZdtSwvJ+GFzl94KbXMNB1JDY=
github.com/lightningnetwork/lightning-onion v1.2.1-0.20240712235311-98bd56499dfb/go.mod h1:c0kvRShutpj3l6B9WtTsNTBUtjSmjZXbJd9ZBRQOSKI=
github.com/lightningnetwork/lnd v0.19.2-beta h1:3SKVrKYFY4IJLlrMf7cDzZcBeT+MxjI9Xy6YpY+EEX4=
github.com/lightningnetwork/lnd v0.19.2-beta/go.mod h1:+yKUfIGKKYRHGewgzQ6xi0S26DIfBiMv1zCdB3m6YxA=
github.com/lightningnetwork/lnd v0.19.3-beta.rc1 h1:UNq7fI2URQmYtVw2ca2T2BB2fWckhLr9DMneMP1oJJU=
github.com/lightningnetwork/lnd v0.19.3-beta.rc1/go.mod h1:Mf5k8y8ykULxcnS84QGy4wSLRwh4ZqwdV9Rvw68kFC4=
github.com/lightningnetwork/lnd/cert v1.2.2 h1:71YK6hogeJtxSxw2teq3eGeuy4rHGKcFf0d0Uy4qBjI=
github.com/lightningnetwork/lnd/cert v1.2.2/go.mod h1:jQmFn/Ez4zhDgq2hnYSw8r35bqGVxViXhX6Cd7HXM6U=
github.com/lightningnetwork/lnd/clock v1.1.1 h1:OfR3/zcJd2RhH0RU+zX/77c0ZiOnIMsDIBjgjWdZgA0=
Expand Down
4 changes: 2 additions & 2 deletions itest/mint_fund_seal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -597,15 +597,15 @@ func deriveRandomKey(t *testing.T, ctxt context.Context,
keyRing *lndservices.LndRpcKeyRing) keychain.KeyDescriptor {

var (
randFam = test.RandInt31n(math.MaxInt32)
randFam = test.RandInt31n(math.MaxInt8)
randInd = test.RandInt31n(255)
desc keychain.KeyDescriptor
err error
)

// Ensure that we use a different key family from tapd.
for randFam == asset.TaprootAssetsKeyFamily {
randFam = test.RandInt31n(math.MaxInt32)
randFam = test.RandInt31n(math.MaxInt8)
}

desc, err = keyRing.DeriveNextKey(
Expand Down
9 changes: 9 additions & 0 deletions itest/multisig.go
Original file line number Diff line number Diff line change
Expand Up @@ -489,6 +489,15 @@ func FinalizePacket(t *testing.T, lnd *rpc.HarnessRPC,
return signedPacket
}

// FinalizeFullySigned is a helper function that finalizes a PSBT packet
// that is already fully signed. It will return the finalized packet.
func FinalizeFullySigned(t *testing.T, pkt *psbt.Packet) *psbt.Packet {
err := psbt.MaybeFinalizeAll(pkt)
require.NoError(t, err)

return pkt
}

// PublishAndLogTransferOption defines a functional option for
// PublishAndLogTransfer.
type PublishAndLogTransferOption func(*publishAndLogTransferOptions)
Expand Down
4 changes: 2 additions & 2 deletions itest/psbt_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1149,7 +1149,7 @@ func testPsbtInteractiveAltLeafAnchoring(t *harnessTest) {
require.NoError(t.t, err)

commitPacket = signPacket(t.t, senderLnd, commitPacket)
commitPacket = FinalizePacket(t.t, senderLnd.RPC, commitPacket)
commitPacket = FinalizeFullySigned(t.t, commitPacket)
publishResp := PublishAndLogTransfer(
t.t, sender, commitPacket, []*tappsbt.VPacket{activePacket},
[]*tappsbt.VPacket{passivePacket}, commitResp,
Expand Down Expand Up @@ -2795,7 +2795,7 @@ func testPsbtExternalCommit(t *harnessTest) {
t.Logf("Committed transaction: %v", toJSON(t.t, commitResp))

btcPacket = signPacket(t.t, aliceLnd, btcPacket)
btcPacket = FinalizePacket(t.t, aliceLnd.RPC, btcPacket)
btcPacket = FinalizeFullySigned(t.t, btcPacket)

transferLabel := "itest-psbt-external-commit"

Expand Down
61 changes: 56 additions & 5 deletions itest/test_harness.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
"github.com/lightninglabs/taproot-assets/taprpc"
unirpc "github.com/lightninglabs/taproot-assets/taprpc/universerpc"
"github.com/lightningnetwork/lnd/build"
"github.com/lightningnetwork/lnd/lnrpc"
"github.com/lightningnetwork/lnd/lnrpc/walletrpc"
"github.com/lightningnetwork/lnd/lntest"
"github.com/lightningnetwork/lnd/lntest/node"
"github.com/lightningnetwork/lnd/lntest/port"
Expand All @@ -40,13 +42,24 @@

// noDelete is a command line flag for disabling deleting the tapd
// data directories.
noDelete = flag.Bool("nodelete", false, "Set to true to keep all "+
"tapd data directories after completing the tests")
noDelete = flag.Bool(
"nodelete", false, "Set to true to keep all tapd data "+
"directories after completing the tests",
)

// logLevel is a command line flag for setting the log level of the
// integration test output.
logLevel = flag.String("loglevel", "info", "Set the log level of the "+
"integration test output")
logLevel = flag.String(
"loglevel", "info", "Set the log level of the integration "+
"test output",
)

// lndRemoteSigner is a command line flag that indicates whether the
// lnd instances should be set up to use a remote signer.
lndRemoteSigner = flag.Bool(
"lndremotesigner", false, "if true, the lnd instances will "+
"be set up to use a remote signer",
)
)

const (
Expand Down Expand Up @@ -303,7 +316,45 @@
proofCourier = universeServer
}

alice := lndHarness.NewNodeWithCoins("Alice", nil)
var alice *node.HarnessNode
if *lndRemoteSigner {
signer := lndHarness.NewNode("Signer", nil)

rpcAccts := signer.RPC.ListAccounts(
&walletrpc.ListAccountsRequest{},
)

watchOnlyAccounts, err := walletrpc.AccountsToWatchOnly(
rpcAccts.Accounts,
)
require.NoError(t, err)
alice = lndHarness.NewNodeRemoteSigner(
"WatchOnly", append([]string{

Check failure on line 332 in itest/test_harness.go

View workflow job for this annotation

GitHub Actions / Lint check

badCall: no-op append call, probably missing arguments (gocritic)
"--remotesigner.enable",
fmt.Sprintf(
"--remotesigner.rpchost=localhost:%d",
signer.Cfg.RPCPort,
),
fmt.Sprintf(
"--remotesigner.tlscertpath=%s",
signer.Cfg.TLSCertPath,
),
fmt.Sprintf(
"--remotesigner.macaroonpath=%s",
signer.Cfg.AdminMacPath,
),
}),
[]byte("itestpassword"), &lnrpc.WatchOnly{
MasterKeyBirthdayTimestamp: 0,
MasterKeyFingerprint: nil,
Accounts: watchOnlyAccounts,
},
)

lndHarness.FundNumCoins(alice, 5)
} else {
alice = lndHarness.NewNodeWithCoins("Alice", nil)
}

// Create a tapd that uses Alice and connect it to the universe server.
tapdHarness := setupTapdHarness(
Expand Down
5 changes: 5 additions & 0 deletions make/testing_flags.mk
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ ifneq ($(nodelete),)
ITEST_FLAGS += -nodelete
endif

# Run the lnd node in remote signing mode.
ifneq ($(remote-signing),)
ITEST_FLAGS += -lndremotesigner
endif

# Run the optional tests.
ifneq ($(optional),)
ITEST_FLAGS += -optional -postgrestimeout=240m
Expand Down
Loading