Hotfix for staking interface router ownership transfer

pull/2369/head
Kieran Prasch 2020-10-14 20:43:45 -07:00 committed by David Núñez
parent bf851eb83e
commit 97aff893fb
4 changed files with 36 additions and 8 deletions

View File

@ -195,8 +195,7 @@ class ContractAdministrator(NucypherTokenActor):
# For ownership transfers.
ownable_deployer_classes = (*dispatched_upgradeable_deployer_classes,
StakingInterfaceRouterDeployer,
)
StakingInterfaceDeployer)
# Used in the automated deployment series.
primary_deployer_classes = (*standard_deployer_classes,
@ -204,7 +203,8 @@ class ContractAdministrator(NucypherTokenActor):
# Comprehensive collection.
all_deployer_classes = (*primary_deployer_classes,
*aux_deployer_classes)
*aux_deployer_classes,
*ownable_deployer_classes)
class UnknownContract(ValueError):
pass

View File

@ -851,13 +851,14 @@ class StakingInterfaceRouterDeployer(OwnableContractMixin, ProxyContractDeployer
raise NotImplementedError
class StakingInterfaceDeployer(BaseContractDeployer, UpgradeableContractMixin):
class StakingInterfaceDeployer(BaseContractDeployer, UpgradeableContractMixin, OwnableContractMixin):
contract_name = 'StakingInterface'
deployment_steps = ('contract_deployment', 'router_deployment')
number_of_deployment_transactions = 2
_proxy_deployer = StakingInterfaceRouterDeployer
_ownable = False
# _ownable = False # TODO: This contract is not truly ownable but we need the logic of the mixin to execute
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)

View File

@ -592,9 +592,7 @@ def allocations(general_config, actor_options, allocation_infile, gas):
@option_target_address
@option_gas
def transfer_ownership(general_config, actor_options, target_address, gas):
"""
Transfer ownership of contracts to another address.
"""
"""Transfer ownership of contracts to another address."""
emitter = general_config.emitter
ADMINISTRATOR, _, _, _ = actor_options.create_actor(emitter)

View File

@ -160,6 +160,35 @@ def test_transfer_ownership(click_runner, testerchain, agency_local_registry):
assert policy_agent.owner == testerchain.etherbase_account
assert adjudicator_agent.owner == testerchain.etherbase_account
#### BEGIN HOTFIX TEST
ownership_command = ('transfer-ownership',
'--registry-infile', agency_local_registry.filepath,
'--contract-name', 'StakingInterface',
'--provider', TEST_PROVIDER_URI,
'--network', TEMPORARY_DOMAIN,
'--target-address', maclane,
'--debug')
account_index = '0\n'
yes = 'Y\n'
user_input = account_index + yes + yes
result = click_runner.invoke(deploy,
ownership_command,
input=user_input,
catch_exceptions=False)
assert result.exit_code == 0, result.output
# All of these are unchanged
assert staking_agent.owner == michwill
assert policy_agent.owner == testerchain.etherbase_account
assert adjudicator_agent.owner == testerchain.etherbase_account
# TODO: Assert the new owner is correct
# This owner is updated
# assert interface_agent.owner == maclane
def test_bare_contract_deployment_to_alternate_registry(click_runner, agency_local_registry):