Skip to content

fix(hex): validate BLS12-381 curve in circom-to-soroban-hex and accept in check-vkey - #303

Open
NePreby wants to merge 1 commit into
vouchlabsio:mainfrom
NePreby:fix/parse-bls12-381-verifying-key
Open

NePreby wants to merge 1 commit into
vouchlabsio:mainfrom
NePreby:fix/parse-bls12-381-verifying-key

Conversation

@NePreby

@NePreby NePreby commented Nov 9, 2026 •

Copy link
Copy Markdown

Summary

Fixes #65.

Root Cause & Changes

  1. Verification Key Curve Validation:

    • In packages/contracts/circom-to-soroban-hex/src/main.rs, added #[serde(default)] curve: Option to VerificationKeyJson.
    • In �k_hex(), explicitly validate �k.curve against �ls12-381 / �ls12381 before processing coordinates, aborting immediately with a clear error if the curve does not match or is absent.
    • Added unit tests verifying rejection of BN254 / non-BLS12-381 keys and successful conversion of BLS12-381 keys.
    • Fixed duplicate dependency declarations in Cargo.toml.
  2. Verification Key Artifacts & CI Check:

    • Updated packages/circuits/scripts/check-vkey.mjs to accept �ls12381 / �ls12-381 alongside �n128.
    • Added packages/circuits/build/verification_key.bls12-381.json matching the deployed BLS12-381 verifying key and unignored it in packages/circuits/.gitignore.

Verification

  • Tested check-vkey.mjs on default �erification_key.json (OK, bn128)
  • Tested check-vkey.mjs on �erification_key.bls12-381.json (OK, bls12381)
  • Tested check-vkey.mjs on invalid curves (fails with explicit error)

Payout Wallet (Tron TRC20)

  • Network: TRX Tron (TRC20)
  • Address: TMqmJjRgVS21NL2eFtfyHciTxvE4BqGmEv

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.

[Bounty: $85] Make circom-to-soroban-hex parse a BLS12-381 verifying key

1 participant