Skip to content
Merged
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
57 changes: 27 additions & 30 deletions .cargo/mutants.toml
Original file line number Diff line number Diff line change
@@ -1,37 +1,34 @@
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 exclusions ---------------------
# 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 exclusions ---------------------
# 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 exclusions are allowing code blocks to run with arithmetic 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
# payjoin/src/core/receive/v2/mod.rs
"payjoin/src/core/receive/v2.mod.*replace \\* with [+/]$", # This targets mutations on the static TWENTY_FOUR_HOURS_DEFAULT_EXPIRATION that is not particularly useful to test for
# Trivial mutations
# These exclusions are allowing code blocks to run with arithmetic 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
# payjoin/src/core/receive/v2/mod.rs
"payjoin/src/core/receive/v2.mod.*replace \\* with [+/]$", # This targets mutations on the static TWENTY_FOUR_HOURS_DEFAULT_EXPIRATION that is not particularly useful to test for

# 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
# These will be removed following #1123
# payjoin/src/core/send/v2/session.rs
"SessionHistory::terminal_error",
# 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
# These will be removed following #1123
# payjoin/src/core/send/v2/session.rs
"SessionHistory::terminal_error",
]
2 changes: 2 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
d9aa8187499a28f1244d8a57d2b474efabd3c1a1
4157a3babacca1a63fac12364446d79aa464b378
9 changes: 5 additions & 4 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,14 @@ As a small exception, trivial tab-completion doesn't need to be disclosed,
so long as it is limited to single keywords or short phrases.

An example disclosure:

> This PR was written primarily by Claude Code.
Or a more detailed disclosure:
> Or a more detailed disclosure:
> I consulted ChatGPT to understand the codebase but the solution
> was fully authored manually by myself.
Failure to disclose this is impolite to the human operators
on the other end of the pull request, and it also makes it difficult to
determine how much scrutiny to apply to the contribution.
> Failure to disclose this is impolite to the human operators
> on the other end of the pull request, and it also makes it difficult to
> determine how much scrutiny to apply to the contribution.

Please be respectful to maintainers and disclose AI assistance so that
they may help you effectively contribute.
Expand Down
9 changes: 4 additions & 5 deletions .github/ISSUE_TEMPLATE/minor-release.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@
name: Minor Release
about: Checklist for releasing a new minor version bump
title: Release MAJOR.MINOR+1.0
labels: ''
assignees: ''

labels: ""
assignees: ""
---

## Create a new minor release
Expand All @@ -24,7 +23,7 @@ assignees: ''
### Checklist

Release numbering must follow [Semantic Versioning]. These steps assume the current `master`
branch **development** version is *MAJOR.MINOR.0*.
branch **development** version is _MAJOR.MINOR.0_.

#### On the day of the feature freeze

Expand All @@ -41,7 +40,7 @@ Change the `master` branch to the next MINOR+1 version:
- Title PR "Bump CRATE version to MAJOR.MINOR+1.0".
- [ ] Merge the `bump-CRATE-MAJOR-MINOR+1` branch to `master`.

If any issues need to be fixed before the *MAJOR.MINOR+1.0* version is released:
If any issues need to be fixed before the _MAJOR.MINOR+1.0_ version is released:

- [ ] Merge fix PRs to the `master` branch.
- [ ] Git cherry-pick fix commits to the `bump-CRATE-MAJOR.MINOR+1` branch.
Expand Down
4 changes: 2 additions & 2 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
Please confirm the following before requesting review:

- [ ] I have [disclosed my use of
AI](https://github.com/payjoin/rust-payjoin/blob/master/.github/CONTRIBUTING.md#ai-assistance-notice)
in the body of this PR.
AI](https://github.com/payjoin/rust-payjoin/blob/master/.github/CONTRIBUTING.md#ai-assistance-notice)
in the body of this PR.
- [ ] I have read [CONTRIBUTING.md](https://github.com/payjoin/rust-payjoin/blob/master/.github/CONTRIBUTING.md#commits) and **rebased my branch to produce [hygienic commits](https://github.com/bitcoin/bitcoin/blob/master/CONTRIBUTING.md#committing-patches)**.
</details>
2 changes: 1 addition & 1 deletion .github/workflows/cron-directory-monitor.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name : Payjoin directory health check
name: Payjoin directory health check
on:
schedule:
- cron: "*/15 * * * *" # Every 15 minutes
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/cron-weekly-mutants.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Weekly cargo-mutants
on:
schedule:
on:
schedule:
- cron: "0 0 * * 0" # runs weekly on Sunday at 00:00
workflow_dispatch: # allows manual triggering
jobs:
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/dart.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,3 @@ jobs:

- name: Run tests
run: dart test

22 changes: 22 additions & 0 deletions .github/workflows/format.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Continuous integration

on: [push, pull_request]

jobs:
Format:
runs-on: ubuntu-latest
steps:
- name: "Checkout repo"
uses: actions/checkout@v4
- name: "Install nix"
uses: DeterminateSystems/determinate-nix-action@main
- name: "Use nix cache"
uses: DeterminateSystems/magic-nix-cache-action@main
- name: Run treefmt
run: |
set -eo pipefail
nix fmt -- --ci || {
echo "❌ Code is not formatted. Showing diff:"
git --no-pager diff
exit 1
}
35 changes: 3 additions & 32 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,34 +40,6 @@ jobs:
- name: Run tests
run: RUST_LOG=debug bash contrib/test.sh

Format:
runs-on: ubuntu-latest
steps:
- name: "Checkout repo"
uses: actions/checkout@v4
- name: "Install nightly toolchain"
uses: dtolnay/rust-toolchain@nightly
with:
components: rustfmt
- name: "Use cache"
uses: Swatinem/rust-cache@v2
- name: "Run formatting check"
run: cargo fmt --all -- --check

Format-FFI:
runs-on: ubuntu-latest
steps:
- name: "Checkout repo"
uses: actions/checkout@v4
- name: "Install nightly toolchain"
uses: dtolnay/rust-toolchain@nightly
with:
components: rustfmt
- name: "Use cache"
uses: Swatinem/rust-cache@v2
- name: "Run formatting check"
run: cd payjoin-ffi && cargo fmt --all -- --check

Lint-FFI:
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -131,15 +103,15 @@ jobs:
run: bash contrib/coverage.sh
- name: "Upload report to coveralls"
uses: coverallsapp/github-action@v2
CodeSpell:

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

DiffMutants:
DiffMutants:
name: Diff cargo-mutants
runs-on: ubuntu-latest
env:
Expand Down Expand Up @@ -172,4 +144,3 @@ jobs:
with:
name: mutants-incremental-cargo.out
path: mutants.out

9 changes: 8 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
[workspace]
members = ["ohttp-relay", "payjoin", "payjoin-cli", "payjoin-directory", "payjoin-test-utils", "payjoin-ffi"]
members = [
"ohttp-relay",
"payjoin",
"payjoin-cli",
"payjoin-directory",
"payjoin-test-utils",
"payjoin-ffi",
]
resolver = "2"

[patch.crates-io]
Expand Down
23 changes: 22 additions & 1 deletion flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

54 changes: 20 additions & 34 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
inputs.nixpkgs.follows = "nixpkgs";
};
crane.url = "github:ipetkov/crane";
treefmt-nix = {
url = "github:numtide/treefmt-nix";
inputs.nixpkgs.follows = "nixpkgs";
};
};

outputs =
Expand All @@ -18,13 +22,23 @@
flake-utils,
rust-overlay,
crane,
treefmt-nix,
}:
flake-utils.lib.eachDefaultSystem (
system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [ rust-overlay.overlays.default ];
overlays = [
rust-overlay.overlays.default
(final: prev: {
rustToolchains = {
msrv = prev.rust-bin.stable.${msrv-version}.default;
stable = prev.rust-bin.stable.latest.default;
nightly = prev.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
};
})
];
};

msrv-version = "1.85.0";
Expand Down Expand Up @@ -103,6 +117,8 @@
)
) craneLibVersions;

treefmtEval = treefmt-nix.lib.evalModule pkgs ./treefmt.nix;

fileSetForCrate =
subdir:
pkgs.lib.fileset.toSource {
Expand Down Expand Up @@ -186,7 +202,7 @@
devShells = devShells // {
default = devShells.nightly;
};
formatter = pkgs.nixfmt-tree;
formatter = treefmtEval.config.build.wrapper;
checks =
packages
// (pkgs.lib.mapAttrs' (
Expand Down Expand Up @@ -249,42 +265,12 @@
}
);

nix-fmt-check = simpleCheck {
name = "nix-fmt-check";
src = pkgs.lib.sources.sourceFilesBySuffices ./. [ ".nix" ];
nativeBuildInputs = [ pkgs.nixfmt-tree ];
checkPhase = ''
treefmt --ci --tree-root .
'';
};

shfmt = simpleCheck rec {
name = "shfmt";
src = pkgs.lib.sources.sourceFilesBySuffices ./. [ ".sh" ];
nativeBuildInputs = [ pkgs.shfmt ];
checkPhase = ''
shfmt -d -s -i 4 -ci ${src}
'';
};

shellcheck = simpleCheck rec {
name = "shellcheck";
src = pkgs.lib.sources.sourceFilesBySuffices ./. [ ".sh" ];
nativeBuildInputs = [
pkgs.shellcheck
pkgs.findutils
];
checkPhase = ''
find "${src}" -name '*.sh' -print0 | xargs -0 shellcheck -x
'';
};
formatting = treefmtEval.config.build.check self;

quick = checkSuite "quick" (
with self.outputs.checks.${system};
[
shfmt
shellcheck
nix-fmt-check
formatting
]
);

Expand Down
5 changes: 3 additions & 2 deletions ohttp-relay/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,10 @@ requests to Gateways that do not support an allowed purpose.
- Gateway opt-in was introduced in [#58](https://github.com/payjoin/ohttp-relay/pull/58)

### Gateway Probing and BIP77 Support

- Added gateway probing functionality with caching mechanism for improved performance [#46](https://github.com/payjoin/ohttp-relay/pull/46)
Implemented BIP77 purpose string detection in allowed purposes response #47
Added ALPN-encoded format parsing for gateway allowed purposes #50
Implemented BIP77 purpose string detection in allowed purposes response #47
Added ALPN-encoded format parsing for gateway allowed purposes #50

- https://github.com/payjoin/ohttp-relay/pull/46
- https://github.com/payjoin/ohttp-relay/pull/47
Expand Down
Loading
Loading