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

upgrade(swap): Upgrade bdk library #180

Draft
wants to merge 41 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
cc760f0
upgrade sqlx to 0.8, add bdk_wallet and bdk_electrum
Einliterflasche Nov 16, 2024
52e52f1
move old wallet code to extra module
Einliterflasche Nov 22, 2024
988143c
fix fee estimation for old client
Einliterflasche Nov 22, 2024
e556bc3
bump bitcoin crate, add new wallet constructor
Einliterflasche Nov 22, 2024
61e45c7
remove unused old Client, move code around for better readibility
Einliterflasche Nov 22, 2024
dc1e323
make Wallet generic over Persister (database) and move more code arou…
Einliterflasche Nov 22, 2024
c7e8db3
add script history, start reimplementing client methods
Einliterflasche Nov 22, 2024
b30cc91
update some imports
Einliterflasche Nov 22, 2024
47bb2ff
cargo fmt
Einliterflasche Nov 23, 2024
a5c4261
Add comments, fix fee estimation, address generation and status_of_sc…
Einliterflasche Nov 25, 2024
32430db
redo state update and wallet sync
Einliterflasche Nov 25, 2024
e634cc8
fix bitcoin address validation and more imports, use Amount everywhere
Einliterflasche Nov 26, 2024
1d2543a
fix tx cancel, lock, punish, redeem, refund
Einliterflasche Nov 26, 2024
11c9aa9
fix bitcoin::Address de-/serialisation
Einliterflasche Nov 26, 2024
bde3b91
fix more address validation
Einliterflasche Nov 26, 2024
3907593
fix more address parsing and validation, also some more imports
Einliterflasche Nov 27, 2024
533bd30
cargo fmt
Einliterflasche Nov 27, 2024
5e15c66
fix wallet initialization, start wallet migration
Einliterflasche Nov 27, 2024
69269c4
fail test instead of ignoring it
Einliterflasche Nov 29, 2024
5e52e0a
perform full scan on creation, load from db if it exists
Einliterflasche Dec 3, 2024
c353538
add more wallet info, fix wallet initialization
Einliterflasche Dec 3, 2024
1302840
fix: default to null in config
binarybaron Dec 3, 2024
ec361a6
migrate from old wallet if needed
Einliterflasche Dec 3, 2024
4e908e7
change something
Einliterflasche Dec 5, 2024
65eed53
fix some tests
Einliterflasche Dec 9, 2024
3b92235
Merge remote-tracking branch 'origin/master' into swap/upgrade-bdk
Einliterflasche Dec 9, 2024
0129170
temporarily patch bdk_wallet and bdk_electrum
Einliterflasche Dec 9, 2024
f421c55
fix more tests
Einliterflasche Dec 9, 2024
a3f4317
fix missing rustls
Einliterflasche Dec 10, 2024
556d161
asb: only start tor client if register_hidden_service=true in the config
Einliterflasche Dec 11, 2024
b048569
fix: use p2wsh_signature_hash instead of p2wpkh_signature_hash
Einliterflasche Dec 11, 2024
e82e2e6
fix some bitcoin address parsing and fee rate parsing
Einliterflasche Dec 11, 2024
54dc27d
dprint fmt
Einliterflasche Dec 16, 2024
a863271
add bitcoin-harness to this project and update to the new bitcoin ver…
Einliterflasche Dec 16, 2024
ffbd53a
fix max_givible again
Einliterflasche Dec 18, 2024
e38d78d
create electrum client separately from wallet, clean up some code
Einliterflasche Dec 20, 2024
4777322
Merge branch 'master' into swap/upgrade-bdk
Einliterflasche Dec 24, 2024
995ff2c
add comment
Einliterflasche Dec 24, 2024
455e83b
Merge branch 'master' into swap/upgrade-bdk
Einliterflasche Dec 24, 2024
26b43d0
ignore .env.development
Einliterflasche Jan 6, 2025
c0828fe
log config file path on ./asb config
Einliterflasche Jan 6, 2025
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
1,340 changes: 941 additions & 399 deletions Cargo.lock

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,8 @@ members = [ "monero-harness", "monero-rpc", "swap", "monero-wallet", "src-tauri"
# patch until new release https://github.com/thomaseizinger/rust-jsonrpc-client/pull/51
jsonrpc_client = { git = "https://github.com/delta1/rust-jsonrpc-client.git", rev = "3b6081697cd616c952acb9c2f02d546357d35506" }
monero = { git = "https://github.com/comit-network/monero-rs", rev = "818f38b" }

# patch until new release https://github.com/bitcoindevkit/bdk/pull/1766
bdk_wallet = { git = "https://github.com/Einliterflasche/bdk", branch = "bump/rusqlite-0.32", features = [ "bundled" ], package = "bdk_wallet" }
bdk_electrum = { git = "https://github.com/Einliterflasche/bdk", branch = "bump/rusqlite-0.32", features = [ "bundled" ], package = "bdk_electrum" }

86 changes: 86 additions & 0 deletions bitcoin-harness/.github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
name: CI

on:
pull_request:
push:
branches:
- 'staging'
- 'trying'
- 'master'

jobs:
static_analysis:
env:
RUST_TOOLCHAIN: stable
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v2

- name: Install ${{ env.RUST_TOOLCHAIN }} toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ env.RUST_TOOLCHAIN }}
override: true
components: rustfmt, clippy

- name: Cache ~/.cargo/bin directory
uses: actions/cache@v1
with:
path: ~/.cargo/bin
key: ubuntu-rust-${{ env.RUST_TOOLCHAIN }}-cargo-bin-directory-v1

- name: Install tomlfmt
run: which cargo-tomlfmt || cargo install cargo-tomlfmt

- name: Check Cargo.toml formatting
run: cargo tomlfmt -d -p Cargo.toml

- name: Check code formatting
run: cargo fmt -- --check

- name: Run clippy
run: cargo clippy --all-targets -- -D warnings

build_test:
strategy:
matrix:
rust_toolchain: [stable, beta]
continue_on_error: [false]
include:
- rust_toolchain: nightly
continue_on_error: true
continue-on-error: ${{ matrix.continue_on_error }}
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v2

- name: Install ${{ matrix.rust_toolchain }} toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.rust_toolchain }}
override: true

- name: Cache target directory
uses: actions/cache@v1
with:
path: target
key: rust-${{ matrix.rust_toolchain }}-target-directory-${{ hashFiles('Cargo.lock') }}-v1

- name: Cache ~/.cargo/registry directory
uses: actions/cache@v1
with:
path: ~/.cargo/registry
key: rust-${{ matrix.rust_toolchain }}-cargo-registry-directory-${{ hashFiles('Cargo.lock') }}-v1

- name: Cargo check
run: cargo check

- name: Cargo test
run: cargo test --features test-docker

- name: Cargo doc
run: cargo test --doc
10 changes: 10 additions & 0 deletions bitcoin-harness/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Generated by Cargo
# will have compiled files and executables
/target/

# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
Cargo.lock

# These are backup files generated by rustfmt
**/*.rs.bk
33 changes: 33 additions & 0 deletions bitcoin-harness/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

## [0.2.1] - 2022-09-19

### Changed

- Replace JSON RPC Client with thomaseizinger/rust-jsonrpc-client

## [0.2.0] - 2020-12-04

### Changed

- **Breaking Change**: Use `bitcoincore_rpc_json::GetRawTransactionVerboseResponse` as return type for `get_raw_transaction_verbose` to get all fields.
- Expose bitcoind rpc client from wallet.
- **Breaking Change**: Upgrade rust-bitcoin to 0.25.

## [0.1.0] - 2020-11-11

### Added

- A library to spin up a bitcoind node and do the things we always do: activate segwit, fund addresses, mine blocks.

[Unreleased]: https://github.com/coblox/bitcoin-harness-rs/compare/0.2.1...HEAD
[0.2.1]: https://github.com/coblox/bitcoin-harness-rs/compare/0.2.1...0.2.0
[0.2.0]: https://github.com/coblox/bitcoin-harness-rs/compare/0.1.0...0.2.0
[0.1.0]: https://github.com/coblox/bitcoin-harness-rs/compare/5549a14a3c5021998a5b4b681bf92b5f2fddf525...0.1.0
39 changes: 39 additions & 0 deletions bitcoin-harness/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
[package]
name = "bitcoin-harness"
version = "0.3.0"
authors = ["CoBloX Team <[email protected]>"]
edition = "2018"
description = "A simple lib to start a bitcoind container, generate blocks and fund addresses"
license = "MIT"

[dependencies]
base64 = "0.12.3"
bitcoin = { version = "0.32", features = ["serde"] }
bitcoincore-rpc-json = "0.19"
futures = "0.3.5"
hex = "0.4.2"
hmac = "0.12.1"
jsonrpc_client = { version = "0.7", features = ["reqwest"] }
rand = "0.8"
reqwest = { version = "0.12", default-features = false, features = ["json"] }
serde = "1.0"
serde_json = "1.0"
sha2 = "0.10.8"
testcontainers = "0.15"
thiserror = "1.0"
tokio = { version = "1.0", features = ["time"] }
tracing = "0.1"
url = "2"

[dev-dependencies]
bitcoincore-rpc = "0.18.0"
pretty_env_logger = "0.5.0"
spectral = "0.6"
tokio = { version = "1.0", features = ["rt-multi-thread", "macros"] }

[features]
default = []
test-docker = []

[patch.crates-io]
jsonrpc_client = { git = "https://github.com/delta1/rust-jsonrpc-client.git", rev = "3b6081697cd616c952acb9c2f02d546357d35506" }
21 changes: 21 additions & 0 deletions bitcoin-harness/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2020 CoBloX

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
2 changes: 2 additions & 0 deletions bitcoin-harness/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# bitcoin-harness-rs
A simple lib to start a bitcoind container, generate blocks and funds addresses.
5 changes: 5 additions & 0 deletions bitcoin-harness/bors.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
status = [
"static_analysis",
"build_test (stable, false)",
"build_test (beta, false)",
]
Loading
Loading