mirror of https://github.com/nucypher/nucypher.git
Move TESTERCHAIN chain information out of domains and into testing constants.
parent
4ed74fc0f2
commit
2a0bd02203
|
@ -11,13 +11,11 @@ class EthChain(ChainInfo, Enum):
|
|||
MAINNET = (1, "mainnet")
|
||||
GOERLI = (5, "goerli")
|
||||
SEPOLIA = (11155111, "sepolia")
|
||||
TESTERCHAIN = (131277322940537, "eth-tester")
|
||||
|
||||
|
||||
class PolygonChain(ChainInfo, Enum):
|
||||
MAINNET = (137, "polygon")
|
||||
MUMBAI = (80001, "mumbai")
|
||||
TESTERCHAIN = (131277322940537, "eth-tester")
|
||||
|
||||
|
||||
class DomainInfo(NamedTuple):
|
||||
|
@ -25,12 +23,6 @@ class DomainInfo(NamedTuple):
|
|||
eth_chain: EthChain
|
||||
polygon_chain: PolygonChain
|
||||
|
||||
def __str__(self) -> str:
|
||||
return self.name
|
||||
|
||||
def __bytes__(self) -> bytes:
|
||||
return self.name.encode()
|
||||
|
||||
@property
|
||||
def is_testnet(self) -> bool:
|
||||
return self.eth_chain != EthChain.MAINNET
|
||||
|
|
|
@ -13,8 +13,6 @@ from nucypher.blockchain.eth.agents import (
|
|||
)
|
||||
from nucypher.blockchain.eth.domains import (
|
||||
DomainInfo,
|
||||
EthChain,
|
||||
PolygonChain,
|
||||
TACoDomain,
|
||||
)
|
||||
from nucypher.blockchain.eth.interfaces import BlockchainInterfaceFactory
|
||||
|
@ -30,6 +28,7 @@ from tests.constants import (
|
|||
MIN_OPERATOR_SECONDS,
|
||||
TEST_ETH_PROVIDER_URI,
|
||||
TESTERCHAIN_CHAIN_ID,
|
||||
TESTERCHAIN_CHAIN_INFO,
|
||||
)
|
||||
from tests.utils.blockchain import TesterBlockchain
|
||||
from tests.utils.registry import ApeRegistrySource
|
||||
|
@ -442,7 +441,7 @@ def mock_condition_blockchains(module_mocker):
|
|||
)
|
||||
|
||||
test_domain_info = DomainInfo(
|
||||
TEMPORARY_DOMAIN, EthChain.TESTERCHAIN, PolygonChain.TESTERCHAIN
|
||||
TEMPORARY_DOMAIN, TESTERCHAIN_CHAIN_INFO, TESTERCHAIN_CHAIN_INFO
|
||||
)
|
||||
|
||||
module_mocker.patch.object(
|
||||
|
|
|
@ -6,15 +6,17 @@ from eth_utils.crypto import keccak
|
|||
from nucypher.blockchain.eth.actors import Operator
|
||||
from nucypher.blockchain.eth.domains import (
|
||||
DomainInfo,
|
||||
EthChain,
|
||||
PolygonChain,
|
||||
TACoDomain,
|
||||
)
|
||||
from nucypher.config.constants import TEMPORARY_DOMAIN
|
||||
from nucypher.crypto.powers import TransactingPower
|
||||
from nucypher.network.nodes import Learner
|
||||
from nucypher.utilities.logging import GlobalLoggerSettings
|
||||
from tests.constants import MOCK_IP_ADDRESS, TESTERCHAIN_CHAIN_ID
|
||||
from tests.constants import (
|
||||
MOCK_IP_ADDRESS,
|
||||
TESTERCHAIN_CHAIN_ID,
|
||||
TESTERCHAIN_CHAIN_INFO,
|
||||
)
|
||||
|
||||
# Don't re-lock accounts in the background while making commitments
|
||||
LOCK_FUNCTION = TransactingPower.lock_account
|
||||
|
@ -148,7 +150,7 @@ def mock_condition_blockchains(module_mocker):
|
|||
{TESTERCHAIN_CHAIN_ID: "eth-tester/pyevm"},
|
||||
)
|
||||
test_domain_info = DomainInfo(
|
||||
TEMPORARY_DOMAIN, EthChain.TESTERCHAIN, PolygonChain.TESTERCHAIN
|
||||
TEMPORARY_DOMAIN, TESTERCHAIN_CHAIN_INFO, TESTERCHAIN_CHAIN_INFO
|
||||
)
|
||||
|
||||
module_mocker.patch.object(
|
||||
|
|
|
@ -7,6 +7,7 @@ from random import SystemRandom
|
|||
from hexbytes import HexBytes
|
||||
from web3 import Web3
|
||||
|
||||
from nucypher.blockchain.eth.domains import ChainInfo
|
||||
from nucypher.blockchain.eth.token import NU
|
||||
from nucypher.config.constants import (
|
||||
NUCYPHER_ENVVAR_KEYSTORE_PASSWORD,
|
||||
|
@ -71,6 +72,8 @@ NUMBER_OF_ALLOCATIONS_IN_TESTS = 50 # TODO: Move to constants
|
|||
|
||||
TESTERCHAIN_CHAIN_ID = 131277322940537
|
||||
|
||||
TESTERCHAIN_CHAIN_INFO = ChainInfo(131277322940537, "eth-tester")
|
||||
|
||||
|
||||
#
|
||||
# Insecure Secrets
|
||||
|
|
|
@ -16,8 +16,6 @@ from nucypher.blockchain.eth.agents import (
|
|||
from nucypher.blockchain.eth.clients import EthereumClient
|
||||
from nucypher.blockchain.eth.domains import (
|
||||
DomainInfo,
|
||||
EthChain,
|
||||
PolygonChain,
|
||||
TACoDomain,
|
||||
)
|
||||
from nucypher.blockchain.eth.interfaces import (
|
||||
|
@ -40,6 +38,7 @@ from tests.constants import (
|
|||
MOCK_KEYSTORE_PATH,
|
||||
NUMBER_OF_MOCK_KEYSTORE_ACCOUNTS,
|
||||
TESTERCHAIN_CHAIN_ID,
|
||||
TESTERCHAIN_CHAIN_INFO,
|
||||
)
|
||||
from tests.mock.interfaces import MockBlockchain
|
||||
from tests.mock.io import MockStdinWrapper
|
||||
|
@ -292,7 +291,7 @@ def mock_condition_blockchains(module_mocker):
|
|||
)
|
||||
|
||||
test_domain_info = DomainInfo(
|
||||
TEMPORARY_DOMAIN, EthChain.TESTERCHAIN, PolygonChain.TESTERCHAIN
|
||||
TEMPORARY_DOMAIN, TESTERCHAIN_CHAIN_INFO, TESTERCHAIN_CHAIN_INFO
|
||||
)
|
||||
|
||||
module_mocker.patch.object(
|
||||
|
|
|
@ -7,8 +7,6 @@ from eth_utils import to_checksum_address
|
|||
|
||||
from nucypher.blockchain.eth.domains import (
|
||||
DomainInfo,
|
||||
EthChain,
|
||||
PolygonChain,
|
||||
TACoDomain,
|
||||
)
|
||||
from nucypher.blockchain.eth.registry import (
|
||||
|
@ -17,6 +15,7 @@ from nucypher.blockchain.eth.registry import (
|
|||
RegistrySourceManager,
|
||||
)
|
||||
from nucypher.config.constants import TEMPORARY_DOMAIN
|
||||
from tests.constants import TESTERCHAIN_CHAIN_INFO
|
||||
|
||||
|
||||
@contextmanager
|
||||
|
@ -28,7 +27,7 @@ def mock_registry_sources(mocker, domain_names: List[str] = None):
|
|||
supported_domain_names = []
|
||||
for domain_name in domain_names:
|
||||
test_domain = DomainInfo(
|
||||
domain_name, EthChain.TESTERCHAIN, PolygonChain.TESTERCHAIN
|
||||
domain_name, TESTERCHAIN_CHAIN_INFO, TESTERCHAIN_CHAIN_INFO
|
||||
)
|
||||
supported_domains.append(test_domain)
|
||||
supported_domain_names.append(domain_name)
|
||||
|
|
Loading…
Reference in New Issue