Skip to content

Commit 80c6dfc

Browse files
mattdffjl
authored andcommitted
crypto/bn256: fix generator on G1 (#15591)
Generator in the current lib uses -2 as the y point when doing ScalarBaseMult, this makes it so that points/signatures generated from libs like py_ecc don't match/validate as pretty much all other libs (including libsnark) have (1, 2) as the standard generator. This does not affect consensus as the generator is never used in the VM, points are always explicitly defined and there is not ScalarBaseMult op - it only makes it so that doing "import github.com/ethereum/go-ethereum/crypto/bn256" doesn't generate bad points in userland tools.
1 parent d927c67 commit 80c6dfc

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎crypto/bn256/curve.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ var curveB = new(big.Int).SetInt64(3)
2020
// curveGen is the generator of G₁.
2121
var curveGen = &curvePoint{
2222
new(big.Int).SetInt64(1),
23-
new(big.Int).SetInt64(-2),
23+
new(big.Int).SetInt64(2),
2424
new(big.Int).SetInt64(1),
2525
new(big.Int).SetInt64(1),
2626
}

0 commit comments

Comments
 (0)