diff --git a/recursion/gnark/go.mod b/recursion/gnark/go.mod index d451ad1d55..9eb6068d07 100644 --- a/recursion/gnark/go.mod +++ b/recursion/gnark/go.mod @@ -3,8 +3,8 @@ module github.com/succinctlabs/sp1-recursion-gnark go 1.22 require ( - github.com/consensys/gnark v0.10.0 - github.com/consensys/gnark-crypto v0.12.2-0.20240215234832-d72fcb379d3e + github.com/consensys/gnark v0.10.1-0.20240504023521-d9bfacd7cb60 + github.com/consensys/gnark-crypto v0.12.2-0.20240504013751-564b6f724c3b github.com/pkg/errors v0.9.1 ) @@ -21,6 +21,7 @@ require ( github.com/mattn/go-isatty v0.0.19 // indirect github.com/mmcloughlin/addchain v0.4.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect + github.com/ronanh/intcomp v1.1.0 // indirect github.com/rs/zerolog v1.30.0 // indirect github.com/stretchr/testify v1.8.4 // indirect github.com/x448/float16 v0.8.4 // indirect diff --git a/recursion/gnark/go.sum b/recursion/gnark/go.sum index 91b9b4fc8a..16fed44843 100644 --- a/recursion/gnark/go.sum +++ b/recursion/gnark/go.sum @@ -6,8 +6,12 @@ github.com/consensys/bavard v0.1.13 h1:oLhMLOFGTLdlda/kma4VOJazblc7IM5y5QPd2A/Yj github.com/consensys/bavard v0.1.13/go.mod h1:9ItSMtA/dXMAiL7BG6bqW2m3NdSEObYWoH223nGHukI= github.com/consensys/gnark v0.10.0 h1:yhi6ThoeFP7WrH8zQDaO56WVXe9iJEBSkfrZ9PZxabw= github.com/consensys/gnark v0.10.0/go.mod h1:VJU5JrrhZorbfDH+EUjcuFWr2c5z19tHPh8D6KVQksU= +github.com/consensys/gnark v0.10.1-0.20240504023521-d9bfacd7cb60 h1:+m2KO2BeqBkH1zfCy88z93144AnnD8boClw6d6sD2Ko= +github.com/consensys/gnark v0.10.1-0.20240504023521-d9bfacd7cb60/go.mod h1:DU7zXvIuOqheiS3EgVdD7ydbXDiLh71FkaArWPxwJqY= github.com/consensys/gnark-crypto v0.12.2-0.20240215234832-d72fcb379d3e h1:MKdOuCiy2DAX1tMp2YsmtNDaqdigpY6B5cZQDJ9BvEo= github.com/consensys/gnark-crypto v0.12.2-0.20240215234832-d72fcb379d3e/go.mod h1:wKqwsieaKPThcFkHe0d0zMsbHEUWFmZcG7KBCse210o= +github.com/consensys/gnark-crypto v0.12.2-0.20240504013751-564b6f724c3b h1:tu0NaVr64o6vXzy9rYSK/LCZXmS+u/k9eP1F8OtRUWQ= +github.com/consensys/gnark-crypto v0.12.2-0.20240504013751-564b6f724c3b/go.mod h1:wKqwsieaKPThcFkHe0d0zMsbHEUWFmZcG7KBCse210o= github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -45,6 +49,8 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M= github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA= +github.com/ronanh/intcomp v1.1.0 h1:i54kxmpmSoOZFcWPMWryuakN0vLxLswASsGa07zkvLU= +github.com/ronanh/intcomp v1.1.0/go.mod h1:7FOLy3P3Zj3er/kVrU/pl+Ql7JFZj7bwliMGketo0IU= github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= github.com/rs/zerolog v1.30.0 h1:SymVODrcRsaRaSInD9yQtKbtWqwsfoPcRff/oRXLj4c= github.com/rs/zerolog v1.30.0/go.mod h1:/tk+P47gFdPXq4QYjvCmT5/Gsug2nagsFWBWhAiSi1w= diff --git a/recursion/gnark/server/load.go b/recursion/gnark/server/load.go index 7f8c5bba61..2cdb89d234 100644 --- a/recursion/gnark/server/load.go +++ b/recursion/gnark/server/load.go @@ -102,11 +102,11 @@ func LoadCircuitArtifacts(dataDir, circuitType string) (constraint.ConstraintSys pkStart := time.Now() pk = groth16.NewProvingKey(ecc.BN254) fmt.Println("Reading PK file...") - if _, err = pk.UnsafeReadFrom(pkReader); err != nil { + err = pk.ReadDump(pkReader) + if err != nil { errPK = errors.Wrap(err, "reading PK content from file") - } else { - fmt.Printf("PK loaded in %s\n", time.Since(pkStart)) } + fmt.Printf("PK loaded in %s\n", time.Since(pkStart)) }() wg.Wait() diff --git a/recursion/gnark/sp1/groth16.go b/recursion/gnark/sp1/groth16.go index 8c1759024f..837f31ac7b 100644 --- a/recursion/gnark/sp1/groth16.go +++ b/recursion/gnark/sp1/groth16.go @@ -46,12 +46,17 @@ func BuildGroth16(buildDir string) error { // Write the R1CS. WriteToFile(buildDir+"/circuit_groth16.bin", r1cs) - // Write the proving key. - WriteToFile(buildDir+"/pk_groth16.bin", pk) - // Write the verifier key. WriteToFile(buildDir+"/vk_groth16.bin", vk) + // Write the proving key. + pkFile, err := os.Create(buildDir + "/pk_groth16.bin") + if err != nil { + return err + } + defer pkFile.Close() + pk.WriteDump(pkFile) + // Write the solidity verifier. solidityVerifierFile, err := os.Create(buildDir + "/Groth16Verifier.sol") if err != nil { @@ -80,7 +85,7 @@ func ProveGroth16(buildDir string, witnessPath string, proofPath string) error { return err } pk := groth16.NewProvingKey(ecc.BN254) - pk.ReadFrom(pkFile) + pk.ReadDump(pkFile) // Read the verifier key. fmt.Println("Reading vk...")