Update acceptance tests contract deployment / fixtures; StakeInfo is no longer a contract.

pull/3230/head
derekpierre 2023-09-12 14:37:07 -04:00
parent 84d8344236
commit 75be004564
5 changed files with 29 additions and 20 deletions

View File

@ -6,7 +6,7 @@ plugins:
dependencies:
- name: nucypher-contracts
github: derekpierre/nucypher-contracts
ref: alpha-tweaks
ref: alpha-tweaks-13
- name: openzeppelin
github: OpenZeppelin/openzeppelin-contracts
version: 4.8.1
@ -29,10 +29,6 @@ deployments:
- contract_type: NuCypherToken
address: '0x1e59ce931B4CFea3fe4B875411e280e173cB7A9C' # deployer account at index 0
nu_token_supply: 1_000_000_000
- contract_type: StakeInfo
address: '0x1e59ce931B4CFea3fe4B875411e280e173cB7A9C' # deployer account at index 0
updaters:
- '0x1e59ce931B4CFea3fe4B875411e280e173cB7A9C' # deployer account at index 0
- contract_type: TACoApplication
address: '0x1e59ce931B4CFea3fe4B875411e280e173cB7A9C' # deployer account at index 0
t_token: <TToken.address>
@ -41,9 +37,15 @@ deployments:
pre_min_operator_seconds: 86400 # one day in seconds
reward_duration: 604800
deauthorization_duration: 5184000
commitment_duration:
- 15724800 # 6 months
- 31449600 # 12 months
- contract_type: TACoChildApplication
address: '0x1e59ce931B4CFea3fe4B875411e280e173cB7A9C' # deployer account at index 0
root_application: <TACoApplication.address>
- contract_type: Coordinator
address: '0x1e59ce931B4CFea3fe4B875411e280e173cB7A9C' # deployer account at index 0
stake_info: <StakeInfo.address>
stake_info: <TACoChildApplication.address>
ritual_timeout: 3600
max_dkg_size: 8
admin: '0x1e59ce931B4CFea3fe4B875411e280e173cB7A9C' # deployer account at index 0

View File

@ -28,7 +28,7 @@ from tests.constants import (
INSECURE_DEVELOPMENT_PASSWORD,
MOCK_STAKING_CONTRACT_NAME,
RITUAL_TOKEN,
STAKE_INFO,
TACO_CHILD_APPLICATION,
TEST_ETH_PROVIDER_URI,
)
from tests.utils.ape import (
@ -127,10 +127,12 @@ def testerchain(project, test_registry) -> TesterBlockchain:
@pytest.fixture(scope='module')
def stake_info(testerchain, test_registry):
result = test_registry.search(contract_name=STAKE_INFO)[0]
_stake_info = testerchain.w3.eth.contract(address=result[2], abi=result[3])
return _stake_info
def taco_child_application(testerchain, test_registry):
result = test_registry.search(contract_name=TACO_CHILD_APPLICATION)[0]
_taco_child_application = testerchain.w3.eth.contract(
address=result[2], abi=result[3]
)
return _taco_child_application
@pytest.fixture(scope="module")
@ -179,7 +181,12 @@ def global_allow_list(testerchain, test_registry):
@pytest.fixture(scope="module")
def staking_providers(testerchain, test_registry, threshold_staking, stake_info):
def staking_providers(
testerchain,
test_registry,
threshold_staking,
taco_child_application,
):
taco_application_agent = ContractAgency.get_agent(
TACoApplicationAgent,
registry=test_registry,
@ -237,13 +244,13 @@ def staking_providers(testerchain, test_registry, threshold_staking, stake_info)
# TODO clean this up, perhaps with a fixture
# update StakeInfo
tx = stake_info.functions.updateOperator(
tx = taco_child_application.functions.updateOperator(
provider_address,
operator_address,
).transact()
testerchain.wait_for_receipt(tx)
tx = stake_info.functions.updateAmount(
tx = taco_child_application.functions.updateAmount(
provider_address,
amount,
).transact()

View File

@ -21,7 +21,7 @@ from nucypher.config.constants import (
MOCK_STAKING_CONTRACT_NAME = "ThresholdStakingForTACoApplicationMock"
RITUAL_TOKEN = "RitualToken"
T_TOKEN = "TToken"
STAKE_INFO = "StakeInfo"
TACO_CHILD_APPLICATION = "TACoChildApplication"
CONDITION_NFT = "ConditionNFT"
GLOBAL_ALLOW_LIST = "GlobalAllowList"

View File

@ -167,11 +167,11 @@ def test_select_client_account_with_balance_display(
show_staking,
show_eth,
show_tokens,
stake_info,
taco_child_application,
):
# Setup
mock_staking_agent.get_all_stakes.return_value = stake_info
mock_staking_agent.get_all_stakes.return_value = taco_child_application
# Missing network kwarg with balance display active
blockchain_read_required = any((show_staking, show_eth, show_tokens))
@ -221,7 +221,7 @@ def test_select_client_account_with_balance_display(
assert str(Web3.from_wei(balance, 'ether')) in captured.out
if show_staking:
if len(stake_info) == 0:
if len(taco_child_application) == 0:
assert "No" in captured.out
else:
assert 'Yes' in captured.out

View File

@ -23,8 +23,8 @@ from tests.constants import (
GLOBAL_ALLOW_LIST,
MOCK_STAKING_CONTRACT_NAME,
RITUAL_TOKEN,
STAKE_INFO,
T_TOKEN,
TACO_CHILD_APPLICATION,
)
# order sensitive
@ -32,9 +32,9 @@ _CONTRACTS_TO_DEPLOY_ON_TESTERCHAIN = (
RITUAL_TOKEN,
T_TOKEN,
NucypherTokenAgent.contract_name,
STAKE_INFO,
MOCK_STAKING_CONTRACT_NAME,
TACoApplicationAgent.contract_name,
TACO_CHILD_APPLICATION,
SubscriptionManagerAgent.contract_name,
CoordinatorAgent.contract_name,
GLOBAL_ALLOW_LIST,