feat: merge-train/barretenberg#22667
Merged
Merged
Conversation
Make the databus mechanism generic on number of bus columns to facilitate extension
…22657) ## 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`).
Collaborator
Author
|
🤖 Auto-merge enabled after 4 hours of inactivity. This PR will be merged automatically once all checks pass. |
Collaborator
Author
Flakey Tests🤖 says: This CI run detected 1 tests that failed, but were tolerated due to a .test_patterns.yml entry. |
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.
BEGIN_COMMIT_OVERRIDE
chore: genericize databus (#22648)
chore(ts): drop dead Plonk VK scaffolding and port #22655 TS cleanup (#22657)
END_COMMIT_OVERRIDE