Skip to content

Commit

Permalink
debugging the connection of splitter to the compilationsuit
Browse files Browse the repository at this point in the history
  • Loading branch information
Soleimani193 committed Oct 1, 2024
1 parent 70878ca commit 27f6362
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 16 deletions.
6 changes: 4 additions & 2 deletions prover/example/test_cases/framework_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ import (
"github.com/consensys/linea-monorepo/prover/protocol/compiler/lookup"
"github.com/consensys/linea-monorepo/prover/protocol/compiler/permutation"
"github.com/consensys/linea-monorepo/prover/protocol/compiler/specialqueries"
"github.com/consensys/linea-monorepo/prover/protocol/compiler/splitter"
"github.com/consensys/linea-monorepo/prover/protocol/compiler/splitter/splitter"
"github.com/consensys/linea-monorepo/prover/protocol/compiler/splitter/stitcher"
"github.com/consensys/linea-monorepo/prover/protocol/compiler/univariates"
"github.com/consensys/linea-monorepo/prover/protocol/compiler/vortex"
"github.com/consensys/linea-monorepo/prover/protocol/ifaces"
Expand Down Expand Up @@ -69,7 +70,8 @@ var (
innerproduct.Compile,
}
ARITHMETICS = compilationSuite{
splitter.SplitColumns(8),
stitcher.Stitcher(4, 8),
splitter.Splitter(8),
localcs.Compile,
globalcs.Compile,
}
Expand Down
5 changes: 3 additions & 2 deletions prover/example/test_cases/local_opening_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ import (
"github.com/consensys/linea-monorepo/prover/maths/common/smartvectors"
"github.com/consensys/linea-monorepo/prover/maths/field"
"github.com/consensys/linea-monorepo/prover/protocol/column"
"github.com/consensys/linea-monorepo/prover/protocol/compiler/splitter"
"github.com/consensys/linea-monorepo/prover/protocol/compiler/splitter/splitter"
"github.com/consensys/linea-monorepo/prover/protocol/compiler/splitter/stitcher"
"github.com/consensys/linea-monorepo/prover/protocol/wizard"
"github.com/stretchr/testify/require"
)
Expand All @@ -31,7 +32,7 @@ func proverLocalOpening(run *wizard.ProverRuntime) {
}

func TestGnarkCompile(t *testing.T) {
comp := wizard.Compile(defineLocalOpening, splitter.SplitColumns(32))
comp := wizard.Compile(defineLocalOpening, stitcher.Stitcher(8, 32), splitter.Splitter(32))
proof := wizard.Prove(comp, proverLocalOpening)

circ, err := wizard.AllocateWizardCircuit(comp)
Expand Down
19 changes: 10 additions & 9 deletions prover/example/test_cases/range_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,27 @@ import (
"testing"

"github.com/consensys/linea-monorepo/prover/maths/common/smartvectors"
"github.com/consensys/linea-monorepo/prover/protocol/compiler/splitter"
"github.com/consensys/linea-monorepo/prover/protocol/column"
"github.com/consensys/linea-monorepo/prover/protocol/compiler/splitter/splitter"
"github.com/consensys/linea-monorepo/prover/protocol/compiler/splitter/stitcher"
"github.com/consensys/linea-monorepo/prover/protocol/wizard"
)

func defineRange(build *wizard.Builder) {
P1 := build.RegisterCommit(P1, 8) // overshadows P1
// P2 := build.RegisterCommit(P2, 8) // overshadows P2
// P3 := build.RegisterCommit(P3, 8) // overshadows P3
P2 := build.RegisterCommit(P2, 8) // overshadows P2
P3 := build.RegisterCommit(P3, 8) // overshadows P3
build.Range(RANGE1, P1, 16)
// build.Range(RANGE2, P2.Repeat(2), 16)
// build.Range(RANGE3, commitment.Interleave(P1, P3), 32)
// build.Range(RANGE4, P3.Shift(1), 16)
build.Range(RANGE2, column.Shift(P2, 1), 16)
build.Range(RANGE4, column.Shift(P3, -2), 16)
}

func proveRange(run *wizard.ProverRuntime) {
run.AssignColumn(P1, smartvectors.ForTest(14, 15, 1, 0, 3, 4, 6, 12))
// run.AssignCommitment(P2, smartvectors.ForTest(1, 15, 14, 0, 3, 4, 6, 12))
// run.AssignCommitment(P3, smartvectors.ForTest(0, 1, 2, 3, 4, 5, 6, 7))
run.AssignColumn(P2, smartvectors.ForTest(1, 15, 14, 0, 3, 4, 6, 12))
run.AssignColumn(P3, smartvectors.ForTest(0, 1, 2, 3, 4, 5, 6, 7))
}

func TestRange(t *testing.T) {
checkSolved(t, defineRange, proveRange, join(ALL_SPECIALS, compilationSuite{splitter.SplitColumns(8)}, DUMMY), true)
checkSolved(t, defineRange, proveRange, join(ALL_SPECIALS, compilationSuite{stitcher.Stitcher(4, 8), splitter.Splitter(8)}, DUMMY), true)
}
2 changes: 1 addition & 1 deletion prover/protocol/compiler/splitter/splitter/constraints.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"github.com/consensys/linea-monorepo/prover/protocol/coin"
"github.com/consensys/linea-monorepo/prover/protocol/column"
"github.com/consensys/linea-monorepo/prover/protocol/column/verifiercol"
alliance "github.com/consensys/linea-monorepo/prover/protocol/compiler/splitter/splitter"
alliance "github.com/consensys/linea-monorepo/prover/protocol/compiler/splitter"
"github.com/consensys/linea-monorepo/prover/protocol/ifaces"
"github.com/consensys/linea-monorepo/prover/protocol/query"
"github.com/consensys/linea-monorepo/prover/protocol/variables"
Expand Down
2 changes: 1 addition & 1 deletion prover/protocol/compiler/splitter/splitter/splitter.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func Splitter(size int) func(*wizard.CompiledIOP) {

// it assigns the stitching columns and delete the assignment of the sub columns.
comp.SubProvers.AppendToInner(comp.NumRounds()-1, func(run *wizard.ProverRuntime) {
for round := range comp.NumRounds() {
for round := range ctx.Splittings {
for bigCol := range ctx.Splittings[round].ByBigCol {
run.Columns.TryDel(bigCol)
}
Expand Down
2 changes: 1 addition & 1 deletion prover/protocol/compiler/splitter/stitcher/stitcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func Stitcher(minSize, maxSize int) func(comp *wizard.CompiledIOP) {

// it assigns the stitching columns and delete the assignment of the sub columns.
comp.SubProvers.AppendToInner(comp.NumRounds()-1, func(run *wizard.ProverRuntime) {
for round := range comp.NumRounds() {
for round := range ctx.Stitchings {
for subCol := range ctx.Stitchings[round].BySubCol {
run.Columns.TryDel(subCol)
}
Expand Down

0 comments on commit 27f6362

Please sign in to comment.