Parameters from the EIP-197 specification
(https://eips.ethereum.org/EIPS/eip-197).
Source code in tests/byzantium/eip197_ec_pairing/spec.py
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69 | @dataclass(frozen=True)
class Spec:
"""
Parameters from the EIP-197 specification
(https://eips.ethereum.org/EIPS/eip-197).
"""
# The prime modulus of the BN254 prime field Fp (from EIP-196)
P = Spec196.P
# The order of the BN254 G1 group
N = Spec196.N
# Precompile address
ECPAIRING = Address(0x08)
# G1 points (from EIP-196)
G1 = Spec196.G1
INF_G1 = Spec196.INF_G1
NEG_G1 = PointG1(Spec196.G1.x, Spec196.P - Spec196.G1.y)
# G2 generator
G2 = PointG2(
(
0x198E9393920D483A7260BFB731FB5D25F1AA493335A9E71297E485B7AEF312C2,
0x1800DEEF121F1E76426A00665E5C4479674322D4F75EDADD46DEBD5CD992F6ED,
),
(
0x090689D0585FF075EC9E99AD690C3395BC4B313370B38EF355ACDADCD122975B,
0x12C85EA5DB8C6DEB4AAB71808DCB408FE3D1E7690C43D37B4CE6CC0166FA7DAA,
),
)
# Point at infinity in G2
INF_G2 = PointG2()
# Pairing precompile results
PAIRING_TRUE = int.to_bytes(1, length=32, byteorder="big")
PAIRING_FALSE = int.to_bytes(0, length=32, byteorder="big")
# Returned on precompile failure
INVALID = b""
|