--confirmations for manual proxy retargeting

pull/2315/head
Kieran Prasch 2020-09-29 16:15:29 -07:00
parent 3de8ecb9a4
commit b1da0270c9
3 changed files with 10 additions and 5 deletions

View File

@ -331,13 +331,16 @@ class ContractAdministrator(NucypherTokenActor):
return receipts
def retarget_proxy(self,
confirmations: int,
contract_name: str,
target_address: str,
just_build_transaction: bool = False):
just_build_transaction: bool = False
):
Deployer = self.__get_deployer(contract_name=contract_name)
deployer = Deployer(registry=self.registry, deployer_address=self.deployer_address)
result = deployer.retarget(target_address=target_address,
just_build_transaction=just_build_transaction)
just_build_transaction=just_build_transaction,
confirmations=confirmations)
return result
def rollback_contract(self, contract_name: str):

View File

@ -364,7 +364,8 @@ def upgrade(general_config, actor_options, retarget, target_address, ignore_depl
target_address=target_address), abort=True)
transaction = ADMINISTRATOR.retarget_proxy(contract_name=contract_name,
target_address=target_address,
just_build_transaction=True)
just_build_transaction=True,
confirmations=confirmations)
trustee_address = select_client_account(emitter=emitter,
prompt="Select trustee address",

View File

@ -169,14 +169,15 @@ def test_manual_proxy_retargeting(testerchain, test_registry, token_economics):
# Build retarget transaction (just for informational purposes)
transaction = deployer.retarget(target_address=latest_deployment.address,
just_build_transaction=True)
just_build_transaction=True,
confirmations=0)
assert transaction['to'] == proxy_deployer.contract.address
upgrade_function, _params = proxy_deployer.contract.decode_function_input(transaction['data']) # TODO: this only tests for ethtester
assert upgrade_function.fn_name == proxy_deployer.contract.functions.upgrade.fn_name
# Retarget, for real
receipt = deployer.retarget(target_address=latest_deployment.address)
receipt = deployer.retarget(target_address=latest_deployment.address, confirmations=0)
assert receipt['status'] == 1