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

Impl PartialOrd and Ord for Invoice #2279

Merged
merged 1 commit into from
May 10, 2023

Conversation

benthecarman
Copy link
Contributor

No description provided.

@TheBlueMatt
Copy link
Collaborator

Hmm, I'd kinda rather we just derive(PartialOrd, Ord) on ~everything in the crate (as required) over allocating a string just to do a comparison?

@codecov-commenter
Copy link

codecov-commenter commented May 9, 2023

Codecov Report

Patch coverage: 66.66% and project coverage change: -0.59 ⚠️

Comparison is base (818dbdf) 91.50% compared to head (2ddce64) 90.91%.

❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2279      +/-   ##
==========================================
- Coverage   91.50%   90.91%   -0.59%     
==========================================
  Files         104      104              
  Lines       52087    52770     +683     
  Branches    52087    52770     +683     
==========================================
+ Hits        47660    47976     +316     
- Misses       4427     4794     +367     
Impacted Files Coverage Δ
lightning/src/ln/features.rs 96.08% <0.00%> (-2.38%) ⬇️
lightning-invoice/src/lib.rs 79.22% <70.83%> (-0.81%) ⬇️
lightning/src/ln/mod.rs 95.00% <100.00%> (+8.63%) ⬆️
lightning/src/routing/gossip.rs 89.77% <100.00%> (ø)
lightning/src/routing/router.rs 94.43% <100.00%> (-0.67%) ⬇️

... and 18 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@benthecarman
Copy link
Contributor Author

benthecarman commented May 9, 2023

Hmm, I'd kinda rather we just derive(PartialOrd, Ord) on ~everything in the crate (as required) over allocating a string just to do a comparison?

Tried doing that, it boils down to not having it impl'd on RecoverableSignature which is part of secp

@wpaulino
Copy link
Contributor

wpaulino commented May 9, 2023

Tried doing that, it boils down to not having it impl'd on RecoverableSignature which is part of secp

rust-bitcoin should support it then. Signature already has them derived so there shouldn't be a problem.

@benthecarman
Copy link
Contributor Author

benthecarman commented May 9, 2023

rust-bitcoin should support it then. Signature already has them derived so there shouldn't be a problem.

Maybe I am an idiot and don't see it but I don't think it exists in rust-bitcoin. This is the only use of RecoverableSignature in rust-bitcoin:

https://github.com/search?q=repo%3Arust-bitcoin%2Frust-bitcoin%20RecoverableSignature&type=code

I made a PR in rust-secp256k1 for now: rust-bitcoin/rust-secp256k1#611

Unless do you mean I do something like this?

impl PartialOrd for InvoiceSignature {
	fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
		self.0.serialize_compact().1.partial_cmp(&other.0.serialize_compact().1)
	}
}

impl Ord for InvoiceSignature {
	fn cmp(&self, other: &Self) -> Ordering {
		self.0.serialize_compact().1.cmp(&other.0.serialize_compact().1)
	}
}

Copy link
Collaborator

@TheBlueMatt TheBlueMatt left a comment

Choose a reason for hiding this comment

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

Yea, rust-secp is the right place for that fix, sorry for the confusion. This LGTM as-is and we should clean it up after rust-secp.

@wpaulino wpaulino merged commit 7b64527 into lightningdevkit:main May 10, 2023
@benthecarman benthecarman deleted the ord-invoice branch May 10, 2023 21:03
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.

5 participants