2018-11-17 14:15:50 +00:00
|
|
|
"""
|
|
|
|
This file is part of nucypher.
|
|
|
|
|
|
|
|
nucypher is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
nucypher is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with nucypher. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
"""
|
2018-12-18 11:06:36 +00:00
|
|
|
|
|
|
|
|
2018-10-13 17:41:41 +00:00
|
|
|
import pytest
|
|
|
|
from web3.contract import Contract
|
|
|
|
|
|
|
|
|
|
|
|
ALGORITHM_SHA256 = 1
|
|
|
|
secret = (123456).to_bytes(32, byteorder='big')
|
|
|
|
|
|
|
|
|
|
|
|
@pytest.fixture()
|
|
|
|
def escrow(testerchain):
|
2018-12-05 14:11:17 +00:00
|
|
|
escrow, _ = testerchain.interface.deploy_contract('MinersEscrowForMiningAdjudicatorMock')
|
2018-10-13 17:41:41 +00:00
|
|
|
return escrow
|
|
|
|
|
|
|
|
|
|
|
|
# @pytest.fixture(params=[False, True])
|
|
|
|
@pytest.fixture()
|
2018-12-05 14:11:17 +00:00
|
|
|
def adjudicator_contract(testerchain, escrow, request):
|
2018-10-13 17:41:41 +00:00
|
|
|
# creator, client, bad_node, node1, node2, node3, *everyone_else = testerchain.interface.w3.eth.accounts
|
|
|
|
|
2018-12-05 14:11:17 +00:00
|
|
|
contract, _ = testerchain.interface.deploy_contract('MiningAdjudicator', escrow.address, ALGORITHM_SHA256)
|
2018-10-13 17:41:41 +00:00
|
|
|
|
|
|
|
# if request.param:
|
|
|
|
# secret_hash = testerchain.interface.w3.sha3(secret)
|
|
|
|
# dispatcher, _ = testerchain.interface.deploy_contract('Dispatcher', contract.address, secret_hash)
|
|
|
|
#
|
|
|
|
# # Deploy second version of the government contract
|
|
|
|
# contract = testerchain.interface.w3.eth.contract(
|
|
|
|
# abi=contract.abi,
|
|
|
|
# address=dispatcher.address,
|
|
|
|
# ContractFactoryClass=Contract)
|
|
|
|
|
|
|
|
return contract
|