Skip to content
Closed
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
63 changes: 30 additions & 33 deletions .cargo/mutants.toml
Original file line number Diff line number Diff line change
@@ -1,41 +1,38 @@
additional_cargo_args = ["--all-features"]
gitignore = true
examine_globs = [
"payjoin/src/**/*.rs"
]
exclude_globs = [
]
examine_globs = ["payjoin/src/**/*.rs"]
exclude_globs = []
exclude_re = [
"impl\\s+(std::fmt::|core::fmt::|fmt::)?(Display|Debug)",
"deserialize",
"Iterator",
".*Error",
"impl\\s+(std::fmt::|core::fmt::|fmt::)?(Display|Debug)",
"deserialize",
"Iterator",
".*Error",

# ---------------------Crate-specific exculsions---------------------
# Timeout loops
# src/receive/v1/mod.rs
"interleave_shuffle", # Replacing index += 1 with index *= 1 in a loop causes a timeout due to an infinite loop
# ---------------------Crate-specific exculsions---------------------
# Timeout loops
# src/receive/v1/mod.rs
"interleave_shuffle", # Replacing index += 1 with index *= 1 in a loop causes a timeout due to an infinite loop

# Trivial mutations
# These exlusions are allowing code blocks to run with artithmetic involving zero and as a result are no-ops
# payjoin/src/core/send/mod.rs
"replace < with <= in PsbtContext::check_outputs",
"replace > with >= in PsbtContext::check_fees",
# payjoin/src/core/send/mod.rs
"replace < with <= in PsbtContextBuilder::build_recommended", # clamping the fee contribution when the fee equals to the recommended fee does not do anything
# Trivial mutations
# These exlusions are allowing code blocks to run with artithmetic involving zero and as a result are no-ops
# payjoin/src/core/send/mod.rs
"replace < with <= in PsbtContext::check_outputs",
"replace > with >= in PsbtContext::check_fees",
# payjoin/src/core/send/mod.rs
"replace < with <= in PsbtContextBuilder::build_recommended", # clamping the fee contribution when the fee equals to the recommended fee does not do anything

# Async SystemTime comparison
# checking if the system time is equal to the expiry is difficult to reasonably test
# payjoin/src/core/receive/v2/mod.rs
"replace < with <= in Receiver<Initialized>::apply_unchecked_from_payload",
"replace > with >= in Receiver<Initialized>::create_poll_request",
"replace > with >= in extract_err_req",
# payjoin/src/core/send/v2/mod.rs
"replace > with >= in Sender<WithReplyKey>::create_v2_post_request",
# Async SystemTime comparison
# checking if the system time is equal to the expiry is difficult to reasonably test
# payjoin/src/core/receive/v2/mod.rs
"replace < with <= in Receiver<Initialized>::apply_unchecked_from_payload",
"replace > with >= in Receiver<Initialized>::create_poll_request",
"replace > with >= in extract_err_req",
# payjoin/src/core/send/v2/mod.rs
"replace > with >= in Sender<WithReplyKey>::create_v2_post_request",

# TODO exclusions
# payjoin/src/core/receive/v1/mod.rs
"replace > with >= in WantsInputs::avoid_uih", # This mutation I am unsure about whether or not it is a trivial mutant and have not decided on how the best way to approach testing it is
# payjoin/src/core/send/mod.rs
"replace match guard proposed_txout.script_pubkey == original_output.script_pubkey with true in PsbtContext::check_outputs", # This non-deterministic mutation has a possible test to catch it
# TODO exclusions
# payjoin/src/core/receive/v1/mod.rs
"replace > with >= in WantsInputs::avoid_uih", # This mutation I am unsure about whether or not it is a trivial mutant and have not decided on how the best way to approach testing it is
# payjoin/src/core/send/mod.rs
"replace match guard proposed_txout.script_pubkey == original_output.script_pubkey with true in PsbtContext::check_outputs", # This non-deterministic mutation has a possible test to catch it
]
14 changes: 10 additions & 4 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ jobs:
steps:
- name: "Checkout repo"
uses: actions/checkout@v4
- name: "Install formatting tools"
run: |
cargo install taplo-cli --quiet
- name: "Install nightly toolchain"
uses: dtolnay/rust-toolchain@nightly
with:
Expand All @@ -45,6 +48,9 @@ jobs:
uses: Swatinem/rust-cache@v2
- name: "Run formatting check"
run: cargo fmt --all -- --check
- name: "Check TOML formatting"
run: taplo format --check


Format-FFI:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -117,9 +123,9 @@ jobs:
uses: coverallsapp/github-action@v2

CodeSpell:
name: Code spell check
runs-on: ubuntu-latest
steps:
name: Code spell check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: codespell-project/actions-codespell@v2

Expand All @@ -132,7 +138,7 @@ jobs:
- name: "Checkout repo"
uses: actions/checkout@v4
with:
fetch-depth: 0 # required for full diff context
fetch-depth: 0
- name: Fetch base branch for diff
run: git fetch origin ${{ github.base_ref }}
- name: Relative diff
Expand Down
8 changes: 7 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
[workspace]
members = ["payjoin", "payjoin-cli", "payjoin-directory", "payjoin-test-utils", "payjoin-ffi"]
members = [
"payjoin",
"payjoin-cli",
"payjoin-directory",
"payjoin-ffi",
"payjoin-test-utils",
]
resolver = "2"

[patch.crates-io]
Expand Down
1 change: 1 addition & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@
cargo-nextest
cargo-watch
rust-analyzer
taplo-cli
] ++ pkgs.lib.optionals (!pkgs.stdenv.isDarwin) [
cargo-llvm-cov
];
Expand Down
29 changes: 21 additions & 8 deletions payjoin-cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,14 @@ path = "src/main.rs"
[features]
default = ["v2"]
native-certs = ["reqwest/rustls-tls-native-roots"]
_manual-tls = ["rcgen", "reqwest/rustls-tls", "hyper-rustls", "payjoin/_manual-tls", "tokio-rustls"]
v1 = ["payjoin/v1","hyper", "hyper-util", "http-body-util"]
_manual-tls = [
"rcgen",
"reqwest/rustls-tls",
"hyper-rustls",
"payjoin/_manual-tls",
"tokio-rustls",
]
v1 = ["payjoin/v1", "hyper", "hyper-util", "http-body-util"]
v2 = ["payjoin/v2", "payjoin/io"]

[dependencies]
Expand All @@ -31,26 +37,33 @@ async-trait = "0.1.89"
clap = { version = "4.5.45", features = ["derive"] }
config = "0.15.14"
corepc-types = "0.8.0"
dirs = "6.0.0"
futures = "0.3.31"
http-body-util = { version = "0.1.3", optional = true }
hyper = { version = "1.6.0", features = ["http1", "server"], optional = true }
hyper-rustls = { version = "0.27.7", default-features=false, features = ["ring"], optional = true }
hyper-rustls = { version = "0.27.7", default-features = false, features = [
"ring",
], optional = true }
hyper-util = { version = "0.1.16", optional = true }
payjoin = { version = "0.24.0", default-features = false }
r2d2 = "0.8.10"
r2d2_sqlite = "0.22.0"
rcgen = { version = "0.14.3", optional = true }
reqwest = { version = "0.12.23", default-features = false, features = ["json", "rustls-tls"] }
reqwest = { version = "0.12.23", default-features = false, features = [
"json",
"rustls-tls",
] }
rusqlite = { version = "0.29.0", features = ["bundled"] }
serde_json = "1.0.142"
serde = { version = "1.0.219", features = ["derive"] }
serde_json = "1.0.142"
sled = "0.34.7"
tokio = { version = "1.47.1", features = ["full"] }
tokio-rustls = { version = "0.26.2", features = ["ring"], default-features = false, optional = true }
url = { version = "2.5.4", features = ["serde"] }
dirs = "6.0.0"
tokio-rustls = { version = "0.26.2", features = [
"ring",
], default-features = false, optional = true }
tracing = "0.1.41"
tracing-subscriber = { version = "0.3.19", features = ["env-filter"] }
url = { version = "2.5.4", features = ["serde"] }

[dev-dependencies]
nix = { version = "0.30.1", features = ["aio", "process", "signal"] }
Expand Down
26 changes: 17 additions & 9 deletions payjoin-directory/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,24 +19,32 @@ _manual-tls = ["hyper-rustls", "tokio-rustls"]

[dependencies]
anyhow = "1.0.99"
bitcoin = { version = "0.32.7", features = ["base64", "rand-std"] }
bhttp = { version = "0.6.1", features = ["http"] }
bitcoin = { version = "0.32.7", features = ["base64", "rand-std"] }
clap = { version = "4.5.45", features = ["derive", "env"] }
config = "0.15.14"
futures = "0.3.31"
http-body-util = "0.1.3"
hyper = { version = "1.6.0", features = ["http1", "server"] }
hyper-rustls = { version = "0.27.7", default-features=false, features = ["webpki-roots", "http1", "ring"], optional=true }
hyper-rustls = { version = "0.27.7", default-features = false, features = [
"webpki-roots",
"http1",
"ring",
], optional = true }
hyper-util = { version = "0.1.16", features = ["tokio"] }
ohttp = { package = "bitcoin-ohttp", version = "0.6.0"}
payjoin = { version = "0.24.0", features = ["directory"], default-features = false }
ohttp = { package = "bitcoin-ohttp", version = "0.6.0" }
payjoin = { version = "0.24.0", features = [
"directory",
], default-features = false }
prometheus = "0.13.4"
redis = { version = "0.32.5", features = ["aio", "tokio-comp"] }
serde = { version = "1.0.219", features = ["derive"] }
tokio = { version = "1.23.31", features = ["full"] }
tokio-rustls = { version = "0.26.2", features = ["ring"], default-features = false, optional = true }
tokio-rustls = { version = "0.26.2", features = [
"ring",
], default-features = false, optional = true }
tracing = "0.1.41"
tracing-subscriber = { version = "0.3.19", features = ["env-filter"] }
prometheus = "0.13.4"
clap = { version = "4.5.45", features = ["derive", "env"] }
config = "0.15.14"
serde = { version = "1.0.219", features = ["derive"] }

[dev-dependencies]
tempfile = "3.20.0"
25 changes: 16 additions & 9 deletions payjoin-ffi/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@ edition = "2021"
license = "MIT OR Apache-2.0"
exclude = ["tests"]

[features]
_test-utils = ["payjoin-test-utils", "tokio", "bitcoind"]
_manual-tls = ["payjoin/_manual-tls"]

[lib]
name = "payjoin_ffi"
crate-type = ["lib", "staticlib", "cdylib"]
Expand All @@ -17,14 +13,14 @@ crate-type = ["lib", "staticlib", "cdylib"]
name = "uniffi-bindgen"
path = "uniffi-bindgen.rs"

[build-dependencies]
uniffi = { version = "0.29.1", features = ["build", "cli"] }
uniffi-dart = { git = "https://github.com/Uniffi-Dart/uniffi-dart.git", rev = "b6186bc", features = ["build"] }
[features]
_test-utils = ["payjoin-test-utils", "tokio", "bitcoind"]
_manual-tls = ["payjoin/_manual-tls"]

[dependencies]
base64 = "0.22.1"
bitcoind = { version = "0.36.1", features = ["0_21_2"], optional = true }
bitcoin-ffi = { git = "https://github.com/benalleng/bitcoin-ffi.git", rev = "8e3a23b" }
bitcoind = { version = "0.36.1", features = ["0_21_2"], optional = true }
hex = "0.4.3"
lazy_static = "1.5.0"
ohttp = { package = "bitcoin-ohttp", version = "0.6.0" }
Expand All @@ -38,6 +34,17 @@ uniffi = { version = "0.29.4" }
uniffi-dart = { git = "https://github.com/Uniffi-Dart/uniffi-dart.git", rev = "b6186bc" }
url = "2.5.4"

[build-dependencies]
uniffi = { version = "0.29.1", features = ["build", "cli"] }
uniffi-dart = { git = "https://github.com/Uniffi-Dart/uniffi-dart.git", rev = "b6186bc", features = [
"build",
] }

[dev-dependencies]
bdk = { version = "0.29.0", features = ["all-keys", "use-esplora-ureq", "keys-bip39", "rpc"] }
bdk = { version = "0.29.0", features = [
"all-keys",
"use-esplora-ureq",
"keys-bip39",
"rpc",
] }
bitcoincore-rpc = "0.19.0"
4 changes: 1 addition & 3 deletions payjoin-ffi/python/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,4 @@ package-dir = { "payjoin" = "src/payjoin" }
include-package-data = true

[tool.pytest.ini_options]
pythonpath = [
"."
]
pythonpath = ["."]
2 changes: 1 addition & 1 deletion payjoin-ffi/uniffi.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ cdylib_name = "payjoin_ffi"
cdylib_name = "payjoin_ffi"

[bindings.swift]
cdylib_name = "payjoin_ffi"
cdylib_name = "payjoin_ffi"
14 changes: 10 additions & 4 deletions payjoin-test-utils/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,18 @@ log = "0.4.27"
ohttp = { package = "bitcoin-ohttp", version = "0.6.0" }
ohttp-relay = { version = "0.0.11", features = ["_test-util"] }
once_cell = "1.21.3"
payjoin = { version = "0.24.0", features = ["io", "_manual-tls", "_test-utils"] }
payjoin = { version = "0.24.0", features = [
"io",
"_manual-tls",
"_test-utils",
] }
payjoin-directory = { version = "0.0.3", features = ["_manual-tls"] }
rcgen = "0.14.3"
rustls = { version = "0.23.31", default-features=false, features = ["ring"] }
reqwest = { version = "0.12.23", default-features = false, features = ["rustls-tls"] }
testcontainers-modules = { version = "0.12.1", features = ["redis"]}
reqwest = { version = "0.12.23", default-features = false, features = [
"rustls-tls",
] }
rustls = { version = "0.23.31", default-features = false, features = ["ring"] }
testcontainers-modules = { version = "0.12.1", features = ["redis"] }
tokio = { version = "1.47.1", features = ["full"] }
tracing = "0.1.41"
tracing-subscriber = { version = "0.3.19", features = ["env-filter"] }
Expand Down
35 changes: 24 additions & 11 deletions payjoin/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,34 @@ description = "Payjoin Library implementing BIP 78 and BIP 77 batching protocols
repository = "https://github.com/payjoin/rust-payjoin"
readme = "../README.md"
keywords = ["bip78", "payjoin", "bitcoin"]
categories = ["api-bindings", "cryptography::cryptocurrencies", "network-programming"]
categories = [
"api-bindings",
"cryptography::cryptocurrencies",
"network-programming",
]
license = "MITNFA"
resolver = "2"
edition = "2021"
rust-version = "1.85"
exclude = ["tests"]

[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[features]
default = ["v2"]
#[doc = "Core features for payjoin state machines"]
_core = ["bitcoin/rand-std", "serde_json", "url/serde", "bitcoin_uri", "serde", "bitcoin/serde"]
_core = [
"bitcoin/rand-std",
"serde_json",
"url/serde",
"bitcoin_uri",
"serde",
"bitcoin/serde",
]
directory = []
v1 = ["_core"]
v2 = ["_core", "hpke", "dep:http", "bhttp", "ohttp", "directory"]
Expand All @@ -28,26 +43,24 @@ _manual-tls = ["reqwest/rustls-tls", "rustls"]
_test-utils = []

[dependencies]
bhttp = { version = "0.6.1", optional = true }
bitcoin = { version = "0.32.7", features = ["base64"] }
bitcoin_uri = { version = "0.1.0", optional = true }
hpke = { package = "bitcoin-hpke", version = "0.13.0", optional = true }
http = { version = "1.3.1", optional = true }
bhttp = { version = "0.6.1", optional = true }
ohttp = { package = "bitcoin-ohttp", version = "0.6.0", optional = true }
serde = { version = "1.0.219", default-features = false, optional = true }
reqwest = { version = "0.12.23", default-features = false, optional = true }
rustls = { version = "0.23.31", optional = true, default-features=false, features = ["ring"] }
url = { version = "2.5.4", optional = true }
rustls = { version = "0.23.31", optional = true, default-features = false, features = [
"ring",
] }
serde = { version = "1.0.219", default-features = false, optional = true }
serde_json = { version = "1.0.142", optional = true }
tracing = "0.1.41"
url = { version = "2.5.4", optional = true }

[dev-dependencies]
bitcoind = { version = "0.36.1", features = ["0_21_2"] }
payjoin-test-utils = { version = "0.0.1" }
once_cell = "1.21.3"
payjoin-test-utils = { version = "0.0.1" }
tokio = { version = "1.47.1", features = ["full"] }
tracing = "0.1.41"

[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]
Loading