Skip to content
Draft
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
23b7ad7
fix(common_constraints): merkle tests are passing
arijitdutta67 Nov 11, 2025
0cce6dd
fix(accumulator): compilation errors fixes (wip)
arijitdutta67 Nov 11, 2025
40587f4
fix(accumulator): fix constant
arijitdutta67 Nov 13, 2025
f44ffe6
feat(flat-proof): bit decompose with slices of pos columns (wip)
arijitdutta67 Nov 14, 2025
d60b149
fix(flat-proof): bug fix, test passing
arijitdutta67 Nov 14, 2025
f2ec528
minor: remove and reinstate print statements
arijitdutta67 Nov 18, 2025
d9ebfff
Merge branch 'prover/dev-small-fields' into prover/fix-state-manager
arijitdutta67 Nov 18, 2025
9081c28
fix(accumulator): fix define column dimension
arijitdutta67 Nov 18, 2025
9c39010
fix(accumulator/assign): remove mimc with posseidon2
arijitdutta67 Nov 19, 2025
e3ef6d0
fix: mimc_config to poseidon2 config
arijitdutta67 Nov 20, 2025
2f8b1dd
fix(accumulator-assign): fixed all compilation error
arijitdutta67 Nov 21, 2025
500469f
fix(accumulator-define): fix all define compiler error to run assign …
arijitdutta67 Nov 21, 2025
7ca4666
fix(accumulator-define): fix the qname compiler error
arijitdutta67 Nov 21, 2025
43fdaa5
fix: fix the poseidon encoding for u64 and fieldhash
arijitdutta67 Nov 24, 2025
b29f89c
fix: change pos from 4 to 16 limbs as it involves hashing
arijitdutta67 Nov 24, 2025
2261b08
fix: debug wip
arijitdutta67 Nov 24, 2025
663ecea
fix: debug empty leaf
arijitdutta67 Nov 24, 2025
df5e650
fix: leaf length fixed, test passing
arijitdutta67 Nov 24, 2025
9ee0769
fix: deletion test fixed, all assign tests are passing now
arijitdutta67 Nov 24, 2025
a81b344
fix(accumulator): changing mimc to poseidon query (wip)
arijitdutta67 Nov 25, 2025
4e8504e
fix(define accumulator): added poseidon2 queries for leaf hashes
arijitdutta67 Nov 26, 2025
aebbbc8
fix(accumulator): poseidon2 query for top root is added
arijitdutta67 Nov 26, 2025
ac37e7f
fix(mock): change mimc to poseidon2
arijitdutta67 Nov 27, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,17 @@ func MustZeroWhenInactive(comp *wizard.CompiledIOP, isActive any, cs ...ifaces.C

if ccol, isc := isActive.(verifiercol.ConstCol); isc {

if ccol.F.IsOne() {
if ccol.Base.IsOne() {
// The constraint is meaningless in that situation
return
}

if !ccol.F.IsZero() {
utils.Panic("activator column is not boolean: is const-col with value=%v", ccol.F.String())
if !ccol.Base.IsZero() {
utils.Panic("activator column is not boolean: is const-col with value=%v", ccol.Base.String())
}

// expectedly, the only possibility
isActive = sym.NewConstant(ccol.F)
isActive = sym.NewConstant(ccol.Base)
}

for _, c := range cs {
Expand Down
4 changes: 4 additions & 0 deletions prover/zkevm/prover/common/flatten_column.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ const (
NbLimbU128 = 8
// NbLimbU256 represents the number of 16-bit limbs for a 256-bit integer.
NbLimbU256 = 16
// NbElemPerHash represents the number of field elements per Posseidon hash.
NbElemPerHash = 8
// NbElemU64 represents the number of field elements per 64-bit integers.
NbElemU64 = 16
)

// FlattenColumn flattens multiple limb columns and an accompanying mask into single columns,
Expand Down
62 changes: 29 additions & 33 deletions prover/zkevm/prover/statemanager/accumulator/assign.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@ import (

"github.com/consensys/linea-monorepo/prover/zkevm/prover/common"

"io"

"github.com/consensys/linea-monorepo/prover/zkevm/prover/common"

"github.com/consensys/linea-monorepo/prover/backend/execution/statemanager"
"github.com/consensys/linea-monorepo/prover/crypto/state-management/accumulator"
"github.com/consensys/linea-monorepo/prover/crypto/state-management/smt"
Expand All @@ -24,10 +20,10 @@ import (

// leafOpenings represents the structure for leaf openings
type leafOpenings struct {
prev [common.NbLimbU64][]field.Element
next [common.NbLimbU64][]field.Element
hKey [common.NbLimbU256][]field.Element
hVal [common.NbLimbU256][]field.Element
prev [common.NbElemU64][]field.Element
next [common.NbElemU64][]field.Element
hKey [common.NbElemPerHash][]field.Element
hVal [common.NbElemPerHash][]field.Element
}

// assignmentBuilder is used to build the assignment of the [Module] module
Expand All @@ -41,12 +37,12 @@ type assignmentBuilder struct {
// leaves stores the assignment of the column holding the leaves (so the
// hash of the leaf openings) for which we give the merkle proof. This corresponds to the
// [Accumulator.Cols.Leaves] column.
leaves [common.NbLimbU256][]field.Element
leaves [common.NbElemPerHash][]field.Element
// positions stores the positions of the leaves in the merkle tree for which we give the Merkle proof. This corresponds to the [Accumulator.Cols.Positions] column.
positions [common.NbLimbU64][]field.Element
positions [common.NbElemU64][]field.Element
// roots stores the roots of the merkle tree. This corresponds
// to the [Accumulator.Cols.Roots] column.
roots [common.NbLimbU256][]field.Element
roots [common.NbElemPerHash][]field.Element
// proofs stores the path and siblings of the merkle proof. Those siblings corresponds
// to the [Accumulator.Cols.Proofs] column.
proofs []smt.Proof
Expand All @@ -57,7 +53,7 @@ type assignmentBuilder struct {
isActive []field.Element
// accumulatorCounter counts the number of rows in the accumulator. It is used to check the
// sequentiality of leaves and roots in accumulator and the merkle module
accumulatorCounter [common.NbLimbU64][]field.Element
accumulatorCounter [common.NbElemU64][]field.Element
// isFirst is one at the first row of any operation. This corresponds to the [Accumulator.IsFirst] column
isFirst []field.Element
// isInsert is one when we have an INSERT operation. It is
Expand All @@ -76,54 +72,54 @@ type assignmentBuilder struct {
// zero otherwise. This corresponds to the [Accumulator.Cols.IsReadNonZero] column
isReadNonZero []field.Element
// hKey is the hash of the key of the trace. This corresponds to the [Accumulator.Column.HKey]
hKey [common.NbLimbU256][]field.Element
hKey [common.NbElemPerHash][]field.Element
// hKeyMinus is the hash of the key of the previous leaf. This corresponds to the [Accumulator.Column.HKeyMinus]
hKeyMinus [common.NbLimbU256][]field.Element
hKeyMinus [common.NbElemPerHash][]field.Element
// hKeyPlus is the hash of the key of the next leaf. This corresponds to the [Accumulator.Column.HKeyPlus]
hKeyPlus [common.NbLimbU256][]field.Element
hKeyPlus [common.NbElemPerHash][]field.Element
// Pointer check columns
// leafMinusIndex is the index of the minus leaf for INSERT, READZERO, and DELETE. This corresponds to the [Accumulator.Column.LeafMinusIndex]
leafMinusIndex [common.NbLimbU64][]field.Element
leafMinusIndex [common.NbElemU64][]field.Element
// leafMinusNext is the index of the Next leaf of the minus leaf for INSERT, READZERO, and DELETE. This corresponds to the [Accumulator.Column.LeafMinusNext]
leafMinusNext [common.NbLimbU64][]field.Element
leafMinusNext [common.NbElemU64][]field.Element
// leafMinusNext is the index of the plus leaf for INSERT, READZERO, and DELETE. This corresponds to the [Accumulator.Column.LeafPlusIndex]
leafPlusIndex [common.NbLimbU64][]field.Element
leafPlusIndex [common.NbElemU64][]field.Element
// leafPlusPrev is the index of the Previous leaf of the plus leaf for INSERT, READZERO, and DELETE. This corresponds to the [Accumulator.Column.LeafPlusPrev]
leafPlusPrev [common.NbLimbU64][]field.Element
leafPlusPrev [common.NbElemU64][]field.Element
// leafDeletedIndex is the index of the Deleted leaf for DELETE. This corresponds to the [Accumulator.Column.LeafDeletedIndex]
leafDeletedIndex [common.NbLimbU64][]field.Element
leafDeletedIndex [common.NbElemU64][]field.Element
// leafDeletedPrev is the index of the Previous leaf of the Deleted leaf for DELETE. This corresponds to the [Accumulator.Column.LeafDeletedPrev]
leafDeletedPrev [common.NbLimbU64][]field.Element
leafDeletedPrev [common.NbElemU64][]field.Element
// leafDeletedNext is the index of the Previous leaf of the Deleted leaf for DELETE. This corresponds to the [Accumulator.Column.LeafDeletedNext]
leafDeletedNext [common.NbLimbU64][]field.Element
leafDeletedNext [common.NbElemU64][]field.Element
// leafOpening is a tuple of four columns containing
// Prev, Next, HKey, HVal of a leaf. This corresponds to the [Accumulator.Column.LeafOpening]
leafOpening leafOpenings
// interm is a slice containing 3 intermediate hash states. This corresponds to the [Accumulator.Column.Interm]
interm [common.NbLimbU256][][]field.Element
interm [common.NbElemPerHash][][]field.Element
// leafHash contains sequential MiMC hashes of leafOpening. It matches with Leaves except when there is empty leaf. This corresponds to the [Accumulator.Column.LeafHashes]
leafHashes [common.NbLimbU256][]field.Element
leafHashes [common.NbElemPerHash][]field.Element
// isEmptyLeaf is one when Leaves contains empty leaf and does not match with LeafHash
isEmptyLeaf []field.Element
// nextFreeNode contains the nextFreeNode for each row of every operation
nextFreeNode [common.NbLimbU64][]field.Element
nextFreeNode [common.NbElemU64][]field.Element
// insertionPath is the path of a newly inserted leaf when INSERT happens,
// it is zero otherwise
insertionPath [common.NbLimbU64][]field.Element
insertionPath [common.NbElemU64][]field.Element
// isInsertRow3 is one for row 3 of INSERT operation
isInsertRow3 []field.Element
// intermTopRoot contains the intermediate MiMC state hash
intermTopRoot [common.NbLimbU256][]field.Element
intermTopRoot [common.NbElemPerHash][]field.Element
// topRoot contains the MiMC hash of SubTreeRoot and NextFreeNode
topRoot [common.NbLimbU256][]field.Element
topRoot [common.NbElemPerHash][]field.Element
}

// newAssignmentBuilder returns an empty builder
func newAssignmentBuilder(s Settings) *assignmentBuilder {
amb := assignmentBuilder{}
amb.Settings = s

for i := 0; i < common.NbLimbU256; i++ {
for i := 0; i < common.NbElemPerHash; i++ {
amb.roots[i] = make([]field.Element, 0, amb.NumRows())
amb.leaves[i] = make([]field.Element, 0, amb.NumRows())
amb.hKey[i] = make([]field.Element, 0, amb.NumRows())
Expand Down Expand Up @@ -227,11 +223,11 @@ func (am *Module) Assign(
}

// Sanity check on the size
if len(builder.leaves) > am.MaxNumProofs {
if len(builder.leaves[0]) > am.MaxNumProofs {
exit.OnLimitOverflow(
am.MaxNumProofs,
len(builder.leaves),
fmt.Errorf("we have registered %v proofs which is more than the maximum number of proofs %v", len(builder.leaves), am.MaxNumProofs),
len(builder.leaves[0]),
fmt.Errorf("we have registered %v proofs which is more than the maximum number of proofs %v", len(builder.leaves[0]), am.MaxNumProofs),
)
}

Expand All @@ -258,7 +254,7 @@ func (am *Module) Assign(
run.AssignColumn(cols.LeafDeletedNext[i].GetColID(), smartvectors.RightZeroPadded(builder.leafDeletedNext[i], paddedSize))
}

for i := 0; i < common.NbLimbU256; i++ {
for i := 0; i < common.NbElemPerHash; i++ {
run.AssignColumn(cols.Roots[i].GetColID(), smartvectors.RightZeroPadded(builder.roots[i], paddedSize))
run.AssignColumn(cols.Leaves[i].GetColID(), smartvectors.RightZeroPadded(builder.leaves[i], paddedSize))

Expand Down
Loading
Loading