mirror of https://github.com/nucypher/nucypher.git
Respond to RFCs for PR #2315; Combating CI timeouts for deployer CLI tests.
parent
b3462d2902
commit
81e401703c
|
@ -630,9 +630,8 @@ class BlockchainInterface:
|
|||
fire_and_forget: bool = False # do not wait for receipt.
|
||||
) -> dict:
|
||||
|
||||
# TODO: Are confirmations and fire_and_forget conflicting options?
|
||||
# if fire_and_forget and confirmations > 0:
|
||||
# raise ValueError
|
||||
if fire_and_forget and confirmations > 0:
|
||||
raise ValueError('Transaction Prevented: Cannot use confirmations and fire_and_forget options together.')
|
||||
|
||||
transaction = self.build_contract_transaction(contract_function=contract_function,
|
||||
sender_address=sender_address,
|
||||
|
|
|
@ -152,7 +152,7 @@ class RegistrySourceManager:
|
|||
def get_primary_sources(cls):
|
||||
return [source for source in cls._FALLBACK_CHAIN if source.is_primary]
|
||||
|
||||
def fetch_latest_publication(self, registry_class, network: str): # TODO: see #1496
|
||||
def fetch_latest_publication(self, registry_class, network: str):
|
||||
"""
|
||||
Get the latest contract registry data available from a registry source chain.
|
||||
"""
|
||||
|
|
|
@ -69,7 +69,7 @@ from nucypher.cli.literature import (
|
|||
SUCCESSFUL_SAVE_MULTISIG_TX_PROPOSAL,
|
||||
SUCCESSFUL_UPGRADE,
|
||||
UNKNOWN_CONTRACT_NAME,
|
||||
IDENTICAL_REGISTRY_WARNING, DEPLOYER_IS_NOT_OWNER
|
||||
IDENTICAL_REGISTRY_WARNING, DEPLOYER_IS_NOT_OWNER, CONFIRM_VERSIONED_UPGRADE
|
||||
)
|
||||
from nucypher.cli.options import (
|
||||
group_options,
|
||||
|
@ -334,7 +334,9 @@ def upgrade(general_config, actor_options, retarget, target_address, ignore_depl
|
|||
try:
|
||||
Deployer = ADMINISTRATOR.deployers[contract_name]
|
||||
except KeyError:
|
||||
emitter.echo(f'No such contract "{contract_name}"', color='red')
|
||||
message = UNKNOWN_CONTRACT_NAME.format(contract_name=contract_name,
|
||||
constants=ADMINISTRATOR.deployers.keys())
|
||||
emitter.echo(message, color='red', bold=True)
|
||||
raise click.Abort()
|
||||
deployer = Deployer(registry=local_registry)
|
||||
|
||||
|
@ -353,8 +355,7 @@ def upgrade(general_config, actor_options, retarget, target_address, ignore_depl
|
|||
|
||||
# Check registry ID has changed locally compared to remote source
|
||||
if (github_registry.id == local_registry.id) and not actor_options.force:
|
||||
emitter.echo(IDENTICAL_REGISTRY_WARNING.format(github_registry=github_registry,
|
||||
local_registry=local_registry), color='red')
|
||||
emitter.echo(IDENTICAL_REGISTRY_WARNING.format(github_registry=github_registry, local_registry=local_registry), color='red')
|
||||
raise click.Abort()
|
||||
else:
|
||||
emitter.echo('✓ Verified local registry contains updates', color='green')
|
||||
|
@ -400,7 +401,7 @@ def upgrade(general_config, actor_options, retarget, target_address, ignore_depl
|
|||
raise click.BadArgumentUsage(message="--target-address is required when using --retarget")
|
||||
if not actor_options.force:
|
||||
click.confirm(CONFIRM_RETARGET.format(contract_name=contract_name, target_address=target_address), abort=True)
|
||||
receipt = ADMINISTRATOR.retarget_proxy(contract_name=contract_name,target_address=target_address, confirmations=0)
|
||||
receipt = ADMINISTRATOR.retarget_proxy(contract_name=contract_name,target_address=target_address, confirmations=confirmations)
|
||||
message = SUCCESSFUL_RETARGET.format(contract_name=contract_name, target_address=target_address)
|
||||
emitter.message(message, color='green')
|
||||
paint_receipt_summary(emitter=emitter, receipt=receipt)
|
||||
|
@ -410,11 +411,11 @@ def upgrade(general_config, actor_options, retarget, target_address, ignore_depl
|
|||
# Check for human verification of versioned upgrade details
|
||||
click.confirm(CONFIRM_BEGIN_UPGRADE.format(contract_name=contract_name), abort=True)
|
||||
if deployer._ownable: # Only ownable + upgradeable contracts apply
|
||||
old_agent = ContractAgency.get_agent(agent_class=deployer.agency, registry=github_registry)
|
||||
new_agent = ContractAgency.get_agent(agent_class=deployer.agency, registry=local_registry)
|
||||
prompt = f"Confirm upgrade {contract_name} from version {old_agent.contract.version}" \
|
||||
f" to version {new_agent.contract.version}?"
|
||||
click.confirm(prompt, abort=True)
|
||||
old_contract = github_registry.search(contract_name=contract_name)[-1] # latest GH version
|
||||
new_contract = local_registry.search(contract_name=contract_name)[-1] # latest local version
|
||||
click.confirm(CONFIRM_VERSIONED_UPGRADE.format(contract_name=contract_name,
|
||||
old_contract=old_contract,
|
||||
new_contract=new_contract), abort=True)
|
||||
|
||||
receipts = ADMINISTRATOR.upgrade_contract(contract_name=contract_name,
|
||||
ignore_deployed=ignore_deployed,
|
||||
|
@ -461,14 +462,14 @@ def contracts(general_config, actor_options, mode, activate, gas, ignore_deploye
|
|||
deployment_parameters = {}
|
||||
if parameters:
|
||||
with open(parameters) as json_file:
|
||||
deployment_parameters = json.load(json_file)
|
||||
deployment_parameters = json.load(json_file) # TODO: Seems like this is bypassing existing flow in economics.py
|
||||
|
||||
#
|
||||
# Deploy Single Contract (Amend Registry)
|
||||
#
|
||||
contract_name = actor_options.contract_name
|
||||
deployment_mode = constants.__getattr__(mode.upper()) # TODO: constant sorrow
|
||||
if contract_name:
|
||||
if contract_name: # TODO: Remove this conditional, make it the default
|
||||
try:
|
||||
contract_deployer_class = ADMINISTRATOR.deployers[contract_name]
|
||||
except KeyError:
|
||||
|
|
|
@ -477,6 +477,8 @@ IDENTICAL_REGISTRY_WARNING = "Local registry ({local_registry.id}) is identical
|
|||
|
||||
DEPLOYER_IS_NOT_OWNER = "Address {deployer_address} is not the owner of {contract_name}'s Dispatcher ({agent.contract_address}). Aborting."
|
||||
|
||||
CONFIRM_VERSIONED_UPGRADE = "Confirm upgrade {contract_name} from version {old_contract.version} to version {new_contract.version}?"
|
||||
|
||||
#
|
||||
# Multisig
|
||||
#
|
||||
|
|
|
@ -238,8 +238,7 @@ def test_batch_deposits(click_runner,
|
|||
'--provider', TEST_PROVIDER_URI)
|
||||
|
||||
account_index = '0\n'
|
||||
yes = 'Y\n'
|
||||
user_input = account_index + yes + yes
|
||||
user_input = account_index + YES_ENTER + YES_ENTER
|
||||
|
||||
result = click_runner.invoke(deploy,
|
||||
deploy_command,
|
||||
|
@ -264,7 +263,7 @@ def test_manual_deployment_of_idle_network(click_runner):
|
|||
'--provider', TEST_PROVIDER_URI,
|
||||
'--registry-infile', ALTERNATE_REGISTRY_FILEPATH_2)
|
||||
|
||||
user_input = '0\n' + 'Y\n' + INSECURE_DEVELOPMENT_PASSWORD
|
||||
user_input = '0\n' + YES_ENTER + INSECURE_DEVELOPMENT_PASSWORD
|
||||
result = click_runner.invoke(deploy, command, input=user_input, catch_exceptions=False)
|
||||
assert result.exit_code == 0
|
||||
|
||||
|
@ -281,7 +280,7 @@ def test_manual_deployment_of_idle_network(click_runner):
|
|||
'--provider', TEST_PROVIDER_URI,
|
||||
'--registry-infile', ALTERNATE_REGISTRY_FILEPATH_2)
|
||||
|
||||
user_input = '0\n' + 'Y\n'
|
||||
user_input = '0\n' + YES_ENTER + INSECURE_DEVELOPMENT_PASSWORD
|
||||
result = click_runner.invoke(deploy, command, input=user_input, catch_exceptions=False)
|
||||
assert result.exit_code == 0
|
||||
|
||||
|
@ -294,7 +293,7 @@ def test_manual_deployment_of_idle_network(click_runner):
|
|||
'--provider', TEST_PROVIDER_URI,
|
||||
'--registry-infile', ALTERNATE_REGISTRY_FILEPATH_2)
|
||||
|
||||
user_input = '0\n' + 'Y\n'
|
||||
user_input = '0\n' + YES_ENTER + INSECURE_DEVELOPMENT_PASSWORD
|
||||
result = click_runner.invoke(deploy, command, input=user_input, catch_exceptions=False)
|
||||
assert result.exit_code == 0
|
||||
|
||||
|
@ -307,7 +306,7 @@ def test_manual_deployment_of_idle_network(click_runner):
|
|||
'--provider', TEST_PROVIDER_URI,
|
||||
'--registry-infile', ALTERNATE_REGISTRY_FILEPATH_2)
|
||||
|
||||
user_input = '0\n' + 'Y\n'
|
||||
user_input = '0\n' + YES_ENTER + INSECURE_DEVELOPMENT_PASSWORD
|
||||
result = click_runner.invoke(deploy, command, input=user_input, catch_exceptions=False)
|
||||
assert result.exit_code == 0
|
||||
|
||||
|
@ -321,7 +320,7 @@ def test_manual_deployment_of_idle_network(click_runner):
|
|||
'--provider', TEST_PROVIDER_URI,
|
||||
'--registry-infile', ALTERNATE_REGISTRY_FILEPATH_2)
|
||||
|
||||
user_input = '0\n' + 'Y\n' + 'Y\n'
|
||||
user_input = '0\n' + YES_ENTER + YES_ENTER + INSECURE_DEVELOPMENT_PASSWORD
|
||||
result = click_runner.invoke(deploy, command, input=user_input, catch_exceptions=False)
|
||||
assert result.exit_code == 0
|
||||
assert list(new_registry.enrolled_names) == deployed_contracts
|
||||
|
|
Loading…
Reference in New Issue