fix(avm)!: assert keys are non-zero on contract registration#22462
Merged
Conversation
iAmMichaelConnor
approved these changes
Apr 10, 2026
5e5bade to
d025e44
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes
During address derivation, the AVM assumes that all input public keys are non-infinite points, and hardcodes an
is_infinityflag as zero. In reviewing how address derivation changes now that noir no longer uses a flag, we found that we actually couldn't rely on that assumption (I thought we could due to #7529 and comments around the repo). This PR explicity checks all keys are non-infinity.Edit: Some keys are checked in the private context, but since this isn't in a protocol contract/the rollup circuits, we still require this change for the avm!
Notes
The DoS (for before or after removing the
infflag from noir) seems to be protected against at the archiver level (#21787) but this is an explicit, constrained solution.Before removing the
infflag, the AVM hardcoded it as zero in the hash preimage(s) to the address. Now it does not exist in noir, we simply omit the flag (see diff) to match the new address derivation.However, we still rely on this assumption for the
ivpkin#[IVK_ON_CURVE_CHECK](which would fail in the AVM for an inf point with(0,0)coordinates, but not in noir), and assume it is non-inf in the call toeccforaddress_point = preaddress_public_key + incoming_viewing_key.