diff --git a/debug/debug.go b/debug/debug.go index 0714cd6fd3..fd6d2ccd4e 100644 --- a/debug/debug.go +++ b/debug/debug.go @@ -1,35 +1,12 @@ package debug import ( - "errors" "path/filepath" "runtime" "strconv" "strings" ) -type StackLine struct { - Line uint32 - File string -} - -// ParseStack parses a stack as stored in a log entry and return readable data -func ParseStack(stack []uint64, stackPaths map[uint32]string) ([]StackLine, error) { - r := make([]StackLine, len(stack)) - - for i, s := range stack { - pID := uint32(s >> 32) - line := uint32(s) - path, ok := stackPaths[pID] - if !ok { - return nil, errors.New("missing stack path in stackPaths map") - } - r[i] = StackLine{Line: line, File: path} - } - - return r, nil -} - func Stack() string { var sbb strings.Builder WriteStack(&sbb) @@ -41,7 +18,7 @@ func WriteStack(sbb *strings.Builder, forceClean ...bool) { // we stop when func name == Define as it is where the gnark circuit code should start // Ask runtime.Callers for up to 10 pcs - pc := make([]uintptr, 10) + pc := make([]uintptr, 20) n := runtime.Callers(3, pc) if n == 0 { // No pcs available. Stop now. diff --git a/debug/debug_test.go b/debug/debug_test.go deleted file mode 100644 index 55d6226f2e..0000000000 --- a/debug/debug_test.go +++ /dev/null @@ -1,46 +0,0 @@ -package debug - -import ( - "testing" - - "github.com/stretchr/testify/require" -) - -func TestParseStack(t *testing.T) { - assert := require.New(t) - - const ( - f1 = "/usr/local/file1.go" - f2 = "/usr/local/file2.go" - f3 = "/usr/local/lib/file3.go" - ) - - stackPaths := make(map[uint32]string) - stackPaths[0] = f1 - stackPaths[1] = f2 - stackPaths[2] = f3 - - stack := []uint64{ - uint64(0<<32) | 27, - uint64(1<<32) | 42, - uint64(2<<32) | 2, - } - - parsed, err := ParseStack(stack, stackPaths) - assert.NoError(err) - - assert.True(len(parsed) == 3) - assert.Equal(f1, parsed[0].File) - assert.Equal(uint32(27), parsed[0].Line) - - assert.Equal(f2, parsed[1].File) - assert.Equal(uint32(42), parsed[1].Line) - - assert.Equal(f3, parsed[2].File) - assert.Equal(uint32(2), parsed[2].Line) - - stack = append(stack, uint64(8000<<32)|2) - _, err = ParseStack(stack, stackPaths) - assert.Error(err) - -} diff --git a/frontend/api.go b/frontend/api.go index 6272b965b3..c339a8b693 100644 --- a/frontend/api.go +++ b/frontend/api.go @@ -119,14 +119,6 @@ type API interface { // Deprecated: use api.Compiler().NewHint() instead NewHint(f hint.Function, nbOutputs int, inputs ...Variable) ([]Variable, error) - // Tag is a shorcut to api.Compiler().Tag() - // Deprecated: use api.Compiler().Tag() instead - Tag(name string) Tag - - // AddCounter is a shorcut to api.Compiler().AddCounter() - // Deprecated: use api.Compiler().AddCounter() instead - AddCounter(from, to Tag) - // ConstantValue is a shorcut to api.Compiler().ConstantValue() // Deprecated: use api.Compiler().ConstantValue() instead ConstantValue(v Variable) (*big.Int, bool) diff --git a/frontend/builder.go b/frontend/builder.go index 64dceca527..38011b8f7e 100644 --- a/frontend/builder.go +++ b/frontend/builder.go @@ -38,15 +38,6 @@ type Compiler interface { // If nbOutputs is specified, it must be >= 1 and <= f.NbOutputs NewHint(f hint.Function, nbOutputs int, inputs ...Variable) ([]Variable, error) - // Tag creates a tag at a given place in a circuit. The state of the tag may contain informations needed to - // measure constraints, variables and coefficients creations through AddCounter - Tag(name string) Tag - - // AddCounter measures the number of constraints, variables and coefficients created between two tags - // note that the PlonK statistics are contextual since there is a post-compile phase where linear expressions - // are factorized. That is, measuring 2 times the "repeating" piece of circuit may give less constraints the second time - AddCounter(from, to Tag) - // ConstantValue returns the big.Int value of v and true if op is a success. // nil and false if failure. This API returns a boolean to allow for future refactoring // replacing *big.Int with fr.Element diff --git a/frontend/ccs.go b/frontend/ccs.go index a46a86bab3..2fac57ac9d 100644 --- a/frontend/ccs.go +++ b/frontend/ccs.go @@ -20,7 +20,6 @@ import ( "github.com/consensys/gnark-crypto/ecc" "github.com/consensys/gnark/backend" "github.com/consensys/gnark/backend/witness" - "github.com/consensys/gnark/frontend/compiled" "github.com/consensys/gnark/frontend/schema" ) @@ -40,17 +39,8 @@ type CompiledConstraintSystem interface { CurveID() ecc.ID - // GetCounters return the collected constraint counters, if any - GetCounters() []compiled.Counter - GetSchema() *schema.Schema // GetConstraints return a human readable representation of the constraints GetConstraints() [][]string - - // GetDebugInfo return the list of debug info per constraints and the map to restore file path - // from the debug info. When compiled with -tags=debug, each constraint has an associated - // stack encoded as a []uint64. The uint64 pack uint32(fileID) | uint32(lineNumber). - // The file string can be retrieved from associated map. - GetDebugInfo() ([][]uint64, map[uint32]string) } diff --git a/frontend/compiled/cs.go b/frontend/compiled/cs.go index b00d7704e2..ea5616d470 100644 --- a/frontend/compiled/cs.go +++ b/frontend/compiled/cs.go @@ -3,13 +3,11 @@ package compiled import ( "fmt" "math/big" - "runtime" "strings" "github.com/blang/semver/v4" "github.com/consensys/gnark" "github.com/consensys/gnark-crypto/ecc" - "github.com/consensys/gnark/backend" "github.com/consensys/gnark/backend/hint" "github.com/consensys/gnark/debug" "github.com/consensys/gnark/frontend/schema" @@ -41,18 +39,11 @@ type ConstraintSystem struct { // debug info contains stack trace (including line number) of a call to a cs.API that // results in an unsolved constraint DebugInfo []LogEntry - // maps unique id to a path (optimized for reading debug info stacks) - DebugStackPaths map[uint32]string - // maps a path to an id (optimized for storing debug info stacks) - debugPathsIds map[string]uint32 `cbor:"-"` - debugPathId uint32 `cbor:"-"` // maps constraint id to debugInfo id // several constraints may point to the same debug info MDebug map[int]int - Counters []Counter `cbor:"-"` - MHints map[int]*Hint // maps wireID to hint MHintsDependencies map[hint.ID]string // maps hintID to hint string identifier @@ -74,8 +65,6 @@ func NewConstraintSystem(scalarField *big.Int) ConstraintSystem { MDebug: make(map[int]int), MHints: make(map[int]*Hint), MHintsDependencies: make(map[hint.ID]string), - DebugStackPaths: make(map[uint32]string), - debugPathsIds: make(map[string]uint32), q: new(big.Int).Set(scalarField), bitLen: scalarField.BitLen(), } @@ -123,36 +112,12 @@ func (cs *ConstraintSystem) Field() *big.Int { return new(big.Int).Set(cs.q) } -// GetCounters return the collected constraint counters, if any -func (cs *ConstraintSystem) GetCounters() []Counter { return cs.Counters } - func (cs *ConstraintSystem) GetSchema() *schema.Schema { return cs.Schema } -// Counter contains measurements of useful statistics between two Tag -type Counter struct { - From, To string - NbVariables int - NbConstraints int - BackendID backend.ID -} - -func (c Counter) String() string { - return fmt.Sprintf("%s %s - %s: %d variables, %d constraints", c.BackendID, c.From, c.To, c.NbVariables, c.NbConstraints) -} - func (cs *ConstraintSystem) AddDebugInfo(errName string, i ...interface{}) int { var l LogEntry - // add the stack info - // TODO @gbotrel duplicate with Debug.stack below - l.Stack = cs.stack() - - if errName == "" { - cs.DebugInfo = append(cs.DebugInfo, l) - return len(cs.DebugInfo) - 1 - } - const minLogSize = 500 var sbb strings.Builder sbb.Grow(minLogSize) @@ -180,6 +145,8 @@ func (cs *ConstraintSystem) AddDebugInfo(errName string, i ...interface{}) int { } } sbb.WriteByte('\n') + // TODO this stack should not be stored as string, but as a slice of locations + // to avoid overloading with lots of str duplicate the serialized constraint system debug.WriteStack(&sbb) l.Format = sbb.String() @@ -192,61 +159,3 @@ func (cs *ConstraintSystem) AddDebugInfo(errName string, i ...interface{}) int { func (cs *ConstraintSystem) FieldBitLen() int { return cs.bitLen } - -func (cs *ConstraintSystem) GetDebugInfo() ([][]uint64, map[uint32]string) { - r := make([][]uint64, len(cs.DebugInfo)) - for _, l := range cs.DebugInfo { - r = append(r, l.Stack) - } - return r, cs.DebugStackPaths -} - -func (cs *ConstraintSystem) stack() (r []uint64) { - if !debug.Debug { - return - } - // derived from: https://golang.org/pkg/runtime/#example_Frames - // we stop when func name == Define as it is where the gnark circuit code should start - - // Ask runtime.Callers for up to 10 pcs - pc := make([]uintptr, 10) - n := runtime.Callers(3, pc) - if n == 0 { - // No pcs available. Stop now. - // This can happen if the first argument to runtime.Callers is large. - return - } - pc = pc[:n] // pass only valid pcs to runtime.CallersFrames - frames := runtime.CallersFrames(pc) - // Loop to get frames. - // A fixed number of pcs can expand to an indefinite number of Frames. - for { - frame, more := frames.Next() - fe := strings.Split(frame.Function, "/") - function := fe[len(fe)-1] - file := frame.File - - if strings.Contains(frame.File, "gnark/frontend") { - continue - } - - // TODO @gbotrel this stores an absolute path, so will work only locally - id, ok := cs.debugPathsIds[file] - if !ok { - id = cs.debugPathId - cs.debugPathId++ - cs.debugPathsIds[file] = id - cs.DebugStackPaths[id] = file - } - r = append(r, ((uint64(id) << 32) | uint64(frame.Line))) - if !more { - break - } - if strings.HasSuffix(function, "Define") { - break - } - } - - return - -} diff --git a/frontend/compiled/log.go b/frontend/compiled/log.go index 407866ebf4..23370cea9a 100644 --- a/frontend/compiled/log.go +++ b/frontend/compiled/log.go @@ -27,11 +27,6 @@ type LogEntry struct { Caller string Format string ToResolve []Term - - // When compiled with -tags=debug, each constraint has an associated - // stack encoded as a []uint64. The uint64 pack uint32(fileID) | uint32(lineNumber). - // The actual string describing the file is stored in a map in the compiled.ConstraintSystem. - Stack []uint64 } func (l *LogEntry) WriteVariable(le LinearExpression, sbb *strings.Builder) { diff --git a/frontend/counter.go b/frontend/counter.go deleted file mode 100644 index 4285a3dd25..0000000000 --- a/frontend/counter.go +++ /dev/null @@ -1,30 +0,0 @@ -/* -Copyright © 2020 ConsenSys - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package frontend - -// Tag contains informations needed to measure and display statistics of a delimited piece of circuit -type Tag struct { - Name string - VID, CID int -} - -// Counter contains measurements of useful statistics between two Tag -type Counter struct { - From, To Tag - NbVariables int - NbConstraints int -} diff --git a/frontend/cs/r1cs/builder.go b/frontend/cs/r1cs/builder.go index 0b4d2ffeeb..534b816983 100644 --- a/frontend/cs/r1cs/builder.go +++ b/frontend/cs/r1cs/builder.go @@ -20,15 +20,12 @@ import ( "errors" "fmt" "math/big" - "path/filepath" "reflect" - "runtime" "sort" "strconv" "strings" "github.com/consensys/gnark-crypto/ecc" - "github.com/consensys/gnark/backend" "github.com/consensys/gnark/backend/hint" "github.com/consensys/gnark/debug" "github.com/consensys/gnark/frontend" @@ -572,29 +569,6 @@ func (system *r1cs) toVariables(in ...frontend.Variable) ([]compiled.LinearExpre return r, s } -// Tag creates a tag at a given place in a circuit. The state of the tag may contain informations needed to -// measure constraints, variables and coefficients creations through AddCounter -func (system *r1cs) Tag(name string) frontend.Tag { - _, file, line, _ := runtime.Caller(1) - - return frontend.Tag{ - Name: fmt.Sprintf("%s[%s:%d]", name, filepath.Base(file), line), - VID: system.NbInternalVariables, - CID: len(system.Constraints), - } -} - -// AddCounter measures the number of constraints, variables and coefficients created between two tags -func (system *r1cs) AddCounter(from, to frontend.Tag) { - system.Counters = append(system.Counters, compiled.Counter{ - From: from.Name, - To: to.Name, - NbVariables: to.VID - from.VID, - NbConstraints: to.CID - from.CID, - BackendID: backend.GROTH16, - }) -} - // NewHint initializes internal variables whose value will be evaluated using // the provided hint function at run time from the inputs. Inputs must be either // variables or convertible to *big.Int. The function returns an error if the diff --git a/frontend/cs/scs/builder.go b/frontend/cs/scs/builder.go index 08d15886ec..0392cf6ce8 100644 --- a/frontend/cs/scs/builder.go +++ b/frontend/cs/scs/builder.go @@ -20,15 +20,12 @@ import ( "errors" "fmt" "math/big" - "path/filepath" "reflect" - "runtime" "sort" "strconv" "strings" "github.com/consensys/gnark-crypto/ecc" - "github.com/consensys/gnark/backend" "github.com/consensys/gnark/backend/hint" "github.com/consensys/gnark/debug" "github.com/consensys/gnark/frontend" @@ -476,31 +473,6 @@ func (system *scs) ConstantValue(v frontend.Variable) (*big.Int, bool) { } } -// Tag creates a tag at a given place in a circuit. The state of the tag may contain informations needed to -// measure constraints, variables and coefficients creations through AddCounter -func (system *scs) Tag(name string) frontend.Tag { - _, file, line, _ := runtime.Caller(1) - - return frontend.Tag{ - Name: fmt.Sprintf("%s[%s:%d]", name, filepath.Base(file), line), - VID: system.NbInternalVariables, - CID: len(system.Constraints), - } -} - -// AddCounter measures the number of constraints, variables and coefficients created between two tags -// note that the PlonK statistics are contextual since there is a post-compile phase where linear expressions -// are factorized. That is, measuring 2 times the "repeating" piece of circuit may give less constraints the second time -func (system *scs) AddCounter(from, to frontend.Tag) { - system.Counters = append(system.Counters, compiled.Counter{ - From: from.Name, - To: to.Name, - NbVariables: to.VID - from.VID, - NbConstraints: to.CID - from.CID, - BackendID: backend.PLONK, - }) -} - // NewHint initializes internal variables whose value will be evaluated using // the provided hint function at run time from the inputs. Inputs must be either // variables or convertible to *big.Int. The function returns an error if the diff --git a/internal/backend/bls12-377/cs/r1cs_test.go b/internal/backend/bls12-377/cs/r1cs_test.go index a40df67d6f..8139a9a293 100644 --- a/internal/backend/bls12-377/cs/r1cs_test.go +++ b/internal/backend/bls12-377/cs/r1cs_test.go @@ -76,9 +76,7 @@ func TestSerialization(t *testing.T) { if diff := cmp.Diff(r1cs1, &reconstructed, cmpopts.IgnoreFields(cs.R1CS{}, "ConstraintSystem.q", - "ConstraintSystem.bitLen", - "ConstraintSystem.debugPathsIds", - "ConstraintSystem.debugPathId")); diff != "" { + "ConstraintSystem.bitLen")); diff != "" { t.Fatalf("round trip mismatch (-want +got):\n%s", diff) } } diff --git a/internal/backend/bls12-381/cs/r1cs_test.go b/internal/backend/bls12-381/cs/r1cs_test.go index 369fcbb22a..36a3046e3f 100644 --- a/internal/backend/bls12-381/cs/r1cs_test.go +++ b/internal/backend/bls12-381/cs/r1cs_test.go @@ -76,9 +76,7 @@ func TestSerialization(t *testing.T) { if diff := cmp.Diff(r1cs1, &reconstructed, cmpopts.IgnoreFields(cs.R1CS{}, "ConstraintSystem.q", - "ConstraintSystem.bitLen", - "ConstraintSystem.debugPathsIds", - "ConstraintSystem.debugPathId")); diff != "" { + "ConstraintSystem.bitLen")); diff != "" { t.Fatalf("round trip mismatch (-want +got):\n%s", diff) } } diff --git a/internal/backend/bls24-315/cs/r1cs_test.go b/internal/backend/bls24-315/cs/r1cs_test.go index 9237c704b2..2e4662d704 100644 --- a/internal/backend/bls24-315/cs/r1cs_test.go +++ b/internal/backend/bls24-315/cs/r1cs_test.go @@ -76,9 +76,7 @@ func TestSerialization(t *testing.T) { if diff := cmp.Diff(r1cs1, &reconstructed, cmpopts.IgnoreFields(cs.R1CS{}, "ConstraintSystem.q", - "ConstraintSystem.bitLen", - "ConstraintSystem.debugPathsIds", - "ConstraintSystem.debugPathId")); diff != "" { + "ConstraintSystem.bitLen")); diff != "" { t.Fatalf("round trip mismatch (-want +got):\n%s", diff) } } diff --git a/internal/backend/bls24-317/cs/r1cs_test.go b/internal/backend/bls24-317/cs/r1cs_test.go index 79be7c1def..0b0f8efd27 100644 --- a/internal/backend/bls24-317/cs/r1cs_test.go +++ b/internal/backend/bls24-317/cs/r1cs_test.go @@ -76,9 +76,7 @@ func TestSerialization(t *testing.T) { if diff := cmp.Diff(r1cs1, &reconstructed, cmpopts.IgnoreFields(cs.R1CS{}, "ConstraintSystem.q", - "ConstraintSystem.bitLen", - "ConstraintSystem.debugPathsIds", - "ConstraintSystem.debugPathId")); diff != "" { + "ConstraintSystem.bitLen")); diff != "" { t.Fatalf("round trip mismatch (-want +got):\n%s", diff) } } diff --git a/internal/backend/bn254/cs/r1cs_test.go b/internal/backend/bn254/cs/r1cs_test.go index b8c61d3e37..b2c1946435 100644 --- a/internal/backend/bn254/cs/r1cs_test.go +++ b/internal/backend/bn254/cs/r1cs_test.go @@ -76,9 +76,7 @@ func TestSerialization(t *testing.T) { if diff := cmp.Diff(r1cs1, &reconstructed, cmpopts.IgnoreFields(cs.R1CS{}, "ConstraintSystem.q", - "ConstraintSystem.bitLen", - "ConstraintSystem.debugPathsIds", - "ConstraintSystem.debugPathId")); diff != "" { + "ConstraintSystem.bitLen")); diff != "" { t.Fatalf("round trip mismatch (-want +got):\n%s", diff) } } diff --git a/internal/backend/bw6-633/cs/r1cs_test.go b/internal/backend/bw6-633/cs/r1cs_test.go index c65d74da87..f889f63ed2 100644 --- a/internal/backend/bw6-633/cs/r1cs_test.go +++ b/internal/backend/bw6-633/cs/r1cs_test.go @@ -76,9 +76,7 @@ func TestSerialization(t *testing.T) { if diff := cmp.Diff(r1cs1, &reconstructed, cmpopts.IgnoreFields(cs.R1CS{}, "ConstraintSystem.q", - "ConstraintSystem.bitLen", - "ConstraintSystem.debugPathsIds", - "ConstraintSystem.debugPathId")); diff != "" { + "ConstraintSystem.bitLen")); diff != "" { t.Fatalf("round trip mismatch (-want +got):\n%s", diff) } } diff --git a/internal/backend/bw6-761/cs/r1cs_test.go b/internal/backend/bw6-761/cs/r1cs_test.go index 909f98c478..556bd43466 100644 --- a/internal/backend/bw6-761/cs/r1cs_test.go +++ b/internal/backend/bw6-761/cs/r1cs_test.go @@ -79,9 +79,7 @@ func TestSerialization(t *testing.T) { if diff := cmp.Diff(r1cs1, &reconstructed, cmpopts.IgnoreFields(cs.R1CS{}, "ConstraintSystem.q", - "ConstraintSystem.bitLen", - "ConstraintSystem.debugPathsIds", - "ConstraintSystem.debugPathId")); diff != "" { + "ConstraintSystem.bitLen")); diff != "" { t.Fatalf("round trip mismatch (-want +got):\n%s", diff) } } diff --git a/internal/generator/backend/template/representations/tests/r1cs.go.tmpl b/internal/generator/backend/template/representations/tests/r1cs.go.tmpl index eb1d484abe..797b781a19 100644 --- a/internal/generator/backend/template/representations/tests/r1cs.go.tmpl +++ b/internal/generator/backend/template/representations/tests/r1cs.go.tmpl @@ -67,9 +67,7 @@ func TestSerialization(t *testing.T) { if diff := cmp.Diff(r1cs1, &reconstructed, cmpopts.IgnoreFields(cs.R1CS{}, "ConstraintSystem.q", - "ConstraintSystem.bitLen", - "ConstraintSystem.debugPathsIds", - "ConstraintSystem.debugPathId")); diff != "" { + "ConstraintSystem.bitLen")); diff != "" { t.Fatalf("round trip mismatch (-want +got):\n%s", diff) } } diff --git a/internal/tinyfield/cs/r1cs_test.go b/internal/tinyfield/cs/r1cs_test.go index b0ebfcaf5b..707452bd32 100644 --- a/internal/tinyfield/cs/r1cs_test.go +++ b/internal/tinyfield/cs/r1cs_test.go @@ -79,9 +79,7 @@ func TestSerialization(t *testing.T) { if diff := cmp.Diff(r1cs1, &reconstructed, cmpopts.IgnoreFields(cs.R1CS{}, "ConstraintSystem.q", - "ConstraintSystem.bitLen", - "ConstraintSystem.debugPathsIds", - "ConstraintSystem.debugPathId")); diff != "" { + "ConstraintSystem.bitLen")); diff != "" { t.Fatalf("round trip mismatch (-want +got):\n%s", diff) } } diff --git a/profile/internal/report/report.go b/profile/internal/report/report.go index 83bc264cbd..2bb48c34b6 100644 --- a/profile/internal/report/report.go +++ b/profile/internal/report/report.go @@ -373,46 +373,6 @@ func (fm functionMap) findOrAdd(ni graph.NodeInfo) (*profile.Function, bool) { return f, true } -type assemblyInstruction struct { - address uint64 - instruction string - function string - file string - line int - flat, cum int64 - flatDiv, cumDiv int64 - startsBlock bool - inlineCalls []callID -} - -type callID struct { - file string - line int -} - -func (a *assemblyInstruction) flatValue() int64 { - if a.flatDiv != 0 { - return a.flat / a.flatDiv - } - return a.flat -} - -func (a *assemblyInstruction) cumValue() int64 { - if a.cumDiv != 0 { - return a.cum / a.cumDiv - } - return a.cum -} - -// valueOrDot formats a value according to a report, intercepting zero -// values. -func valueOrDot(value int64, rpt *Report) string { - if value == 0 { - return "." - } - return rpt.formatValue(value) -} - // printTags collects all tags referenced in the profile and prints // them in a sorted table. func printTags(w io.Writer, rpt *Report) error { diff --git a/std/algebra/fields_bls12377/e2_test.go b/std/algebra/fields_bls12377/e2_test.go index ab65964f25..2d069a20df 100644 --- a/std/algebra/fields_bls12377/e2_test.go +++ b/std/algebra/fields_bls12377/e2_test.go @@ -264,9 +264,6 @@ func TestMulByNonResidueFp2(t *testing.T) { // fp2c := NewFp2Elmt(&cs, nil, nil) // fp2c.MulByNonResidue(&cs, &fp2a) - // api.Tag(fp2c.X, "c0") - // api.Tag(fp2c.Y, "c1") - // // witness.A.A0 = (a.A0) // witness.A.A1 = (a.A1) diff --git a/std/math/emulated/field.go b/std/math/emulated/field.go index 3cec8af812..588991da0c 100644 --- a/std/math/emulated/field.go +++ b/std/math/emulated/field.go @@ -513,14 +513,6 @@ func (f *field[T]) NewHint(hf hint.Function, nbOutputs int, inputs ...frontend.V return ret, nil } -func (f *field[T]) Tag(name string) frontend.Tag { - return f.api.Compiler().Tag(name) -} - -func (f *field[T]) AddCounter(from frontend.Tag, to frontend.Tag) { - f.api.Compiler().AddCounter(from, to) -} - func (f *field[T]) ConstantValue(v frontend.Variable) (*big.Int, bool) { var limbs []frontend.Variable // emulated limbs switch vv := v.(type) { diff --git a/test/assert.go b/test/assert.go index e667aaa613..1bd0f2de5e 100644 --- a/test/assert.go +++ b/test/assert.go @@ -31,7 +31,6 @@ import ( "github.com/consensys/gnark/backend/plonkfri" "github.com/consensys/gnark/backend/witness" "github.com/consensys/gnark/frontend" - "github.com/consensys/gnark/frontend/compiled" "github.com/consensys/gnark/frontend/cs/r1cs" "github.com/consensys/gnark/frontend/cs/scs" "github.com/stretchr/testify/require" @@ -338,28 +337,6 @@ func (assert *Assert) solvingFailed(circuit frontend.Circuit, invalidAssignment } -// GetCounters compiles (or fetch from the compiled circuit cache) the circuit with set backends and curves -// and returns measured counters -func (assert *Assert) GetCounters(circuit frontend.Circuit, opts ...TestingOption) []compiled.Counter { - opt := assert.options(opts...) - - var r []compiled.Counter - - for _, curve := range opt.curves { - for _, b := range opt.backends { - curve := curve - b := b - assert.Run(func(assert *Assert) { - ccs, err := assert.compile(circuit, curve, b, opt.compileOpts) - assert.NoError(err) - r = append(r, ccs.GetCounters()...) - }, curve.String(), b.String()) - } - } - - return r -} - // Fuzz fuzzes the given circuit by instantiating "randomized" witnesses and cross checking // execution result between constraint system solver and big.Int test execution engine // diff --git a/test/engine.go b/test/engine.go index d823230608..434199b68b 100644 --- a/test/engine.go +++ b/test/engine.go @@ -465,15 +465,6 @@ func (e *engine) MarkBoolean(v frontend.Variable) { } } -func (e *engine) Tag(name string) frontend.Tag { - // do nothing, we don't measure constraints with the test engine - return frontend.Tag{Name: name} -} - -func (e *engine) AddCounter(from, to frontend.Tag) { - // do nothing, we don't measure constraints with the test engine -} - func (e *engine) toBigInt(i1 frontend.Variable) *big.Int { switch vv := i1.(type) { case *big.Int: