You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
BIP-322 defines three validator outputs: valid at time T and age S, inconclusive, and invalid. Two of those lived in Verification while the third was reported as Err, so the spec's own state machine was split across a Rust idiom. Verification now carries all three.
Changes
Added Invalid(Error) variant to Verification.
Added a Box around TransactionExtract's source.
Removed #[allow(clippy::result_large_err)] from every function.
Notes for reviewers
Invalid carries the full Error, which means Verification can no longer derive Clone, Copy, PartialEq or Eq. Error implements none of them, and bitcoin::io::Error can't.
This looks good overall. I just merged the changes from #77. A couple thoughts for you since you are a consumer of this library:
create_to_sign and extract_tx are more internal integrity failures rather than Verifiction::Invalid so maybe they keep their error variants? I don't feel strongly about this and the way it is right now seems okay to me.
check_to_sign only ever produces Error::ToSignInvalid so maybe we don't need the Option there?
This is an existing footgun I can see being problematic: calling .is_ok() doesn't necessarily mean the proof is valid, just that the input decoded valid. It can be Ok(Verification::Invalid(..)). We could either flatten everything to just return Verification or add some sort of #[must_use] + a helper .is_valid() + a note in the Changelog about this.
Let me know your thoughts.
This branch has not been deployed
No deployments
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
BIP-322 defines three validator outputs: valid at time T and age S, inconclusive, and invalid. Two of those lived in
Verificationwhile the third was reported asErr, so the spec's own state machine was split across a Rust idiom.Verificationnow carries all three.Changes
Invalid(Error)variant toVerification.BoxaroundTransactionExtract's source.#[allow(clippy::result_large_err)]from every function.Notes for reviewers
Invalidcarries the fullError, which meansVerificationcan no longer deriveClone,Copy,PartialEqorEq. Error implements none of them, and bitcoin::io::Error can't.Closes #83
Closes #58