diff --git a/nucypher/blockchain/eth/actors.py b/nucypher/blockchain/eth/actors.py index 01561629f..21fea11d2 100644 --- a/nucypher/blockchain/eth/actors.py +++ b/nucypher/blockchain/eth/actors.py @@ -1191,7 +1191,7 @@ class Staker(NucypherTokenActor): @only_me @save_receipt def set_min_fee_rate(self, min_rate: int) -> Tuple[str, str]: - """Public facing method for staker to set their minimum acceptable fee rate""" + """Public facing method for staker to set the minimum acceptable fee rate for their associated worker""" minimum, _default, maximum = self.policy_agent.get_fee_rate_range() if min_rate < minimum or min_rate > maximum: raise ValueError(f"Minimum fee rate {min_rate} must fall within global fee range of [{minimum}, {maximum}]") @@ -1210,7 +1210,7 @@ class Staker(NucypherTokenActor): @property def raw_min_fee_rate(self) -> int: - """Minimum acceptable fee rate set by staker. + """Minimum acceptable fee rate set by staker for their associated worker. This fee rate is only used if it falls within the global fee range. If it doesn't a default fee rate is used instead of the raw value (see `min_fee_rate`)""" staker_address = self.checksum_address diff --git a/nucypher/blockchain/eth/agents.py b/nucypher/blockchain/eth/agents.py index 49626dfd3..7b2b50602 100644 --- a/nucypher/blockchain/eth/agents.py +++ b/nucypher/blockchain/eth/agents.py @@ -821,19 +821,19 @@ class PolicyManagerAgent(EthereumContractAgent): return fee_amount def get_fee_rate_range(self) -> Tuple[int, int, int]: - """Check minimum, default & maximum fee rate for all stakers and all policies ('global fee range')""" + """Check minimum, default & maximum fee rate for all policies ('global fee range')""" minimum, default, maximum = self.contract.functions.feeRateRange().call() return minimum, default, maximum @validate_checksum_address def get_min_fee_rate(self, staker_address: str) -> int: - """Check minimum fee rate that staker earns""" + """Check minimum fee rate that staker accepts""" min_rate = self.contract.functions.getMinFeeRate(staker_address).call() return min_rate @validate_checksum_address def get_raw_min_fee_rate(self, staker_address: str) -> int: - """Check minimum acceptable fee rate set by staker""" + """Check minimum acceptable fee rate set by staker for their associated worker""" min_rate = self.contract.functions.nodes(staker_address).call()[3] return min_rate diff --git a/nucypher/blockchain/eth/sol/source/contracts/PolicyManager.sol b/nucypher/blockchain/eth/sol/source/contracts/PolicyManager.sol index d802719eb..3cdfe7211 100644 --- a/nucypher/blockchain/eth/sol/source/contracts/PolicyManager.sol +++ b/nucypher/blockchain/eth/sol/source/contracts/PolicyManager.sol @@ -145,7 +145,7 @@ contract PolicyManager is Upgradeable { } /** - * @notice Set maximum, minimum and default fee rate for all stakers and all policies ('global fee range') + * @notice Set minimum, default & maximum fee rate for all stakers and all policies ('global fee range') */ // TODO # 1501 // function setFeeRateRange(Range calldata _range) external onlyOwner { @@ -156,7 +156,7 @@ contract PolicyManager is Upgradeable { } /** - * @notice Set the minimum acceptable fee rate (set by staker) + * @notice Set the minimum acceptable fee rate (set by staker for their associated worker) * @dev Input value must fall within `feeRateRange` (global fee range) */ function setMinFeeRate(uint256 _minFeeRate) external { @@ -172,7 +172,7 @@ contract PolicyManager is Upgradeable { } /** - * @notice Get the minimum acceptable fee rate (set by staker) + * @notice Get the minimum acceptable fee rate (set by staker for their associated worker) */ function getMinFeeRate(NodeInfo storage _nodeInfo) internal view returns (uint256) { // if minFeeRate has not been set or chosen value falls outside the global fee range @@ -187,7 +187,7 @@ contract PolicyManager is Upgradeable { } /** - * @notice Get the minimum acceptable fee rate (set by staker) + * @notice Get the minimum acceptable fee rate (set by staker for their associated worker) */ function getMinFeeRate(address _node) public view returns (uint256) { NodeInfo storage nodeInfo = nodes[_node]; @@ -626,7 +626,7 @@ contract PolicyManager is Upgradeable { } /** - * @notice Get information about staker fee + * @notice Get information about staker's fee rate * @param _node Address of staker * @param _period Period to get fee delta */ diff --git a/nucypher/cli/commands/deploy.py b/nucypher/cli/commands/deploy.py index 5bda9005f..9378c2094 100644 --- a/nucypher/cli/commands/deploy.py +++ b/nucypher/cli/commands/deploy.py @@ -594,7 +594,7 @@ def transfer_ownership(general_config, actor_options, target_address, gas): @click.option('--maximum', help="Maximum value for range (in wei)", type=WEI) def set_range(general_config, actor_options, minimum, default, maximum): """ - Set the maximum, minimum & default fee rate for all stakers and all policies ('global fee range') in the policy manager contract. + Set the minimum, default & maximum fee rate for all policies ('global fee range') in the policy manager contract. The minimum acceptable fee rate (set by stakers) must fall within the global fee range. """ emitter = general_config.emitter @@ -608,5 +608,5 @@ def set_range(general_config, actor_options, minimum, default, maximum): maximum = click.prompt("Enter new maximum value for range", type=click.IntRange(min=default)) ADMINISTRATOR.set_fee_rate_range(minimum=minimum, default=default, maximum=maximum) - emitter.echo(f"The staker fee rate was set to the default value {default} such that it falls " + emitter.echo(f"The staker's fee rate was set to the default value {default} such that it falls " f"within the range [{minimum}, {maximum}]") diff --git a/nucypher/cli/commands/stake.py b/nucypher/cli/commands/stake.py index 10c814ace..c1c80d60b 100644 --- a/nucypher/cli/commands/stake.py +++ b/nucypher/cli/commands/stake.py @@ -919,7 +919,7 @@ def events(general_config, staker_options, config_file, event_name): @click.option('--min-rate', help="Minimum acceptable fee rate, set by staker", type=WEI) def set_min_rate(general_config, transacting_staker_options, config_file, force, min_rate): """ - Staker sets the minimum fee rate they will accept. + Staker sets the minimum acceptable fee rate for their associated worker. """ emitter = _setup_emitter(general_config) diff --git a/nucypher/cli/painting.py b/nucypher/cli/painting.py index 6bc7541b9..5c5d6679b 100644 --- a/nucypher/cli/painting.py +++ b/nucypher/cli/painting.py @@ -374,7 +374,7 @@ def paint_min_rate(emitter, registry, policy_agent, staker_address): raw_minimum = policy_agent.raw_min_fee_rate(staker_address) rate_payload = f""" -Minimum acceptable fee rate (set by staker): +Minimum acceptable fee rate (set by staker for their associated worker): ~ Previously set ....... {prettify_eth_amount(raw_minimum)} ~ Effective ............ {prettify_eth_amount(minimum)}""" emitter.echo(rate_payload) diff --git a/tests/cli/test_status.py b/tests/cli/test_status.py index 37b8f53f5..7958e0922 100644 --- a/tests/cli/test_status.py +++ b/tests/cli/test_status.py @@ -97,7 +97,7 @@ def test_nucypher_status_stakers(click_runner, agency_local_registry, stakers): def test_nucypher_status_fee_range(click_runner, agency_local_registry, stakers): - # Get information about global fee range (maximum rate, minimum rate, default rate) + # Get information about global fee range (minimum rate, default rate, maximum rate) stakers_command = ('fee-range', '--registry-filepath', agency_local_registry.filepath, '--provider', TEST_PROVIDER_URI,