From 88386c91f9d79502965d55e4645774975d63e0f6 Mon Sep 17 00:00:00 2001 From: "Kieran R. Prasch" Date: Thu, 2 Jan 2020 12:37:56 -0800 Subject: [PATCH] Respond to RFCs in PR #1536 --- nucypher/blockchain/eth/actors.py | 5 ++++- nucypher/cli/characters/stake.py | 8 +++++--- nucypher/cli/painting.py | 2 +- tests/conftest.py | 2 +- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/nucypher/blockchain/eth/actors.py b/nucypher/blockchain/eth/actors.py index b16fa7a17..0d6e651a7 100644 --- a/nucypher/blockchain/eth/actors.py +++ b/nucypher/blockchain/eth/actors.py @@ -994,7 +994,10 @@ class Worker(NucypherTokenActor): @property def token_balance(self) -> NU: - """Return this worker's current token balance""" + """ + Return this worker's current token balance. + Note: Workers typically do not control any tokens. + """ balance = int(self.token_agent.get_balance(address=self.__worker_address)) nu_balance = NU(balance, 'NuNit') return nu_balance diff --git a/nucypher/cli/characters/stake.py b/nucypher/cli/characters/stake.py index 169079c1a..b19b6d69a 100644 --- a/nucypher/cli/characters/stake.py +++ b/nucypher/cli/characters/stake.py @@ -252,7 +252,7 @@ def set_worker(click_config, if not force: click.confirm(f"Commit to bonding " - f"worker {worker_address} to staker {client_account} " + f"worker {worker_address} to staker {staking_address} " f"for a minimum of {STAKEHOLDER.economics.minimum_worker_periods} periods?", abort=True) STAKEHOLDER.assimilate(checksum_address=client_account, password=password) @@ -427,7 +427,8 @@ def create(click_config, # Consistency check to prevent the above agreement from going stale. last_second_current_period = STAKEHOLDER.staking_agent.get_current_period() if start_period != last_second_current_period + 1: - emitter.echo("Current period advanced before stake was broadcasted. Please try again.") + emitter.echo("Current period advanced before stake was broadcasted. Please try again.", + color='red') raise click.Abort # Authenticate and Execute @@ -593,7 +594,8 @@ def divide(click_config, # Consistency check to prevent the above agreement from going stale. last_second_current_period = STAKEHOLDER.staking_agent.get_current_period() if action_period != last_second_current_period: - emitter.echo("Current period advanced before stake division was broadcasted. Please try again.") + emitter.echo("Current period advanced before stake division was broadcasted. Please try again.", + red='red') raise click.Abort # Execute diff --git a/nucypher/cli/painting.py b/nucypher/cli/painting.py index dcc1282b2..34018841a 100644 --- a/nucypher/cli/painting.py +++ b/nucypher/cli/painting.py @@ -420,7 +420,7 @@ def paint_stakes(emitter, stakes, paint_inactive: bool = False): emitter.echo(header, bold=True) emitter.echo(breaky, bold=True) - for stake in sorted([s for s in stakes if s not in active_stakes], # TODO + for stake in sorted([s for s in stakes if s not in active_stakes], # TODO: Code optimization here..? key=lambda some_stake: some_stake.address_index_ordering_key): row = prettify_stake(stake=stake, index=None) emitter.echo(row, color='red') diff --git a/tests/conftest.py b/tests/conftest.py index 3937c768c..279cacbd4 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -40,7 +40,7 @@ WebEmitter._crash_on_error_default = True LOCK_FUNCTION = TransactingPower.lock_account TransactingPower.lock_account = lambda *a, **k: True -# Disable any hardcoded preferred teaches during tests. +# Disable any hardcoded preferred teachers during tests. TEACHER_NODES = dict()