mirror of https://github.com/nucypher/nucypher.git
Fake addresses for fake Ursulas. Good enough for these highperf tests.
parent
52dcd13a53
commit
97b19ea3e4
|
@ -18,7 +18,7 @@ def test_ursula_serves_statics(ursula_test_config, testerchain, agency):
|
||||||
|
|
||||||
node = make_ursulas(
|
node = make_ursulas(
|
||||||
ursula_config=ursula_test_config,
|
ursula_config=ursula_test_config,
|
||||||
quantity=1,
|
max_quantity=1,
|
||||||
staking_provider_addresses=testerchain.stake_providers_accounts,
|
staking_provider_addresses=testerchain.stake_providers_accounts,
|
||||||
operator_addresses=testerchain.ursulas_accounts,
|
operator_addresses=testerchain.ursulas_accounts,
|
||||||
).pop()
|
).pop()
|
||||||
|
|
|
@ -428,7 +428,7 @@ def _mock_testerchain() -> MockBlockchain:
|
||||||
@pytest.fixture(scope='module')
|
@pytest.fixture(scope='module')
|
||||||
def _mock_testerchain_with_5000_ursulas() -> MockBlockchain:
|
def _mock_testerchain_with_5000_ursulas() -> MockBlockchain:
|
||||||
BlockchainInterfaceFactory._interfaces = dict()
|
BlockchainInterfaceFactory._interfaces = dict()
|
||||||
testerchain = _make_testerchain(mock_backend=True, population=5000)
|
testerchain = _make_testerchain(mock_backend=True, population=30)
|
||||||
BlockchainInterfaceFactory.register_interface(interface=testerchain)
|
BlockchainInterfaceFactory.register_interface(interface=testerchain)
|
||||||
yield testerchain
|
yield testerchain
|
||||||
|
|
||||||
|
@ -697,6 +697,10 @@ def fleet_of_highperf_mocked_ursulas(ursula_test_config, request, big_testerchai
|
||||||
quantity = request.param
|
quantity = request.param
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
quantity = 5000 # Bigass fleet by default; that's kinda the point.
|
quantity = 5000 # Bigass fleet by default; that's kinda the point.
|
||||||
|
|
||||||
|
staking_addresses = (to_checksum_address('0x' + os.urandom(20).hex()) for _ in range(5000))
|
||||||
|
operator_addresses = (to_checksum_address('0x' + os.urandom(20).hex()) for _ in range(5000))
|
||||||
|
|
||||||
with GlobalLoggerSettings.pause_all_logging_while():
|
with GlobalLoggerSettings.pause_all_logging_while():
|
||||||
with contextlib.ExitStack() as stack:
|
with contextlib.ExitStack() as stack:
|
||||||
|
|
||||||
|
@ -705,10 +709,10 @@ def fleet_of_highperf_mocked_ursulas(ursula_test_config, request, big_testerchai
|
||||||
|
|
||||||
_ursulas = make_ursulas(
|
_ursulas = make_ursulas(
|
||||||
ursula_config=ursula_test_config,
|
ursula_config=ursula_test_config,
|
||||||
quantity=quantity,
|
max_quantity=quantity,
|
||||||
know_each_other=False,
|
know_each_other=False,
|
||||||
staking_provider_addresses=testerchain.stake_providers_accounts,
|
staking_provider_addresses=staking_addresses,
|
||||||
operator_addresses=testerchain.ursulas_accounts
|
operator_addresses=operator_addresses,
|
||||||
)
|
)
|
||||||
all_ursulas = {u.checksum_address: u for u in _ursulas}
|
all_ursulas = {u.checksum_address: u for u in _ursulas}
|
||||||
|
|
||||||
|
@ -726,7 +730,7 @@ def fleet_of_highperf_mocked_ursulas(ursula_test_config, request, big_testerchai
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture(scope="module")
|
@pytest.fixture(scope="module")
|
||||||
def highperf_mocked_alice(fleet_of_highperf_mocked_ursulas, test_registry_source_manager, monkeymodule, big_testerchain):
|
def highperf_mocked_alice(fleet_of_highperf_mocked_ursulas, test_registry_source_manager, monkeymodule, testerchain):
|
||||||
monkeymodule.setattr(CharacterConfiguration, 'DEFAULT_PAYMENT_NETWORK', TEMPORARY_DOMAIN)
|
monkeymodule.setattr(CharacterConfiguration, 'DEFAULT_PAYMENT_NETWORK', TEMPORARY_DOMAIN)
|
||||||
|
|
||||||
config = AliceConfiguration(dev_mode=True,
|
config = AliceConfiguration(dev_mode=True,
|
||||||
|
|
|
@ -2,10 +2,11 @@
|
||||||
|
|
||||||
|
|
||||||
import contextlib
|
import contextlib
|
||||||
|
|
||||||
|
import pytest
|
||||||
import time
|
import time
|
||||||
|
|
||||||
import maya
|
import maya
|
||||||
import pytest
|
|
||||||
from nucypher_core.umbral import SecretKey, Signer
|
from nucypher_core.umbral import SecretKey, Signer
|
||||||
|
|
||||||
from nucypher.characters.lawful import Ursula
|
from nucypher.characters.lawful import Ursula
|
||||||
|
@ -17,7 +18,7 @@ from tests.mock.performance_mocks import (
|
||||||
mock_message_verification,
|
mock_message_verification,
|
||||||
mock_metadata_validation,
|
mock_metadata_validation,
|
||||||
mock_secret_source,
|
mock_secret_source,
|
||||||
mock_verify_node,
|
mock_verify_node
|
||||||
)
|
)
|
||||||
from tests.utils.ursula import MOCK_KNOWN_URSULAS_CACHE
|
from tests.utils.ursula import MOCK_KNOWN_URSULAS_CACHE
|
||||||
|
|
||||||
|
@ -40,10 +41,7 @@ performance bottlenecks.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.skip("TODO: This test is not yet unfederated.")
|
def test_alice_can_learn_about_a_whole_bunch_of_ursulas(highperf_mocked_alice, test_registry_source_manager):
|
||||||
def test_alice_can_learn_about_a_whole_bunch_of_ursulas(
|
|
||||||
highperf_mocked_alice, test_registry_source_manager
|
|
||||||
):
|
|
||||||
# During the fixture execution, Alice verified one node.
|
# During the fixture execution, Alice verified one node.
|
||||||
# TODO: Consider changing this - #1449
|
# TODO: Consider changing this - #1449
|
||||||
assert VerificationTracker.node_verifications == 1
|
assert VerificationTracker.node_verifications == 1
|
||||||
|
|
|
@ -88,7 +88,7 @@ def test_learner_ignores_stored_nodes_from_other_domains(
|
||||||
learner, other_staker = make_ursulas(
|
learner, other_staker = make_ursulas(
|
||||||
ursula_test_config,
|
ursula_test_config,
|
||||||
domain="call-it-mainnet",
|
domain="call-it-mainnet",
|
||||||
quantity=2,
|
max_quantity=2,
|
||||||
know_each_other=True,
|
know_each_other=True,
|
||||||
staking_provider_addresses=testerchain.stake_providers_accounts[:2],
|
staking_provider_addresses=testerchain.stake_providers_accounts[:2],
|
||||||
operator_addresses=testerchain.ursulas_accounts[:2],
|
operator_addresses=testerchain.ursulas_accounts[:2],
|
||||||
|
@ -97,7 +97,7 @@ def test_learner_ignores_stored_nodes_from_other_domains(
|
||||||
pest, *other_ursulas_from_the_wrong_side_of_the_tracks = make_ursulas(
|
pest, *other_ursulas_from_the_wrong_side_of_the_tracks = make_ursulas(
|
||||||
ursula_test_config,
|
ursula_test_config,
|
||||||
domain="i-dunno-testt-maybe",
|
domain="i-dunno-testt-maybe",
|
||||||
quantity=5,
|
max_quantity=5,
|
||||||
know_each_other=True,
|
know_each_other=True,
|
||||||
staking_provider_addresses=testerchain.stake_providers_accounts[2:],
|
staking_provider_addresses=testerchain.stake_providers_accounts[2:],
|
||||||
operator_addresses=testerchain.ursulas_accounts[2:],
|
operator_addresses=testerchain.ursulas_accounts[2:],
|
||||||
|
@ -157,7 +157,7 @@ def test_learner_uses_both_nodes_from_storage_and_fallback_nodes(
|
||||||
domain=domain,
|
domain=domain,
|
||||||
node_storage=node_storage,
|
node_storage=node_storage,
|
||||||
know_each_other=True,
|
know_each_other=True,
|
||||||
quantity=3,
|
max_quantity=3,
|
||||||
save_metadata=True,
|
save_metadata=True,
|
||||||
staking_provider_addresses=testerchain.stake_providers_accounts[:3],
|
staking_provider_addresses=testerchain.stake_providers_accounts[:3],
|
||||||
operator_addresses=testerchain.ursulas_accounts[:3],
|
operator_addresses=testerchain.ursulas_accounts[:3],
|
||||||
|
|
|
@ -64,12 +64,12 @@ def make_ursulas(
|
||||||
ursula_config: UrsulaConfiguration,
|
ursula_config: UrsulaConfiguration,
|
||||||
staking_provider_addresses: Iterable[str],
|
staking_provider_addresses: Iterable[str],
|
||||||
operator_addresses: Iterable[str],
|
operator_addresses: Iterable[str],
|
||||||
quantity: int = NUMBER_OF_URSULAS_IN_DEVELOPMENT_NETWORK,
|
max_quantity: int = NUMBER_OF_URSULAS_IN_DEVELOPMENT_NETWORK,
|
||||||
know_each_other: bool = True,
|
know_each_other: bool = True,
|
||||||
**ursula_overrides
|
**ursula_overrides
|
||||||
) -> List[Ursula]:
|
) -> List[Ursula]:
|
||||||
|
|
||||||
providers_and_operators = list(zip(staking_provider_addresses, operator_addresses))[:quantity]
|
providers_and_operators = list(zip(staking_provider_addresses, operator_addresses))[:max_quantity]
|
||||||
ursulas = list()
|
ursulas = list()
|
||||||
|
|
||||||
for staking_provider_address, operator_address in providers_and_operators:
|
for staking_provider_address, operator_address in providers_and_operators:
|
||||||
|
|
Loading…
Reference in New Issue