Skip to content
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

Support regtest #707

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Open

Support regtest #707

wants to merge 10 commits into from

Conversation

danielgranhao
Copy link
Contributor

@danielgranhao danielgranhao commented Jan 31, 2025

This PR is a first step towards #635. It doesn't provide any tests, but it already provides value as it allows using the CLI to manually test most (if not all - haven't fully tested) types of payments supported by the SDK. This is especially useful for chain swaps, as up until now we have been testing on mainnet, given the high fees on testnet3.

Changes:

  • Adjusts the SDK to support regtest
    • Relies on changes to boltz client and sdk-common
    • Disables tls for electrum clients when on regtest
    • Adds variants to network enums
    • Sets default BTC asset id for regtest (existing migration is adjusted directly as it is assumed that no node will switch networks)
  • Regtest setup is added. I took the setup from boltz and adjusted it to our needs.
    • The main changes were the addition of mempool (given we rely on it for fee estimations), removal of Otterscan explorer, and setting the platform to allow the images to run emulated on arm Macs. (edit) Also, it now adds a local rtsync instance (thanks, @hydra-yse 🙂 )
    • It can be further optimized (e.g. it still runs anvil, startup is a bit finicky and sometimes fails)

See the regtest/README.md for how to start and use the test setup.

I've tested basic cases (Sending and receiving to/from BTC address and sending and receiving using bolt11) and these have worked fine.

Copy link
Collaborator

@dangeross dangeross left a comment

Choose a reason for hiding this comment

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

Awesome! I'll give it a test. It looks like the UDL is missing LiquidNetwork::Regtest

lib/core/src/sdk.rs Outdated Show resolved Hide resolved
lib/core/src/model.rs Outdated Show resolved Hide resolved
Copy link
Collaborator

@dangeross dangeross left a comment

Choose a reason for hiding this comment

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

These are the errors I got running locally. After fixing the ones below I eventually got:

Error response from daemon: failed to mount local volume: mount ./data/mempool-db:/var/lib/docker/volumes/mempool-db-data/_data, flags: 0x1000: no such file or directory

regtest/docker-compose.yml Outdated Show resolved Hide resolved
regtest/docker-compose.yml Outdated Show resolved Hide resolved
regtest/docker-compose.yml Outdated Show resolved Hide resolved
Copy link
Collaborator

@dangeross dangeross left a comment

Choose a reason for hiding this comment

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

Tested ACK (needs a rebase).

It would be good to see (in a followup PR) a more detailed guide, maybe running though the life of a payment end-to-end.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants