feat: swap polys to facilitate dynamic trace overflow#9976
Conversation
| // need to determine the dyadic size for this. We call the size function on the current circuit which will have | ||
| // the same fixed block sizes but might also have an overflow block potentially influencing the dyadic circuit | ||
| // size. | ||
| size_t dyadic_circuit_size = circuit.blocks.get_structured_dyadic_size(); |
There was a problem hiding this comment.
This was the major issue: The fixed sizes are set using the trace settings so the overflow block was 0 and hence the dyadic_circuit_size was not computed correctly. This was leading us to not take into account the lookup contributions at the end of the current circuit trace in PG. Modifying the fixed_sizes to include the overflow block is not easily possible in the current design and it makes sense to compute the dyadic_circuit_size using the current circuit. It will have the same TraceSetting (hence the same sizes also contained in the fixed_sizes structure ) but also the correct size of the overflow block. I expect we might be able to get rid of the fixed_sizes structure as a follow up or do something a bit cleaner in a follow up
| info(""); | ||
| } | ||
|
|
||
| void print_previous_active_ranges() |
There was a problem hiding this comment.
when i was printing the active ranges it wasn't reflecting everything due to the lookup and databus caveat so I think it made sense to refine the labels
| } | ||
| proving_key = std::make_shared<DeciderProvingKey>(circuit, trace_settings); | ||
|
|
||
| // The commitment key is initialised with the number of points determined by the trace_settings' dyadic size. If a |
There was a problem hiding this comment.
This is the caveat with overflowing circuits and having a single CIVC commitment key, maybe this could be refined in a follow up PR but seemed the easiest solution as it is. In the ideal case when we never overflow we still can benefit from having a single commitment key
| } else { | ||
| proving_key = std::make_shared<DeciderProvingKey>(circuit, trace_settings); | ||
| } | ||
| proving_key = std::make_shared<DeciderProvingKey>(circuit, trace_settings); |
There was a problem hiding this comment.
Also: please fuse this into the previous line if we're not conditionally defining (though I don't understand why we did that to begin with...)
There was a problem hiding this comment.
because at first round of client ivc we were also initializing the tracker but i discovered this could be included in the constructor of civc
| TEST_F(ClientIVCTests, DynamicOverflow) | ||
| { | ||
| // Define trace settings with zero overflow capacity | ||
| ClientIVC ivc{ { SMALL_TEST_STRUCTURE, /*overflow_capacity=*/0 } }; |
There was a problem hiding this comment.
If small tests structure changes behind the scenes, this test could silently break (i.e., it may continue to pass but cease to test what it's supposed to). Will you please define a new trace structure in this file for use in these two tests only?
| // The active ranges must also include the rows where the actual databus and lookup table data are stored. | ||
| // (Note: lookup tables are constructed at the end of the trace; databus data is constructed at the start). | ||
| size_t dyadic_circuit_size = fixed_sizes.get_structured_dyadic_size(); | ||
| // (Note: lookup tables are constructed at the end of the trace; databus data is constructed at the start) so we |
There was a problem hiding this comment.
This comment will break if the ordering in the trace structure ever changes--there's little chance that the person changing the structure remembers this comment exists, if they ever knew.
There was a problem hiding this comment.
a way to make this more robust is to update the active ranges as we are constructing the DeciderProvingKey so if the position of the rows changes it is obvious that the tracker's active ranges also need to be updated, will add an issue.
| */ | ||
| static void test_fold_with_virtual_size_expansion() | ||
| { | ||
| uint32_t overflow_capacity = 0; // consider the case where the overflow is not known until runtime |
There was a problem hiding this comment.
Same as above--if test correctness depends on a particular trace structure, we need to guard against that structure changing silently by putting the structure in the test (or test suite).
| const RelationSeparator& alphas_, | ||
| const RelationParameters<FF>& relation_parameters) | ||
| const RelationParameters<FF>& relation_parameters, | ||
| const bool use_prev_accumulator_tracker = false) |
There was a problem hiding this comment.
Why is this boolean needed here now?
There was a problem hiding this comment.
This function is used in two situations, perturbator computation in which we use the active ranges from the previous accumulator and if we manually want to compute the evaluations for each row of an accumulator
There was a problem hiding this comment.
maybe it should be default true and optional false?
| using Flavor = TypeParam; | ||
| using Builder = Flavor::CircuitBuilder; | ||
|
|
||
| TraceSettings trace_settings{ SMALL_TEST_STRUCTURE }; |
Changes to public function bytecode sizes
🧾 Summary (100% most significant diffs)
Full diff report 👇
|
Changes to circuit sizes
🧾 Summary (100% most significant diffs)
Full diff report 👇
|
🤖 I have created a release *beep* *boop* --- <details><summary>aztec-package: 0.65.2</summary> ## [0.65.2](aztec-package-v0.65.1...aztec-package-v0.65.2) (2024-11-28) ### Features * New proving broker ([#10174](#10174)) ([6fd5fc1](6fd5fc1)) </details> <details><summary>barretenberg.js: 0.65.2</summary> ## [0.65.2](barretenberg.js-v0.65.1...barretenberg.js-v0.65.2) (2024-11-28) ### Miscellaneous * **barretenberg.js:** Synchronize aztec-packages versions </details> <details><summary>aztec-packages: 0.65.2</summary> ## [0.65.2](aztec-packages-v0.65.1...aztec-packages-v0.65.2) (2024-11-28) ### Features * Fee foresight support ([#10262](#10262)) ([9e19244](9e19244)) * New proving broker ([#10174](#10174)) ([6fd5fc1](6fd5fc1)) * Sequential insertion in indexed trees ([#10111](#10111)) ([bfd9fa6](bfd9fa6)) * Swap polys to facilitate dynamic trace overflow ([#9976](#9976)) ([b7b282c](b7b282c)) ### Bug Fixes * Don't store indices of zero leaves. ([#10270](#10270)) ([c22be8b](c22be8b)) * Expect proper duplicate nullifier error patterns in e2e tests ([#10256](#10256)) ([4ee8344](4ee8344)) ### Miscellaneous * Check artifact consistency ([#10271](#10271)) ([6a49405](6a49405)) * Dont import things that themselves import jest in imported functions ([#10260](#10260)) ([9440c1c](9440c1c)) * Fix bad merge in integration l1 publisher ([#10272](#10272)) ([b5a6aa4](b5a6aa4)) * Fixing sol warnings ([#10276](#10276)) ([3d113b2](3d113b2)) * Pull out sync changes ([#10274](#10274)) ([391a6b7](391a6b7)) * Pull value merger code from sync ([#10080](#10080)) ([3392629](3392629)) * Remove default gas settings ([#10163](#10163)) ([c9a4d88](c9a4d88)) * Replace relative paths to noir-protocol-circuits ([654d801](654d801)) * Teardown context in prover coordination test ([#10257](#10257)) ([7ea3888](7ea3888)) </details> <details><summary>barretenberg: 0.65.2</summary> ## [0.65.2](barretenberg-v0.65.1...barretenberg-v0.65.2) (2024-11-28) ### Features * Sequential insertion in indexed trees ([#10111](#10111)) ([bfd9fa6](bfd9fa6)) * Swap polys to facilitate dynamic trace overflow ([#9976](#9976)) ([b7b282c](b7b282c)) ### Bug Fixes * Don't store indices of zero leaves. ([#10270](#10270)) ([c22be8b](c22be8b)) ### Miscellaneous * Pull value merger code from sync ([#10080](#10080)) ([3392629](3392629)) </details> --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
🤖 I have created a release *beep* *boop* --- <details><summary>aztec-package: 0.65.2</summary> ## [0.65.2](AztecProtocol/aztec-packages@aztec-package-v0.65.1...aztec-package-v0.65.2) (2024-11-28) ### Features * New proving broker ([#10174](AztecProtocol/aztec-packages#10174)) ([6fd5fc1](AztecProtocol/aztec-packages@6fd5fc1)) </details> <details><summary>barretenberg.js: 0.65.2</summary> ## [0.65.2](AztecProtocol/aztec-packages@barretenberg.js-v0.65.1...barretenberg.js-v0.65.2) (2024-11-28) ### Miscellaneous * **barretenberg.js:** Synchronize aztec-packages versions </details> <details><summary>aztec-packages: 0.65.2</summary> ## [0.65.2](AztecProtocol/aztec-packages@aztec-packages-v0.65.1...aztec-packages-v0.65.2) (2024-11-28) ### Features * Fee foresight support ([#10262](AztecProtocol/aztec-packages#10262)) ([9e19244](AztecProtocol/aztec-packages@9e19244)) * New proving broker ([#10174](AztecProtocol/aztec-packages#10174)) ([6fd5fc1](AztecProtocol/aztec-packages@6fd5fc1)) * Sequential insertion in indexed trees ([#10111](AztecProtocol/aztec-packages#10111)) ([bfd9fa6](AztecProtocol/aztec-packages@bfd9fa6)) * Swap polys to facilitate dynamic trace overflow ([#9976](AztecProtocol/aztec-packages#9976)) ([b7b282c](AztecProtocol/aztec-packages@b7b282c)) ### Bug Fixes * Don't store indices of zero leaves. ([#10270](AztecProtocol/aztec-packages#10270)) ([c22be8b](AztecProtocol/aztec-packages@c22be8b)) * Expect proper duplicate nullifier error patterns in e2e tests ([#10256](AztecProtocol/aztec-packages#10256)) ([4ee8344](AztecProtocol/aztec-packages@4ee8344)) ### Miscellaneous * Check artifact consistency ([#10271](AztecProtocol/aztec-packages#10271)) ([6a49405](AztecProtocol/aztec-packages@6a49405)) * Dont import things that themselves import jest in imported functions ([#10260](AztecProtocol/aztec-packages#10260)) ([9440c1c](AztecProtocol/aztec-packages@9440c1c)) * Fix bad merge in integration l1 publisher ([#10272](AztecProtocol/aztec-packages#10272)) ([b5a6aa4](AztecProtocol/aztec-packages@b5a6aa4)) * Fixing sol warnings ([#10276](AztecProtocol/aztec-packages#10276)) ([3d113b2](AztecProtocol/aztec-packages@3d113b2)) * Pull out sync changes ([#10274](AztecProtocol/aztec-packages#10274)) ([391a6b7](AztecProtocol/aztec-packages@391a6b7)) * Pull value merger code from sync ([#10080](AztecProtocol/aztec-packages#10080)) ([3392629](AztecProtocol/aztec-packages@3392629)) * Remove default gas settings ([#10163](AztecProtocol/aztec-packages#10163)) ([c9a4d88](AztecProtocol/aztec-packages@c9a4d88)) * Replace relative paths to noir-protocol-circuits ([654d801](AztecProtocol/aztec-packages@654d801)) * Teardown context in prover coordination test ([#10257](AztecProtocol/aztec-packages#10257)) ([7ea3888](AztecProtocol/aztec-packages@7ea3888)) </details> <details><summary>barretenberg: 0.65.2</summary> ## [0.65.2](AztecProtocol/aztec-packages@barretenberg-v0.65.1...barretenberg-v0.65.2) (2024-11-28) ### Features * Sequential insertion in indexed trees ([#10111](AztecProtocol/aztec-packages#10111)) ([bfd9fa6](AztecProtocol/aztec-packages@bfd9fa6)) * Swap polys to facilitate dynamic trace overflow ([#9976](AztecProtocol/aztec-packages#9976)) ([b7b282c](AztecProtocol/aztec-packages@b7b282c)) ### Bug Fixes * Don't store indices of zero leaves. ([#10270](AztecProtocol/aztec-packages#10270)) ([c22be8b](AztecProtocol/aztec-packages@c22be8b)) ### Miscellaneous * Pull value merger code from sync ([#10080](AztecProtocol/aztec-packages#10080)) ([3392629](AztecProtocol/aztec-packages@3392629)) </details> --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
Update PG/ClientIvc so that during accumulation we can handle a circuit that overflows the nominal structured trace (and potentially increases the dyadic size of the accumulator) without knowing about the size of the overflow in advance. (A previous PR makes it possible to overflow arbitrarily as long as ClientIvc is initialized with the proper overflow capacity). Ensure the ExecutionTraceTracker is updated correctly when encountering a circuit that overflows and also ensure that the tracker is used appropriately in Protogalaxy.