From 4d179cced6726c9eb4e421230b7fb9ea999b9530 Mon Sep 17 00:00:00 2001 From: Marius van der Wijden Date: Fri, 5 Jun 2020 13:31:37 +0200 Subject: [PATCH 1/2] core/vm: crypto/bls12381: minor code comments --- core/vm/contracts.go | 2 +- crypto/bls12381/fp2.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/core/vm/contracts.go b/core/vm/contracts.go index 70621ccbc01e..5f0d9095dd26 100644 --- a/core/vm/contracts.go +++ b/core/vm/contracts.go @@ -904,7 +904,7 @@ func (c *bls12381MapG1) Run(input []byte) ([]byte, error) { return nil, err } - // Encode the G1 point to 256 bytes + // Encode the G1 point to 128 bytes return g.EncodePoint(r), nil } diff --git a/crypto/bls12381/fp2.go b/crypto/bls12381/fp2.go index bf14690a2ce6..d7820e061d07 100644 --- a/crypto/bls12381/fp2.go +++ b/crypto/bls12381/fp2.go @@ -44,7 +44,7 @@ func newFp2() *fp2 { func (e *fp2) fromBytes(in []byte) (*fe2, error) { if len(in) != 96 { - return nil, errors.New("input string should be larger than 96 bytes") + return nil, errors.New("length of input string should be 96 bytes") } c1, err := fromBytes(in[:48]) if err != nil { From b3e443a340e231f9df9643c5a67bcd3a5d66d31f Mon Sep 17 00:00:00 2001 From: Marius van der Wijden Date: Fri, 5 Jun 2020 14:14:24 +0200 Subject: [PATCH 2/2] crypto/bls12381: fix comment --- crypto/bls12381/g2.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crypto/bls12381/g2.go b/crypto/bls12381/g2.go index b9d183cc4b54..1d1a3258f7c7 100644 --- a/crypto/bls12381/g2.go +++ b/crypto/bls12381/g2.go @@ -165,7 +165,7 @@ func (g *G2) ToBytes(p *PointG2) []byte { return out } -// EncodePoint encodes a point into 128 bytes. +// EncodePoint encodes a point into 256 bytes. func (g *G2) EncodePoint(p *PointG2) []byte { // outRaw is 96 bytes outRaw := g.ToBytes(p)