-
Notifications
You must be signed in to change notification settings - Fork 410
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: added serialization header to CS and debug info to all constrai…
…nts with -tags=debug (#347) * feat: added GnarkVersion semver tag in cs serialized objects * feat: store debug info stack for all constraints if debug tag is set * doc: added TODO * fix: round trip serialization test of cs * fix: stack parsing * style: better comments * feat: ignore some fields when serializing a constraint system * fix: fix previous commit, unexport fields in cs * test: added version test to ensure we update hardcoded v * test: added debug.ParseStack test * fix: fix version test to work on CI using git ls-remote
- Loading branch information
Showing
39 changed files
with
390 additions
and
373 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
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) | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.