mirror of https://github.com/nucypher/nucypher.git
Leftovers: Miner --> Staker, MiningAdjudicator --> Adjudicator, etc.
parent
877833aaf3
commit
398896d2ab
|
@ -30,7 +30,7 @@ from constant_sorrow.constants import (
|
|||
UNKNOWN_STAKES,
|
||||
NOT_STAKING,
|
||||
NO_STAKES,
|
||||
STRANGER_MINER
|
||||
STRANGER_STAKER
|
||||
)
|
||||
from eth_tester.exceptions import TransactionFailed
|
||||
from twisted.internet import task, reactor
|
||||
|
@ -382,7 +382,7 @@ class Staker(NucypherTokenActor):
|
|||
self._staking_task = task.LoopingCall(self.heartbeat)
|
||||
|
||||
else:
|
||||
self.token_agent = STRANGER_MINER
|
||||
self.token_agent = STRANGER_STAKER
|
||||
|
||||
self.staking_agent = StakingEscrow(blockchain=self.blockchain)
|
||||
|
||||
|
|
|
@ -761,18 +761,18 @@ class AdjudicatorDeployer(ContractDeployer):
|
|||
deployer_address=self.deployer_address,
|
||||
bare=True)
|
||||
|
||||
mining_adjudicator_contract, deploy_txhash = self.blockchain.interface.deploy_contract(self.contract_name,
|
||||
self.staking_agent.contract_address,
|
||||
*self.__economics.deployment_parameters)
|
||||
adjudicator_contract, deploy_txhash = self.blockchain.interface.deploy_contract(self.contract_name,
|
||||
self.staking_agent.contract_address,
|
||||
*self.__economics.deployment_parameters)
|
||||
|
||||
upgrade_tx_hash = proxy_deployer.retarget(new_target=mining_adjudicator_contract.address,
|
||||
upgrade_tx_hash = proxy_deployer.retarget(new_target=adjudicator_contract.address,
|
||||
existing_secret_plaintext=existing_secret_plaintext,
|
||||
new_secret_hash=new_secret_hash)
|
||||
_upgrade_receipt = self.blockchain.wait_for_receipt(upgrade_tx_hash)
|
||||
|
||||
# Wrap the escrow contract
|
||||
wrapped_adjudicator_contract = self.blockchain.interface._wrap_contract(proxy_deployer.contract,
|
||||
target_contract=mining_adjudicator_contract)
|
||||
target_contract=adjudicator_contract)
|
||||
|
||||
# Switch the contract for the wrapped one
|
||||
policy_manager_contract = wrapped_adjudicator_contract
|
||||
|
|
|
@ -234,7 +234,7 @@ class Alice(Character, PolicyAuthor):
|
|||
duration = calculate_period_duration(future_time=expiration)
|
||||
else:
|
||||
duration = duration or self.duration
|
||||
expiration = datetime_at_period(self.miner_agent.get_current_period() + duration)
|
||||
expiration = datetime_at_period(self.staking_agent.get_current_period() + duration)
|
||||
|
||||
if not value and not rate:
|
||||
value = int(self.rate * duration)
|
||||
|
|
|
@ -148,10 +148,10 @@ class NucypherDeployerClickConfig(NucypherClickConfig):
|
|||
def collect_deployment_secrets(self) -> Secrets:
|
||||
|
||||
# Deployment Environment Variables
|
||||
self.staking_escrow_deployment_secret = os.environ.get("NUCYPHER_MINERS_ESCROW_SECRET")
|
||||
self.staking_escrow_deployment_secret = os.environ.get("NUCYPHER_STAKING_ESCROW_SECRET")
|
||||
self.policy_manager_deployment_secret = os.environ.get("NUCYPHER_POLICY_MANAGER_SECRET")
|
||||
self.user_escrow_proxy_deployment_secret = os.environ.get("NUCYPHER_USER_ESCROW_PROXY_SECRET")
|
||||
self.adjudicator_deployment_secret = os.environ.get("NUCYPHER_MINING_ADJUDICATOR_SECRET")
|
||||
self.adjudicator_deployment_secret = os.environ.get("NUCYPHER_ADJUDICATOR_SECRET")
|
||||
|
||||
|
||||
if not self.staking_escrow_deployment_secret:
|
||||
|
|
|
@ -39,9 +39,9 @@ from nucypher.utilities.sandbox.constants import (
|
|||
NUMBER_OF_URSULAS_IN_BLOCKCHAIN_TESTS,
|
||||
NUMBER_OF_ETH_TEST_ACCOUNTS,
|
||||
DEVELOPMENT_ETH_AIRDROP_AMOUNT,
|
||||
MINERS_ESCROW_DEPLOYMENT_SECRET,
|
||||
STAKING_ESCROW_DEPLOYMENT_SECRET,
|
||||
POLICY_MANAGER_DEPLOYMENT_SECRET,
|
||||
MINING_ADJUDICATOR_DEPLOYMENT_SECRET,
|
||||
ADJUDICATOR_DEPLOYMENT_SECRET,
|
||||
USER_ESCROW_PROXY_DEPLOYMENT_SECRET
|
||||
)
|
||||
|
||||
|
@ -219,9 +219,9 @@ class TesterBlockchain(Blockchain):
|
|||
origin = testerchain.interface.w3.eth.accounts[0]
|
||||
deployer = Deployer(blockchain=testerchain, deployer_address=origin, bare=True)
|
||||
|
||||
_txhashes, agents = deployer.deploy_network_contracts(staker_secret=MINERS_ESCROW_DEPLOYMENT_SECRET,
|
||||
_txhashes, agents = deployer.deploy_network_contracts(staker_secret=STAKING_ESCROW_DEPLOYMENT_SECRET,
|
||||
policy_secret=POLICY_MANAGER_DEPLOYMENT_SECRET,
|
||||
adjudicator_secret=MINING_ADJUDICATOR_DEPLOYMENT_SECRET,
|
||||
adjudicator_secret=ADJUDICATOR_DEPLOYMENT_SECRET,
|
||||
user_escrow_proxy_secret=USER_ESCROW_PROXY_DEPLOYMENT_SECRET)
|
||||
return testerchain, agents
|
||||
|
||||
|
|
|
@ -89,13 +89,13 @@ NUMBER_OF_ALLOCATIONS_IN_TESTS = 100 # TODO: Move to constants
|
|||
|
||||
INSECURE_DEVELOPMENT_PASSWORD = ''.join(SystemRandom().choice(ascii_uppercase + digits) for _ in range(16))
|
||||
|
||||
MINERS_ESCROW_DEPLOYMENT_SECRET = INSECURE_DEVELOPMENT_PASSWORD + str(os.urandom(16))
|
||||
STAKING_ESCROW_DEPLOYMENT_SECRET = INSECURE_DEVELOPMENT_PASSWORD + str(os.urandom(16))
|
||||
|
||||
POLICY_MANAGER_DEPLOYMENT_SECRET = INSECURE_DEVELOPMENT_PASSWORD + str(os.urandom(16))
|
||||
|
||||
USER_ESCROW_PROXY_DEPLOYMENT_SECRET = INSECURE_DEVELOPMENT_PASSWORD + str(os.urandom(16))
|
||||
|
||||
MINING_ADJUDICATOR_DEPLOYMENT_SECRET = INSECURE_DEVELOPMENT_PASSWORD + str(os.urandom(16))
|
||||
ADJUDICATOR_DEPLOYMENT_SECRET = INSECURE_DEVELOPMENT_PASSWORD + str(os.urandom(16))
|
||||
|
||||
|
||||
#
|
||||
|
|
|
@ -3,9 +3,10 @@
|
|||
rm -rf ~/.local/share/nucypher
|
||||
|
||||
# Set Upgrade Secrets
|
||||
export NUCYPHER_MINER_ESCROW_SECRET='debuggerdebugger'
|
||||
export NUCYPHER_STAKING_ESCROW_SECRET='debuggerdebugger'
|
||||
export NUCYPHER_POLICY_MANAGER_SECRET='debuggerdebugger'
|
||||
export NUCYPHER_USER_ESCROW_PROXY_SECRET='debuggerdebugger'
|
||||
export NUCYPHER_ADJUDICATOR_SECRET='debuggerdebugger'
|
||||
|
||||
# Deploy Main Contracts
|
||||
nucypher-deploy contracts --provider-uri ipc:///tmp/geth.ipc --poa
|
||||
|
|
|
@ -30,9 +30,9 @@ from nucypher.utilities.sandbox.blockchain import TesterBlockchain as _TesterBlo
|
|||
from nucypher.utilities.sandbox.constants import (
|
||||
ONE_YEAR_IN_SECONDS,
|
||||
USER_ESCROW_PROXY_DEPLOYMENT_SECRET,
|
||||
MINING_ADJUDICATOR_DEPLOYMENT_SECRET,
|
||||
ADJUDICATOR_DEPLOYMENT_SECRET,
|
||||
POLICY_MANAGER_DEPLOYMENT_SECRET,
|
||||
MINERS_ESCROW_DEPLOYMENT_SECRET,
|
||||
STAKING_ESCROW_DEPLOYMENT_SECRET,
|
||||
NUMBER_OF_ALLOCATIONS_IN_TESTS,
|
||||
TEST_PROVIDER_URI)
|
||||
|
||||
|
@ -53,9 +53,9 @@ def test_rapid_deployment(token_economics):
|
|||
|
||||
# The Big Three (+ Dispatchers)
|
||||
# Deploy User Escrow, too (+ Linker)
|
||||
deployer.deploy_network_contracts(staker_secret=MINERS_ESCROW_DEPLOYMENT_SECRET,
|
||||
deployer.deploy_network_contracts(staker_secret=STAKING_ESCROW_DEPLOYMENT_SECRET,
|
||||
policy_secret=POLICY_MANAGER_DEPLOYMENT_SECRET,
|
||||
adjudicator_secret=MINING_ADJUDICATOR_DEPLOYMENT_SECRET,
|
||||
adjudicator_secret=ADJUDICATOR_DEPLOYMENT_SECRET,
|
||||
user_escrow_proxy_secret=USER_ESCROW_PROXY_DEPLOYMENT_SECRET)
|
||||
|
||||
all_yall = blockchain.unassigned_accounts
|
||||
|
|
|
@ -52,7 +52,7 @@ def test_deposit_tokens(testerchain, agency, token_economics):
|
|||
testerchain.time_travel(periods=1)
|
||||
balance = token_agent.get_balance(address=someone)
|
||||
assert balance == locked_tokens
|
||||
assert agent.get_locked_tokens(miner_address=someone) == locked_tokens
|
||||
assert agent.get_locked_tokens(staker_address=someone) == locked_tokens
|
||||
|
||||
|
||||
@pytest.mark.slow()
|
|
@ -26,9 +26,9 @@ def test_coexisting_configurations(click_runner,
|
|||
envvars = {'NUCYPHER_KEYRING_PASSWORD': INSECURE_DEVELOPMENT_PASSWORD,
|
||||
|
||||
# Upgradeable Contracts
|
||||
'NUCYPHER_MINERS_ESCROW_SECRET': INSECURE_DEVELOPMENT_PASSWORD,
|
||||
'NUCYPHER_STAKING_ESCROW_SECRET': INSECURE_DEVELOPMENT_PASSWORD,
|
||||
'NUCYPHER_POLICY_MANAGER_SECRET': INSECURE_DEVELOPMENT_PASSWORD,
|
||||
'NUCYPHER_MINING_ADJUDICATOR_SECRET': INSECURE_DEVELOPMENT_PASSWORD,
|
||||
'NUCYPHER_ADJUDICATOR_SECRET': INSECURE_DEVELOPMENT_PASSWORD,
|
||||
'NUCYPHER_USER_ESCROW_PROXY_SECRET': INSECURE_DEVELOPMENT_PASSWORD,
|
||||
|
||||
# Auxiliary
|
||||
|
|
Loading…
Reference in New Issue