feat: port payjoin core to no_std#1615
Conversation
Coverage Report for CI Build 27080196308Coverage decreased (-0.5%) to 84.823%Details
Uncovered Changes
Coverage Regressions56 previously-covered lines in 6 files lost coverage.
Coverage Stats
💛 - Coveralls |
|
Great to see this take off here. My biggest question is about |
benalleng
left a comment
There was a problem hiding this comment.
Looks like a good start, though there are some feature organizations I have some questions about.
| DOTNET_ROOT = "${dotnetSdk}/share/dotnet"; | ||
| DOTNET_CLI_TELEMETRY_OPTOUT = "1"; | ||
| CC_wasm32_unknown_unknown = "${pkgs.llvmPackages.clang-unwrapped}/bin/clang"; | ||
| AR_wasm32_unknown_unknown = "${pkgs.llvmPackages.bintools-unwrapped}/bin/llvm-ar"; | ||
| CC_thumbv7em_none_eabihf = "arm-none-eabi-gcc"; |
There was a problem hiding this comment.
Same here they seem language specific.
249f524 to
04f34f6
Compare
| - name: "Build embedded target" | ||
| env: | ||
| CC_thumbv7em_none_eabihf: arm-none-eabi-gcc | ||
| run: cargo build -p payjoin --no-default-features --features "alloc,v2" --target thumbv7em-none-eabihf -Zbuild-std=core,alloc |
There was a problem hiding this comment.
Can this be done with a nix develop .#embedded -c cargo build or maybe setup a way to use nix build .#checks.x86_64-linux.embedded
853bb38 to
c0c2149
Compare
After reviewing the code, |
Summary
This is a implementation of
no_stdsupport for thepayjoincrate,enabling its use on embedded devices
As discussed in #942, running payjoin logic on a hardware signer enables
stronger security guarantees: the device can verify the fallback transaction,
compare it against the payjoin proposal, and only sign previously-approved
inputs — without trusting the host machine.
Feature Architecture
A new
v2-stdfeature was introduced to separate the state machine logicfrom networking dependencies:
allocv2v2-stdv2+ networking (url,ohttp,hpke,bhttp,http)stdtokio,serde_json,bitcoin/base64Verified Build Targets
cargo build -p payjoin --no-default-features --features v2,alloccargo build -p payjoin --no-default-features --features v2,alloc --target thumbv7em-none-eabihf-p payjoincargo build -p payjoin --no-default-features --features v2,stdNotes for Reviewers
Please review commit by commit:
refactor: introduce no_std/alloc feature split in payjoin coreThe main structural change — replaces
std::withcore::/alloc::and gates std-only deps behind#[cfg(feature = "std")]or#[cfg(feature = "v2-std")].fix: gate v2 std-only code behind cfg featuresExtends gating to v2 send/receive and persist. Key decisions:
HasReplyableErrornow carriesfallback_txin both configs to preserve fallback through replay;MaybeSuccessTransition::deconstructusesSaveinstead ofSaveAndCloseon success.fix: update payjoin-ffi for no_std feature splitMinimal FFI updates to match new
AsyncSessionPersisterbounds.fix: restore OHTTP test constants and enable v2 feature in test utilsKEM,KEY_ID,SYMMETRICwere dropped upstream without updating internal tests. Restores them inpayjoin-test-utils/src/v2.rs.chore: update CI, lock files and flake for no_std targetsAdds
thumbv7em-none-eabihfto CI and ARM cross-toolchain to the Nix dev shell.AI Assistance
This implementation was developed with AI assistance (Claude, Anthropic).
Pull Request Checklist
Please confirm the following before requesting review:
AI
in the body of this PR.