Ensure that start block for DKG event scanning is never negative.

Stop RitualTracker when Ursula stops.
Cleanup test.
pull/3117/head
derekpierre 2023-05-04 17:33:33 -04:00
parent 782f65691e
commit 149d16c0b3
3 changed files with 5 additions and 13 deletions

View File

@ -134,7 +134,7 @@ class ActiveRitualTracker:
)
expected_start_block = w3.eth.get_block(
latest_block.number - number_of_blocks_in_the_past
max(0, latest_block.number - number_of_blocks_in_the_past)
)
while (
expected_start_block.number > 0

View File

@ -1023,6 +1023,7 @@ class Ursula(Teacher, Character, Operator, Ritualist):
self.stop_learning_loop()
self.work_tracker.stop()
self._operator_bonded_tracker.stop()
self.ritual_tracker.stop()
if halt_reactor:
reactor.stop()

View File

@ -12,18 +12,9 @@ from tests.utils.middleware import NodeIsDownMiddleware
from tests.utils.ursula import make_ursulas
@pytest.mark.usefixtures("ursulas")
def test_stakers_bond_to_ursulas(
testerchain, test_registry, staking_providers, ursula_test_config
):
nodes = make_ursulas(
ursula_config=ursula_test_config,
staking_provider_addresses=testerchain.stake_providers_accounts,
operator_addresses=testerchain.ursulas_accounts,
)
assert len(nodes) == len(staking_providers)
for ursula in nodes:
def test_stakers_bond_to_ursulas(ursulas, test_registry, staking_providers):
assert len(ursulas) == len(staking_providers)
for ursula in ursulas:
ursula.validate_operator(registry=test_registry)
assert ursula.verified_operator