Skip to content

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
ImanKalyanChakraborty:forks/amsterdam
Open

fix(bls12_381): added raise for all InvalidParameter exceptions in decode_g1_scalar_pair / decode_g2_scalar_pair#2742
ImanKalyanChakraborty wants to merge 1 commit intoethereum:forks/amsterdamfrom
ImanKalyanChakraborty:forks/amsterdam

Conversation

@ImanKalyanChakraborty
Copy link
Copy Markdown

🗒️ Description

Fix missing raise statements in BLS12-381 scalar pair decoders.

Both decode_g1_scalar_pair and decode_g2_scalar_pair were constructing an InvalidParameter exception 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 raise statements to ensure proper error handling and defensive validation.

🔗 Related Issues or PRs

Fixes #2734

✅ Checklist

  • All: Ran fast static checks to avoid unnecessary CI fails, see also Code Standards and Enabling Pre-commit Checks:
    just static
  • All: PR title adheres to the repo standard - it will be used as the squash commit message and should start type(scope):.
  • All: Considered updating the online docs in the ./docs/ directory.
  • All: Set appropriate labels for the changes (only maintainers can apply labels).
  • Tests: Ran mkdocs serve locally and verified the auto-generated docs for new tests in the Test Case Reference are correctly formatted.
  • Tests: For PRs implementing a missed test case, update the post-mortem document to add an entry the list.
  • Ported Tests: All converted JSON/YML tests from ethereum/tests or tests/static have been assigned @ported_from marker.

Cute Animal Picture

Put a link to a cute animal picture inside the parenthesis-->

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.

decode_g1_scalar_pair / decode_g2_scalar_pair: missing raise makes length check a no-op

1 participant