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_mimc_contract.TestMiMCContract Class Reference
Inheritance diagram for test_contracts.test_mimc_contract.TestMiMCContract:
Inheritance graph
[legend]
Collaboration diagram for test_contracts.test_mimc_contract.TestMiMCContract:
Collaboration graph
[legend]

Public Member Functions

None test_mimc_alt_bn128 (self)
 
None test_mimc_bls12_377 (self)
 

Static Public Member Functions

None setUpClass ()
 

Detailed Description

Definition at line 21 of file test_mimc_contract.py.

Member Function Documentation

◆ setUpClass()

None test_contracts.test_mimc_contract.TestMiMCContract.setUpClass ( )
static

Definition at line 24 of file test_mimc_contract.py.

24  def setUpClass() -> None:
25  web3: Any = open_web3_from_network(get_eth_network(None))
26  contracts_dir = get_contracts_dir()
27  contract_instance_desc = InstanceDescription.deploy(
28  web3,
29  join(contracts_dir, "TestMiMC.sol"),
30  "TestMiMC",
31  web3.eth.accounts[0], # pylint: disable=no-member
32  None,
33  500000,
34  {"allow_paths": contracts_dir})
35  global CONTRACT_INSTANCE # pylint: disable=global-statement
36  CONTRACT_INSTANCE = contract_instance_desc.instantiate(web3)
37 
Here is the call graph for this function:

◆ test_mimc_alt_bn128()

None test_contracts.test_mimc_contract.TestMiMCContract.test_mimc_alt_bn128 (   self)

Definition at line 38 of file test_mimc_contract.py.

38  def test_mimc_alt_bn128(self) -> None:
39  # pylint: disable=line-too-long
40  x = int(28948022309329048855892746252171976963317496166410141009864396001978282409983).to_bytes(32, 'big') # noqa
41  y = int(14220067918847996031108144435763672811050758065945364308986253046354060608451).to_bytes(32, 'big') # noqa
42  # pylint: enable=line-too-long
43  h = MiMCAltBN128().hash(x, y)
44 
45  result = CONTRACT_INSTANCE.functions.testMimcAltBN128(x, y).call()
46  self.assertEqual(h, result)
47 

◆ test_mimc_bls12_377()

None test_contracts.test_mimc_contract.TestMiMCContract.test_mimc_bls12_377 (   self)

Definition at line 48 of file test_mimc_contract.py.

48  def test_mimc_bls12_377(self) -> None:
49  # pylint: disable=line-too-long
50  x = int(28948022309329048855892746252171976963317496166410141009864396001978282409983).to_bytes(32, 'big') # noqa
51  y = int(14220067918847996031108144435763672811050758065945364308986253046354060608451).to_bytes(32, 'big') # noqa
52  # pylint: enable=line-too-long
53  h = MiMCBLS12_377().hash(x, y)
54 
55  result = CONTRACT_INSTANCE.functions.testMimcBLS12_377(x, y).call()
56  self.assertEqual(h, result)

The documentation for this class was generated from the following file:
zeth.cli.utils.get_eth_network
NetworkConfig get_eth_network(Optional[str] eth_network)
Definition: utils.py:84
zeth.cli.zeth_deploy.int
int
Definition: zeth_deploy.py:27
zeth.cli.utils.open_web3_from_network
Any open_web3_from_network(NetworkConfig eth_net)
Definition: utils.py:114
zeth.core.utils.get_contracts_dir
str get_contracts_dir()
Definition: utils.py:255