-
Notifications
You must be signed in to change notification settings - Fork 235
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
refactor: Trace structure is an object #10003
Conversation
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.
Nice looks good. Just one alias that looked like it shouldn't be building..
fixed_sizes.set_fixed_block_sizes(trace_settings); | ||
|
||
if (trace_settings.structure) { | ||
info("yes trace structure"); |
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.
stray info
uint32_t overflow_capacity = 0; | ||
}; | ||
|
||
class MegaTraceBlock : public ExecutionTraceBlock<fr, 4, 14> { |
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.
Maybe at least inline comments indicating what these numbers are?
.overflow = 0 }; | ||
|
||
/** | ||
* @brief A minimal structuring specifically tailored to the medium complexity transaction for the Cli: MentIVC |
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.
weird comment thing happening here
@@ -374,7 +374,7 @@ Accumulator ECCVMSetRelationImpl<FF>::compute_grand_product_denominator(const Al | |||
} | |||
|
|||
/** | |||
* @brief Expression for the StandardArithmetic gate. | |||
* @brief Expression for the StandardExecutionTracemetic gate. |
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.
tracemetic, nice
@@ -123,8 +123,8 @@ template <typename RecursiveFlavor> class RecursiveVerifierTest : public testing | |||
static void test_independent_vk_hash() | |||
{ | |||
// Retrieves the trace blocks (each consisting of a specific gate) from the recursive verifier circuit | |||
auto get_blocks = [](size_t inner_size) | |||
-> std::tuple<typename OuterBuilder::GateBlocks, std::shared_ptr<typename OuterFlavor::VerificationKey>> { | |||
auto get_blocks = [](size_t inner_size) -> std::tuple<typename OuterBuilder::ExeeuctionTrace, |
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.
hmm how is this building? ExeeuctionTrace
A trace structure is a set of block sizes that are known at compile time, but previously there was no simple way to extract any of this compile time information even at runtime without executing some heavier code or perhaps by duplicating a switch statement and manually computing a size a runtime. Motivated by this, I refactor the trace structure (formerly an enum coupled loosely to some related structures) so that it becomes a struct. At the same time I refactor related structures to use more familiar patterns. I also do some renaming and related general tidying.
size
functions will be implemented in a follow-on, where they will help to allocate and use a single commitment key throughoutClientIVC
.Changes in structuring pattern
Old pattern:
-
TraceBlocks
subclassesMegaTraceBlocks<ExecutionTraceBlock>
- Each trace structure is a subclass with a different default constructor
-
set_fixed_block_sizes
instantiates afixed_block_sizes
objectMegaTraceBlocks<uint32_t>
-
set_fixed_block_sizes
checks an enum to figure out which trace structure class to default construct-
set_fixed_block_sizes
overwrites thefixed_block_sizes
objectNew Pattern:
-
TraceStructure
isMegaTraceBlockData<uint32_t>
- Each trace structure is a
static constexpr
instance ofTraceStructure
.-
set_fixed_block_sizes
on aMegaExecutionTraceBlocks
object takes a trace structure instance and uses it to set thefixed_size
of the blocks.Notions of "execution trace" and "arithmetization"
ExecutionTrace_
used to be the name for a purely static class that assists in proving key construction. We would have unclear lines of code that looked likeExecutionTrace_::populate(builder, proving_key)
where it's not clear that is happening--which thing is being populated? The builder is notconst
, but could it be? Trying to constify took me down a rabbit hole that felt out of scope, so I still don't know. I renamed this class to TraceToPolynomials for clarity and because I wanted to use the name ExecutionTrace for the container of the blocks (In the end I went withExecutionTraceBlocks
) and metadata that used to be theArithemetization
.Arithmetization
(something I think I initially defined) is renamed toExecutionTrace
, broadly speaking. I removed some of the nested class definitions fromMegaArith
&UltraArith
because I think it helps readability, and I flattened the nestedTraceBlocks
class into its container class which is now calledFooTraceBlocks
--I didn't see what the nesting gave us there.Etc
To handle the
NONE
structure case, I use astd::optional
.ClientIVC
gets a constructor from aTraceSettings
and a booleanauto_verify_mode
. Just a bit of cleanup--there were dozens of instances where this constructor was called for.I remove some unused templating.
I don't see the value of having a fully public setter for a private value so I nixed
set_fixed_size
. This clarified the rather puzzling (to me) lineoverflow_block.set_fixed_size(static_cast<uint32_t>(overflow_block.size()));