Skip to content

chore(ts): drop dead Plonk VK scaffolding and port #22655 TS cleanup#22657

Merged
iakovenkos merged 4 commits into
merge-train/barretenbergfrom
claudebox/ts-vk-constants-cleanup
Apr 20, 2026
Merged

chore(ts): drop dead Plonk VK scaffolding and port #22655 TS cleanup#22657
iakovenkos merged 4 commits into
merge-train/barretenbergfrom
claudebox/ts-vk-constants-cleanup

Conversation

@AztecBot

@AztecBot AztecBot commented Apr 20, 2026

Copy link
Copy Markdown
Collaborator

Context

Follow-up to #22655 (feat!: poseidon2 with compressed internal rounds and aux wires) and the scope audit that started from it.

The original PR surfaced a recurring pain: every time the MegaHonk flavor changes, TypeScript has to be hand-edited because several downstream call sites duplicate derived VK sizes or freeze entire VKs as inline blobs. While auditing for similar bad patterns, it became clear that a chunk of the stdlib VK module is Plonk-era scaffolding \u2014 pre-Honk types whose only remaining callers are themselves test-only or dead. Those classes are why the flavor-change struggle exists in TS in the first place: VerificationKeyData.makeFakeHonk was synthesising fake keyAsBytes by serializing a fake Plonk VerificationKey, dragging Plonk types into the Honk path.

What this PR does (3 commits)

1. chore(stdlib): remove dead mocked_keys.ts hex blob

Deletes yarn-project/stdlib/src/abi/mocked_keys.ts, a ~2 KB orphan Plonk VK hex blob. Grepping the monorepo: 1 declaration, 0 references. stdlib/src/abi/index.ts does not re-export it.

2. chore(ts): use MEGA_VK_LENGTH_IN_FIELDS instead of hardcoded 4064

Ports the TS-only cleanup from #22655 so it lands independently of whether the Poseidon2 flavor change merges:

  • 4 call sites of Buffer.alloc(4064) in aztec.js/src/contract/{contract,deploy_method}.test.ts \u2192 Buffer.alloc(MEGA_VK_LENGTH_IN_FIELDS * Fr.SIZE_IN_BYTES).
  • VerificationKey.makeFakeMegaHonk() dropped its ~4 KB base64 blob in favor of Buffer.alloc(MEGA_VK_LENGTH_IN_FIELDS * Fr.SIZE_IN_BYTES).

Intentionally NOT ported: the MEGA_VK_LENGTH_IN_FIELDS 127\u2192135 bump in constants.gen.ts, which tracks the C++ flavor change that's not in merge-train/barretenberg. The ported code is layout-agnostic.

3. chore(stdlib): drop Plonk VerificationKey/CommitmentMap/G1AffineElement

Deletes the entire Plonk-era VK scaffold. Nothing reads it off the wire and nothing in Honk needs it:

  • VerificationKey (Plonk class with CommitmentMap of {Q_1, SIGMA_1, ...}, containsRecursiveProof, recursiveProofPublicInputIndices): zero non-test callers. Every caller was itself dead (makeVerificationKey factory, a one-off round-trip test, or the Honk VerificationKeyData fake helpers that were using it as a source of placeholder bytes).
  • CommitmentMap and G1AffineElement: only referenced by VerificationKey. Gone.
  • CircuitType enum (STANDARD/ULTRA) in stdlib/src/types/shared.ts: only existed to type-tag Plonk VKs. Gone.
  • makeVerificationKey in stdlib/src/tests/factories.ts: exported but not imported anywhere.
  • 'can deserialize vk built by noir' test: round-tripped an inline ~2 KB Plonk VK hex; cannot parse any current protocol VK.
  • VerificationKeyData.makeFakeHonk / makeFakeRollupHonk: now synthesize keyAsBytes from VerificationKeyAsFields.toBuffer() (the real Honk serialization) instead of from a fake Plonk VK. makeFake(len) had zero callers and was removed.
  • VerificationKey.makeFakeMegaHonk(): its one remaining caller (pxe/.../private_kernel_execution_prover.test.ts) now inlines Buffer.alloc(MEGA_VK_LENGTH_IN_FIELDS * Fr.SIZE_IN_BYTES).

Net: \u2212209 lines from stdlib/src/vks/verification_key.ts plus the shared / factories / pxe updates.

Scope audit (gist)

https://gist.github.com/AztecBot/67c6cc69458f63c296d0557b2e598632 (updated)

Verification

grep across yarn-project/ confirms zero remaining references to VerificationKey.makeFake, VerificationKey.makeFakeMegaHonk, VerificationKey.fromBuffer, new VerificationKey(, CommitmentMap, G1AffineElement, CircuitType, or makeVerificationKey. Remaining hits for the string VerificationKey are unrelated (VerificationKeyAsFields, VerificationKeyData, PrivateVerificationKeyHints, VerificationKeyNoir type binding, computeVerificationKeyHash, makeProofAndVerificationKey).

@AztecBot AztecBot added ci-draft Run CI on draft PRs. claudebox Owned by claudebox. it can push to this PR. labels Apr 20, 2026
Ported from #22655 so the TS-side cleanup lands independently of the flavor
change: removes the 4064 byte-size literal from the contract tests and the
~4 KB base64 VK blob from VerificationKey.makeFakeMegaHonk(). Buffer size
is now derived from MEGA_VK_LENGTH_IN_FIELDS * Fr.SIZE_IN_BYTES so future
Mega flavor changes only need to touch the generated constants file.
@AztecBot AztecBot changed the title chore(stdlib): remove dead mocked_keys.ts hex blob chore(ts): port TS VK constant cleanup from #22655 Apr 20, 2026
@iakovenkos iakovenkos self-requested a review April 20, 2026 11:10
@iakovenkos iakovenkos marked this pull request as ready for review April 20, 2026 11:10
These classes only served the pre-Honk Plonk verifier path and had no
remaining non-test callers:

- Plonk VerificationKey (with CommitmentMap of {Q_1, SIGMA_1, ...} and
  a containsRecursiveProof flag) was only constructed by dead factory
  functions and its own test. Deleted.
- CommitmentMap and G1AffineElement were only used by the Plonk class.
  Deleted.
- CircuitType enum (STANDARD/ULTRA) only existed to type-tag Plonk VKs.
  Deleted.
- makeVerificationKey factory in tests/factories.ts — exported but not
  imported anywhere. Deleted.
- The 'can deserialize vk built by noir' test was a round-trip of an
  inline ~2 KB Plonk VK hex; it cannot parse any current protocol VK.
  Deleted.
- VerificationKeyData.makeFakeHonk / makeFakeRollupHonk now synthesize
  keyAsBytes from the already-fake VerificationKeyAsFields instead of
  serializing a fake Plonk VK. makeFake(len) had zero callers and was
  also removed.
- VerificationKey.makeFakeMegaHonk() had one test-only caller in
  private_kernel_execution_prover.test.ts, inlined there as a
  Buffer.alloc(MEGA_VK_LENGTH_IN_FIELDS * Fr.SIZE_IN_BYTES).

Net: -198 lines.
@AztecBot AztecBot changed the title chore(ts): port TS VK constant cleanup from #22655 chore(ts): drop dead Plonk VK scaffolding and port #22655 TS cleanup Apr 20, 2026
@iakovenkos iakovenkos added ci-full Run all master checks. and removed ci-draft Run CI on draft PRs. labels Apr 20, 2026
@iakovenkos iakovenkos requested review from ledwards2225 and removed request for iakovenkos April 20, 2026 13:11

@ledwards2225 ledwards2225 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ick! thanks

@iakovenkos iakovenkos merged commit c1455c0 into merge-train/barretenberg Apr 20, 2026
12 checks passed
@iakovenkos iakovenkos deleted the claudebox/ts-vk-constants-cleanup branch April 20, 2026 15:59
dipkakwani pushed a commit to dipkakwani/aztec-packages that referenced this pull request Apr 22, 2026
BEGIN_COMMIT_OVERRIDE
chore: genericize databus (AztecProtocol#22648)
chore(ts): drop dead Plonk VK scaffolding and port AztecProtocol#22655 TS cleanup
(AztecProtocol#22657)
END_COMMIT_OVERRIDE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci-full Run all master checks. claudebox Owned by claudebox. it can push to this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants