-
Notifications
You must be signed in to change notification settings - Fork 106
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Lookups: Improve assertions and tests regarding empty rows and table duplicates #1263
Conversation
09684d6
to
fa03ec4
Compare
@mimoo Question: https://github.com/o1-labs/proof-systems/blob/develop/kimchi/src/circuits/lookup/tables/mod.rs#L35 (You were in |
798f83f
to
77fbfc1
Compare
c799649
to
f9b2ce7
Compare
442a784
to
670bf26
Compare
670bf26
to
eaf3184
Compare
e7a23cc
to
f004e8b
Compare
f004e8b
to
0e772a2
Compare
@@ -411,6 +433,8 @@ impl<F: PrimeField + SquareRootField> LookupConstraintSystem<F> { | |||
lookup_table8.push(eval); | |||
} | |||
|
|||
// @volhovm: Do we need to enforce that there is at least one table |
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.
We should actually ensure that either we have a table with ID 0 or that there was space for us to insert a 0 value.
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.
"space to insert zero value" is checking that the total number of lookup table rows is one less than d1
domain minus zk rows?
@@ -204,7 +204,7 @@ impl LookupInfo { | |||
&self, | |||
domain: &EvaluationDomains<F>, | |||
gates: &[CircuitGate<F>], | |||
) -> (LookupSelectors<Evaluations<F>>, Vec<LookupTable<F>>) { | |||
) -> (LookupSelectors<Evaluations<F>>, HashSet<LookupTable<F>>) { |
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.
HashSet
ordering is non-deterministic (and we probably shouldn't be hashing a whole lookup table). Revert.
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.
Hashset order being nondeterministic is true, but the problem is deeper then: we build tables right now on the result of this hashset converted to a vector: we return gate_tables.iter().convert()
, where gate_tables
is a hashset. What I did instead is to return it directly without converting to vec, because it might be more convenient to check for duplicates.
The question is: how do you want tables sorted between each other, and is there any difference at all?
/// A table of values that can be used for a lookup, along with the ID for the table. | ||
#[derive(Debug, Clone)] | ||
#[derive(Debug, Clone, PartialEq, Eq, Hash)] |
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.
Don't hash/check equality on a Vec<Vec<F>>
. It could be large!
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.
It is absolutely true and I realise it, but otherwise we can't really check if there are any truly duplicate tables in our setup. In that case we would only be able to check table id collisions. I guess it's fine.
bdd89db
to
fba1add
Compare
fba1add
to
1f59b81
Compare
1f59b81
to
7c4e977
Compare
7c4e977
to
2121c7f
Compare
Opened PR: MinaProtocol/mina#14549. |
Changes have to be done in https://github.com/o1-labs/o1js-bindings/tree/main/kimchi/wasm.
|
Please git merge develop and check again against mina. |
runtime_tables_ids | ||
.iter() | ||
.chain(fixed_lookup_tables_ids.iter()), | ||
"duplicates between runtime and fixed tables", |
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.
We explicitly don't want this. This should never have landed without backing this out.
https://github.com/o1-labs/proof-systems/pull/1263/files#diff-c712332ec88dcf26c81cb945fa135596e8816276fbec24228af3922546cc5443R384
This resolves MinaProtocol/mina#14070 and MinaProtocol/mina#14097.