From 93af8e043e609bd992484d0616dbcdd438bb3e86 Mon Sep 17 00:00:00 2001 From: DanGould Date: Sat, 7 Nov 2026 15:08:35 +0800 Subject: [PATCH] Collect changelog lines from per-PR fragments Every pull request that changes a release crate adds its line under the same "## Unreleased" heading, so any two open pull requests for a crate conflict in CHANGELOG.md, and each merge forces a rebase on the rest. Do what Bitcoin Core does with doc/release-notes-*.md. A pull request adds its own uniquely named file under /changelog.d/, and bump.sh moves the fragments into the new version's section and deletes them. contrib/release/changelog-fragments.sh assembles the section: list items outside a heading first, then each "### " heading with the items every fragment puts under it. It rejects prose and "## " headings, which would end the version's section early, continuation lines that prettier would lift out of their item, and anything in changelog.d/ that is not a visible, regular .md file with LF line endings, since bump.sh deletes what it reads and check-invariants counts what is left. The changelog check runs it on every directory bump.sh reads, rejects tracked files in any other changelog.d/, and now asks for an added, changed or renamed fragment instead of a CHANGELOG.md edit. A deleted fragment counts only when the crate's [package] version changes too, which is what a bump PR does. version_at, which reads that version at a git ref, moves to crates.sh for this, and now parses the [package] table instead of taking the first line-anchored "version", so check-bump.sh shares it. bump.sh checks the fragments before it edits anything, refuses untracked files in the directories it reads, and refuses to bump a release crate that has none, since extract-changelog.sh cannot fill a release body from an empty section. The language changelogs read fragments from payjoin-ffi//changelog.d/ the same way. A pull request can merge while a bump PR is open, or after it and before the tag. When run again at the version a bump already set, bump.sh moves the new fragments into that version's section, keeping the text already there, and fills in new placeholders. check-invariants fails while the released crate's changelog.d/ still holds a fragment, so tag.sh and the bump PR check refuse a release whose notes miss a change it ships. The existing Unreleased entries move into fragments, one per change. Keep blank lines within items so folding preserves paragraphs and code. Let FFI source changes use any supported language fragment directory, and read Git paths without display quoting so unusual names count. Document the fragment syntax and direct C# changes to the shared FFI changelog directory. Co-authored-by: spacebear <144076611+spacebear21@users.noreply.github.com> --- .github/CONTRIBUTING.md | 16 +- .github/ISSUE_TEMPLATE/minor-release.md | 18 +- .github/workflows/changelog-check.yml | 71 ++++++- contrib/release/bump.sh | 184 +++++++++++++----- contrib/release/changelog-fragments.sh | 108 ++++++++++ contrib/release/check-bump.sh | 5 - contrib/release/check-invariants.sh | 14 +- contrib/release/crates.sh | 21 ++ contrib/release/test-changelog-fragments.sh | 71 +++++++ payjoin-cli/CHANGELOG.md | 20 -- .../changelog.d/cancel-for-fallback-tx.md | 4 + .../changelog.d/cancel-no-broadcast-hint.md | 4 + payjoin-cli/changelog.d/classify-tx.md | 6 + .../changelog.d/skip-unsupported-coins.md | 1 + payjoin-cli/changelog.d/taproot-key-spend.md | 2 + payjoin-ffi/CHANGELOG.md | 41 ---- payjoin-ffi/RELEASING.md | 27 ++- payjoin-ffi/changelog.d/classify-tx.md | 23 +++ .../changelog.d/dart-prebuilt-libraries.md | 5 + ...recate-extract-tx-to-schedule-broadcast.md | 3 + payjoin-ffi/changelog.d/httpx2.md | 1 + .../changelog.d/native-release-assets.md | 3 + .../changelog.d/python-wheel-platforms.md | 3 + payjoin-mailroom/CHANGELOG.md | 5 - .../changelog.d/extra-allowed-purposes.md | 1 + .../changelog.d/oversized-mailbox-payloads.md | 1 + payjoin/CHANGELOG.md | 44 ----- payjoin/changelog.d/classify-tx.md | 32 +++ ...recate-extract-tx-to-schedule-broadcast.md | 4 + payjoin/changelog.d/seal-fallback-tx.md | 5 + 30 files changed, 548 insertions(+), 195 deletions(-) create mode 100755 contrib/release/changelog-fragments.sh create mode 100755 contrib/release/test-changelog-fragments.sh create mode 100644 payjoin-cli/changelog.d/cancel-for-fallback-tx.md create mode 100644 payjoin-cli/changelog.d/cancel-no-broadcast-hint.md create mode 100644 payjoin-cli/changelog.d/classify-tx.md create mode 100644 payjoin-cli/changelog.d/skip-unsupported-coins.md create mode 100644 payjoin-cli/changelog.d/taproot-key-spend.md create mode 100644 payjoin-ffi/changelog.d/classify-tx.md create mode 100644 payjoin-ffi/changelog.d/dart-prebuilt-libraries.md create mode 100644 payjoin-ffi/changelog.d/deprecate-extract-tx-to-schedule-broadcast.md create mode 100644 payjoin-ffi/changelog.d/httpx2.md create mode 100644 payjoin-ffi/changelog.d/native-release-assets.md create mode 100644 payjoin-ffi/changelog.d/python-wheel-platforms.md create mode 100644 payjoin-mailroom/changelog.d/extra-allowed-purposes.md create mode 100644 payjoin-mailroom/changelog.d/oversized-mailbox-payloads.md create mode 100644 payjoin/changelog.d/classify-tx.md create mode 100644 payjoin/changelog.d/deprecate-extract-tx-to-schedule-broadcast.md create mode 100644 payjoin/changelog.d/seal-fallback-tx.md diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 86d721eab..4f3fe2a28 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -111,9 +111,21 @@ echo "✓ Pre-commit hook passed" ### Changelog -Each release crate (`payjoin`, `payjoin-cli`, `payjoin-mailroom`) and `payjoin-ffi` keeps a `CHANGELOG.md` with an `## Unreleased` section at the top. If your pull request changes what a user of that crate sees, add a line there in the same commit. Write it for the person reading the release notes, not for the reviewer. The release PR renames the heading to the version number and nothing else. `payjoin-ffi/CHANGELOG.md` is the release notes for the Python, JavaScript, C# and Dart packages, which are released together at its version. +Each release crate (`payjoin`, `payjoin-cli`, `payjoin-mailroom`) and `payjoin-ffi` keeps a `CHANGELOG.md`. Pull requests don't edit it. If your pull request changes what a user of that crate sees, add a new file to the crate's `changelog.d/` directory in the same commit, such as `payjoin/changelog.d/reject-duplicate-inputs.md`. Give it a name no other pull request is likely to pick, so two pull requests never touch the same file. Write it for the person reading the release notes, not for the reviewer. -If the change has no user-visible effect (refactoring, tests, CI, comments), say so in the pull request description and a maintainer will apply the `changelog: none` label. CI fails a pull request that touches one of those crates' `src/` without either a changelog line or that label. +A fragment must be a visible, regular `.md` file with LF line endings. It holds one or more Markdown list items starting with `- `. Indent continuation lines by at least two spaces or a tab. Blank lines within an item, including paragraphs and indented code blocks, are preserved; spacing between items, headings and fragments is trimmed. Only `### ` headings are allowed at the top level, such as `### API Additions` or `### Bug Fixes`; the release collects every fragment's items under the heading they share. + +```markdown +- Reject an Original PSBT that spends the same input twice. + +### API Additions + +- Add `InputPair::outpoint`. +``` + +The release PR moves the fragments into the new version's section of `CHANGELOG.md` and deletes them. `payjoin-ffi/CHANGELOG.md` is the release notes for the Python, JavaScript, C# and Dart packages, which are released together at its version. Changes specific to Python, JavaScript or Dart go in `payjoin-ffi/python/changelog.d/`, `payjoin-ffi/javascript/changelog.d/` or `payjoin-ffi/dart/changelog.d/`, respectively. C# changes go in the shared `payjoin-ffi/changelog.d/` directory. + +If the change has no user-visible effect (refactoring, tests, CI, comments), say so in the pull request description and a maintainer will apply the `changelog: none` label. CI fails a pull request that touches one of those crates' `src/` without either a fragment or that label. ### Deprecations diff --git a/.github/ISSUE_TEMPLATE/minor-release.md b/.github/ISSUE_TEMPLATE/minor-release.md index 78816a1ea..8d718c2fa 100644 --- a/.github/ISSUE_TEMPLATE/minor-release.md +++ b/.github/ISSUE_TEMPLATE/minor-release.md @@ -10,8 +10,8 @@ assignees: "" Release-managed crates are `payjoin`, `payjoin-cli` and `payjoin-mailroom`. Versions follow [Semantic Versioning]. Tags are `-`. The changelog for this release is the -`## Unreleased` section of `CRATE/CHANGELOG.md`; it was written by the pull requests that -landed since the last release, so there is nothing to compile here. +set of fragments in `CRATE/changelog.d/`; each pull request that landed since the last +release wrote its own, so there is nothing to compile here. ### Summary @@ -23,8 +23,9 @@ landed since the last release, so there is nothing to compile here. - [ ] Branch `bump-CRATE-MAJOR-MINOR+1` from `master`. - [ ] Run `contrib/release/bump.sh CRATE MAJOR.MINOR+1.0`. It sets the version, rewrites - every workspace member's requirement on the crate, renames `## Unreleased` to - `## MAJOR.MINOR+1.0` with a fresh empty `## Unreleased` above it, fills in the + every workspace member's requirement on the crate, moves the fragments in + `CRATE/changelog.d/` into a new `## MAJOR.MINOR+1.0` section of `CRATE/CHANGELOG.md` + and deletes them, fills in the `0.0.0-unreleased` placeholders in the crate's source, regenerates both lock files and runs check-invariants. It needs jq, and the lock file step calls `cargo +nightly`, so run it where rustup has a nightly toolchain. `nix develop .#release` @@ -36,8 +37,13 @@ landed since the last release, so there is nothing to compile here. for `payjoin`, cargo-semver-checks. - [ ] Merge. -If a fix must land before the tag, merge it to `master` as usual; it carries its own -changelog line. The bump PR is not edited for it. +If a pull request for CRATE merges while the bump PR is open, rebase the bump branch on +`master`, run `contrib/release/bump.sh CRATE MAJOR.MINOR+1.0` again and amend the bump +commit. At a version it already set, bump.sh moves the new fragments into that version's +section and fills in any new placeholders. If one merges after the bump PR and before the +tag, do the same in a new pull request; if that fills in placeholders under `CRATE/src`, +it needs the `changelog: none` label. `tag.sh` refuses to tag while `CRATE/changelog.d/` +holds a fragment. #### Tag and publish diff --git a/.github/workflows/changelog-check.yml b/.github/workflows/changelog-check.yml index 572b08d9e..d057dc560 100644 --- a/.github/workflows/changelog-check.yml +++ b/.github/workflows/changelog-check.yml @@ -1,9 +1,12 @@ # .github/workflows/changelog-check.yml # # A pull request that changes a release crate's or payjoin-ffi's source -# must add a line to that crate's CHANGELOG.md under "## Unreleased", or -# carry the "changelog: none" label. The bump PR then only renames the -# heading, so a merge under an open bump PR never requires editing it. +# must add a changelog fragment in a directory that crate reads, or carry +# the "changelog: none" label. Each pull request writes its own file, so +# pull requests do not conflict over CHANGELOG.md. A bump PR, which +# changes the crate's version, passes by deleting the fragments it moves +# into CHANGELOG.md. Every fragment in the tree must also be one bump.sh +# reads and can parse, since a bad one stops the next release. name: Changelog on: @@ -16,27 +19,75 @@ permissions: jobs: changelog: name: Changelog entry - if: "${{ !contains(github.event.pull_request.labels.*.name, 'changelog: none') }}" runs-on: ubuntu-26.04 steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: persist-credentials: false # unneeded: no git auth beyond checkout fetch-depth: 0 - - name: Require a changelog line for each changed crate + - name: Require a changelog fragment for each changed crate + if: "${{ !contains(github.event.pull_request.labels.*.name, 'changelog: none') }}" env: BASE: ${{ github.event.pull_request.base.sha }} HEAD: ${{ github.event.pull_request.head.sha }} run: | set -euo pipefail source contrib/release/crates.sh - changed="$(git diff --name-only "$BASE" "$HEAD")" + mapfile -d '' -t changed < <(git diff --name-only -z "$BASE" "$HEAD") + mapfile -d '' -t written < <(git diff --name-only -z --diff-filter=AMR "$BASE" "$HEAD") + mapfile -d '' -t deleted < <(git diff --name-only -z --diff-filter=D "$BASE" "$HEAD") + has_path() { + local prefix="$1" path + shift + for path in "$@"; do + [[ $path == "$prefix"* ]] && return 0 + done + return 1 + } status=0 for crate in $RELEASE_CRATES payjoin-ffi; do - grep -q "^$crate/src/" <<<"$changed" || continue - if ! grep -q "^$crate/CHANGELOG.md$" <<<"$changed"; then - echo "::error::$crate/src changed but $crate/CHANGELOG.md did not; add a line under '## Unreleased', or say in the PR description that there is no user-visible change so a maintainer can label it 'changelog: none'" - status=1 + has_path "$crate/src/" "${changed[@]}" || continue + mapfile -t dirs < <(changelog_dirs "$crate") + deleted_fragment=0 + for dir in "${dirs[@]}"; do + has_path "$dir/" "${written[@]}" && continue 2 + if has_path "$dir/" "${deleted[@]}"; then + deleted_fragment=1 + fi + done + # A bump, which changes the crate's version, moves fragments + # into CHANGELOG.md. + old="$(version_at "$BASE" "$crate")" + new="$(version_at "$HEAD" "$crate")" + if [ "$deleted_fragment" -eq 1 ] && + [ -n "$new" ] && [ "$old" != "$new" ]; then + continue fi + echo "::error::$crate/src changed but no fragment was added in a supported changelog.d/ directory; add one (see the Changelog section of CONTRIBUTING.md), or say in the PR description that there is no user-visible change so a maintainer can label it 'changelog: none'" + status=1 done exit "$status" + - name: Check every fragment + run: | + set -euo pipefail + ./contrib/release/test-changelog-fragments.sh + source contrib/release/crates.sh + dirs=() + for crate in $RELEASE_CRATES payjoin-ffi; do + mapfile -t -O "${#dirs[@]}" dirs < <(changelog_dirs "$crate") + done + status=0 + for dir in "${dirs[@]}"; do + echo "Checking $dir" + ./contrib/release/changelog-fragments.sh "$dir" >/dev/null || status=1 + done + # bump.sh never releases a fragment kept anywhere else. + while IFS= read -r -d '' path; do + [[ $path =~ (^|/)changelog\.d/ ]] || continue + for dir in "${dirs[@]}"; do + [[ $path == "$dir"/* ]] && continue 2 + done + printf '::error::%q is not in a changelog.d directory that bump.sh reads\n' "$path" + status=1 + done < <(git ls-files -z) + exit "$status" diff --git a/contrib/release/bump.sh b/contrib/release/bump.sh index 09c234870..87bc112ea 100755 --- a/contrib/release/bump.sh +++ b/contrib/release/bump.sh @@ -1,9 +1,9 @@ #!/usr/bin/env bash # # Prepare a release crate's bump commit. Sets the crate's version, rewrites -# every workspace member's version requirement on it, renames the -# "## Unreleased" changelog section to the new version and opens a fresh -# empty one above it, fills in the version placeholders in the crate's +# every workspace member's version requirement on it, moves the changelog +# fragments in /changelog.d/ into a new section of its CHANGELOG.md +# and deletes them, fills in the version placeholders in the crate's # source, regenerates both lock files, then runs check-invariants. Leaves # the changes uncommitted for review. # @@ -11,8 +11,15 @@ # opens by naming the wrapped payjoin release, and its version is also # set in the Python, JavaScript, Dart and C# package manifests, the uv and # npm lock files, and the language changelogs, which open with a stock -# entry that points at payjoin-ffi/CHANGELOG.md. bindings-version.sh then -# confirms the packages agree. +# entry that points at payjoin-ffi/CHANGELOG.md, followed by the fragments +# in that language's changelog.d/. bindings-version.sh then confirms the +# packages agree. +# +# Run again at the version a bump already set, it folds the fragments +# that landed since into that version's sections and fills in any new +# placeholders, so a bump PR can take in the pull requests merged while it +# was open. check-invariants fails while fragments are left over, so a +# release is never tagged without them. # # usage: bump.sh [--no-lock] # crate a release crate, or payjoin-ffi for the language bindings @@ -33,7 +40,7 @@ if [ "${1:-}" = "--no-lock" ]; then shift fi [ "$#" -eq 2 ] || { - sed -n '2,22p' "$0" >&2 + sed -n '2,30p' "$0" >&2 exit 1 } crate="$1" @@ -43,17 +50,62 @@ die() { exit 1 } -# Rename a changelog's "## Unreleased" section to , open a fresh -# empty one above it, and make the first entry of the renamed -# section, above any lines pull requests left there. The list stays tight, -# without a blank line after , so prettier does not reflow it. -open_section() { # - awk -v h="$2" -v l="$3" ' - !seen && $0 == "## Unreleased" { seen = 1; print; print ""; print h; print ""; print l; next } - seen == 1 { seen = 2; if ($0 == "") { held = 1; next } } - held { held = 0; if ($0 !~ /^- /) print "" } - { print } - ' "$1" >"$1.tmp" && mv "$1.tmp" "$1" +# Print the section that the changelog.d/ fragments beside +# hold, failing on a malformed fragment. +fragments() { # + "$DIR/changelog-fragments.sh" "$(dirname "$1")/changelog.d" +} + +# Write the section of from the fragments beside it, +# then delete them. A section that already exists keeps its text: any +# opening prose stays on top and its items come before the fragments'. +# A new section goes above the newest one and opens with , when +# given. Blank lines within items stay intact when the section is folded. +write_section() { # [line] + local changelog="$1" heading="$2" line="${3:-}" dir start end last tmp body + dir="$(dirname "$changelog")/changelog.d" + tmp="$(mktemp -d -p "$WORK")" + start="$(grep -n -m1 -xF -e "$heading" "$changelog" | cut -d: -f1 || true)" + if [ -n "$start" ]; then + end="$(tail -n "+$((start + 1))" "$changelog" | grep -n -m1 '^## ' | cut -d: -f1 || true)" + end="${end:+$((start + end))}" + last='$' + [ -z "$end" ] || last="$((end - 1))" + sed -n "$((start + 1)),${last}p" "$changelog" >"$tmp/section" + # Opening prose is everything before the first item or heading. + awk '/^(- |### )/ { exit } { print }' "$tmp/section" | + sed -e '/./,$!d' -e :a -e '/^\n*$/{$d;N;ba' -e '}' >"$tmp/prose" + awk 'p || /^(- |### )/ { p = 1; print }' "$tmp/section" >"$tmp/items" + else + : >"$tmp/prose" + [ -z "$line" ] || printf '%s\n' "$line" >"$tmp/items" + touch "$tmp/items" + fi + # The section's own lines are reported against "items", counted from + # its first item or heading. + body="$("$DIR/changelog-fragments.sh" --first "$tmp/items" "$dir")" || + die "fix the fragment named above, or for an \"items\" line, the '$heading' section of $changelog" + [ ! -s "$tmp/prose" ] || body="$(cat "$tmp/prose")"$'\n\n'"$body" + { + if [ -n "$start" ]; then + head -n "$start" "$changelog" + printf '\n%s\n' "$body" + [ -z "$end" ] || { echo && tail -n "+$end" "$changelog"; } + else + start="$(grep -n -m1 '^## ' "$changelog" | cut -d: -f1 || true)" + if [ -n "$start" ]; then + head -n "$((start - 1))" "$changelog" + else + cat "$changelog" + echo + fi + printf '%s\n\n%s\n' "$heading" "$body" + [ -z "$start" ] || { echo && tail -n "+$start" "$changelog"; } + fi + } >"$tmp/changelog" + mv "$tmp/changelog" "$changelog" + rm -f "$dir"/*.md + rmdir "$dir" 2>/dev/null || true } # Replace the version placeholder in the crate's source. A bare @@ -83,7 +135,7 @@ fill_unreleased() { # # skipped. The lock files are edited the same way rather than regenerated, # so the only change in them is the version. bump_bindings() { # - local old="$1" new="$2" old_py new_py f line + local old="$1" new="$2" old_py new_py f # Python spells a -rc.N pre-release as rcN (PEP 440), in uv.lock too. old_py="${old/-rc./rc}" new_py="${new/-rc./rc}" @@ -120,21 +172,20 @@ bump_bindings() { # die "could not set Version in $f" echo " $f: Version -> $new" - # Each language changelog opens the new section with a stock entry that - # points at the shared changelog, above any language-specific lines a - # pull request left under "## Unreleased". The URL is absolute because - # pub.dev renders Dart's changelog and cannot resolve ../CHANGELOG.md. - line="- Wraps payjoin-ffi $new; see its [changelog](https://github.com/payjoin/rust-payjoin/blob/payjoin-ffi-$new/payjoin-ffi/CHANGELOG.md)." - for f in payjoin-ffi/python/CHANGELOG.md payjoin-ffi/javascript/CHANGELOG.md payjoin-ffi/dart/CHANGELOG.md; do - if grep -qx '## Unreleased' "$f"; then - open_section "$f" "## [$new]" "$line" - echo " $f: '## Unreleased' -> '## [$new]', fresh Unreleased section added" - else - { printf '## [%s]\n\n%s\n\n' "$new" "$line" && cat "$f"; } >"$f.tmp" && mv "$f.tmp" "$f" - echo " $f: '## [$new]' section added" - fi - { grep -qxF -e "## [$new]" "$f" && grep -qxF -e "$line" "$f"; } || - die "could not add the $new section to $f" +} + +# Each language changelog opens the new section with a stock entry that +# points at the shared changelog, above any language-specific fragments. +# The URL is absolute because pub.dev renders Dart's changelog and cannot +# resolve ../CHANGELOG.md. +binding_changelogs() { # + local line f + line="- Wraps payjoin-ffi $1; see its [changelog](https://github.com/payjoin/rust-payjoin/blob/payjoin-ffi-$1/payjoin-ffi/CHANGELOG.md)." + for f in "${LANGUAGE_CHANGELOGS[@]}"; do + write_section "$f" "## [$1]" "$line" + { grep -qxF -e "## [$1]" "$f" && grep -qxF -e "$line" "$f"; } || + die "could not write the $1 section of $f" + echo " $f: '## [$1]' section written" done } @@ -151,9 +202,51 @@ else fi [ -z "$(git status --porcelain --untracked-files=no)" ] || die "commit or discard your changes first" +WORK="$(mktemp -d)" +trap 'rm -rf "$WORK"' EXIT + +# Check every fragment this bump will move before changing anything. The +# bump deletes them, so an uncommitted one would be lost from the tree +# while its text ships in the release. +changelog="$crate/CHANGELOG.md" +LANGUAGE_CHANGELOGS=(payjoin-ffi/python/CHANGELOG.md payjoin-ffi/javascript/CHANGELOG.md payjoin-ffi/dart/CHANGELOG.md) +mapfile -t dirs < <(changelog_dirs "$crate") +untracked="$(git ls-files --others -- "${dirs[@]}")" +[ -z "$untracked" ] || die "commit or remove the untracked files first: $untracked" +notes="$(fragments "$changelog")" || die "fix the fragment named above first" +if [ "$crate" = payjoin-ffi ]; then + for f in "${LANGUAGE_CHANGELOGS[@]}"; do + notes+="$(fragments "$f")" || die "fix the fragment named above first" + done +fi + +# The crate's changelog keeps its heading style: the binding changelogs +# bracket versions, the crates do not. +if grep -q '^## \[' "$changelog"; then + heading="## [$new]" +else + heading="## $new" +fi + RELEASE_METADATA="$(cargo_metadata)" old="$(manifest_version "$crate")" -[ "$old" != "$new" ] || die "$crate is already $new" +if [ "$old" = "$new" ]; then + grep -qxF -e "$heading" "$changelog" || + die "$crate is already $new, but $changelog has no '$heading' section to fold fragments into" + [ -n "$notes" ] || die "$crate is already $new and no fragments are left to fold in" + echo "Folding new fragments into $crate $new" + write_section "$changelog" "$heading" + echo " $changelog: fragments from $crate/changelog.d/ folded into '$heading'" + [ "$crate" != payjoin-ffi ] || binding_changelogs "$new" + fill_unreleased "$new" + "$DIR/check-invariants.sh" "$crate" + echo + echo "Review the '$heading' section of $changelog, then amend the bump commit with:" + echo " git commit --amend -a --no-edit" + exit 0 +fi +[ "$crate" = payjoin-ffi ] || [ -n "$notes" ] || + die "$crate/changelog.d/ has no fragments; a release needs at least one changelog line" echo "Bumping $crate $old -> $new" # The crate's own version: the first line-anchored `version =` in its manifest. @@ -171,28 +264,21 @@ while IFS= read -r manifest; do fi done < <(cargo_metadata | jq -r '.packages[].manifest_path') -[ "$crate" != payjoin-ffi ] || bump_bindings "$old" "$new" - -# The crate's changelog keeps its heading style: the binding changelogs -# bracket versions, the crates do not. -changelog="$crate/CHANGELOG.md" -grep -qx '## Unreleased' "$changelog" || - die "$changelog has no '## Unreleased' section; add the lines for this release under one first" -if grep -q '^## \[' "$changelog"; then - heading="## [$new]" -else - heading="## $new" +if [ "$crate" = payjoin-ffi ]; then + bump_bindings "$old" "$new" + binding_changelogs "$new" fi + if [ "$crate" = payjoin-ffi ]; then # The entry names the wrapped payjoin release first; the manifests no # longer carry it, and the package docs point readers here for it. line="- Wraps payjoin $(manifest_version payjoin)" - open_section "$changelog" "$heading" "$line" + write_section "$changelog" "$heading" "$line" grep -qxF -e "$line" "$changelog" || die "could not add '$line' to $changelog" - echo " $changelog: '## Unreleased' -> '$heading' opening with '$line', fresh Unreleased section added" + echo " $changelog: '$heading' section added from $crate/changelog.d/, opening with '$line'" else - sed -i "0,/^## Unreleased$/s//## Unreleased\n\n$heading/" "$changelog" - echo " $changelog: '## Unreleased' -> '$heading', fresh Unreleased section added" + write_section "$changelog" "$heading" + echo " $changelog: '$heading' section added from $crate/changelog.d/" fi fill_unreleased "$new" diff --git a/contrib/release/changelog-fragments.sh b/contrib/release/changelog-fragments.sh new file mode 100755 index 000000000..7b3050d5c --- /dev/null +++ b/contrib/release/changelog-fragments.sh @@ -0,0 +1,108 @@ +#!/usr/bin/env bash +# +# Print the changelog section that a changelog.d directory holds, without +# its version heading. Each pull request adds its own uniquely named +# fragment, so concurrent pull requests never edit the same lines of +# CHANGELOG.md. bump.sh moves the fragments into the version's section and +# deletes them. +# +# A fragment is a Markdown file of one or more "- " list items, optionally +# grouped under "### " headings. Lines that continue an item are indented +# by at least two spaces or a tab, as Markdown needs to keep them in it. +# Items outside a heading come first, then each heading in the order it +# first appears, with the items every fragment puts under it. Fragments are +# read in file name order. Blank lines within items are kept; spacing +# between items is trimmed. Prints nothing when there is nothing to read. +# Fails, naming the file and where it can the line, on prose or a +# "## " heading, which would end the version's section early. Every entry +# in the directory must be a visible, regular .md file, because bump.sh +# deletes the fragments it reads and check-invariants counts what is left. +# +# usage: changelog-fragments.sh [--first ] +# --first read , in fragment form, before the directory's +# fragments; bump.sh passes the items a version's section +# already holds, so they keep their place +set -euo pipefail + +first=() +if [ "${1:-}" = "--first" ] && [ "$#" -ge 2 ]; then + [ -s "$2" ] && first=("$2") + shift 2 +fi +[ "$#" -eq 1 ] || { + sed -n '2,23p' "$0" >&2 + exit 1 +} +dir="$1" + +shopt -s nullglob dotglob +export LC_ALL=C +files=() +[ -d "$dir" ] && files=("$dir"/*) +reject() { + echo "changelog-fragments: $1 $2" >&2 + exit 1 +} +for f in "${files[@]}"; do + case "${f##*/}" in + .*) reject "$f" "is hidden; name fragments .md" ;; + *.md) ;; + *) reject "$f" "is not a .md fragment" ;; + esac + [ ! -L "$f" ] || reject "$f" "is a symlink" + [ -f "$f" ] || reject "$f" "is not a regular file" + [ -s "$f" ] || reject "$f" "is empty" +done +files=("${first[@]}" "${files[@]}") +[ "${#files[@]}" -gt 0 ] || exit 0 + +awk ' + function fail(why) { + printf "changelog-fragments: %s:%d: %s\n", FILENAME, FNR, why > "/dev/stderr" + failed = 1 + exit 1 + } + function close_fragment() { + if (file == "") return + if (!items) fail_file(file, "has no list items") + if (group != "" && !grouped) fail_file(file, "has no items under \"" group "\"") + } + function fail_file(f, why) { + printf "changelog-fragments: %s %s\n", f, why > "/dev/stderr" + failed = 1 + exit 1 + } + FNR == 1 { close_fragment(); file = FILENAME; group = ""; items = 0; grouped = 1; item = 0; blank = "" } + /\r/ { fail("has a carriage return; save the fragment with LF line endings") } + /^[[:space:]]*$/ { if (item) blank = blank $0 "\n"; next } + /^### .*[[:space:]]$/ { fail("trailing whitespace after the heading") } + /^### [^[:space:]]/ { + if (group != "" && !grouped) fail("no items under \"" group "\"") + group = $0 + grouped = 0 + item = 0 + blank = "" + if (!(group in seen)) { seen[group] = 1; order[++groups] = group } + next + } + /^#/ { fail("only \"### \" headings may appear in a fragment") } + /^- / { items++; grouped = 1; item = 1; blank = ""; body[group] = body[group] $0 "\n"; next } + /^( |\t)/ { + if (!item) fail("indented line outside a list item") + body[group] = body[group] blank $0 "\n" + blank = "" + next + } + /^[[:space:]]/ { fail("indent a continuation line by at least two spaces") } + { fail("expected a \"- \" list item, an indented continuation or a \"### \" heading") } + END { + if (failed) exit 1 + close_fragment() + out = body[""] + for (i = 1; i <= groups; i++) { + if (out != "") out = out "\n" + out = out order[i] "\n\n" body[order[i]] + } + printf "%s", out + } +' "${files[@]}" diff --git a/contrib/release/check-bump.sh b/contrib/release/check-bump.sh index 9e36b7619..9799152b5 100755 --- a/contrib/release/check-bump.sh +++ b/contrib/release/check-bump.sh @@ -23,11 +23,6 @@ source contrib/lockfile.sh } base="$1" -# A crate's [package] version at a git ref (the only line-anchored `version`). -version_at() { - git show "$1:$2/Cargo.toml" 2>/dev/null | sed -n 's/^version = "\(.*\)"/\1/p' | head -1 -} - RELEASE_METADATA="$(cargo_metadata)" echo "Comparing release crate versions against $base" changed=() diff --git a/contrib/release/check-invariants.sh b/contrib/release/check-invariants.sh index 82c0605bb..e669bc083 100755 --- a/contrib/release/check-invariants.sh +++ b/contrib/release/check-invariants.sh @@ -2,8 +2,9 @@ # # Check that each release crate is internally consistent: every dependent's # version requirement on it matches its manifest version, both tracked lock -# files record that version, its CHANGELOG.md has a section for it, and its -# source has no version placeholder left for bump.sh to fill in. +# files record that version, its CHANGELOG.md has a section for it, no +# changelog fragment is left out of that section, and its source has no +# version placeholder left for bump.sh to fill in. # Offline, a few seconds. Checks all release crates, or the ones named. set -euo pipefail # shellcheck source=contrib/release/crates.sh @@ -36,13 +37,20 @@ mismatches="$(cargo_metadata | jq -r --argjson t "$(printf '%s' "$crates" | jq - for crate in $crates; do version="$(manifest_version "$crate")" - echo "Checking $crate $version: lock files, CHANGELOG.md and placeholders" + echo "Checking $crate $version: lock files, CHANGELOG.md, fragments and placeholders" for lock in Cargo-minimal.lock Cargo-recent.lock; do recorded="$(lockfile_version "$REPO_ROOT/$lock" "$crate")" [ "$recorded" = "$version" ] || problem "$lock records $crate ${recorded:-}, expected $version" done grep -qxF -e "## $version" -e "## [$version]" "$REPO_ROOT/$crate/CHANGELOG.md" || problem "$crate/CHANGELOG.md has no ## $version section" + # A fragment here describes a change this release ships without it. + while IFS= read -r dir; do + [ -d "$REPO_ROOT/$dir" ] || continue + while IFS= read -r fragment; do + problem "$fragment is not in the $version section; run contrib/release/bump.sh $crate $version again to fold it in" + done < <(cd "$REPO_ROOT" && find "$dir" -mindepth 1 -not -type d | LC_ALL=C sort) + done < <(changelog_dirs "$crate") if git -C "$REPO_ROOT" grep -n -F -e "$UNRELEASED" -- "$crate/src"; then problem "$crate/src still has the $UNRELEASED placeholder; bump.sh fills it in" fi diff --git a/contrib/release/crates.sh b/contrib/release/crates.sh index c84b67356..835e53832 100644 --- a/contrib/release/crates.sh +++ b/contrib/release/crates.sh @@ -71,3 +71,24 @@ crate_published() { curl -sfL -o /dev/null -H "User-Agent: rust-payjoin release tooling" \ "https://crates.io/api/v1/crates/$1/$2" } + +# Print the changelog.d directories that hold 's fragments: its own +# and, for payjoin-ffi, each language binding's. bump.sh reads no others. +changelog_dirs() { + printf '%s\n' "$1/changelog.d" + [ "$1" != payjoin-ffi ] || printf '%s\n' payjoin-ffi/{python,javascript,dart}/changelog.d +} + +# Print the [package] version of 's manifest at git , or +# nothing if it has none there. +version_at() { # + git -C "$REPO_ROOT" show "$1:$2/Cargo.toml" 2>/dev/null | awk ' + /^\[/ { package = ($0 == "[package]") } + package && /^version[[:space:]]*=/ { + sub(/^version[[:space:]]*=[[:space:]]*"/, "") + sub(/".*/, "") + print + exit + } + ' +} diff --git a/contrib/release/test-changelog-fragments.sh b/contrib/release/test-changelog-fragments.sh new file mode 100755 index 000000000..48149762c --- /dev/null +++ b/contrib/release/test-changelog-fragments.sh @@ -0,0 +1,71 @@ +#!/usr/bin/env bash +# Check that folding preserves item content and trims structural spacing. +set -euo pipefail +DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +WORK="$(mktemp -d)" +trap 'rm -rf "$WORK"' EXIT +mkdir "$WORK/fragments" + +cat >"$WORK/fragments/a.md" <<'EOF' + +- First paragraph. + + Second paragraph. + + +- Example: + ```python + message = """first + + + second""" + ``` + + +### Fixes + +- First fix. + + +EOF +cat >"$WORK/fragments/b.md" <<'EOF' + +- Another item. + +### Fixes + +- Second fix. +EOF +cat >"$WORK/expected" <<'EOF' +- First paragraph. + + Second paragraph. +- Example: + ```python + message = """first + + + second""" + ``` +- Another item. + +### Fixes + +- First fix. +- Second fix. +EOF +"$DIR/changelog-fragments.sh" "$WORK/fragments" >"$WORK/actual" +diff -u "$WORK/expected" "$WORK/actual" + +# A later fold reads the existing section through --first. +rm "$WORK/fragments/"*.md +printf '%s\n' '### Fixes' '- Late fix.' >"$WORK/fragments/late.md" +printf '%s\n' '- Late fix.' >>"$WORK/expected" +"$DIR/changelog-fragments.sh" --first "$WORK/actual" "$WORK/fragments" >"$WORK/refolded" +diff -u "$WORK/expected" "$WORK/refolded" + +# Whitespace on blank lines within an item is content too. +printf '\n- Item.\n \n\t\n Continuation.\n\n' >"$WORK/fragments/late.md" +printf '%s\n' '- Item.' ' ' $'\t' ' Continuation.' >"$WORK/expected" +"$DIR/changelog-fragments.sh" "$WORK/fragments" >"$WORK/actual" +diff -u "$WORK/expected" "$WORK/actual" diff --git a/payjoin-cli/CHANGELOG.md b/payjoin-cli/CHANGELOG.md index a158deba3..5b716441b 100644 --- a/payjoin-cli/CHANGELOG.md +++ b/payjoin-cli/CHANGELOG.md @@ -1,25 +1,5 @@ # payjoin-cli Changelog -## Unreleased - -- Fix panic when spending taproot UTXOs. They are now contributed as key-path - spends with an assumed default input weight. -- Any unsupported coin is simply skipped instead of crashing the cli. -- The v2 receiver no longer prints the fallback transaction hex when the - Original PSBT arrives. The message now points to - `payjoin-cli cancel `, which broadcasts the fallback transaction - if the payjoin fails. -- `resume` checks the wallet once for transactions settling each open receiver - session, in any state, and closes a session once its settling transaction - has one confirmation. It reports whether the Payjoin, the fallback, or - another transaction settled it. Sessions with non-SegWit senders are now - tracked too. The receiver no longer polls the mempool after posting the - proposal. -- When `cancel` fails to broadcast the fallback transaction, it now says the - session is still open and points to `cancel --no-broadcast` to close it. - The hint for a cancelled session awaiting its fallback mentions the flag - too. - ## 1.0.0 The first stable payjoin-cli release, tracking payjoin 1.2.0. The CLI adopts diff --git a/payjoin-cli/changelog.d/cancel-for-fallback-tx.md b/payjoin-cli/changelog.d/cancel-for-fallback-tx.md new file mode 100644 index 000000000..1b8bd3755 --- /dev/null +++ b/payjoin-cli/changelog.d/cancel-for-fallback-tx.md @@ -0,0 +1,4 @@ +- The v2 receiver no longer prints the fallback transaction hex when the + Original PSBT arrives. The message now points to + `payjoin-cli cancel `, which broadcasts the fallback transaction + if the payjoin fails. diff --git a/payjoin-cli/changelog.d/cancel-no-broadcast-hint.md b/payjoin-cli/changelog.d/cancel-no-broadcast-hint.md new file mode 100644 index 000000000..4bcec53c2 --- /dev/null +++ b/payjoin-cli/changelog.d/cancel-no-broadcast-hint.md @@ -0,0 +1,4 @@ +- When `cancel` fails to broadcast the fallback transaction, it now says the + session is still open and points to `cancel --no-broadcast` to close it. + The hint for a cancelled session awaiting its fallback mentions the flag + too. diff --git a/payjoin-cli/changelog.d/classify-tx.md b/payjoin-cli/changelog.d/classify-tx.md new file mode 100644 index 000000000..6004fe9ef --- /dev/null +++ b/payjoin-cli/changelog.d/classify-tx.md @@ -0,0 +1,6 @@ +- `resume` checks the wallet once for transactions settling each open receiver + session, in any state, and closes a session once its settling transaction + has one confirmation. It reports whether the Payjoin, the fallback, or + another transaction settled it. Sessions with non-SegWit senders are now + tracked too. The receiver no longer polls the mempool after posting the + proposal. diff --git a/payjoin-cli/changelog.d/skip-unsupported-coins.md b/payjoin-cli/changelog.d/skip-unsupported-coins.md new file mode 100644 index 000000000..6b8386c45 --- /dev/null +++ b/payjoin-cli/changelog.d/skip-unsupported-coins.md @@ -0,0 +1 @@ +- Any unsupported coin is simply skipped instead of crashing the cli. diff --git a/payjoin-cli/changelog.d/taproot-key-spend.md b/payjoin-cli/changelog.d/taproot-key-spend.md new file mode 100644 index 000000000..1ff4b0f66 --- /dev/null +++ b/payjoin-cli/changelog.d/taproot-key-spend.md @@ -0,0 +1,2 @@ +- Fix panic when spending taproot UTXOs. They are now contributed as key-path + spends with an assumed default input weight. diff --git a/payjoin-ffi/CHANGELOG.md b/payjoin-ffi/CHANGELOG.md index 1198b3bdd..b9d65b645 100644 --- a/payjoin-ffi/CHANGELOG.md +++ b/payjoin-ffi/CHANGELOG.md @@ -1,44 +1,3 @@ -## Unreleased - -- Python: require Python 3.11+ and replace httpx with httpx2. Callers catching HTTP errors from fetch_ohttp_keys should use httpx2.HTTPError instead of httpx.HTTPError. -- Deprecate `MaybeInputsOwned.extract_tx_to_schedule_broadcast`. Cancel the - session when the payjoin fails and broadcast the `fallback_tx` of the - resulting `ReceiverPendingFallback` instead. -- Add `classify_tx` to every receiver state that holds a fallback transaction - and is advancing the Payjoin protocol, from `MaybeInputsOwned` through - `Monitor`. Pass every consensus-encoded transaction the wallet receives to - `classify_tx` on each open session, or to `classify_receiver_tx` with a - session in any state. It returns a `Resolution` whose `resolved_by` is a - `ResolvedBy` of `Payjoin`, `Fallback` or `Unrecognized`, or none for a - transaction that spends none of the sender's original inputs, and never - reports `Payjoin` before `PayjoinProposal`. -- Add `close_session` to the same states, and `close_receiver_session` for a - session in any state. Each takes a `Resolution` and returns a - `CloseTransition` that ends the session once the wallet decides the - transaction has enough confirmations. Saving it fails with a transient - error, without persisting, if the resolution was classified from another - session, or, for `close_receiver_session`, if the session state cannot be - closed via resolution. Closing classifies the transaction again against - the session's current state. -- Remove `Monitor.check_for_transaction`, with its `TransactionFinder` - callback and `MonitorTransition`. It closed the session on first sight of - a predicted txid and never saw a spend that is neither the proposal nor - the fallback. Use `classify_tx` and `close_session` instead. -- Remove `proposal_txid_is_stable` from every receiver state. It checked - only the sender's inputs, so a legacy or P2SH-wrapped receiver input could - change the txid even when it returned true. Use `classify_tx` instead. -- Python: the Linux wheel's library now needs at most glibc 2.17, and - the wheel is tagged `manylinux_2_17`. The macOS wheel now supports - macOS 10.15 and later, down from 13. -- The GitHub release now attaches every native library as - `payjoin_ffi--.`, listed in `SHA256SUMS` and - attested. `VERIFYING.md` explains how to check one or rebuild it. -- Dart: the package now ships the release's prebuilt native libraries, - and the build hook uses them instead of compiling Rust, so apps no - longer need a Rust toolchain or network access at build time. Set - `build: source` under `hooks: user_defines: payjoin:` in your app's - `pubspec.yaml` to keep compiling it. - ## [0.25.1] - Wraps payjoin 1.2.0 diff --git a/payjoin-ffi/RELEASING.md b/payjoin-ffi/RELEASING.md index ada1ecece..fc886b075 100644 --- a/payjoin-ffi/RELEASING.md +++ b/payjoin-ffi/RELEASING.md @@ -32,22 +32,29 @@ nix develop .#release -c contrib/release/bump.sh --no-lock payjoin-ffi X.Y.Z ``` It sets the version in `payjoin-ffi/Cargo.toml`, the four package -manifests, `python/uv.lock` and `javascript/package-lock.json`, renames -`## Unreleased` in `payjoin-ffi/CHANGELOG.md` to the version with a fresh -empty `## Unreleased` above it and a first entry naming the wrapped -`payjoin` release, opens a section in each language changelog with a -stock entry pointing at it, and fills in the `0.0.0-unreleased` +manifests, `python/uv.lock` and `javascript/package-lock.json`, moves +the fragments in `payjoin-ffi/changelog.d/` into a new section of +`payjoin-ffi/CHANGELOG.md` whose first entry names the wrapped `payjoin` +release, opens a section in the Python, JavaScript and Dart changelogs with a stock entry +pointing at it followed by that language's `changelog.d/` fragments, +deletes the fragments it moved, and fills in the `0.0.0-unreleased` placeholders in `payjoin-ffi/src`, such as `Deprecated since payjoin -0.0.0-unreleased`, with the version each names. The lock file step calls +0.0.0-unreleased`, with the version each names. If more fragments land +before the tag, run it again at the same version to move them into the +release's sections. The lock file step calls `cargo +nightly`, which the release shell lacks, so pass `--no-lock` there, then run `contrib/update-lock-files.sh` from a rustup shell and `contrib/release/check-invariants.sh payjoin-ffi` again. `payjoin-ffi/CHANGELOG.md` is the canonical changelog and becomes the -GitHub release body; pull requests write to its `## Unreleased` section -as they do for the release crates. The language changelogs record only -language-specific changes and link to it; pub.dev displays Dart's. Check -the manifests agree with: +GitHub release body; pull requests add fragments to +`payjoin-ffi/changelog.d/` as they do for the release crates. The +Python, JavaScript and Dart changelogs record only changes specific to +those languages, from fragments in `payjoin-ffi/python/changelog.d/`, +`payjoin-ffi/javascript/changelog.d/` and `payjoin-ffi/dart/changelog.d/`, +respectively, and link to it; pub.dev displays Dart's. C# changes go in +the shared `payjoin-ffi/changelog.d/` directory. Check the manifests +agree with: ```shell nix develop .#release -c contrib/release/bindings-version.sh diff --git a/payjoin-ffi/changelog.d/classify-tx.md b/payjoin-ffi/changelog.d/classify-tx.md new file mode 100644 index 000000000..b0faa4467 --- /dev/null +++ b/payjoin-ffi/changelog.d/classify-tx.md @@ -0,0 +1,23 @@ +- Add `classify_tx` to every receiver state that holds a fallback transaction + and is advancing the Payjoin protocol, from `MaybeInputsOwned` through + `Monitor`. Pass every consensus-encoded transaction the wallet receives to + `classify_tx` on each open session, or to `classify_receiver_tx` with a + session in any state. It returns a `Resolution` whose `resolved_by` is a + `ResolvedBy` of `Payjoin`, `Fallback` or `Unrecognized`, or none for a + transaction that spends none of the sender's original inputs, and never + reports `Payjoin` before `PayjoinProposal`. +- Add `close_session` to the same states, and `close_receiver_session` for a + session in any state. Each takes a `Resolution` and returns a + `CloseTransition` that ends the session once the wallet decides the + transaction has enough confirmations. Saving it fails with a transient + error, without persisting, if the resolution was classified from another + session, or, for `close_receiver_session`, if the session state cannot be + closed via resolution. Closing classifies the transaction again against + the session's current state. +- Remove `Monitor.check_for_transaction`, with its `TransactionFinder` + callback and `MonitorTransition`. It closed the session on first sight of + a predicted txid and never saw a spend that is neither the proposal nor + the fallback. Use `classify_tx` and `close_session` instead. +- Remove `proposal_txid_is_stable` from every receiver state. It checked + only the sender's inputs, so a legacy or P2SH-wrapped receiver input could + change the txid even when it returned true. Use `classify_tx` instead. diff --git a/payjoin-ffi/changelog.d/dart-prebuilt-libraries.md b/payjoin-ffi/changelog.d/dart-prebuilt-libraries.md new file mode 100644 index 000000000..7e6b22ad1 --- /dev/null +++ b/payjoin-ffi/changelog.d/dart-prebuilt-libraries.md @@ -0,0 +1,5 @@ +- Dart: the package now ships the release's prebuilt native libraries, + and the build hook uses them instead of compiling Rust, so apps no + longer need a Rust toolchain or network access at build time. Set + `build: source` under `hooks: user_defines: payjoin:` in your app's + `pubspec.yaml` to keep compiling it. diff --git a/payjoin-ffi/changelog.d/deprecate-extract-tx-to-schedule-broadcast.md b/payjoin-ffi/changelog.d/deprecate-extract-tx-to-schedule-broadcast.md new file mode 100644 index 000000000..a9a65f4a3 --- /dev/null +++ b/payjoin-ffi/changelog.d/deprecate-extract-tx-to-schedule-broadcast.md @@ -0,0 +1,3 @@ +- Deprecate `MaybeInputsOwned.extract_tx_to_schedule_broadcast`. Cancel the + session when the payjoin fails and broadcast the `fallback_tx` of the + resulting `ReceiverPendingFallback` instead. diff --git a/payjoin-ffi/changelog.d/httpx2.md b/payjoin-ffi/changelog.d/httpx2.md new file mode 100644 index 000000000..ee460c401 --- /dev/null +++ b/payjoin-ffi/changelog.d/httpx2.md @@ -0,0 +1 @@ +- Python: require Python 3.11+ and replace httpx with httpx2. Callers catching HTTP errors from fetch_ohttp_keys should use httpx2.HTTPError instead of httpx.HTTPError. diff --git a/payjoin-ffi/changelog.d/native-release-assets.md b/payjoin-ffi/changelog.d/native-release-assets.md new file mode 100644 index 000000000..2d5a9cda5 --- /dev/null +++ b/payjoin-ffi/changelog.d/native-release-assets.md @@ -0,0 +1,3 @@ +- The GitHub release now attaches every native library as + `payjoin_ffi--.`, listed in `SHA256SUMS` and + attested. `VERIFYING.md` explains how to check one or rebuild it. diff --git a/payjoin-ffi/changelog.d/python-wheel-platforms.md b/payjoin-ffi/changelog.d/python-wheel-platforms.md new file mode 100644 index 000000000..08e04665d --- /dev/null +++ b/payjoin-ffi/changelog.d/python-wheel-platforms.md @@ -0,0 +1,3 @@ +- Python: the Linux wheel's library now needs at most glibc 2.17, and + the wheel is tagged `manylinux_2_17`. The macOS wheel now supports + macOS 10.15 and later, down from 13. diff --git a/payjoin-mailroom/CHANGELOG.md b/payjoin-mailroom/CHANGELOG.md index 9a5c0ccfc..2d827b263 100644 --- a/payjoin-mailroom/CHANGELOG.md +++ b/payjoin-mailroom/CHANGELOG.md @@ -1,10 +1,5 @@ # Payjoin Mailroom Changelog -## Unreleased - -- Let relay operators accept gateway purposes besides BIP77 with `[ohttp_relay] extra_allowed_purposes` (#2024) -- Reject mailbox payloads too large to return through the OHTTP gateway with 413, and V1 requests too large to relay with `original-psbt-rejected`, instead of truncating the response (#1983) - ## 0.1.3 - Enforce `blocked_regions` and `blocked_ips` on the ACME and manual TLS serve paths (#1941) diff --git a/payjoin-mailroom/changelog.d/extra-allowed-purposes.md b/payjoin-mailroom/changelog.d/extra-allowed-purposes.md new file mode 100644 index 000000000..702b61500 --- /dev/null +++ b/payjoin-mailroom/changelog.d/extra-allowed-purposes.md @@ -0,0 +1 @@ +- Let relay operators accept gateway purposes besides BIP77 with `[ohttp_relay] extra_allowed_purposes` (#2024) diff --git a/payjoin-mailroom/changelog.d/oversized-mailbox-payloads.md b/payjoin-mailroom/changelog.d/oversized-mailbox-payloads.md new file mode 100644 index 000000000..67a181cdf --- /dev/null +++ b/payjoin-mailroom/changelog.d/oversized-mailbox-payloads.md @@ -0,0 +1 @@ +- Reject mailbox payloads too large to return through the OHTTP gateway with 413, and V1 requests too large to relay with `original-psbt-rejected`, instead of truncating the response (#1983) diff --git a/payjoin/CHANGELOG.md b/payjoin/CHANGELOG.md index 8445226d2..d4e484a19 100644 --- a/payjoin/CHANGELOG.md +++ b/payjoin/CHANGELOG.md @@ -1,49 +1,5 @@ # Payjoin Changelog -## Unreleased - -- Close a leak in the `HasFallbackTx` seal. Generic code bounded on the trait - could call the sealed `fallback_tx` method, which was never part of the - documented API; such code no longer compiles. Read the fallback transaction - from `Receiver::fallback_tx` after `cancel`, or from - `SessionHistory::fallback_tx`. -- Deprecate `Receiver::extract_tx_to_schedule_broadcast`. - Schedule the fallback broadcast by cancelling the session when the payjoin - fails: `cancel` yields a `Receiver` whose `fallback_tx` - is the transaction to broadcast. -- Deprecate `Receiver::check_for_transaction`. It closes the - session on first sight of a predicted txid, never sees a spend that is - neither the proposal nor the fallback, and closes a session with - non-SegWit sender inputs without checking. Use `classify_tx` and `close` - instead. It now probes a txid that includes the script_sig of a legacy or - P2SH-wrapped receiver input. It used to probe a txid that never appears - on chain for such a session. -- Deprecate `Receiver::proposal_txid_is_stable`. It checks only the - sender's inputs, so a legacy or P2SH-wrapped receiver input can change - the txid even when it returns true. Use `classify_tx` instead. - -### API Additions - -- Add `classify_tx` to every `receive::v2::Receiver` state that holds a - fallback transaction and is advancing the Payjoin protocol, from - `MaybeInputsOwned` through `Monitor`. For a transaction spending the - sender's original inputs it returns a `Resolution`, whose `resolved_by` is a - `ResolvedBy` saying whether that transaction is the Payjoin proposal, the - fallback, or neither. `ReceiveSession::classify_tx` does the same for a - session in any state. Wallets should pass every transaction they receive to - `classify_tx` on each open session. It recognizes the proposal even after a - non-SegWit sender's signature changes its txid, and never reports `Payjoin` - before `PayjoinProposal` -- Add `close` to the same states and to `ReceiveSession`. It takes a - `Resolution` and ends the session once the wallet decides the transaction - has enough confirmations, without broadcasting the fallback. Only - `classify_tx` makes a `Resolution`, and `close` rejects one classified from - another session. `ReceiveSession::close` also rejects a session state - that cannot be closed via resolution. `close` classifies the transaction - again against the session's current state, and records - `PayjoinProposalSent` from `Monitor`, and from `PayjoinProposal` when the - Payjoin resolved it, and `Aborted` otherwise - ## 1.2.0 This release adds a non-blocking interface to the receiver state machine. diff --git a/payjoin/changelog.d/classify-tx.md b/payjoin/changelog.d/classify-tx.md new file mode 100644 index 000000000..b319f1132 --- /dev/null +++ b/payjoin/changelog.d/classify-tx.md @@ -0,0 +1,32 @@ +- Deprecate `Receiver::check_for_transaction`. It closes the + session on first sight of a predicted txid, never sees a spend that is + neither the proposal nor the fallback, and closes a session with + non-SegWit sender inputs without checking. Use `classify_tx` and `close` + instead. It now probes a txid that includes the script_sig of a legacy or + P2SH-wrapped receiver input. It used to probe a txid that never appears + on chain for such a session. +- Deprecate `Receiver::proposal_txid_is_stable`. It checks only the + sender's inputs, so a legacy or P2SH-wrapped receiver input can change + the txid even when it returns true. Use `classify_tx` instead. + +### API Additions + +- Add `classify_tx` to every `receive::v2::Receiver` state that holds a + fallback transaction and is advancing the Payjoin protocol, from + `MaybeInputsOwned` through `Monitor`. For a transaction spending the + sender's original inputs it returns a `Resolution`, whose `resolved_by` is a + `ResolvedBy` saying whether that transaction is the Payjoin proposal, the + fallback, or neither. `ReceiveSession::classify_tx` does the same for a + session in any state. Wallets should pass every transaction they receive to + `classify_tx` on each open session. It recognizes the proposal even after a + non-SegWit sender's signature changes its txid, and never reports `Payjoin` + before `PayjoinProposal` +- Add `close` to the same states and to `ReceiveSession`. It takes a + `Resolution` and ends the session once the wallet decides the transaction + has enough confirmations, without broadcasting the fallback. Only + `classify_tx` makes a `Resolution`, and `close` rejects one classified from + another session. `ReceiveSession::close` also rejects a session state + that cannot be closed via resolution. `close` classifies the transaction + again against the session's current state, and records + `PayjoinProposalSent` from `Monitor`, and from `PayjoinProposal` when the + Payjoin resolved it, and `Aborted` otherwise diff --git a/payjoin/changelog.d/deprecate-extract-tx-to-schedule-broadcast.md b/payjoin/changelog.d/deprecate-extract-tx-to-schedule-broadcast.md new file mode 100644 index 000000000..d0b9f95e6 --- /dev/null +++ b/payjoin/changelog.d/deprecate-extract-tx-to-schedule-broadcast.md @@ -0,0 +1,4 @@ +- Deprecate `Receiver::extract_tx_to_schedule_broadcast`. + Schedule the fallback broadcast by cancelling the session when the payjoin + fails: `cancel` yields a `Receiver` whose `fallback_tx` + is the transaction to broadcast. diff --git a/payjoin/changelog.d/seal-fallback-tx.md b/payjoin/changelog.d/seal-fallback-tx.md new file mode 100644 index 000000000..5c85bd1b8 --- /dev/null +++ b/payjoin/changelog.d/seal-fallback-tx.md @@ -0,0 +1,5 @@ +- Close a leak in the `HasFallbackTx` seal. Generic code bounded on the trait + could call the sealed `fallback_tx` method, which was never part of the + documented API; such code no longer compiles. Read the fallback transaction + from `Receiver::fallback_tx` after `cancel`, or from + `SessionHistory::fallback_tx`.