Skip to content
Draft
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
34 changes: 34 additions & 0 deletions .github/actions/setup-bitcoind/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: "Setup bitcoind"
description: "Install a pinned Bitcoin Core release for integration tests"
inputs:
version:
description: "Bitcoin Core version to install"
required: false
default: "30.2"

runs:
using: "composite"

steps:
- name: install bitcoind ${{ inputs.version }}
shell: bash
run: |
set -euo pipefail

if command -v bitcoind >/dev/null 2>&1; then
bitcoind --version
exit 0
fi

VERSION="${{ inputs.version }}"
ARCHIVE="bitcoin-${VERSION}-x86_64-linux-gnu.tar.gz"
URL="https://bitcoincore.org/bin/bitcoin-core-${VERSION}/${ARCHIVE}"
WORKDIR="$(mktemp -d)"

curl --fail --location --retry 5 --output "${WORKDIR}/${ARCHIVE}" "${URL}"
tar -C "${WORKDIR}" -xzf "${WORKDIR}/${ARCHIVE}"

sudo install -m 0755 "${WORKDIR}/bitcoin-${VERSION}/bin/bitcoind" /usr/local/bin/bitcoind
sudo install -m 0755 "${WORKDIR}/bitcoin-${VERSION}/bin/bitcoin-cli" /usr/local/bin/bitcoin-cli

bitcoind --version
43 changes: 43 additions & 0 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,9 @@ jobs:
name: itest-binaries
path: itest

- name: Setup bitcoind
uses: ./.github/actions/setup-bitcoind

- name: Initialize environment
run: |
chmod +x itest/itest.test itest/btcd-itest itest/lnd-itest itest/tapd-itest itest/chantools/chantools
Expand Down Expand Up @@ -480,6 +483,9 @@ jobs:
name: itest-binaries
path: itest

- name: Setup bitcoind
uses: ./.github/actions/setup-bitcoind

- name: Initialize environment
run: |
chmod +x itest/itest.test itest/btcd-itest itest/lnd-itest itest/tapd-itest itest/chantools/chantools
Expand Down Expand Up @@ -553,6 +559,40 @@ jobs:
format: 'golang'
parallel: true

integration-test-v3:
name: run v3 anchor itest
runs-on: ubuntu-latest
steps:
- name: git checkout
uses: actions/checkout@v5

- name: Setup go ${{ env.GO_VERSION }}
uses: ./.github/actions/setup-go
with:
go-version: '${{ env.GO_VERSION }}'
key-prefix: itest-v3

- name: Setup bitcoind
uses: ./.github/actions/setup-bitcoind

- name: Initialize environment
run: mkdir -p ~/.aperture

- name: run v3 anchor itest
run: make itest-v3

- name: Zip log files on failure
if: ${{ failure() }}
run: 7z a logs-itest-v3.zip itest/regtest/*.log itest/regtest/logs-tranche*/*.log || true

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

# Custom channel integration tests.
custom-channels-itest:
name: run custom channels itests
Expand All @@ -572,6 +612,9 @@ jobs:
name: itest-binaries
path: itest

- name: Setup bitcoind
uses: ./.github/actions/setup-bitcoind

- name: Initialize environment
run: |
chmod +x itest/tapd-integrated-itest itest/btcd-itest itest/custom_channels/itest-cc.test
Expand Down
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,9 @@ itest-cc-parallel: build-itest build-itest-cc-binary clean-cc-itest-logs

itest: build-itest itest-only

itest-v3:
$(MAKE) itest backend=bitcoind icase=anchor_tx_version_v3

itest-trace: build-itest itest-only-trace

itest-only: aperture-dir clean-itest-logs
Expand Down
2 changes: 1 addition & 1 deletion asset/group_key_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ func TestNonSpendableLeafScript(t *testing.T) {

// Finally, we'll make the dummy spend transaction, and
// the output script that we'll attempt to spend.
spendTx := wire.NewMsgTx(1)
spendTx := wire.NewMsgTx(3)
spendTx.AddTxIn(&wire.TxIn{})

leafScript, err := txscript.PayToTaprootScript(
Expand Down
5 changes: 5 additions & 0 deletions asset/mock.go
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,11 @@ func virtualGenesisTx(newAsset *Asset) (*wire.MsgTx, error) {

// With our single input and output mapped, we're ready to construct our
// virtual transaction.
//
// IMPORTANT: The virtual transaction version must remain at v2 for
// backwards compatibility. Changing the version would invalidate all
// existing asset witness signatures. Only the anchor (real Bitcoin)
// transactions use v3.
virtualTx := wire.NewMsgTx(2)
virtualTx.AddTxIn(txIn)
virtualTx.AddTxOut(txOut)
Expand Down
28 changes: 28 additions & 0 deletions authmailbox/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"time"

"github.com/btcsuite/btclog/v2"
"github.com/lightninglabs/taproot-assets/asset"
"github.com/lightninglabs/taproot-assets/fn"
"github.com/lightninglabs/taproot-assets/internal/test"
"github.com/lightninglabs/taproot-assets/proof"
Expand Down Expand Up @@ -169,6 +170,32 @@ func TestServerClientAuthAndRestart(t *testing.T) {
t.Cleanup(func() {
require.NoError(t, multiSub.Stop())
})
assertMultiSubConnected := func(targetKeys ...keychain.KeyDescriptor) {
t.Helper()

serverURL := url.URL{Host: clientCfg.ServerAddress}
require.Eventually(t, func() bool {
multiSub.RLock()
defer multiSub.RUnlock()

client, ok := multiSub.clients[serverURL]
if !ok {
return false
}

for _, targetKey := range targetKeys {
key := asset.ToSerialized(targetKey.PubKey)
subscription, ok := client.subscriptions[key]
if !ok || !subscription.IsSubscribed() {
return false
}
}

return true
}, testTimeout, testMinBackoff)
}
assertMultiSubConnected(clientKey1, clientKey2)

msgChan := multiSub.MessageChan()
readMultiSub := func(targetID ...uint64) {
t.Helper()
Expand Down Expand Up @@ -221,6 +248,7 @@ func TestServerClientAuthAndRestart(t *testing.T) {
harness.Start(t)
client1.assertConnected(t)
client2.assertConnected(t)
assertMultiSubConnected(clientKey1, clientKey2)

// Let's send another message to all clients.
msg2 := &Message{
Expand Down
10 changes: 6 additions & 4 deletions authmailbox/receive_subscription.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"io"
"math"
"sync"
"sync/atomic"
"time"

"github.com/btcsuite/btclog/v2"
Expand Down Expand Up @@ -61,6 +62,7 @@ type receiveSubscription struct {
serverStream clientStream
streamMutex sync.RWMutex
streamCancel func()
subscribed atomic.Bool

authOkChan chan struct{}
msgChan chan<- *ReceivedMessages
Expand Down Expand Up @@ -198,10 +200,7 @@ func (s *receiveSubscription) wait(backoff time.Duration) error {
// IsSubscribed returns true if at least one account is in an active state and
// the subscription stream to the server was established successfully.
func (s *receiveSubscription) IsSubscribed() bool {
s.streamMutex.RLock()
defer s.streamMutex.RUnlock()

return s.serverStream != nil
return s.subscribed.Load()
}

// connectServerStream opens the initial connection to the server for the stream
Expand Down Expand Up @@ -412,6 +411,8 @@ func (s *receiveSubscription) readIncomingStream(ctx context.Context) {
// The server confirms the account subscription. Nothing for us
// to do here.
case *respTypeAuthSuccess:
s.subscribed.Store(true)

// Inform the subscription about the arrived auth
// confirmation.
select {
Expand Down Expand Up @@ -476,6 +477,7 @@ func (s *receiveSubscription) closeStream(ctx context.Context) error {

s.streamMutex.Lock()
defer s.streamMutex.Unlock()
s.subscribed.Store(false)

if s.streamCancel != nil {
s.streamCancel()
Expand Down
9 changes: 9 additions & 0 deletions docs/release-notes/release-notes-0.8.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,11 @@
Add pagination support (offset, limit, direction) to the `ListAssets` RPC
endpoint.

- [PR#1857](https://github.com/lightninglabs/taproot-assets/pull/1857)
Add RPC support for selecting the version of newly created anchor
transactions in minting, send, and virtual-PSBT anchoring flows while
keeping v2 as the default.

## tapcli Updates

- [PR#1995](https://github.com/lightninglabs/taproot-assets/pull/1995)
Expand Down Expand Up @@ -308,6 +313,10 @@

## Testing

- [PR#1857](https://github.com/lightninglabs/taproot-assets/pull/1857)
Add a dedicated bitcoind-backed integration lane that verifies explicit
v3 anchor transactions end to end.

- [Wallet Backup Integration Tests](https://github.com/lightninglabs/taproot-assets/pull/1980):
Add two integration tests for wallet backup covering genesis backup/restore,
idempotent import, all three backup modes with size comparison, post-restore
Expand Down
Loading
Loading