Rename eth_provider_uri to eth_endpoint as it pertains to Characters/nodes/CLI options.

pull/3262/head
derekpierre 2023-09-29 14:47:18 -04:00
parent f278b9d9f1
commit 4166c7dae9
38 changed files with 148 additions and 135 deletions

View File

@ -55,7 +55,7 @@ L2_NETWORK = "mumbai"
# rest of the network from the seednode.
bob = Bob(
domain=L1_NETWORK,
eth_provider_uri=L1_PROVIDER,
eth_endpoint=L1_PROVIDER,
)
# Bob puts his public keys somewhere alice can find them.
@ -90,7 +90,7 @@ alice = Alice(
checksum_address=ALICE_ADDRESS,
signer=wallet,
domain=L1_NETWORK,
eth_provider_uri=L1_PROVIDER,
eth_endpoint=L1_PROVIDER,
pre_payment_method=pre_payment_method,
)

View File

@ -88,7 +88,7 @@ alicia = Alice(
checksum_address=ALICE_ADDRESS,
signer=wallet,
domain=L1_NETWORK,
eth_provider_uri=L1_PROVIDER,
eth_endpoint=L1_PROVIDER,
pre_payment_method=pre_payment_method,
)

View File

@ -45,7 +45,7 @@ print("Creating the Doctor ...")
doctor = Bob(
domain=L1_NETWORK,
crypto_power_ups=power_ups,
eth_provider_uri=L1_PROVIDER,
eth_endpoint=L1_PROVIDER,
)
print("Doctor = ", doctor)

View File

@ -96,7 +96,7 @@ print(f"\nEncrypted message:\n{bytes(threshold_message_kit).hex()}")
print("--------- Threshold Decryption ---------")
bob = Bob(
eth_provider_uri=staking_provider_uri,
eth_endpoint=staking_provider_uri,
domain=network,
coordinator_provider_uri=coordinator_provider_uri,
coordinator_network=coordinator_network,

View File

@ -73,7 +73,7 @@ print(f"\nEncrypted message:\n{bytes(threshold_message_kit).hex()}")
print("--------- Threshold Decryption ---------")
bob = Bob(
eth_provider_uri=staking_provider_uri,
eth_endpoint=staking_provider_uri,
domain=network,
coordinator_provider_uri=coordinator_provider_uri,
coordinator_network=coordinator_network,

View File

@ -158,7 +158,7 @@ class Operator(BaseActor):
def __init__(
self,
eth_provider_uri: str,
eth_endpoint: str,
coordinator_provider_uri: str,
coordinator_network: str,
pre_payment_method: ContractPayment,
@ -173,7 +173,7 @@ class Operator(BaseActor):
**kwargs,
):
# Falsy values may be passed down from the superclass
if not eth_provider_uri:
if not eth_endpoint:
raise ValueError("Ethereum Provider URI is required to init an operator.")
if not coordinator_provider_uri:
raise ValueError("Polygon Provider URI is required to init an operator.")
@ -204,7 +204,7 @@ class Operator(BaseActor):
self.application_agent = ContractAgency.get_agent(
TACoApplicationAgent,
provider_uri=eth_provider_uri,
provider_uri=eth_endpoint,
registry=self.registry,
)
@ -742,10 +742,10 @@ class Operator(BaseActor):
class PolicyAuthor(NucypherTokenActor):
"""Alice base class for blockchain operations, mocking up new policies!"""
def __init__(self, eth_provider_uri: str, *args, **kwargs):
def __init__(self, eth_endpoint: str, *args, **kwargs):
super().__init__(*args, **kwargs)
self.application_agent = ContractAgency.get_agent(
TACoApplicationAgent, registry=self.registry, provider_uri=eth_provider_uri
TACoApplicationAgent, registry=self.registry, provider_uri=eth_endpoint
)
def create_policy(self, *args, **kwargs):

View File

@ -20,7 +20,7 @@ class OperatorBondedTracker(SimpleTask):
application_agent = ContractAgency.get_agent(
TACoApplicationAgent,
registry=self._ursula.registry,
provider_uri=self._ursula.eth_provider_uri,
provider_uri=self._ursula.eth_endpoint,
)
# use TACo root since unbonding happens at root and not child (more immediate this way)
staking_provider_address = application_agent.get_staking_provider_from_operator(

View File

@ -34,7 +34,7 @@ class Character(Learner):
def __init__(
self,
domain: str,
eth_provider_uri: str = None,
eth_endpoint: str = None,
known_node_class: object = None,
is_me: bool = True,
checksum_address: str = None,
@ -113,14 +113,16 @@ class Character(Learner):
except NoSigningPower:
self._stamp = NO_SIGNING_POWER
self.eth_provider_uri = eth_provider_uri
self.registry = registry or ContractRegistry.from_latest_publication(
domain=domain
self.eth_endpoint = eth_endpoint
self.registry = (
registry
or ContractRegistry.from_latest_publication(domain=domain)
) # See #1580
# REST
self.network_middleware = network_middleware or RestMiddleware(registry=self.registry,
eth_provider_uri=eth_provider_uri)
self.network_middleware = network_middleware or RestMiddleware(
registry=self.registry, eth_provider_uri=eth_endpoint
)
# Learner
Learner.__init__(self,

View File

@ -131,7 +131,7 @@ class Alice(Character, actors.PolicyAuthor):
self,
# Mode
is_me: bool = True,
eth_provider_uri: str = None,
eth_endpoint: str = None,
signer=None,
# Ownership
checksum_address: Optional[ChecksumAddress] = None,
@ -170,7 +170,7 @@ class Alice(Character, actors.PolicyAuthor):
self,
known_node_class=Ursula,
is_me=is_me,
eth_provider_uri=eth_provider_uri,
eth_endpoint=eth_endpoint,
checksum_address=checksum_address,
network_middleware=network_middleware,
*args,
@ -179,7 +179,7 @@ class Alice(Character, actors.PolicyAuthor):
if is_me: # TODO: #289
blockchain = BlockchainInterfaceFactory.get_interface(
eth_provider_uri=self.eth_provider_uri
eth_provider_uri=self.eth_endpoint
)
signer = signer or Web3Signer(
blockchain.client
@ -193,7 +193,7 @@ class Alice(Character, actors.PolicyAuthor):
domain=self.domain,
transacting_power=self.transacting_power,
registry=self.registry,
eth_provider_uri=eth_provider_uri,
eth_endpoint=eth_endpoint,
)
self.log = Logger(self.__class__.__name__)
@ -458,7 +458,7 @@ class Bob(Character):
self,
is_me: bool = True,
verify_node_bonding: bool = False,
eth_provider_uri: str = None,
eth_endpoint: str = None,
coordinator_provider_uri: str = None, # TODO: Move to a higher level and formalize
coordinator_network: str = None, # TODO: Move to a higher level and formalize
*args,
@ -469,7 +469,7 @@ class Bob(Character):
is_me=is_me,
known_node_class=Ursula,
verify_node_bonding=verify_node_bonding,
eth_provider_uri=eth_provider_uri,
eth_endpoint=eth_endpoint,
*args,
**kwargs,
)
@ -825,7 +825,7 @@ class Ursula(Teacher, Character, Operator):
client_password: Optional[str] = None,
transacting_power: Optional[TransactingPower] = None,
operator_signature_from_metadata=NOT_SIGNED,
eth_provider_uri: Optional[str] = None,
eth_endpoint: Optional[str] = None,
condition_provider_uris: Optional[Dict[int, List[str]]] = None,
pre_payment_method: Optional[Union[PaymentMethod, ContractPayment]] = None,
# Character
@ -844,7 +844,7 @@ class Ursula(Teacher, Character, Operator):
domain=domain,
known_node_class=Ursula,
include_self_in_the_state=True,
eth_provider_uri=eth_provider_uri,
eth_endpoint=eth_endpoint,
**character_kwargs,
)
@ -863,7 +863,7 @@ class Ursula(Teacher, Character, Operator):
signer=self.signer,
crypto_power=self._crypto_power,
operator_address=operator_address,
eth_provider_uri=eth_provider_uri,
eth_endpoint=eth_endpoint,
pre_payment_method=pre_payment_method,
client_password=client_password,
condition_provider_uris=condition_provider_uris,
@ -997,10 +997,10 @@ class Ursula(Teacher, Character, Operator):
# Connect to Provider
if not BlockchainInterfaceFactory.is_interface_initialized(
eth_provider_uri=self.eth_provider_uri
eth_provider_uri=self.eth_endpoint
):
BlockchainInterfaceFactory.initialize_interface(
eth_provider_uri=self.eth_provider_uri
eth_provider_uri=self.eth_endpoint
)
if preflight:

View File

@ -75,7 +75,7 @@ class Vladimir(Ursula):
checksum_address=cls.fraud_address,
operator_address=cls.fraud_address,
signer=Web3Signer(blockchain.client),
eth_provider_uri=blockchain.eth_provider_uri,
eth_endpoint=blockchain.eth_provider_uri,
pre_payment_method=bogus_pre_payment_method,
)

View File

@ -159,7 +159,7 @@ def perform_startup_ip_check(emitter: StdoutEmitter, ursula: Ursula, force: bool
external_ip = determine_external_ip_address(
network=ursula.domain,
known_nodes=ursula.known_nodes,
provider_uri=ursula.eth_provider_uri,
provider_uri=ursula.eth_endpoint,
)
except UnknownIPAddress:
message = 'Cannot automatically determine external IP address'

View File

@ -34,7 +34,7 @@ from nucypher.cli.options import (
option_config_root,
option_dev,
option_dry_run,
option_eth_provider_uri,
option_eth_endpoint,
option_force,
option_gas_strategy,
option_key_material,
@ -74,7 +74,7 @@ class UrsulaConfigOptions:
def __init__(
self,
eth_provider_uri: str,
eth_endpoint: str,
operator_address: str,
rest_host: str,
rest_port: int,
@ -93,7 +93,7 @@ class UrsulaConfigOptions:
pre_payment_network: str,
):
self.eth_provider_uri = eth_provider_uri
self.eth_endpoint = eth_endpoint
self.signer_uri = signer_uri
self.operator_address = operator_address
self.rest_host = rest_host
@ -121,7 +121,7 @@ class UrsulaConfigOptions:
light=self.light,
registry_filepath=self.registry_filepath,
policy_registry_filepath=self.policy_registry_filepath,
eth_provider_uri=self.eth_provider_uri,
eth_endpoint=self.eth_endpoint,
signer_uri=self.signer_uri,
gas_strategy=self.gas_strategy,
max_gas_price=self.max_gas_price,
@ -144,7 +144,7 @@ class UrsulaConfigOptions:
domain=self.domain,
registry_filepath=self.registry_filepath,
policy_registry_filepath=self.policy_registry_filepath,
eth_provider_uri=self.eth_provider_uri,
eth_endpoint=self.eth_endpoint,
signer_uri=self.signer_uri,
gas_strategy=self.gas_strategy,
max_gas_price=self.max_gas_price,
@ -175,7 +175,7 @@ class UrsulaConfigOptions:
self.operator_address = select_client_account(
emitter=emitter,
prompt=prompt,
eth_provider_uri=self.eth_provider_uri,
eth_provider_uri=self.eth_endpoint,
signer_uri=self.signer_uri,
)
@ -185,7 +185,7 @@ class UrsulaConfigOptions:
emitter,
network=self.domain,
force=force,
provider_uri=self.eth_provider_uri,
provider_uri=self.eth_endpoint,
)
return UrsulaConfiguration.generate(
@ -198,7 +198,7 @@ class UrsulaConfigOptions:
operator_address=self.operator_address,
registry_filepath=self.registry_filepath,
policy_registry_filepath=self.policy_registry_filepath,
eth_provider_uri=self.eth_provider_uri,
eth_provider_uri=self.eth_endpoint,
signer_uri=self.signer_uri,
gas_strategy=self.gas_strategy,
max_gas_price=self.max_gas_price,
@ -217,7 +217,7 @@ class UrsulaConfigOptions:
operator_address=self.operator_address,
registry_filepath=self.registry_filepath,
policy_registry_filepath=self.policy_registry_filepath,
eth_provider_uri=self.eth_provider_uri,
eth_provider_uri=self.eth_endpoint,
signer_uri=self.signer_uri,
gas_strategy=self.gas_strategy,
max_gas_price=self.max_gas_price,
@ -235,7 +235,7 @@ class UrsulaConfigOptions:
group_config_options = group_options(
# NOTE: Don't set defaults here or they will be applied to config updates. Use the Config API.
UrsulaConfigOptions,
eth_provider_uri=option_eth_provider_uri(),
eth_endpoint=option_eth_endpoint(),
signer_uri=option_signer_uri,
gas_strategy=option_gas_strategy,
max_gas_price=option_max_gas_price,
@ -290,7 +290,7 @@ class UrsulaCharacterOptions:
URSULA = make_cli_character(
character_config=ursula_config,
emitter=emitter,
provider_uri=ursula_config.eth_provider_uri,
provider_uri=ursula_config.eth_endpoint,
min_stake=self.min_stake,
teacher_uri=self.teacher_uri,
unlock_keystore=not self.config_options.dev,
@ -333,11 +333,11 @@ def init(general_config, config_options, force, config_root, key_material):
_pre_launch_warnings(emitter, dev=None, force=force)
if not config_root:
config_root = general_config.config_root
if not config_options.eth_provider_uri:
if not config_options.eth_endpoint:
raise click.BadOptionUsage(
"--eth-provider",
"--eth-endpoint",
message=click.style(
"--eth-provider is required to initialize a new ursula.", fg="red"
"--eth-endpoint is required to initialize a new ursula.", fg="red"
),
)
if not config_options.pre_payment_provider:
@ -491,7 +491,7 @@ def config(general_config, config_options, config_file, force, action):
emitter=emitter,
network=config_options.domain,
force=force,
provider_uri=config_options.eth_provider_uri,
provider_uri=config_options.eth_endpoint,
)
config_options.rest_host = rest_host
if action == "migrate":

View File

@ -199,9 +199,10 @@ def option_policy_encrypting_key(required: bool = False):
required=required)
def option_eth_provider_uri(default=None, required: bool = False):
def option_eth_endpoint(default=None, required: bool = False):
return click.option(
'--eth-provider', 'eth_provider_uri',
"--eth-endpoint",
"eth_endpoint",
help="Blockchain provider's URI i.e. 'file:///path/to/geth.ipc'",
type=click.STRING,
required=required,

View File

@ -368,7 +368,7 @@ class CharacterConfiguration(BaseConfiguration):
# Blockchain
poa: Optional[bool] = None,
light: bool = False,
eth_provider_uri: Optional[str] = None,
eth_endpoint: Optional[str] = None,
gas_strategy: Union[Callable, str] = DEFAULT_GAS_STRATEGY,
max_gas_price: Optional[int] = None,
signer_uri: Optional[str] = None,
@ -418,7 +418,7 @@ class CharacterConfiguration(BaseConfiguration):
# Blockchain
self.poa = poa
self.is_light = light
self.eth_provider_uri = eth_provider_uri or NO_BLOCKCHAIN_CONNECTION
self.eth_endpoint = eth_endpoint or NO_BLOCKCHAIN_CONNECTION
self.signer_uri = signer_uri or None
# Learner
@ -443,11 +443,11 @@ class CharacterConfiguration(BaseConfiguration):
self.gas_strategy = gas_strategy
self.max_gas_price = max_gas_price # gwei
is_initialized = BlockchainInterfaceFactory.is_interface_initialized(
eth_provider_uri=self.eth_provider_uri
eth_provider_uri=self.eth_endpoint
)
if not is_initialized and eth_provider_uri:
if not is_initialized and eth_endpoint:
BlockchainInterfaceFactory.initialize_interface(
eth_provider_uri=self.eth_provider_uri,
eth_provider_uri=self.eth_endpoint,
poa=self.poa,
light=self.is_light,
emitter=emitter,
@ -456,7 +456,7 @@ class CharacterConfiguration(BaseConfiguration):
)
else:
self.log.warn(
f"Using existing blockchain interface connection ({self.eth_provider_uri})."
f"Using existing blockchain interface connection ({self.eth_endpoint})."
)
# TODO: this is potential fix for multichain connection, if we want to use it build it out into a loop
@ -533,7 +533,7 @@ class CharacterConfiguration(BaseConfiguration):
# Network
self.network_middleware = network_middleware or self.DEFAULT_NETWORK_MIDDLEWARE(
registry=self.registry, eth_provider_uri=self.eth_provider_uri
registry=self.registry, eth_provider_uri=self.eth_endpoint
)
super().__init__(filepath=self.config_file_location, config_root=self.config_root)
@ -703,12 +703,12 @@ class CharacterConfiguration(BaseConfiguration):
)
# Optional values (mode)
if self.eth_provider_uri:
if self.eth_endpoint:
if not self.signer_uri:
self.signer_uri = self.eth_provider_uri
self.signer_uri = self.eth_endpoint
payload.update(
dict(
eth_provider_uri=self.eth_provider_uri,
eth_endpoint=self.eth_endpoint,
poa=self.poa,
light=self.is_light,
signer_uri=self.signer_uri,

View File

@ -87,8 +87,8 @@ class UrsulaConfiguration(CharacterConfiguration):
if not staking_provider_uris:
self.condition_provider_uris[staking_chain_id] = staking_provider_uris
if self.eth_provider_uri not in staking_provider_uris:
staking_provider_uris.append(self.eth_provider_uri)
if self.eth_endpoint not in staking_provider_uris:
staking_provider_uris.append(self.eth_endpoint)
@classmethod
def address_from_filepath(cls, filepath: Path) -> str:

View File

@ -5,10 +5,11 @@ from nucypher.config.migrations.common import perform_migration
def __migration(config: Dict) -> Dict:
taco_network = NetworksInventory.get_network(config["domain"])
eth_provider = config["eth_provider_uri"]
eth_chain_id = NetworksInventory.get_ethereum_chain_id(config["domain"])
eth_chain_id = taco_network.eth_network.value
polygon_provider = config["payment_provider"]
polygon_chain_id = NetworksInventory.get_polygon_chain_id(config["payment_network"])
polygon_chain_id = taco_network.poly_network.value
if "condition_provider_uris" in config:
return config
config["condition_provider_uris"] = {

View File

@ -88,7 +88,11 @@ class NucypherMiddlewareClient:
if node_or_sprout:
if node_or_sprout is not EXEMPT_FROM_VERIFICATION:
node = node_or_sprout.mature() # Morph into a node.
node.verify_node(network_middleware_client=self, registry=self.registry, eth_provider_uri=self.eth_provider_uri)
node.verify_node(
network_middleware_client=self,
registry=self.registry,
eth_endpoint=self.eth_provider_uri,
)
return self.parse_node_or_host_and_port(node_or_sprout, host, port)
def parse_node_or_host_and_port(self, node, host, port):

View File

@ -272,7 +272,7 @@ class Learner:
self.learning_deferred = Deferred()
self.domain = domain
default_middleware = self.__DEFAULT_MIDDLEWARE_CLASS(
registry=self.registry, eth_provider_uri=self.eth_provider_uri
registry=self.registry, eth_provider_uri=self.eth_endpoint
)
self.network_middleware = network_middleware or default_middleware
self.save_metadata = save_metadata
@ -359,7 +359,7 @@ class Learner:
maybe_sage_node = self.node_class.from_teacher_uri(
teacher_uri=uri,
min_stake=0,
provider_uri=self.eth_provider_uri,
provider_uri=self.eth_endpoint,
network_middleware=self.network_middleware,
registry=self.registry,
)
@ -383,7 +383,7 @@ class Learner:
seed_node = self.node_class.from_seednode_metadata(
seednode_metadata=seednode_metadata,
network_middleware=self.network_middleware,
provider_uri=self.eth_provider_uri,
provider_uri=self.eth_endpoint,
)
except Exception as e:
# TODO: log traceback here?
@ -472,7 +472,7 @@ class Learner:
force=force_verification_recheck,
network_middleware_client=self.network_middleware.client,
registry=registry,
eth_provider_uri=self.eth_provider_uri,
eth_endpoint=self.eth_endpoint,
)
except SSLError:
# TODO: Bucket this node as having bad TLS info - maybe it's an update that hasn't fully propagated? 567
@ -1056,14 +1056,14 @@ class Teacher:
return staking_provider_address == self.checksum_address
def _staking_provider_is_really_staking(
self, registry: ContractRegistry, eth_provider_uri: Optional[str] = None
self, registry: ContractRegistry, eth_endpoint: Optional[str] = None
) -> bool:
"""
This method assumes the stamp's signature is valid and accurate.
As a follow-up, this checks that the staking provider is, indeed, staking.
"""
application_agent = ContractAgency.get_agent(
TACoApplicationAgent, registry=registry, provider_uri=eth_provider_uri
TACoApplicationAgent, registry=registry, provider_uri=eth_endpoint
) # type: TACoApplicationAgent
is_staking = application_agent.is_authorized(staking_provider=self.checksum_address) # checksum address here is staking provider
return is_staking
@ -1071,7 +1071,7 @@ class Teacher:
def validate_operator(
self,
registry: ContractRegistry = None,
eth_provider_uri: Optional[str] = None,
eth_endpoint: Optional[str] = None,
) -> None:
# TODO: restore this enforcement
# if registry and not eth_provider_uri:
@ -1088,14 +1088,14 @@ class Teacher:
# On-chain staking check, if registry is present
if registry:
if not self._operator_is_bonded(
registry=registry, provider_uri=eth_provider_uri
registry=registry, provider_uri=eth_endpoint
): # <-- Blockchain CALL
message = f"Operator {self.operator_address} is not bonded to staking provider {self.checksum_address}"
self.log.debug(message)
raise self.UnbondedOperator(message)
if self._staking_provider_is_really_staking(
registry=registry, eth_provider_uri=eth_provider_uri
registry=registry, eth_endpoint=eth_endpoint
): # <-- Blockchain CALL
self.log.info(f"Verified operator {self}")
self.verified_operator = True
@ -1115,7 +1115,7 @@ class Teacher:
raise self.InvalidNode("Metadata signature is invalid")
def validate_metadata(
self, registry: ContractRegistry = None, eth_provider_uri: Optional[str] = None
self, registry: ContractRegistry = None, eth_endpoint: Optional[str] = None
):
# Verify the metadata signature
if not self.verified_metadata:
@ -1126,13 +1126,13 @@ class Teacher:
return
# Offline check of valid stamp signature by worker
self.validate_operator(registry=registry, eth_provider_uri=eth_provider_uri)
self.validate_operator(registry=registry, eth_endpoint=eth_endpoint)
def verify_node(
self,
network_middleware_client,
registry: ContractRegistry = None,
eth_provider_uri: Optional[str] = None,
eth_endpoint: Optional[str] = None,
certificate_filepath: Optional[Path] = None,
force: bool = False,
) -> bool:
@ -1165,7 +1165,7 @@ class Teacher:
)
# This is both the stamp's client signature and interface metadata check; May raise InvalidNode
self.validate_metadata(registry=registry, eth_provider_uri=eth_provider_uri)
self.validate_metadata(registry=registry, eth_endpoint=eth_endpoint)
# The node's metadata is valid; let's be sure the interface is in order.
if not certificate_filepath:

View File

@ -157,16 +157,14 @@ def create_metrics_collectors(ursula: "lawful.Ursula") -> List[MetricsCollector]
# Blockchain prometheus
# TODO possible include information about payment
collectors.append(
BlockchainMetricsCollector(eth_provider_uri=ursula.eth_provider_uri)
)
collectors.append(BlockchainMetricsCollector(eth_provider_uri=ursula.eth_endpoint))
# Staking Provider prometheus
collectors.append(
StakingProviderMetricsCollector(
staking_provider_address=ursula.checksum_address,
contract_registry=ursula.registry,
eth_provider_uri=ursula.eth_provider_uri,
eth_provider_uri=ursula.eth_endpoint,
)
)

View File

@ -137,12 +137,12 @@ def test_invalid_operators_tolerance(
force=True,
registry=test_registry,
network_middleware_client=ursula.network_middleware.client,
eth_provider_uri=ursula.eth_provider_uri,
eth_endpoint=ursula.eth_endpoint,
)
# In particular, we know that it's bonded to a staker who is really staking.
assert ursula.is_confirmed
assert ursula._staking_provider_is_really_staking(
registry=test_registry, eth_provider_uri=TEST_ETH_PROVIDER_URI
registry=test_registry, eth_endpoint=TEST_ETH_PROVIDER_URI
)
# OK. Now we learn about this new worker.
@ -161,7 +161,7 @@ def test_invalid_operators_tolerance(
# OK...so...the staker is not staking anymore ...
assert not ursula._staking_provider_is_really_staking(
registry=test_registry, eth_provider_uri=TEST_ETH_PROVIDER_URI
registry=test_registry, eth_endpoint=TEST_ETH_PROVIDER_URI
)
# ... but the worker node still is "verified" (since we're not forcing on-chain verification)
@ -176,7 +176,7 @@ def test_invalid_operators_tolerance(
force=True,
registry=test_registry,
network_middleware_client=ursula.network_middleware.client,
eth_provider_uri=TEST_ETH_PROVIDER_URI,
eth_endpoint=TEST_ETH_PROVIDER_URI,
)
#

View File

@ -16,7 +16,7 @@ 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, eth_provider_uri=TEST_ETH_PROVIDER_URI
registry=test_registry, eth_endpoint=TEST_ETH_PROVIDER_URI
)
assert ursula.verified_operator
@ -106,7 +106,7 @@ def test_vladimir_uses_his_own_signing_key(alice, ursulas, test_registry):
message = f"Operator {vladimir.operator_address} is not bonded"
with pytest.raises(vladimir.UnbondedOperator, match=message):
vladimir.validate_metadata(
registry=test_registry, eth_provider_uri=TEST_ETH_PROVIDER_URI
registry=test_registry, eth_endpoint=TEST_ETH_PROVIDER_URI
)

View File

@ -21,7 +21,7 @@ def test_character_transacting_power_signing(testerchain, test_registry):
signer = Character(
is_me=True,
domain=TEMPORARY_DOMAIN,
eth_provider_uri=TEST_ETH_PROVIDER_URI,
eth_endpoint=TEST_ETH_PROVIDER_URI,
registry=test_registry,
checksum_address=eth_address,
)

View File

@ -131,7 +131,7 @@ def test_ursula_and_local_keystore_signer_integration(
worker_account.address,
"--config-root",
str(config_root_path.absolute()),
"--eth-provider",
"--eth-endpoint",
TEST_ETH_PROVIDER_URI,
"--pre-payment-provider",
TEST_POLYGON_PROVIDER_URI,

View File

@ -45,7 +45,7 @@ def test_ursula_run_with_prometheus_but_no_metrics_port(click_runner):
"--dry-run", # Disable twisted reactor in subprocess
"--lonely", # Do not load seednodes
"--prometheus", # Specify collection of prometheus metrics
"--eth-provider",
"--eth-endpoint",
TEST_ETH_PROVIDER_URI,
"--pre-payment-provider",
TEST_POLYGON_PROVIDER_URI,
@ -74,7 +74,7 @@ def test_run_lone_default_development_ursula(click_runner, ursulas, testerchain)
"--lonely", # Do not load seednodes,
"--operator-address",
ursulas[0].operator_address,
"--eth-provider",
"--eth-endpoint",
TEST_ETH_PROVIDER_URI,
"--pre-payment-provider",
TEST_ETH_PROVIDER_URI,
@ -128,7 +128,7 @@ def test_ursula_learns_via_cli(click_runner, ursulas, testerchain):
"--dry-run", # Disable twisted reactor
"--operator-address",
ursulas[0].operator_address,
"--eth-provider",
"--eth-endpoint",
TEST_ETH_PROVIDER_URI,
"--pre-payment-provider",
TEST_ETH_PROVIDER_URI,
@ -180,7 +180,7 @@ def test_persistent_node_storage_integration(
init_args = (
"ursula",
"init",
"--eth-provider",
"--eth-endpoint",
TEST_ETH_PROVIDER_URI,
"--pre-payment-provider",
TEST_POLYGON_PROVIDER_URI,

View File

@ -130,8 +130,8 @@ def random_address(random_account):
@pytest.fixture(scope="module")
def ursula_test_config(test_registry, temp_dir_path, testerchain):
config = make_ursula_test_configuration(
eth_provider_uri=TEST_ETH_PROVIDER_URI,
pre_payment_provider=TEST_ETH_PROVIDER_URI,
eth_endpoint=TEST_ETH_PROVIDER_URI,
polygon_endpoint=TEST_ETH_PROVIDER_URI,
test_registry=test_registry,
rest_port=select_test_port(),
operator_address=testerchain.ursulas_accounts.pop(),
@ -145,8 +145,8 @@ def ursula_test_config(test_registry, temp_dir_path, testerchain):
@pytest.fixture(scope="module")
def alice_test_config(ursulas, testerchain, test_registry):
config = make_alice_test_configuration(
eth_provider_uri=TEST_ETH_PROVIDER_URI,
pre_payment_provider=TEST_ETH_PROVIDER_URI,
eth_endpoint=TEST_ETH_PROVIDER_URI,
polygon_endpoint=TEST_ETH_PROVIDER_URI,
known_nodes=ursulas,
checksum_address=testerchain.alice_account,
test_registry=test_registry,
@ -157,9 +157,11 @@ def alice_test_config(ursulas, testerchain, test_registry):
@pytest.fixture(scope="module")
def bob_test_config(testerchain, test_registry):
config = make_bob_test_configuration(eth_provider_uri=TEST_ETH_PROVIDER_URI,
test_registry=test_registry,
checksum_address=testerchain.bob_account)
config = make_bob_test_configuration(
eth_endpoint=TEST_ETH_PROVIDER_URI,
test_registry=test_registry,
checksum_address=testerchain.bob_account,
)
yield config
config.cleanup()
@ -338,7 +340,7 @@ def light_ursula(temp_dir_path, random_account, mocker):
pre_payment_method=pre_payment_method,
checksum_address=random_account.address,
operator_address=random_account.address,
eth_provider_uri=MOCK_ETH_PROVIDER_URI,
eth_endpoint=MOCK_ETH_PROVIDER_URI,
signer=KeystoreSigner(path=temp_dir_path),
)
return ursula
@ -462,7 +464,7 @@ def highperf_mocked_alice(
def highperf_mocked_bob(fleet_of_highperf_mocked_ursulas):
config = BobConfiguration(
dev_mode=True,
eth_provider_uri=TEST_ETH_PROVIDER_URI,
eth_endpoint=TEST_ETH_PROVIDER_URI,
domain=TEMPORARY_DOMAIN,
network_middleware=MockRestMiddlewareForLargeFleetTests(
eth_provider_uri=TEST_ETH_PROVIDER_URI

View File

@ -49,7 +49,7 @@ def test_bob_retrieves(alice, ursulas, certificates_tempdir):
bob = Bob(
domain=TEMPORARY_DOMAIN,
start_learning_now=True,
eth_provider_uri=MOCK_ETH_PROVIDER_URI,
eth_endpoint=MOCK_ETH_PROVIDER_URI,
network_middleware=MockRestMiddleware(eth_provider_uri=MOCK_ETH_PROVIDER_URI),
abort_on_learning_error=True,
known_nodes=a_couple_of_ursulas,

View File

@ -42,7 +42,7 @@ def test_initialize_via_cli(
"init",
"--network",
TEMPORARY_DOMAIN,
"--eth-provider",
"--eth-endpoint",
MOCK_ETH_PROVIDER_URI,
"--pre-payment-provider",
TEST_ETH_PROVIDER_URI,
@ -103,13 +103,18 @@ def test_reconfigure_via_cli(
# Read pre-edit state
config = config_class.from_configuration_file(custom_config_filepath)
assert config.eth_provider_uri != TEST_ETH_PROVIDER_URI
assert config.eth_endpoint != TEST_ETH_PROVIDER_URI
del config
# Write
view_args = (config_class.CHARACTER_CLASS.__name__.lower(), 'config',
'--config-file', str(custom_config_filepath.absolute()),
'--eth-provider', TEST_ETH_PROVIDER_URI)
view_args = (
config_class.CHARACTER_CLASS.__name__.lower(),
"config",
"--config-file",
str(custom_config_filepath.absolute()),
"--eth-endpoint",
TEST_ETH_PROVIDER_URI,
)
result = click_runner.invoke(nucypher_cli, view_args, env=ENV)
assert result.exit_code == 0
@ -121,4 +126,4 @@ def test_reconfigure_via_cli(
assert str(custom_filepath) in result.output
# After editing the fields have been updated
assert config.eth_provider_uri == TEST_ETH_PROVIDER_URI
assert config.eth_endpoint == TEST_ETH_PROVIDER_URI

View File

@ -62,7 +62,7 @@ def test_corrupted_configuration(
init_args = (
"ursula",
"init",
"--eth-provider",
"--eth-endpoint",
MOCK_ETH_PROVIDER_URI,
"--pre-payment-provider",
TEST_POLYGON_PROVIDER_URI,
@ -109,7 +109,7 @@ def test_corrupted_configuration(
TEMPORARY_DOMAIN,
"--pre-payment-network",
TEMPORARY_DOMAIN,
"--eth-provider",
"--eth-endpoint",
MOCK_ETH_PROVIDER_URI,
"--pre-payment-provider",
TEST_POLYGON_PROVIDER_URI,

View File

@ -36,7 +36,7 @@ def test_ursula_startup_ip_checkup(click_runner, mocker):
"init",
"--network",
TEMPORARY_DOMAIN,
"--eth-provider",
"--eth-endpoint",
MOCK_ETH_PROVIDER_URI,
"--pre-payment-provider",
TEST_POLYGON_PROVIDER_URI,
@ -55,7 +55,7 @@ def test_ursula_startup_ip_checkup(click_runner, mocker):
"--network",
TEMPORARY_DOMAIN,
"--force",
"--eth-provider",
"--eth-endpoint",
MOCK_ETH_PROVIDER_URI,
"--pre-payment-provider",
TEST_POLYGON_PROVIDER_URI,
@ -73,7 +73,7 @@ def test_ursula_startup_ip_checkup(click_runner, mocker):
"--network",
TEMPORARY_DOMAIN,
"--force",
"--eth-provider",
"--eth-endpoint",
MOCK_ETH_PROVIDER_URI,
"--pre-payment-provider",
TEST_POLYGON_PROVIDER_URI,

View File

@ -60,7 +60,7 @@ def test_interactive_initialize_ursula(click_runner, mocker, tmpdir):
"init",
"--network",
TEMPORARY_DOMAIN,
"--eth-provider",
"--eth-endpoint",
MOCK_ETH_PROVIDER_URI,
"--pre-payment-provider",
MOCK_ETH_PROVIDER_URI,
@ -100,7 +100,7 @@ def test_initialize_custom_configuration_root(
MOCK_IP_ADDRESS,
"--rest-port",
deploy_port,
"--eth-provider",
"--eth-endpoint",
MOCK_ETH_PROVIDER_URI,
"--pre-payment-provider",
MOCK_ETH_PROVIDER_URI,

View File

@ -50,7 +50,7 @@ def test_ursula_init_with_local_keystore_signer(
# Layer 1
"--network",
TEMPORARY_DOMAIN,
"--eth-provider",
"--eth-endpoint",
testerchain.eth_provider_uri,
# Layer 2
"--pre-payment-network",

View File

@ -52,7 +52,7 @@ def test_development_character_configurations(
lonely=True,
domain=TEMPORARY_DOMAIN,
checksum_address=testerchain.unassigned_accounts[0],
eth_provider_uri=MOCK_ETH_PROVIDER_URI,
eth_endpoint=MOCK_ETH_PROVIDER_URI,
)
if character is Ursula:
params.update(dict(operator_address=testerchain.unassigned_accounts[0]))
@ -125,7 +125,7 @@ def test_default_character_configuration_preservation(
keystore.signing_public_key = SecretKey.random().public_key()
character_config = configuration_class(
checksum_address=fake_address,
eth_provider_uri=MOCK_ETH_PROVIDER_URI,
eth_endpoint=MOCK_ETH_PROVIDER_URI,
domain=network,
rest_host=MOCK_IP_ADDRESS,
pre_payment_provider=MOCK_ETH_PROVIDER_URI,
@ -137,7 +137,7 @@ def test_default_character_configuration_preservation(
else:
character_config = configuration_class(
checksum_address=fake_address,
eth_provider_uri=MOCK_ETH_PROVIDER_URI,
eth_endpoint=MOCK_ETH_PROVIDER_URI,
domain=network,
pre_payment_network=TEMPORARY_DOMAIN,
policy_registry=test_registry,
@ -178,7 +178,7 @@ def test_ursula_development_configuration(testerchain):
operator_address=testerchain.unassigned_accounts[1],
domain=TEMPORARY_DOMAIN,
pre_payment_network=TEMPORARY_DOMAIN,
eth_provider_uri=MOCK_ETH_PROVIDER_URI,
eth_endpoint=MOCK_ETH_PROVIDER_URI,
)
assert config.is_me is True
assert config.dev_mode is True

View File

@ -57,7 +57,7 @@ def test_alices_powers_are_persistent(ursulas, temp_dir_path, testerchain):
bob = Bob(
start_learning_now=False,
domain=TEMPORARY_DOMAIN,
eth_provider_uri=MOCK_ETH_PROVIDER_URI,
eth_endpoint=MOCK_ETH_PROVIDER_URI,
network_middleware=MockRestMiddleware(eth_provider_uri=MOCK_ETH_PROVIDER_URI),
)
@ -98,7 +98,7 @@ def test_alices_powers_are_persistent(ursulas, temp_dir_path, testerchain):
# Bob's eldest brother, Roberto, appears too
roberto = Bob(
domain=TEMPORARY_DOMAIN,
eth_provider_uri=MOCK_ETH_PROVIDER_URI,
eth_endpoint=MOCK_ETH_PROVIDER_URI,
start_learning_now=False,
network_middleware=MockRestMiddleware(eth_provider_uri=MOCK_ETH_PROVIDER_URI),
)

View File

@ -81,18 +81,18 @@ def test_characters_use_keystore(temp_dir_path, testerchain):
start_learning_now=False,
keystore=keystore,
domain=TEMPORARY_DOMAIN,
eth_provider_uri=MOCK_ETH_PROVIDER_URI,
eth_endpoint=MOCK_ETH_PROVIDER_URI,
checksum_address=testerchain.alice_account,
pre_payment_method=pre_payment_method,
)
Bob(
eth_provider_uri=MOCK_ETH_PROVIDER_URI,
eth_endpoint=MOCK_ETH_PROVIDER_URI,
start_learning_now=False,
keystore=keystore,
domain=TEMPORARY_DOMAIN,
)
Ursula(
eth_provider_uri=MOCK_ETH_PROVIDER_URI,
eth_endpoint=MOCK_ETH_PROVIDER_URI,
start_learning_now=False,
keystore=keystore,
rest_host=LOOPBACK_ADDRESS,
@ -170,7 +170,7 @@ def test_ritualist(temp_dir_path, testerchain, dkg_public_key):
pre_payment_method=pre_payment_method,
operator_address=testerchain.ursulas_accounts[0],
signer=Web3Signer(testerchain.client),
eth_provider_uri=MOCK_ETH_PROVIDER_URI,
eth_endpoint=MOCK_ETH_PROVIDER_URI,
)
ritual_id = 23

View File

@ -46,7 +46,7 @@ class BaseTestNodeStorageBackends:
rest_port=select_test_port(),
domain=TEMPORARY_DOMAIN,
signer=signer,
eth_provider_uri=MOCK_ETH_PROVIDER_URI,
eth_endpoint=MOCK_ETH_PROVIDER_URI,
checksum_address=operator_addresses[i],
operator_address=operator_addresses[i],
pre_payment_method=pre_payment_method,

View File

@ -162,7 +162,7 @@ def make_alice(known_nodes: Optional[Set[Ursula]] = None):
wallet.unlock_account(account=ALICE_ADDRESS, password=SIGNER_PASSWORD)
alice_config = AliceConfiguration(
eth_provider_uri=ETHEREUM_PROVIDER_URI,
eth_endpoint=ETHEREUM_PROVIDER_URI,
checksum_address=ALICE_ADDRESS,
signer_uri=f'keystore://{SIGNER_URI}',
config_root=TEMP_ALICE_DIR,

View File

@ -22,7 +22,7 @@ def test_actor_without_signing_power_cannot_sign():
crypto_power=cannot_sign,
start_learning_now=False,
domain=TEMPORARY_DOMAIN,
eth_provider_uri=MOCK_ETH_PROVIDER_URI,
eth_endpoint=MOCK_ETH_PROVIDER_URI,
)
# The non-signer's stamp doesn't work for signing...
@ -47,7 +47,7 @@ def test_actor_with_signing_power_can_sign():
is_me=True,
start_learning_now=False,
domain=TEMPORARY_DOMAIN,
eth_provider_uri=MOCK_ETH_PROVIDER_URI,
eth_endpoint=MOCK_ETH_PROVIDER_URI,
)
stamp_of_the_signer = signer.stamp
@ -73,14 +73,14 @@ def test_anybody_can_verify(random_address):
domain=TEMPORARY_DOMAIN,
checksum_address=random_address,
pre_payment_method=FreeReencryptions(),
eth_provider_uri=MOCK_ETH_PROVIDER_URI,
eth_endpoint=MOCK_ETH_PROVIDER_URI,
)
# So, our story is fairly simple: an everyman meets Alice.
somebody = Character(
start_learning_now=False,
domain=TEMPORARY_DOMAIN,
eth_provider_uri=MOCK_ETH_PROVIDER_URI,
eth_endpoint=MOCK_ETH_PROVIDER_URI,
)
# Alice signs a message.

View File

@ -25,16 +25,16 @@ TEST_CHARACTER_CONFIG_BASE_PARAMS = dict(
def assemble(
checksum_address: str = None,
eth_provider_uri: str = None,
eth_endpoint: str = None,
test_registry: ContractRegistry = None,
known_nodes: List[Ursula] = None,
) -> dict:
"""Assemble a dictionary of keyword arguments to use when constructing a test configuration."""
# Generate runtime config params
runtime_params = dict(
eth_provider_uri=eth_provider_uri,
eth_endpoint=eth_endpoint,
registry=test_registry,
network_middleware=MockRestMiddleware(eth_provider_uri=eth_provider_uri),
network_middleware=MockRestMiddleware(eth_provider_uri=eth_endpoint),
known_nodes=known_nodes,
checksum_address=checksum_address,
)