Skip to content

feat(bls-signatures): introduce granular parse and point-conversion error variants - #902

Open
raushan728 wants to merge 2 commits into
anza-xyz:masterfrom
raushan728:feat/granular-bls-errors
Open

feat(bls-signatures): introduce granular parse and point-conversion error variants#902
raushan728 wants to merge 2 commits into
anza-xyz:masterfrom
raushan728:feat/granular-bls-errors

Conversation

@raushan728

Copy link
Copy Markdown
Contributor
  • BlsError collapsed multiple distinct parse/point-validation failures into ParseFromString, ParseFromBytes, PointConversion (see TODOs in error.rs)
  • Added granular variants: InvalidBase64, StringLengthExceeded, InvalidEncodedLength, InvalidLengthMultiple, InvalidPointEncoding, IdentityPointRejected, KeypairMismatch
  • Removed the three legacy variants, now fully superseded
  • Updated impl_from_str! / impl_bls_conversions! macros to preserve exact failure cause at decode and affine-conversion boundaries
  • Updated keypair.rs to use InvalidEncodedLength for length mismatches and KeypairMismatch for public/secret key mismatch (previously misused ParseFromBytes)
  • Updated secret_key.rs to use InvalidEncodedLength for length mismatches

Breaking Change

BlsError is not #[non_exhaustive] variants added, removed. Downstream exhaustive matches on BlsError will need updating.

…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).
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.

1 participant