Skip to content

fix(avm)!: Pre audit public data check / squash#21266

Merged
sirasistant merged 5 commits intomerge-train/avmfrom
arv/public_data_tree_pre_audit
Mar 13, 2026
Merged

fix(avm)!: Pre audit public data check / squash#21266
sirasistant merged 5 commits intomerge-train/avmfrom
arv/public_data_tree_pre_audit

Conversation

@sirasistant
Copy link
Copy Markdown
Contributor

No relevant findings, just hardening, reordering and documentation.

@sirasistant sirasistant changed the base branch from next to merge-train/avm March 9, 2026 17:21
@sirasistant sirasistant added the ci-full Run all master checks. label Mar 9, 2026
* - 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).
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"... irreproducible hash ..": What do we mean by this?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That we can't provide a preimage to

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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]
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Standard naming is #[TRACE_CONTINUITY]


pol commit end; // @boolean (by definition)
#[END_CONDITION]
end = sel * (1 - sel');
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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]
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use standard naming as mentioned earlier.

namespace bb::avm2::simulation {

struct PublicDataWriteData {
PublicDataTreeLeafPreimage updated_low_leaf_preimage;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Each member of type FF should be initialized to 0.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here FF member should be explicitly initialized to zero.

Copy link
Copy Markdown
Contributor

@jeanmon jeanmon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good work! I have only minor comments.

@sirasistant sirasistant enabled auto-merge (squash) March 13, 2026 15:38
@sirasistant sirasistant merged commit 17b49f7 into merge-train/avm Mar 13, 2026
11 checks passed
@sirasistant sirasistant deleted the arv/public_data_tree_pre_audit branch March 13, 2026 16:21
@AztecBot AztecBot mentioned this pull request Mar 13, 2026
github-merge-queue Bot pushed a commit that referenced this pull request Mar 13, 2026
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci-full Run all master checks.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants