Conversation
ed255
commented
Feb 4, 2026
| // Group statement indices by their content. | ||
| let mut content_to_indices: HashMap<&Statement, Vec<usize>> = HashMap::new(); | ||
| let mut statement_dedup_index: HashMap<&Statement, usize> = HashMap::new(); | ||
| let mut statement_content_groups = Vec::new(); |
Collaborator
Author
There was a problem hiding this comment.
This change is to generate a deterministic statement_content_groups.
robknight
reviewed
Feb 5, 2026
|
|
||
| impl Eq for Value {} | ||
|
|
||
| impl Ord for Value { |
Collaborator
There was a problem hiding this comment.
This used to exist and was intentionally removed: #393
Collaborator
Author
There was a problem hiding this comment.
Thanks for pointing that out!
So one issue is that given x and y Values, if they are i64 the result of x < y and x <= y doesn't match the predicate Lt and LtEq because the encoding of i64 into RawValue uses two's complement which means negative numbers have the most significant bit set and would be treated as big non-negative numbers by Ord.
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.
Previously we were using HashMap and HashSet for the Dictionary and Set containers. This was very efficient but it was slightly inconvenient because sometimes we iterate over the entries of those collections to generate statements for recursive predicates, leading to non-deterministic order of statements which makes debugging issues harder.
By using BTreeMap and BTreeSet we always get deterministic iteration over the container entries, at a small cost of performance (which should be negligible because we target consumer devices and the bottleneck is in the proving process).
As an added bonus, now when we iterate over the Dictionary and Set we visit the entries in the same order as they are laid out in the Merkle Tree.
I've also done a small change in
MultiPodBuilderto make an internal structure deterministic.I've requested review of 2 people to get critical feedback on this change.