-
Notifications
You must be signed in to change notification settings - Fork 121
Prover/State Manager Small Field Migration #1715
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
base: prover/dev-small-fields
Are you sure you want to change the base?
Conversation
| panic("TODO: change the MiMC queries and replace them by Poseidon. Also review the [common.NbElemPerHash] loop") | ||
|
|
||
| for i := 0; i < common.NbLimbU256; i++ { | ||
| for i := 0; i < common.NbElemPerHash; i++ { |
Check warning
Code scanning / CodeQL
Unreachable statement Warning
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 2 days ago
To resolve the unreachable statement error, you should remove (or comment out) all code following the panic statement within the checkLeafHashes function, since it cannot execute due to the unconditional panic. Specifically, in prover/zkevm/prover/statemanager/accumulator/define.go, lines 686 through 714 (the entirety of the unreachable loop and subsequent expressions) should be removed, leaving only the panic and its comment to make it clear that this code requires future revision. This avoids misleading future readers and passes static analysis. If the code should remain for future use, it can be preserved as a multi-line comment or TODO but not as executable code.
No additional imports or methods are required for this fix.
| @@ -682,35 +682,6 @@ | ||
| cols := am.Cols | ||
|
|
||
| panic("TODO: change the MiMC queries and replace them by Poseidon. Also review the [common.NbElemPerHash] loop") | ||
|
|
||
| for i := 0; i < common.NbElemPerHash; i++ { | ||
|
|
||
| // TODO: fix MiMC query | ||
| am.comp.InsertMiMC(am.Round, am.qname("MIMC_PREV_%d", i), cols.LeafOpenings.Prev[0], cols.Zero, cols.Interm[i][0], nil) | ||
| am.comp.InsertMiMC(am.Round, am.qname("MIMC_NEXT_%d", i), cols.LeafOpenings.Next[0], cols.Interm[i][0], cols.Interm[i][1], nil) | ||
|
|
||
| // TODO: fix MiMC query | ||
| am.comp.InsertMiMC(am.Round, am.qname("MIMC_HKEY"), cols.LeafOpenings.HKey[0], cols.Interm[1][0], cols.Interm[2][0], nil) | ||
| am.comp.InsertMiMC(am.Round, am.qname("MIMC_HVAL_LEAF_%d", i), cols.LeafOpenings.HVal[0], cols.Interm[2][0], cols.LeafHashes[i], nil) | ||
|
|
||
| // Global: IsActive[i] * (1 - IsEmptyLeaf[i]) * (Leaves[i] - LeafHashes[i]) | ||
| expr1 := symbolic.Sub(cols.Leaves[i], cols.LeafHashes[i]) | ||
| expr2 := symbolic.Sub(symbolic.NewConstant(1), cols.IsEmptyLeaf) | ||
| expr3 := symbolic.Mul(cols.IsActiveAccumulator, expr1, expr2) | ||
| am.comp.InsertGlobal(am.Round, am.qname("LEAF_HASH_EQUALITY_%d", i), expr3) | ||
| } | ||
| // Booleaninty of IsEmptyLeaf: IsActive[i] * (IsEmptyLeaf^2[i] - IsEmptyLeaf[i]) | ||
| expr4 := symbolic.Sub(symbolic.Square(cols.IsEmptyLeaf), cols.IsEmptyLeaf) | ||
| expr4 = symbolic.Mul(expr4, cols.IsActiveAccumulator) | ||
| am.comp.InsertGlobal(am.Round, am.qname("IS_EMPTY_LEAF_BOOLEANITY"), expr4) | ||
|
|
||
| // IsEmptyLeaf is set to true if and only if it is the third row for INSERT, or fourth row for DELETE | ||
| // i.e. IsActiveAccumulator[i] * (IsEmptyLeaf[i] - IsFirst[i-2] * IsInsert[i-2] - IsFirst[i-3] * IsDelete[i-3]) | ||
| expr5 := symbolic.Mul(cols.IsActiveAccumulator, | ||
| symbolic.Sub(cols.IsEmptyLeaf, | ||
| symbolic.Mul(column.Shift(cols.IsFirst, -2), column.Shift(cols.IsInsert, -2)), | ||
| symbolic.Mul(column.Shift(cols.IsFirst, -3), column.Shift(cols.IsDelete, -3)))) | ||
| am.comp.InsertGlobal(am.Round, am.qname("IS_EMPTY_LEAF_ONE_FOR_INSERT_THIRD_ROW_AND_DELETE_FOURTH_ROW"), expr5) | ||
| } | ||
|
|
||
| func (am *Module) checkNextFreeNode() { |
This PR implements issue(s) #
Checklist