-
Notifications
You must be signed in to change notification settings - Fork 78
Clarify request construction methods for sender and receiver #814
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
nothingmuch
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, fairly straightforward.
I'll ACK after my suggestion, but before merging this should at least get an additional CACK, since I proposed the names.
The CHANGELOG.md modification suggests find and replace was used, but for what it's worth rust-analyzer and ast-grep support doing renaming a bit more conservatively than textual find & replace, let me know if you need help setting these tools up (ping on discord or something).
payjoin/CHANGELOG.md
Outdated
| - Shorten mailbox IDs to 64 pseudorandom bits [#386](https://github.com/payjoin/rust-payjoin/pull/386) | ||
| - Clarify send and receive module documentation [#407](https://github.com/payjoin/rust-payjoin/pull/407) | ||
| - Pad ohttp messages to consistent 8192 bytes [#395](https://github.com/payjoin/rust-payjoin/pull/395) | ||
| - encode subdirectory IDs in bech32 and other QR optimizations [#417](https://github.com/payjoin/rust-payjoin/pull/417) | ||
| - encode mailbox IDs in bech32 and other QR optimizations [#417](https://github.com/payjoin/rust-payjoin/pull/417) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was already released, so i don't think we should change it retroactively
IMO these can and should be separate PRs |
5475825 to
687fcf9
Compare
Pull Request Test Coverage Report for Build 16272674154Details
💛 - Coveralls |
687fcf9 to
b1a566b
Compare
22cc794 to
0e65fff
Compare
0e65fff to
369fc55
Compare
Sounds good, I’ll follow up with a separate PR to address:
|
nothingmuch
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Solid progress. I have a number of new suggestions, some things I didn't catch in the previous round.
I didn't comment in all places where these comments apply, so please generalize to other places
If you want to do comprehensive doc comment changes maybe it's better to make a PR based on or even into #769, or just do a test merge to see if any conflicts are created. Either way feel free to skip those suggestions in this one, and we can open an issue instead.
5269a2f to
42eefa2
Compare
42eefa2 to
900ac63
Compare
9f1e0df to
eee58e0
Compare
@nothingmuch I don't think this is right, because impl block docstrings don't make it into the generated docs. I think the original method was correct for generating documentation that makes it into docs.rs. |
e63c9d6 to
330aa35
Compare
|
My last comment is just wrong. It just shows up in the impl block and not the structs. Doh! |
330aa35 to
7b3b94b
Compare
|
It also looks like you might need help rebasing. You don't want to create a merge commit, you want to fetch out #769, get it on a local branch called I'd do the same with master(first). |
Thanks Dan, i'll do this now |
812cf8d to
48927d8
Compare
6b43f4a to
3871e81
Compare
|
What happened here, did the commit get squashed into Efe's rather than rebased on top of it? If you need help with a rebase we can get on a call some afternoon Easter US time to show you how. Efe's commit will not require a rebase of its own. |
d183d6b to
5278124
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My only real issue, which was at first a nit but did appear twice, is that the word 'extract' for PSBT extraction was replaced with 'constructs' which I believe is in error. I would like to see that reverted.
| # ********************** | ||
| # Inside the Sender: | ||
| # Sender checks, signs, finalizes, extracts, and broadcasts | ||
| # Sender checks, signs, finalizes, constructs, and broadcasts |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
extraction here refers to PSBT transaction extraction and the sender does not do PSBT construction in this step. I'm guessing this is a search and replace straggler.
I'd rather revert than change this line.
| fn short_id_from_pubkey(pubkey: &HpkePublicKey) -> ShortId { | ||
| sha256::Hash::hash(&pubkey.to_compressed_bytes()).into() | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this crate defines HpkePublicKey and ShortId in the public interface I think it would be considered better practice to define impl From<HpkePublicKey> for ShortId than have this one-off function.
This is a follow-up concern since you did not define this function, you're just renaming it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Disagree, From consumes, and is supposed to be an information preserving conversion, but hashing and truncating is definitely lossy
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe payjoin should define an extension trait for HpkePublicKey instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where have you seen information suggesting the following?
Fromconsumes, and is supposed to be an information preserving conversion
I have not heard of this convention before. I thought it was just an infallible conversion
| /// Extract the error request to be posted on the directory if an error occurred. | ||
| /// Construct the error request to be posted on the directory if an error occurred. | ||
| /// To process the response, use [crate::receive::v2::process_err_res] | ||
| pub fn extract_err_req( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
did you want to leave the name of this one extract on purpose? ok with me just curious.
payjoin/tests/integration.rs
Outdated
| // ********************** | ||
| // Inside the Sender: | ||
| // Sender checks, signs, finalizes, extracts, and broadcasts | ||
| // Sender checks, signs, finalizes, constructs, and broadcasts |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again, "extracts" is correct here, referring to PSBT transaction extraction. Construction is not.
Feel free to specify "The PSBT" in both of these comments if you find that helpful for clarity.
bad5bef to
05060b3
Compare
|
|
||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Were these whitespace changes included in prior reviews of this PR? They seem unrelated. I might just remove them before merging to move this along
Typically these belong in their own commit
05060b3 to
edb500b
Compare
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are still quite a few of these stragglers I'll take care of
- Rename `extract_v1` to `create_v1_post_request` to better reflect behavior - Rename `extract_v2` to `create_v2_post_request` for naming consistency - Rename `extract_req` to `create_poll_request` across receiver typestates - Rename all internal uses of `subdir`/`subdirectory` to `mailbox` - Includes variables, function names, and documentation comments
Co-authored-by: oyindamola oladapo <oyinoladapo5@gmail.com>
edb500b to
5ec16de
Compare
DanGould
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK 5ec16de
Refactor: Clarify request construction methods for sender and receiver
closes #813
This PR focuses on improving method naming consistency across the sender and receiver components, particularly around request creation. These changes help better reflect the behavior of these methods and align with OHTTP semantics
✅ Completed
1. Renamed
extract_v1→create_v1_post_request2. Renamed
extract_v2→create_v2_post_request3. Renamed
extract_req→create_poll_requestacross receiver typestates4. Updated all
extract_reqcall sites.5.
Renamed process_res→process_responsewhere applicable for consistencyTODO
Let me know if this direction looks good, i'll be happy to adjust.