Skip to content
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

Accomodate Updated BIP 78 Spec #505

Merged
merged 2 commits into from
Jan 23, 2025
Merged

Conversation

DanGould
Copy link
Contributor

@DanGould DanGould commented Jan 23, 2025

See #480

InternalInputContributionError has only one error variant as a result of this, which means it's a smell to clean up in #403

One thing I note is that the BIP says "Our recommendation for maxadditionalfeecontribution= is originalPSBTFeeRate * 110." and our actual use is let recommended_additional_fee = min_fee_rate * input_weight; where input_weight is 110 only where mixed inputs appear. I did not remove the expected_input_weight function for a blanket 110 recommendation, which I believe is in line with actual incentives to use a matching input. but I could go either way.

BIP 78 (Payjoin v1) was updated to remain in compliance
with BIP 174 (PSBT v0).

See: bitcoin/bips#1396
See also: payjoin#480
@coveralls
Copy link
Collaborator

coveralls commented Jan 23, 2025

Pull Request Test Coverage Report for Build 12932827292

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • 4 unchanged lines in 2 files lost coverage.
  • Overall coverage increased (+0.006%) to 78.541%

Files with Coverage Reduction New Missed Lines %
payjoin/src/send/mod.rs 2 93.79%
payjoin/src/receive/error.rs 2 21.8%
Totals Coverage Status
Change from base Build 12922010861: 0.006%
Covered Lines: 3638
Relevant Lines: 4632

💛 - Coveralls

@DanGould DanGould marked this pull request as ready for review January 23, 2025 04:22
@DanGould DanGould requested a review from spacebear21 January 23, 2025 04:22
Copy link
Collaborator

@spacebear21 spacebear21 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the BIP says "Our recommendation for maxadditionalfeecontribution= is originalPSBTFeeRate * 110." and our actual use is let recommended_additional_fee = min_fee_rate * input_weight; where input_weight is 110 only where mixed inputs appear.

AFAICT our implementation uses "cheapest default if mixed input types" which is 58 for P2TR, not 110. Actually it's not clear to me why the BIP recommends 110, it seems to be a compromise for covering most common input types except P2PKH?

I did not remove the expected_input_weight function for a blanket 110 recommendation, which I believe is in line with actual incentives to use a matching input. but I could go either way.

I agree with leaving our implementation as is. It enables savings for the sender if they use a cheaper input type, and we went to great lengths to get precise input weight calculations so they are well-tested. The only drawback is expected_input_weight could fail if the input is not recognized, but I think that's fine because the receiver needs to be able to calculate sender input weights in additional_input_weight anyway.

@@ -128,41 +128,6 @@ mod integration {
);
Ok(())
}

#[test]
fn disallow_mixed_input_scripts() -> Result<(), BoxError> {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a v2_to_v2_mixed_input_script_types test that checks for allowing mixed input script types. Maybe we should move it here as allow_mixed_input_scripts since it's now shared logic and v1 tests are shorter to write.

payjoin/src/send/mod.rs Show resolved Hide resolved
@DanGould
Copy link
Contributor Author

I knew there was some send-side check I was missing. Fixed that and moved the test too. Thanks for the thorough review (as always, King behavior).

BIP 78 was updated to allow mixed inputs.

> Disallowing mixed inputs was based on incorrect assumption that no
> wallet supports mixed inputs and thus mixed inputs imply PayJoin.
> However there are at least three wallets supporting mixed inputs.
> (Confirmed: Bitcoin Core, LND, Coinomi) Thus it makes sense to enable
> mixed inputs to avoid a payjoin-specific fingerptint. To avoid
> compatibility issues a grace period is suggested.

See: bitcoin/bips#1605
See also: payjoin#480
Copy link
Collaborator

@spacebear21 spacebear21 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK ab12170

@spacebear21 spacebear21 merged commit e88f972 into payjoin:master Jan 23, 2025
6 checks passed
@DanGould DanGould deleted the update-bip78 branch January 23, 2025 17:46
@DanGould DanGould mentioned this pull request Jan 23, 2025
15 tasks
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.

3 participants