Skip to content

WIP#2

Closed
arminsabouri wants to merge 4 commits intoreceiver-generic-over-typestatefrom
sender-generic-over-typestate
Closed

WIP#2
arminsabouri wants to merge 4 commits intoreceiver-generic-over-typestatefrom
sender-generic-over-typestate

Conversation

@arminsabouri
Copy link
Copy Markdown
Owner

No description provided.

This commit updates the `v2::Receiver` to be generic over its
typestate (e.g., `UncheckedProposal`, `InputsSeen`, etc.). The
motivation:

* Improves readability and maintainability: Each typestate now
  clearly belongs to the receiver session. This makes the code easier
  to reason about, without runtime cost. It also sets us up to
  define a shared pattern between v2, NS1R and future state machines.

* Decouples typestate data from transition logic: NS1R typesates can now
  consume state structs without being tied to the transition machinery.
  This keeps state transitions encapsulated and makes the underlying
  session data easier to use in other contexts.

This commit renames the original `Receiver` struct to `WithContext`.
This type now represents the receiver session once the HPKE context has been
created. The Receiver name is re-purposed for the new generic wrapper
over typestate.

For the UniFFI exported receiver we monomorphizes the exported structs over a
specific typestate. UniFFI doesn't support exporting generic structs, so
we expose a concrete type to the FFI.
The full paths are often hard to read and create noise in this file.
@coveralls
Copy link
Copy Markdown

coveralls commented May 30, 2025

Pull Request Test Coverage Report for Build 15351526536

Details

  • 60 of 63 (95.24%) changed or added relevant lines in 6 files are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage increased (+0.03%) to 84.619%

Changes Missing Coverage Covered Lines Changed/Added Lines %
payjoin/src/send/v2/persist.rs 1 2 50.0%
payjoin-cli/src/db/v2.rs 9 11 81.82%
Files with Coverage Reduction New Missed Lines %
payjoin-cli/src/db/v2.rs 1 94.59%
Totals Coverage Status
Change from base Build 15348576798: 0.03%
Covered Lines: 6558
Relevant Lines: 7750

💛 - Coveralls

@arminsabouri arminsabouri force-pushed the receiver-generic-over-typestate branch 2 times, most recently from 922a224 to 1b42be6 Compare May 30, 2025 18:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants