diff --git a/prover/protocol/column/store.go b/prover/protocol/column/store.go index 7e669f86f..5717c5033 100644 --- a/prover/protocol/column/store.go +++ b/prover/protocol/column/store.go @@ -4,6 +4,7 @@ import ( "github.com/consensys/linea-monorepo/prover/protocol/ifaces" "github.com/consensys/linea-monorepo/prover/utils" "github.com/consensys/linea-monorepo/prover/utils/collection" + "github.com/sirupsen/logrus" ) // Store registers [Natural] for structs that can return the infos given a name @@ -63,7 +64,9 @@ func (s *Store) AddToRound(round int, name ifaces.ColID, size int, status Status } if !utils.IsPowerOfTwo(size) { - utils.Panic("can't register %v because it has a non-power of two size (%v)", name, size) + adjustedSize := utils.NextPowerOfTwo(size) + logrus.Infof("Can't register %v because it has a non-power of two size (%v). Adjusted size to next power of two: %v", name, size, adjustedSize) + size = adjustedSize } // Compute the location of the commitment in the store diff --git a/prover/protocol/wizard/compiled.go b/prover/protocol/wizard/compiled.go index eab3ecc2b..843617287 100644 --- a/prover/protocol/wizard/compiled.go +++ b/prover/protocol/wizard/compiled.go @@ -166,7 +166,10 @@ func (c *CompiledIOP) InsertCommit(round int, name ifaces.ColID, size int) iface // - if the size of the column is not a power of 2 // - if a column using the same name has already been registered func (c *CompiledIOP) InsertColumn(round int, name ifaces.ColID, size int, status column.Status) ifaces.Column { - + // Panic if the size is not a power of 2 + if !utils.IsPowerOfTwo(size) { + utils.Panic("Registering column %v with a non power of two size = %v", name, size) + } // @alex: this has actually caught a few typos. When wrongly setting an // incorrect but very large size here, it will generate a disproportionate // wizard diff --git a/prover/zkevm/arithmetization/definition.go b/prover/zkevm/arithmetization/definition.go index d1c473181..55fc55c76 100644 --- a/prover/zkevm/arithmetization/definition.go +++ b/prover/zkevm/arithmetization/definition.go @@ -69,17 +69,14 @@ func (s *schemaScanner) scanColumns() { module = s.Modules[ctx.Module()] moduleLimit = s.LimitMap[module.Name] mult = ctx.LengthMultiplier() - size = int(mult) * moduleLimit ) - // adjust the size , this adjusts the size for interleaved columns and their permuted version. - // Since these are the only columns from corset with non-power of two. - if !utils.IsPowerOfTwo(size) { - size = utils.NextPowerOfTwo(int(mult) * moduleLimit) - } + /*if _, isIL := s.InterleavedColumns[name]; isIL { + continue + }*/ // #nosec G115 -- this bound will not overflow - s.Comp.InsertCommit(0, ifaces.ColID(name), size) + s.Comp.InsertCommit(0, ifaces.ColID(name), int(mult)*moduleLimit) } } diff --git a/prover/zkevm/prover/statemanager/codehashconsistency/consistency.go b/prover/zkevm/prover/statemanager/codehashconsistency/consistency.go index bc1fe0f90..8307e14ff 100644 --- a/prover/zkevm/prover/statemanager/codehashconsistency/consistency.go +++ b/prover/zkevm/prover/statemanager/codehashconsistency/consistency.go @@ -9,6 +9,7 @@ import ( "github.com/consensys/linea-monorepo/prover/protocol/ifaces" "github.com/consensys/linea-monorepo/prover/protocol/wizard" sym "github.com/consensys/linea-monorepo/prover/symbolic" + "github.com/consensys/linea-monorepo/prover/utils" "github.com/consensys/linea-monorepo/prover/zkevm/prover/common" commonconstraints "github.com/consensys/linea-monorepo/prover/zkevm/prover/common/common_constraints" "github.com/consensys/linea-monorepo/prover/zkevm/prover/statemanager/mimccodehash" @@ -57,7 +58,7 @@ type Module struct { func NewModule(comp *wizard.CompiledIOP, name string, ss *statesummary.Module, mch *mimccodehash.Module) Module { name = name + "_CODEHASH_CONSISTENCY" - size := ss.IsActive.Size() + mch.IsActive.Size() + size := utils.NextPowerOfTwo[int](ss.IsActive.Size() + mch.IsActive.Size()) ch := Module{ StateSummaryInput: ss, diff --git a/prover/zkevm/prover/statemanager/codehashconsistency/consistency_test.go b/prover/zkevm/prover/statemanager/codehashconsistency/consistency_test.go index 79039067f..8207fbcf4 100644 --- a/prover/zkevm/prover/statemanager/codehashconsistency/consistency_test.go +++ b/prover/zkevm/prover/statemanager/codehashconsistency/consistency_test.go @@ -25,7 +25,7 @@ func TestConsistency(t *testing.T) { mimcCodeHash *mimccodehash.Module consistency Module sizeStateSummary = 128 - sizeMimcCodeHash = 128 + sizeMimcCodeHash = 256 ) define := func(b *wizard.Builder) {