mirror of https://github.com/nucypher/nucypher.git
Update tests accordingly to accommodate fee model architecture where appropriate.
parent
7f636613f1
commit
c898742902
|
@ -137,6 +137,7 @@ def test_dkg_initiation(
|
|||
accounts,
|
||||
initiator,
|
||||
cohort,
|
||||
fee_model,
|
||||
global_allow_list,
|
||||
testerchain,
|
||||
ritual_token,
|
||||
|
@ -147,16 +148,15 @@ def test_dkg_initiation(
|
|||
cohort_staking_provider_addresses = list(u.checksum_address for u in cohort)
|
||||
|
||||
# Approve the ritual token for the coordinator agent to spend
|
||||
amount = coordinator_agent.get_ritual_initiation_cost(
|
||||
providers=cohort_staking_provider_addresses, duration=duration
|
||||
)
|
||||
amount = fee_model.getRitualCost(len(cohort_staking_provider_addresses), duration)
|
||||
ritual_token.approve(
|
||||
coordinator_agent.contract_address,
|
||||
fee_model.address,
|
||||
amount,
|
||||
sender=accounts[initiator.transacting_power.account],
|
||||
)
|
||||
|
||||
receipt = coordinator_agent.initiate_ritual(
|
||||
fee_model=fee_model.address,
|
||||
providers=cohort_staking_provider_addresses,
|
||||
authority=initiator.transacting_power.account,
|
||||
duration=duration,
|
||||
|
@ -243,8 +243,12 @@ def test_encrypt(
|
|||
|
||||
|
||||
@pytest_twisted.inlineCallbacks
|
||||
def test_unauthorized_decryption(bob, cohort, threshold_message_kit, ritual_id):
|
||||
def test_unauthorized_decryption(
|
||||
bob, cohort, threshold_message_kit, ritual_id, signer, global_allow_list
|
||||
):
|
||||
print("======== DKG DECRYPTION (UNAUTHORIZED) ========")
|
||||
assert not global_allow_list.isAddressAuthorized(ritual_id, signer.accounts[0])
|
||||
|
||||
bob.start_learning_loop(now=True)
|
||||
with pytest.raises(
|
||||
Ursula.NotEnoughUrsulas,
|
||||
|
|
|
@ -14,6 +14,7 @@ def test_ursula_dkg_rounds_fault_tolerance(
|
|||
ursulas,
|
||||
testerchain,
|
||||
ritual_token,
|
||||
fee_model,
|
||||
global_allow_list,
|
||||
coordinator_agent,
|
||||
accounts,
|
||||
|
@ -30,6 +31,7 @@ def test_ursula_dkg_rounds_fault_tolerance(
|
|||
initiator,
|
||||
testerchain,
|
||||
ritual_token,
|
||||
fee_model,
|
||||
global_allow_list,
|
||||
coordinator_agent,
|
||||
cohort_addresses,
|
||||
|
@ -61,21 +63,21 @@ def initiate_dkg(
|
|||
initiator,
|
||||
testerchain,
|
||||
ritual_token,
|
||||
fee_model,
|
||||
global_allow_list,
|
||||
coordinator_agent,
|
||||
cohort_addresses,
|
||||
):
|
||||
duration = 24 * 60 * 60
|
||||
# Approve the ritual token for the coordinator agent to spend
|
||||
amount = coordinator_agent.get_ritual_initiation_cost(
|
||||
providers=cohort_addresses, duration=duration
|
||||
)
|
||||
amount = fee_model.getRitualCost(len(cohort_addresses), duration)
|
||||
ritual_token.approve(
|
||||
coordinator_agent.contract_address,
|
||||
fee_model.address,
|
||||
amount,
|
||||
sender=accounts[initiator.transacting_power.account],
|
||||
)
|
||||
receipt = coordinator_agent.initiate_ritual(
|
||||
fee_model=fee_model.address,
|
||||
providers=cohort_addresses,
|
||||
authority=initiator.transacting_power.account,
|
||||
duration=duration,
|
||||
|
|
|
@ -62,6 +62,7 @@ def test_initiate_ritual(
|
|||
agent,
|
||||
cohort,
|
||||
get_random_checksum_address,
|
||||
fee_model,
|
||||
global_allow_list,
|
||||
transacting_powers,
|
||||
ritual_token,
|
||||
|
@ -72,17 +73,18 @@ def test_initiate_ritual(
|
|||
assert number_of_rituals == 0
|
||||
|
||||
duration = 60 * 60 * 24
|
||||
amount = agent.get_ritual_initiation_cost(cohort, duration)
|
||||
amount = fee_model.getRitualCost(len(cohort), duration)
|
||||
|
||||
# Approve the ritual token for the coordinator agent to spend
|
||||
ritual_token.approve(
|
||||
agent.contract_address,
|
||||
fee_model.address,
|
||||
amount,
|
||||
sender=accounts[initiator.transacting_power.account],
|
||||
)
|
||||
|
||||
authority = get_random_checksum_address()
|
||||
receipt = agent.initiate_ritual(
|
||||
fee_model=fee_model.address,
|
||||
providers=cohort,
|
||||
authority=authority,
|
||||
duration=duration,
|
||||
|
|
|
@ -148,6 +148,7 @@ def run_test(
|
|||
|
||||
cohort_staking_provider_addresses = list(u.checksum_address for u in cohort)
|
||||
mock_coordinator_agent.initiate_ritual(
|
||||
fee_model=get_random_checksum_address(),
|
||||
providers=cohort_staking_provider_addresses,
|
||||
authority=alice.transacting_power.account,
|
||||
duration=1,
|
||||
|
|
|
@ -43,6 +43,7 @@ def test_mock_coordinator_initiation(
|
|||
mock_transacting_power = mocker.Mock()
|
||||
mock_transacting_power.account = random_address
|
||||
coordinator.initiate_ritual(
|
||||
fee_model=get_random_checksum_address(),
|
||||
providers=list(nodes_transacting_powers.keys()),
|
||||
authority=mock_transacting_power.account,
|
||||
duration=1,
|
||||
|
|
Loading…
Reference in New Issue