fix(bls12_381): added raise for all InvalidParameter exceptions in decode_g1_scalar_pair / decode_g2_scalar_pair#2742
Open
ImanKalyanChakraborty wants to merge 1 commit intoethereum:forks/amsterdamfrom
Conversation
…lar_pair / decode_g2_scalar_pair
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.
🗒️ Description
Fix missing
raisestatements in BLS12-381 scalar pair decoders.Both
decode_g1_scalar_pairanddecode_g2_scalar_pairwere constructing anInvalidParameterexception when input length checks failed, but not raising it. This resulted in the validation being a no-op, allowing execution to continue with invalid inputs.While current callers (
bls12_g1_msm,bls12_g2_msm) enforce correct input lengths and pass properly sized slices, thus making the bug effectively unreachable in existing flows, this behavior breaks the function’s contract and could lead to silent failures if these utilities are used elsewhere (e.g., tests, tooling, or future refactors).This PR adds the missing
raisestatements to ensure proper error handling and defensive validation.🔗 Related Issues or PRs
Fixes #2734
✅ Checklist
just statictype(scope):.mkdocs servelocally and verified the auto-generated docs for new tests in the Test Case Reference are correctly formatted.@ported_frommarker.Cute Animal Picture