Skip to content

Commit

Permalink
fs in solidity compliant with the go implem (#819)
Browse files Browse the repository at this point in the history
* fix: fs compliant with gnark

* fix: added missing template functions

* fix: fixed hex

* fix: fixed offset derive_gamma

* build: re ran go generate

---------

Co-authored-by: Gautam Botrel <gautam.botrel@gmail.com>
  • Loading branch information
ThomasPiellard and gbotrel authored Sep 29, 2023
1 parent 5a4c6a5 commit 7335a6b
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 41 deletions.
91 changes: 52 additions & 39 deletions backend/plonk/bn254/solidity.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 7 additions & 1 deletion backend/plonk/bn254/verify.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
{{ template "import_fr" . }}
{{if eq .Curve "BN254"}}
"github.com/consensys/gnark-crypto/ecc/bn254/fp"
"fmt"
{{end}}
{{ template "import_kzg" . }}
{{ template "import_curve" . }}
Expand Down Expand Up @@ -338,7 +339,12 @@ func deriveRandomness(fs *fiatshamir.Transcript, challenge string, points ...*cu
// Code has not been audited and is provided as-is, we make no guarantees or warranties to its safety and reliability.
func (vk *VerifyingKey) ExportSolidity(w io.Writer) error {
funcMap := template.FuncMap{
// The name "inc" is what the function will be called in the template text.
"hex": func(i int) string {
return fmt.Sprintf("0x%x", i)
},
"mul": func(a, b int) int {
return a*b
},
"inc": func(i int) int {
return i + 1
},
Expand Down

0 comments on commit 7335a6b

Please sign in to comment.