This repository was archived by the owner on Aug 5, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
ZK-634: Constrain token index #40
Merged
Merged
Conversation
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
a1e8acc
to
3291449
Compare
3291449
to
73893d3
Compare
… into token-constraints
|
… into token-constraints
… into token-constraints
pmikolajczyk41
approved these changes
Jan 23, 2025
pub fn constrain_index<Constraints: From<TokenIndexConstraints> + Ord + IntoEnumIterator>( | ||
&self, | ||
layouter: &mut impl Layouter<Fr>, | ||
advice_pool: &ColumnPool<Advice, SynthesisPhase>, | ||
indicators: &[AssignedCell; NUM_TOKENS], | ||
todo: &mut Todo<Constraints>, | ||
) -> Result<(), Error> { | ||
let values = array::from_fn(|i| indicators[i].value().cloned()); | ||
let index = off_circuit::index_from_indicator_values(&values); | ||
let indicator_values = array::from_fn(|i| indicators[i].value().cloned()); |
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.
nit: probably indicators.map(|v|v.cloned())
would do
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.
almost:) replaced with something as close to what you suggested as I could
Comment on lines
165
to
166
pub type IndexGate = LinearEquationGate<NUM_INDEX_GATE_COLUMNS, IndexGateConfig>; | ||
pub type IndexGateInput = LinearEquationGateInput<AssignedCell, NUM_INDEX_GATE_COLUMNS>; |
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.
stylistic nit: it would be a tad better to have const generics always either first or last
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.
definitely, done
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
No description provided.