Fix bug in UserEscrowDeployer tests

pull/1124/head
David Núñez 2019-07-17 16:28:26 +02:00 committed by Kieran Prasch
parent 6ff6d77c2b
commit 22166d0242
No known key found for this signature in database
GPG Key ID: 199AB839D4125A62
2 changed files with 11 additions and 7 deletions

View File

@ -547,28 +547,28 @@ class UserEscrowProxyDeployer(ContractDeployer):
gas_limit=gas_limit) gas_limit=gas_limit)
return contract, deployment_receipt return contract, deployment_receipt
def deploy(self, secret_hash: bytes, existing_secret_plaintext: bytes = None, gas_limit: int = None) -> dict: def deploy(self, secret_hash: bytes, gas_limit: int = None) -> dict:
""" """
Deploys a new UserEscrowProxy contract, and a new UserEscrowLibraryLinker, targeting the first. Deploys a new UserEscrowProxy contract, and a new UserEscrowLibraryLinker, targeting the first.
This is meant to be called only once per general deployment. This is meant to be called only once per general deployment.
""" """
deployment_receipts = dict() receipts = dict()
# UserEscrowProxy # UserEscrowProxy
user_escrow_proxy_contract, deployment_receipt = self._deploy_essential(gas_limit=gas_limit) user_escrow_proxy_contract, deployment_receipt = self._deploy_essential(gas_limit=gas_limit)
deployment_receipts['deployment'] = deployment_receipts receipts['deployment'] = deployment_receipt
# UserEscrowLibraryLinker # UserEscrowLibraryLinker
linker_deployer = self.__linker_deployer(blockchain=self.blockchain, linker_deployer = self.__linker_deployer(blockchain=self.blockchain,
deployer_address=self.deployer_address, deployer_address=self.deployer_address,
target_contract=user_escrow_proxy_contract) target_contract=user_escrow_proxy_contract)
linker_deployment_txhash = linker_deployer.deploy(secret_hash=secret_hash, gas_limit=gas_limit) linker_deployment_receipt = linker_deployer.deploy(secret_hash=secret_hash, gas_limit=gas_limit)
deployment_receipts['linker_deployment'] = linker_deployment_txhash['txhash'] receipts['linker_deployment'] = linker_deployment_receipt['txhash']
self._contract = user_escrow_proxy_contract self._contract = user_escrow_proxy_contract
return deployment_receipts return receipts
@classmethod @classmethod
def get_latest_version(cls, blockchain) -> Contract: def get_latest_version(cls, blockchain) -> Contract:

View File

@ -44,7 +44,11 @@ def test_user_escrow_deployer(session_testerchain, session_agency, user_escrow_p
testerchain = session_testerchain testerchain = session_testerchain
deployer_account = testerchain.etherbase_account deployer_account = testerchain.etherbase_account
secret_hash = keccak_digest(USER_ESCROW_PROXY_DEPLOYMENT_SECRET.encode()) secret_hash = keccak_digest(USER_ESCROW_PROXY_DEPLOYMENT_SECRET.encode())
_escrow_proxy_deployments_txhashes = user_escrow_proxy_deployer.deploy(secret_hash=secret_hash) user_escrow_proxy_receipts = user_escrow_proxy_deployer.deploy(secret_hash=secret_hash)
assert len(user_escrow_proxy_receipts) == 2
for title, receipt in user_escrow_proxy_receipts.items():
assert receipt['status'] == 1
deployer = UserEscrowDeployer(deployer_address=deployer_account, deployer = UserEscrowDeployer(deployer_address=deployer_account,
blockchain=testerchain) blockchain=testerchain)