-
Notifications
You must be signed in to change notification settings - Fork 139
Prover: add missing invalidity circuits to PayloadCircuits #3074
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+61
−11
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -59,15 +59,23 @@ var AllCircuits = []circuits.CircuitID{ | |
| } | ||
|
|
||
| // PayloadCircuits defines the ordered list of payload circuits that can be aggregated. | ||
| // This order corresponds to circuit IDs 0-5 in GlobalCircuitIDMapping. | ||
| // This order corresponds to circuit IDs 0-13 in GlobalCircuitIDMapping. | ||
| // Infrastructure circuits (emulation, aggregation, pi-interconnection, emulation-dummy) are NOT included here. | ||
| var PayloadCircuits = []string{ | ||
| "execution-dummy", // ID 0 | ||
| "data-availability-dummy", // ID 1 | ||
| "execution", // ID 2 | ||
| "execution-large", // ID 3 | ||
| "execution-limitless", // ID 4 | ||
| "data-availability-v2", // ID 5 | ||
| "execution-dummy", // ID 0 | ||
| "data-availability-dummy", // ID 1 | ||
| "execution", // ID 2 | ||
| "execution-large", // ID 3 | ||
| "execution-limitless", // ID 4 | ||
| "data-availability-v2", // ID 5 | ||
| "invalidity-nonce-balance-dummy", // ID 6 | ||
| "invalidity-precompile-logs-dummy", // ID 7 | ||
| "invalidity-filtered-address-dummy", // ID 8 | ||
| "invalidity-nonce-balance", // ID 9 | ||
| "invalidity-precompile-logs", // ID 10 | ||
| "invalidity-filtered-address", // ID 11 | ||
| "invalidity-precompile-logs-limitless", // ID 12 | ||
| "invalidity-precompile-logs-large", // ID 13 | ||
| } | ||
|
|
||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This was already addressed. We added TestPayloadCircuitsMatchGlobalMapping which does exactly what it asks. |
||
| // Setup orchestrates the setup process for specified circuits, ensuring assets are generated or updated as needed. | ||
|
|
@@ -146,7 +154,7 @@ func Setup(ctx context.Context, args SetupArgs) error { | |
| return fmt.Errorf("%s failed to load public input interconnection setup: %w", cmdName, err) | ||
| } | ||
|
|
||
| // Collect verifying keys for payload circuits only (IDs 0-5) | ||
| // Collect verifying keys for payload circuits only (IDs 0-13) | ||
| // The IsAllowedCircuitID bitmask in the config determines which ones are actually allowed at runtime | ||
| payloadVks, err := collectPayloadVerifyingKeys(ctx, cfg, srsProvider) | ||
| if err != nil { | ||
|
|
@@ -398,10 +406,10 @@ func createCircuitBuilder(c circuits.CircuitID, cfg *config.Config, args SetupAr | |
| } | ||
| } | ||
|
|
||
| // collectPayloadVerifyingKeys gathers verifying keys for payload circuits only (IDs 0-5). | ||
| // collectPayloadVerifyingKeys gathers verifying keys for payload circuits only (IDs 0-13). | ||
| // These are the circuits that can be aggregated. Infrastructure circuits (emulation, | ||
| // aggregation, pi-interconnection, emulation-dummy) are excluded. | ||
| // The returned slice is indexed by payload circuit ID (0-5). | ||
| // The returned slice is indexed by payload circuit ID (0-13). | ||
| func collectPayloadVerifyingKeys(ctx context.Context, cfg *config.Config, srsProvider circuits.SRSProvider) ([]plonk.VerifyingKey, error) { | ||
| payloadVks := make([]plonk.VerifyingKey, len(PayloadCircuits)) | ||
|
|
||
|
|
@@ -439,7 +447,10 @@ func collectPayloadVerifyingKeys(ctx context.Context, cfg *config.Config, srsPro | |
| // Note: emulation-dummy is NOT a payload dummy - it's an infrastructure circuit dummy. | ||
| func isPayloadDummyCircuit(cID string) bool { | ||
| switch circuits.CircuitID(cID) { | ||
| case circuits.ExecutionDummyCircuitID, circuits.DataAvailabilityDummyCircuitID: | ||
| case circuits.ExecutionDummyCircuitID, circuits.DataAvailabilityDummyCircuitID, | ||
| circuits.InvalidityNonceBalanceDummyCircuitID, | ||
| circuits.InvalidityPrecompileLogsDummyCircuitID, | ||
| circuits.InvalidityFilteredAddressDummyCircuitID: | ||
| return true | ||
| } | ||
| return false | ||
|
|
||
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Swapped order of large and limitless invalidity circuits
High Severity
PayloadCircuitslists"invalidity-precompile-logs-limitless"at index 12 and"invalidity-precompile-logs-large"at index 13, butAllCircuitshas the opposite order —InvalidityPrecompileLogsLargeCircuitIDat position 12 andInvalidityPrecompileLogsLimitlessCircuitIDat position 13. IfGlobalCircuitIDMappingassigns IDs consistent withAllCircuits, this swap causes verifying keys to be collected at wrong indices, leading to VK digest mismatches during aggregation proof generation.Additional Locations (1)
prover/cmd/prover/cmd/setup.go#L51-L53Reviewed by Cursor Bugbot for commit 433a014. Configure here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
False positive. PayloadCircuits order matches GlobalCircuitIDMapping (the canonical ID source), not AllCircuits. AllCircuits has no positional ID semantics — it's just a set for the --circuits flag. This is verified by TestPayloadCircuitsMatchGlobalMapping