Skip to content

Commit

Permalink
Merge pull request Consensys#37 from bnb-chain/zkbnb-develop-v0.8.0-c…
Browse files Browse the repository at this point in the history
…ontract-solving-update

zkbnb-develop-v0.8.0-contract-solving-update
  • Loading branch information
ZhAnGeek authored Apr 12, 2023
2 parents ec65ca1 + dc7bbb6 commit bc73461
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 16 deletions.
6 changes: 4 additions & 2 deletions internal/backend/bls12-377/groth16/commitment.go

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

6 changes: 4 additions & 2 deletions internal/backend/bls12-381/groth16/commitment.go

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

6 changes: 4 additions & 2 deletions internal/backend/bls24-315/groth16/commitment.go

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

6 changes: 4 additions & 2 deletions internal/backend/bls24-317/groth16/commitment.go

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

6 changes: 4 additions & 2 deletions internal/backend/bn254/groth16/commitment.go

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

6 changes: 4 additions & 2 deletions internal/backend/bw6-633/groth16/commitment.go

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

6 changes: 4 additions & 2 deletions internal/backend/bw6-761/groth16/commitment.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
@@ -1,11 +1,13 @@
import (
"crypto/sha256"
{{- template "import_fr" . }}
{{- template "import_curve" . }}
"github.com/consensys/gnark/constraint"
"math/big"
)

func solveCommitmentWire(commitmentInfo *constraint.Commitment, commitment *curve.G1Affine, publicCommitted []*big.Int) (fr.Element, error) {
res, err := fr.Hash(commitmentInfo.SerializeCommitment(commitment.Marshal(), publicCommitted, (fr.Bits-1)/8+1), []byte(constraint.CommitmentDst), 1)
return res[0], err
bytes := sha256.Sum256(commitmentInfo.SerializeCommitment(commitment.Marshal(), publicCommitted, (fr.Bits-1)/8+1))
bi := new(big.Int).SetBytes(bytes[:])
return *new(fr.Element).SetBigInt(bi), nil
}

0 comments on commit bc73461

Please sign in to comment.