-
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
feat(avm): class id derivation #12263
Conversation
8cfc56a
to
44a43eb
Compare
@@ -156,6 +156,18 @@ const PIL_CONSTANTS = [ | |||
'MAX_PACKED_PUBLIC_BYTECODE_SIZE_IN_FIELDS', | |||
]; | |||
|
|||
const PIL_GENERATORS: string[] = [ |
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.
Generators weren't included in the PIL in the previous PR - followed the same approach as the cpp
gen
for (size_t i = 0; i < num_perm_events; i++) { | ||
std::array<FF, 3> perm_input = { 0, 0, 0 }; |
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 was actually a little bug in poseidon2_hash.pil
😱. We weren't cleaning out the input array between permutation runs.
@@ -67,21 +67,20 @@ namespace poseidon2_hash; | |||
// The permutation output values are represented by b_0, b_1, b_2, b_3 | |||
// This most definitely could be simplified to a lower degree check | |||
// The next perm input is constrained to be the previous perm output + the new values to be hashed if we | |||
// are not at the start or the end of hashing | |||
pol NEXT_INPUT_IS_PREV_OUTPUT_SEL = (1 - LATCH_CONDITION) * (1 - start); |
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 was a bug 😨 . It was too relaxed, it's changed to only be the (1 - LATCH_CONDITION)
@@ -43,4 +43,13 @@ namespace constants; | |||
pol START_EMIT_NULLIFIER_WRITE_OFFSET = 207; | |||
pol START_EMIT_L2_TO_L1_MSG_WRITE_OFFSET = 223; | |||
pol START_EMIT_UNENCRYPTED_LOG_WRITE_OFFSET = 225; | |||
pol GENERATOR_INDEX__NOTE_HASH_NONCE = 2; |
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.
Not used but part of constants gen right now
} | ||
|
||
// TODO: This should probably be refined and moved to bc_retrieval test file once that exists | ||
TEST(ClassIdDerivationConstrainingTest, WithRetrievalInteraction) |
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.
When bc_retrieval is being properly done, we should move the test to there
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!
// H(GENERATOR_INDEX__CONTRACT_LEAF, artifact_hash, private_function_root, public_bytecode_commitment) | ||
pol commit class_id; | ||
|
||
pol commit temp_constant_for_lookup; |
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.
Can you add a todo comment about the constants?
// Since the inputs to poseidon2 have to be chunks of 3, we need two lookups if we want to do this in a single row | ||
#[CLASS_ID_POSEIDON2_0] | ||
sel { temp_constant_for_lookup, artifact_hash, private_function_root, class_id } | ||
in poseidon2_hash.sel { poseidon2_hash.input_0, poseidon2_hash.input_1, poseidon2_hash.input_2, poseidon2_hash.output }; |
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.
Is it possible to use a more fine grained selector like poseidon2_hash.end? Saves us inverses etc! (same below).
a02e2f7
to
dd671ad
Compare
* master: (92 commits) chore: Log prover publisher address on creation (#12267) feat: https for bootnode in devnet (#12161) feat(avm): support shifts in lookups (#12280) feat(docs): Add flamegraph tool to counter contract tutorial (#12202) feat(spartan): 192 node 1 tps - additional validator service (#12238) feat(avm): class id derivation (#12263) docs: Fees doc snippets and code snippets (#12229) refactor: proving cost in fee header (#12048) fix: prometheus scrapes itself in the cluster (#12277) feat: metrics (#12256) chore: cleanup stdlib internal imports (#12274) git subrepo push --branch=master noir-projects/aztec-nr git_subrepo.sh: Fix parent in .gitrepo file. [skip ci] chore: replace relative paths to noir-protocol-circuits git subrepo push --branch=master barretenberg fix: Enforce no import side effects (#12268) refactor!: note interfaces (#12106) yolo undenoise tests feat: new transcript functionality to hash elements without including in proof (#12233) chore: remove gcloud metrics (#12265) ...
Please read contributing guidelines and remove this line.