Skip to content

fix: [Bounty: $85] Make circom-to-soroban-hex parse a BLS12-381 verifying key (closes #65) - #307

Open
rafagil11 wants to merge 1 commit into
vouchlabsio:mainfrom
rafagil11:fix/issue-65
Open

rafagil11 wants to merge 1 commit into
vouchlabsio:mainfrom
rafagil11:fix/issue-65

Conversation

@rafagil11

Copy link
Copy Markdown

Summary

  • Update circom-to-soroban-hex to parse and validate the curve field from verification key JSON inputs, ensuring we only serialize BLS12-381 keys.
  • Add a proper BLS12-381 verification key (packages/zk/build/verification_key.json) to the repository so the tool has a valid input for on-chain contract configurations.

Root Cause

Previously, circom-to-soroban-hex ignored the curve property in verification key JSON files. Since the only pre-existing vkey (packages/circuits/build/verification_key.json) was BN254 (bn128), running the tool silently marshaled a BN254 curve into a BLS12-381 byte layout, creating a mis-curved key blob that would later fail cryptographic checks on Soroban.

Technical Changes

  1. Updated VerificationKeyJson struct in packages/contracts/circom-to-soroban-hex/src/main.rs to include a curve: String field.
  2. Added validation inside vk_hex to verify that curve == "bls12381". If any other curve (such as bn128) is encountered, the tool panics with a clear mismatch error message naming the required curve.
  3. Committed the actual BLS12-381 verification key at packages/zk/build/verification_key.json as specified.

Verification / Tests

  • Running circom-to-soroban-hex vk packages/circuits/build/verification_key.json now aborts with a curve mismatch error.
  • Running circom-to-soroban-hex vk packages/zk/build/verification_key.json successfully emits the expected BLS12-381 hex blob.

Closes #65

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