Zeth - Zerocash on Ethereum  0.8
Reference implementation of the Zeth protocol by Clearmatics
Public Member Functions | Static Public Member Functions | List of all members
test_contracts.test_bw6_761_contract.TestBW6_761Contract Class Reference
Inheritance diagram for test_contracts.test_bw6_761_contract.TestBW6_761Contract:
Inheritance graph
[legend]
Collaboration diagram for test_contracts.test_bw6_761_contract.TestBW6_761Contract:
Collaboration graph
[legend]

Public Member Functions

None test_bw6_ecadd (self)
 
None test_bw6_ecmul (self)
 
None test_bw6_ecpairing (self)
 

Static Public Member Functions

None setUpClass ()
 

Detailed Description

Definition at line 87 of file test_bw6_761_contract.py.

Member Function Documentation

◆ setUpClass()

None test_contracts.test_bw6_761_contract.TestBW6_761Contract.setUpClass ( )
static

Definition at line 90 of file test_bw6_761_contract.py.

90  def setUpClass() -> None:
91  print("Deploying TestBW6_761.sol")
92  _web3, eth = mock.open_test_web3()
93  _bw6_interface, bw6_instance = mock.deploy_contract(
94  eth,
95  eth.accounts[0],
96  "TestBW6_761",
97  {})
98  global BW6_INSTANCE # pylint: disable=global-statement
99  BW6_INSTANCE = bw6_instance
100 

◆ test_bw6_ecadd()

None test_contracts.test_bw6_761_contract.TestBW6_761Contract.test_bw6_ecadd (   self)
Check that [6] == [2] + [4]

Definition at line 101 of file test_bw6_761_contract.py.

101  def test_bw6_ecadd(self) -> None:
102  """
103  Check that [6] == [2] + [4]
104  """
105  result = BW6_INSTANCE.functions.testECAdd(G1_2 + G1_4).call()
106  self.assertEqual(G1_6, result)
107 

◆ test_bw6_ecmul()

None test_contracts.test_bw6_761_contract.TestBW6_761Contract.test_bw6_ecmul (   self)
Check that [-8] == -2 * [4]

Definition at line 108 of file test_bw6_761_contract.py.

108  def test_bw6_ecmul(self) -> None:
109  """
110  Check that [-8] == -2 * [4]
111  """
112  result = BW6_INSTANCE.functions.testECMul(G1_4 + FR_MINUS_2).call()
113  self.assertEqual(G1_MINUS_8, result)
114 

◆ test_bw6_ecpairing()

None test_contracts.test_bw6_761_contract.TestBW6_761Contract.test_bw6_ecpairing (   self)
Check that e([6], [4]) * e([3],[8]) * e([4],[4]) * e([-8], [8]) == 1

Definition at line 115 of file test_bw6_761_contract.py.

115  def test_bw6_ecpairing(self) -> None:
116  """
117  Check that e([6], [4]) * e([3],[8]) * e([4],[4]) * e([-8], [8]) == 1
118  """
119  # Note, return result here is uint256(1) or uint256(0) depending on the
120  # pairing check result.
121  points = G1_6 + G2_4 + G1_3 + G2_8 + G1_4 + G2_4 + G1_MINUS_8 + G2_8
122  result = BW6_INSTANCE.functions.testECPairing(points).call()
123  self.assertEqual(1, result)
124 
125  points = G1_6 + G2_4 + G1_3 + G2_8 + G1_4 + G2_4 + G1_MINUS_8 + G2_4
126  result = BW6_INSTANCE.functions.testECPairing(points).call()
127  self.assertEqual(0, result)

The documentation for this class was generated from the following file: