feat(bls-signatures): introduce granular parse and point-conversion error variants - #902
Open
raushan728 wants to merge 2 commits into
Open
feat(bls-signatures): introduce granular parse and point-conversion error variants#902raushan728 wants to merge 2 commits into
raushan728 wants to merge 2 commits into
Conversation
…ants Add InvalidBase64, StringLengthExceeded, InvalidEncodedLength, InvalidLengthMultiple, InvalidPointEncoding, and IdentityPointRejected to BlsError so callers can distinguish malformed base64, string/byte length mismatches, invalid curve point encoding, and identity-point rejection instead of collapsing them into ParseFromString/ParseFromBytes/ PointConversion. BREAKING CHANGE: BlsError gains six new variants. Any exhaustive match on BlsError in downstream code will need a wildcard arm or explicit handling for the new variants.
Introduces KeypairMismatch to reject mismatched keypairs during deserialization. Deletes ParseFromBytes, ParseFromString, and PointConversion entirely, as they have been fully superseded by granular error variants introduced in the previous commit. BREAKING CHANGE: BlsError variants ParseFromBytes, ParseFromString, and PointConversion have been deleted. Downstream consumers matching on these variants will fail to compile and must migrate to the new granular variants (InvalidEncodedLength, InvalidBase64, InvalidPointEncoding, IdentityPointRejected, KeypairMismatch).
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
BlsErrorcollapsed multiple distinct parse/point-validation failures intoParseFromString,ParseFromBytes,PointConversion(see TODOs inerror.rs)InvalidBase64,StringLengthExceeded,InvalidEncodedLength,InvalidLengthMultiple,InvalidPointEncoding,IdentityPointRejected,KeypairMismatchimpl_from_str!/impl_bls_conversions!macros to preserve exact failure cause at decode and affine-conversion boundarieskeypair.rsto useInvalidEncodedLengthfor length mismatches andKeypairMismatchfor public/secret key mismatch (previously misusedParseFromBytes)secret_key.rsto useInvalidEncodedLengthfor length mismatchesBreaking Change
BlsErroris not#[non_exhaustive]variants added, removed. Downstream exhaustive matches onBlsErrorwill need updating.