Update TACo example scripts to no longer use redundant parameters with respect to polygon network.

pull/3262/head
derekpierre 2023-10-02 10:50:00 -04:00
parent d3e175a800
commit 4ab26188e9
3 changed files with 29 additions and 23 deletions

View File

@ -8,7 +8,7 @@ THIS_IS_NOT_A_TRINKET = 55 # sometimes called "public key"
signer = InMemorySigner()
enrico = _Enrico(encrypting_key=THIS_IS_NOT_A_TRINKET, signer=signer)
bob = ThisBobAlwaysDecrypts(domain="lynx", eth_provider_uri="Nowhere")
bob = ThisBobAlwaysDecrypts(domain="lynx", eth_endpoint="Nowhere")
ANYTHING_CAN_BE_PASSED_AS_RITUAL_ID = 55

View File

@ -3,6 +3,7 @@ import os
from nucypher_core.ferveo import DkgPublicKey
from nucypher.blockchain.eth.agents import CoordinatorAgent
from nucypher.blockchain.eth.networks import NetworksInventory
from nucypher.blockchain.eth.registry import ContractRegistry
from nucypher.blockchain.eth.signers import InMemorySigner
from nucypher.characters.lawful import Bob, Enrico
@ -18,11 +19,10 @@ LOG_LEVEL = "info"
GlobalLoggerSettings.set_log_level(log_level_name=LOG_LEVEL)
GlobalLoggerSettings.start_console_logging()
staking_provider_uri = os.environ["DEMO_L1_PROVIDER_URI"]
network = "lynx"
eth_endpoint = os.environ["DEMO_L1_PROVIDER_URI"]
taco_network = NetworksInventory.get_network("lynx")
coordinator_provider_uri = os.environ["DEMO_L2_PROVIDER_URI"]
coordinator_network = "mumbai"
polygon_endpoint = os.environ["DEMO_L2_PROVIDER_URI"]
###############
# Enrico
@ -30,9 +30,13 @@ coordinator_network = "mumbai"
print("--------- Threshold Encryption ---------")
registry = ContractRegistry.from_latest_publication(
domain=taco_network.name,
)
coordinator_agent = CoordinatorAgent(
provider_uri=coordinator_provider_uri,
registry=ContractRegistry.from_latest_publication(domain=coordinator_network),
provider_uri=polygon_endpoint,
registry=registry,
)
ritual_id = 1 # got this from a side channel
ritual = coordinator_agent.get_ritual(ritual_id)
@ -96,11 +100,10 @@ print(f"\nEncrypted message:\n{bytes(threshold_message_kit).hex()}")
print("--------- Threshold Decryption ---------")
bob = Bob(
eth_endpoint=staking_provider_uri,
domain=network,
coordinator_provider_uri=coordinator_provider_uri,
coordinator_network=coordinator_network,
registry=ContractRegistry.from_latest_publication(domain=network),
domain=taco_network.name,
eth_endpoint=eth_endpoint,
polygon_endpoint=polygon_endpoint,
registry=registry,
)
bob.start_learning_loop(now=True)

View File

@ -3,6 +3,7 @@ import os
from nucypher_core.ferveo import DkgPublicKey
from nucypher.blockchain.eth.agents import CoordinatorAgent
from nucypher.blockchain.eth.networks import NetworksInventory
from nucypher.blockchain.eth.registry import ContractRegistry
from nucypher.blockchain.eth.signers import InMemorySigner
from nucypher.characters.lawful import Bob, Enrico
@ -18,11 +19,10 @@ LOG_LEVEL = "info"
GlobalLoggerSettings.set_log_level(log_level_name=LOG_LEVEL)
GlobalLoggerSettings.start_console_logging()
staking_provider_uri = os.environ["DEMO_L1_PROVIDER_URI"]
network = "lynx"
eth_endpoint = os.environ["DEMO_L1_PROVIDER_URI"]
taco_network = NetworksInventory.get_network("lynx")
coordinator_provider_uri = os.environ["DEMO_L2_PROVIDER_URI"]
coordinator_network = "mumbai"
polygon_endpoint = os.environ["DEMO_L2_PROVIDER_URI"]
###############
# Enrico
@ -30,9 +30,13 @@ coordinator_network = "mumbai"
print("--------- Threshold Encryption ---------")
registry = ContractRegistry.from_latest_publication(
domain=taco_network.name,
)
coordinator_agent = CoordinatorAgent(
provider_uri=coordinator_provider_uri,
registry=ContractRegistry.from_latest_publication(domain=coordinator_network),
provider_uri=polygon_endpoint,
registry=registry,
)
ritual_id = 1 # got this from a side channel
ritual = coordinator_agent.get_ritual(ritual_id)
@ -73,11 +77,10 @@ print(f"\nEncrypted message:\n{bytes(threshold_message_kit).hex()}")
print("--------- Threshold Decryption ---------")
bob = Bob(
eth_endpoint=staking_provider_uri,
domain=network,
coordinator_provider_uri=coordinator_provider_uri,
coordinator_network=coordinator_network,
registry=ContractRegistry.from_latest_publication(domain=network),
domain=taco_network.name,
eth_endpoint=eth_endpoint,
polygon_endpoint=polygon_endpoint,
registry=registry,
)
bob.start_learning_loop(now=True)