fix(avm)!: Pre audit public data check / squash#21266
fix(avm)!: Pre audit public data check / squash#21266sirasistant merged 5 commits intomerge-train/avmfrom
Conversation
| * - clk must not repeat for writes to the same slot (asserted by public_data_squash interaction) | ||
| * - low_leaf_index < 2^PUBLIC_DATA_TREE_HEIGHT (Merkle check requirement). | ||
| * - tree_size_before_write < 2^PUBLIC_DATA_TREE_HEIGHT (Merkle check requirement). | ||
| * - The tree genesis state must have an irreproducible hash for uninitialized leaves (0). |
There was a problem hiding this comment.
"... irreproducible hash ..": What do we mean by this?
There was a problem hiding this comment.
That we can't provide a preimage to
There was a problem hiding this comment.
You mean the tree cannot evolve to a hash of the genesis state because according to the mutation constraints it is impossible to fill the leaves with zero? Please add a little explanation.
|
|
||
| // Next sel=1 implies current sel=1 or first_row=1 | ||
| // With this constraint, we can only have sel=1 for N rows after the first, where N could be zero. | ||
| #[START_CONDITION] |
There was a problem hiding this comment.
Standard naming is #[TRACE_CONTINUITY]
|
|
||
| pol commit end; // @boolean (by definition) | ||
| #[END_CONDITION] | ||
| end = sel * (1 - sel'); |
There was a problem hiding this comment.
We save one degree if we define end like this:
end = sel - not_end
|
|
||
| // Next sel=1 implies current sel=1 or first_row=1 | ||
| // With this constraint, we can only have sel=1 for N rows after the first, where N could be zero. | ||
| #[START_CONDITION] |
There was a problem hiding this comment.
Please use standard naming as mentioned earlier.
| namespace bb::avm2::simulation { | ||
|
|
||
| struct PublicDataWriteData { | ||
| PublicDataTreeLeafPreimage updated_low_leaf_preimage; |
There was a problem hiding this comment.
Each member of type FF should be initialized to 0.
There was a problem hiding this comment.
Same here FF member should be explicitly initialized to zero.
jeanmon
left a comment
There was a problem hiding this comment.
Good work! I have only minor comments.
BEGIN_COMMIT_OVERRIDE chore: contract_instance_retrieval pre-audit avm (#21220) fix(avm)!: bytecode hashing - internal audit (#21152) fix(avm)!: precomputed pre-audit (#21313) fix(avm)!: remove unused dc selector (#21314) fix(avm)!: Pre audit public data check / squash (#21266) chore(avm): Pre audit misc opcodes (#21521) END_COMMIT_OVERRIDE
No relevant findings, just hardening, reordering and documentation.