-
Notifications
You must be signed in to change notification settings - Fork 327
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
fix(avm): relax constraints for leaf_index kernel opcodes #8288
fix(avm): relax constraints for leaf_index kernel opcodes #8288
Conversation
274c735
to
c1d1f44
Compare
c1d1f44
to
3f702ba
Compare
Benchmark resultsMetrics with a significant change:
Detailed resultsAll benchmarks are run on txs on the This benchmark source data is available in JSON format on S3 here. Proof generationEach column represents the number of threads used in proof generation.
L2 block published to L1Each column represents the number of txs on an L2 block published to L1.
L2 chain processingEach column represents the number of blocks on the L2 chain where each block has 8 txs.
Circuits statsStats on running time and I/O sizes collected for every kernel circuit run across all benchmarks.
Stats on running time collected for app circuits
AVM SimulationTime to simulate various public functions in the AVM.
Public DB AccessTime to access various public DBs.
Tree insertion statsThe duration to insert a fixed batch of leaves into each tree type.
MiscellaneousTransaction sizes based on how many contract classes are registered in the tx.
Transaction size based on fee payment method | Metric | | |
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.
LGTM!
3f702ba
to
8c6b6af
Compare
#[KERNEL_OUTPUT_LOOKUP] | ||
sel_q_kernel_output_lookup {kernel_out_offset, ia, side_effect_counter, ib} in sel_kernel_out {clk, kernel_value_out, kernel_side_effect_out, kernel_metadata_out}; | ||
sel_q_kernel_output_lookup {kernel_out_offset, /*ia,*/ /*side_effect_counter,*/ ib } in sel_kernel_out {clk, /*kernel_value_out,*/ /*kernel_side_effect_out,*/ kernel_metadata_out}; |
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.
Had to turn off the kernel_value_out and side_effect parts of the lookup
} | ||
|
||
// Leaf index -> exists | ||
std::unordered_map<uint32_t, FF> get_leaf_index_hints() const |
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.
Splitting out leaf index hints since they now use the leaf index instead of side effect counters which would likely collide in a single map
@@ -173,7 +173,16 @@ void AvmKernelTraceBuilder::op_note_hash_exists(uint32_t clk, | |||
{ | |||
|
|||
uint32_t offset = START_NOTE_HASH_EXISTS_WRITE_OFFSET + note_hash_exists_offset; | |||
perform_kernel_output_lookup(offset, side_effect_counter, note_hash, FF(result)); | |||
// TODO(#8287)Lookups are heavily underconstrained atm | |||
if (result == 1) { |
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.
This whole section is a bit messy atm while the lookups are still "half-on". Will be resolved when we clean up the hints/public inputs stuff and if we give the trace.cpp
access to the public inputs as well
@@ -467,9 +468,10 @@ describe('AVM simulator: transpiled Noir contracts', () => { | |||
expect(results.output).toEqual([expectFound ? Fr.ONE : Fr.ZERO]); | |||
|
|||
expect(trace.traceL1ToL2MessageCheck).toHaveBeenCalledTimes(1); | |||
const foundOrUndefined = mockAtLeafIndex === undefined || results.output[0].equals(Fr.ONE); |
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.
This is similar to what we do now for the accrued_substate.test.ts
, because of the new way we handle non-exists criteria for leaf indices
8c6b6af
to
4f54b7f
Compare
const exists = gotLeafIndex === leafIndex.toBigInt(); | ||
this.log.debug(`noteHashes(${storageAddress})@${noteHash} ?? leafIndex: ${leafIndex}, exists: ${exists}.`); | ||
this.trace.traceNoteHashCheck(storageAddress, noteHash, leafIndex, exists); | ||
const gotLeafValue = await this.hostStorage.commitmentsDb.getCommitmentValue(leafIndex.toBigInt()); |
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.
We now get the value given the index rather than the other way around, if the values do not match, we return the value that we found (this way the kernel can verify the merkle path).
We constrain equality in the VM (eventually)
62bd9dc
into
lw/public_validation_requests
)" This reverts commit 62bd9dc.
Re-constraining this is being tracked in #8287