Skip to content

Commit

Permalink
Update execution_data_collector.go
Browse files Browse the repository at this point in the history
  • Loading branch information
bogdanbear committed Oct 11, 2024
1 parent fe58c27 commit a81d211
Showing 1 changed file with 10 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1030,22 +1030,19 @@ func DefineSelectorConstraints(comp *wizard.CompiledIOP, edc *ExecutionDataColle
// the last value of TotalBytesCounter for which the filter IsActive = 1.
func DefineTotalBytesCounterConstraints(comp *wizard.CompiledIOP, edc *ExecutionDataCollector, name string) {
comp.InsertLocal(0, ifaces.QueryIDf("%s_%v_TOTAL_BYTES_COUNTER_START_LOCAL_CONSTRAINT", name, edc.TotalBytesCounter.GetColID()),
sym.Mul(
edc.IsActive,
sym.Sub(
edc.TotalBytesCounter,
edc.NoBytes, // blockIDs start from 1
),
sym.Sub(
edc.TotalBytesCounter,
edc.NoBytes, // the first value of the total bytes counter must be the number of bytes on the first row.
),
)

comp.InsertGlobal(0, ifaces.QueryIDf("%s_%v_TOTAL_BYTES_COUNTER_GLOBAL_CONSTRAINT", name, edc.TotalBytesCounter.GetColID()),
sym.Mul(
edc.IsActive,
edc.IsActive, // Here, we only consider the active part. On the inactive part, edc.TotalBytesCounter is forced to be zero in DefineZeroizationConstraints.
sym.Sub(
edc.TotalBytesCounter,
edc.NoBytes,
column.Shift(edc.TotalBytesCounter, -1),
column.Shift(edc.TotalBytesCounter, -1), // the TotalBytes counter increases appropriately.
),
),
)
Expand All @@ -1054,6 +1051,7 @@ func DefineTotalBytesCounterConstraints(comp *wizard.CompiledIOP, edc *Execution
comp.Columns.SetStatus(edc.FinalTotalBytesCounter.GetColID(), column.Proof)
// get accessors
accessor := accessors.NewFromPublicColumn(edc.FinalTotalBytesCounter, 0)
// enforce that FinalTotalBytesCounter contains the last value of TotalBytesCounter on the active part.
util.CheckLastELemConsistency(comp, edc.IsActive, edc.TotalBytesCounter, accessor, name)
}

Expand Down Expand Up @@ -1354,10 +1352,10 @@ func AssignExecutionDataCollector(run *wizard.ProverRuntime,
}

} else {
// finished processing all the blocks, move to padding
// we do not set the isActive filter to 1
// No more blocks to assign
// before breaking, set FinalTotalBytesCounter
// finished processing all the blocks, reached the inactive part of the module.
// therefore, we do not set the isActive filter to 1.
// No more blocks to assign.
// before breaking, set FinalTotalBytesCounter to correspond to TotalBytesCounter in the last active row (totalCt-1).
vect.FinalTotalBytesCounter = vect.TotalBytesCounter[totalCt-1]
break
}
Expand Down

0 comments on commit a81d211

Please sign in to comment.