Skip to content

scripts+bw-compatibility-test: update Dave and make it use sqlite #9655

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

Merged
merged 2 commits into from
Apr 1, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
46 changes: 45 additions & 1 deletion scripts/bw-compatibility-test/docker-compose.override.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ services:
build:
context: ../../
dockerfile: dev.Dockerfile
image: lnd-dev:backward-compat-test-build
container_name: bob-pr
restart: unless-stopped
ports:
Expand Down Expand Up @@ -40,4 +41,47 @@ services:
--protocol.option-scid-alias
--protocol.zero-conf
--protocol.simple-taproot-chans
--trickledelay=50
--trickledelay=50

dave-pr:
image: lnd-dev:backward-compat-test-build
container_name: dave-pr
restart: unless-stopped
ports:
- 10014:10009
- 9744:9735
- 8094:8080
networks:
regtest:
aliases:
- dave
volumes:
- "dave:/root/.lnd"
depends_on:
- bitcoind
command: >
lnd
--logdir=/root/.lnd
--alias=dave
--rpclisten=0.0.0.0:10009
--restlisten=0.0.0.0:8080
--color=#cccccc
--noseedbackup
--bitcoin.active
--bitcoin.regtest
--bitcoin.node=bitcoind
--bitcoind.rpchost=bitcoind
--bitcoind.rpcuser=lightning
--bitcoind.rpcpass=lightning
--bitcoind.zmqpubrawblock=tcp://bitcoind:28332
--bitcoind.zmqpubrawtx=tcp://bitcoind:28333
--debuglevel=debug
--externalip=dave
--tlsextradomain=dave
--accept-keysend
--protocol.option-scid-alias
--protocol.zero-conf
--protocol.simple-taproot-chans
--trickledelay=50
--db.backend=sqlite
--db.use-native-sql
2 changes: 2 additions & 0 deletions scripts/bw-compatibility-test/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,8 @@ services:
- "--tlsextradomain=dave"
- "--accept-keysend"
- "--trickledelay=50"
- "--db.backend=sqlite"
- "--db.use-native-sql"

networks:
regtest:
Expand Down
44 changes: 28 additions & 16 deletions scripts/bw-compatibility-test/network.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,35 @@ DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"

source "$DIR/.env"

# Global variable to keep track of which Bob container to use.
# Once Bob is upgraded to the PR version, this variable must
# be updated to 'bob-pr'.
# Global variables to keep track of which Bob and Dave container
# to use. Once Bob and Dave is upgraded to the PR version, this
# variable must be updated to 'bob-pr' and 'dave-pr` respectively.
BOB=bob
DAVE=dave

# upgrade_bob shuts down the stable Bob container, upgrades the
# compose variables to use the PR version of Bob, rebuilds the
# Bob container, and starts the PR version of Bob.
function upgrade_bob() {
# Shutdown Bob.
compose_stop bob
# upgrade_node shuts down the stable container for a node (currently
# Bob or Dave), upgrades the compose variables, rebuilds the PR version,
# and starts it.
function upgrade_node() {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice 🙏

local node="$1"
local pr="${node}-pr"
local var_name="$(echo "$node" | tr '[:lower:]' '[:upper:]')"

# Shutdown the stable node.
compose_stop "$node"

# Upgrade the compose variables so that the Bob configuration
# Upgrade the compose variables so that the node configuration
# is swapped out for the PR version.
compose_upgrade
export BOB=bob-pr

# Force the rebuild of the Bob container.
compose_rebuild bob-pr
# Export the PR version of the node.
export "$var_name"="$pr"

# Force the rebuild of the PR version of the container.
compose_rebuild "$pr"

# This should now start with the new version of Bob.
compose_start bob-pr
# This should now start the PR version of the node.
compose_start "$pr"
}

# wait_for_nodes waits for all the nodes in the argument list to
Expand Down Expand Up @@ -333,5 +340,10 @@ function charlie() {
}

function dave() {
docker exec -i dave lncli --network regtest "$@"
docker exec -i "$DAVE" lncli --network regtest "$@"
}

function dave-pr() {
docker exec -i dave-pr lncli --network regtest "$@"
}

17 changes: 16 additions & 1 deletion scripts/bw-compatibility-test/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ send_payment alice dave

# Upgrade the compose variables so that the Bob configuration
# is swapped out for the PR version.
upgrade_bob
upgrade_node bob

# Wait for Bob to start.
wait_for_node bob
Expand All @@ -50,4 +50,19 @@ send_payment bob dave
send_payment dave bob
send_payment alice dave

# Upgrade the compose variables so that the Dave configuration
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think we should first run the basic tests for bob before updating dave. otherwise we are not testing the send/receive/route with bob on the PR while dave is still on master. So bugs can slip through here in the case where send and receive only work if both nodes have upgraded

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point! Changed to run the basic tests after Bob is upgraded as well as after Dave is upgraded (to see that a migration doesn't bork anything).

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cool - thanks 🙏

# is swapped out for the PR version.
upgrade_node dave

wait_for_node dave
wait_for_active_chans dave 1

# Show that Dave is now running the current branch.
do_for print_version dave

# Repeat the basic tests (after potential migraton).
send_payment bob dave
send_payment dave bob
send_payment alice dave

echo "🛡️⚔️🫡 Backwards compatibility test passed! 🫡⚔️🛡️"