From 627982765753b69d31a6eb2e0685ac2255461720 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20N=C3=BA=C3=B1ez?= Date: Sun, 28 Mar 2021 19:58:48 +0200 Subject: [PATCH] Remove stale references to PreallocationEscrow contract stuff --- nucypher/blockchain/eth/constants.py | 2 -- nucypher/blockchain/eth/registry.py | 5 +---- tests/fixtures.py | 4 ++-- tests/integration/conftest.py | 4 +--- tests/mock/interfaces.py | 12 +----------- 5 files changed, 5 insertions(+), 22 deletions(-) diff --git a/nucypher/blockchain/eth/constants.py b/nucypher/blockchain/eth/constants.py index e0902a453..58dce1bca 100644 --- a/nucypher/blockchain/eth/constants.py +++ b/nucypher/blockchain/eth/constants.py @@ -26,7 +26,6 @@ STAKING_ESCROW_CONTRACT_NAME = 'StakingEscrow' STAKING_ESCROW_STUB_CONTRACT_NAME = 'StakingEscrowStub' POLICY_MANAGER_CONTRACT_NAME = 'PolicyManager' STAKING_INTERFACE_CONTRACT_NAME = 'StakingInterface' -PREALLOCATION_ESCROW_CONTRACT_NAME = 'PreallocationEscrow' ADJUDICATOR_CONTRACT_NAME = 'Adjudicator' WORKLOCK_CONTRACT_NAME = 'WorkLock' MULTISIG_CONTRACT_NAME = 'MultiSig' @@ -39,7 +38,6 @@ NUCYPHER_CONTRACT_NAMES = ( DISPATCHER_CONTRACT_NAME, STAKING_INTERFACE_CONTRACT_NAME, STAKING_INTERFACE_ROUTER_CONTRACT_NAME, - PREALLOCATION_ESCROW_CONTRACT_NAME, WORKLOCK_CONTRACT_NAME, MULTISIG_CONTRACT_NAME, ) diff --git a/nucypher/blockchain/eth/registry.py b/nucypher/blockchain/eth/registry.py index d3088d125..f2fe0a914 100644 --- a/nucypher/blockchain/eth/registry.py +++ b/nucypher/blockchain/eth/registry.py @@ -25,12 +25,9 @@ import shutil import tempfile from abc import ABC, abstractmethod from constant_sorrow.constants import REGISTRY_COMMITTED -from eth_typing.evm import ChecksumAddress -from typing import Dict, Iterator, List, Tuple, Type, Union, Optional -from web3.types import ABI +from typing import Dict, Iterator, List, Tuple, Type, Union from nucypher.blockchain.eth import CONTRACT_REGISTRY_BASE -from nucypher.blockchain.eth.constants import PREALLOCATION_ESCROW_CONTRACT_NAME from nucypher.blockchain.eth.networks import NetworksInventory from nucypher.config.constants import DEFAULT_CONFIG_ROOT from nucypher.utilities.logging import Logger diff --git a/tests/fixtures.py b/tests/fixtures.py index 835e0c3cd..b4b5c944b 100644 --- a/tests/fixtures.py +++ b/tests/fixtures.py @@ -566,8 +566,8 @@ def _make_agency(testerchain, test_registry, token_economics, deployer_transacti @pytest.fixture(scope='module') -def test_registry_source_manager(testerchain, test_registry): - with mock_registry_source_manager(blockchain=testerchain, test_registry=test_registry): +def test_registry_source_manager(test_registry): + with mock_registry_source_manager(test_registry=test_registry): yield diff --git a/tests/integration/conftest.py b/tests/integration/conftest.py index 3d1639783..f4d30283e 100644 --- a/tests/integration/conftest.py +++ b/tests/integration/conftest.py @@ -161,9 +161,7 @@ def test_registry(): @pytest.fixture(scope='module') def test_registry_source_manager(mock_testerchain, test_registry): - with mock_registry_source_manager(blockchain=mock_testerchain, - test_registry=test_registry, - mock_backend=True) as real_inventory: + with mock_registry_source_manager(test_registry=test_registry) as real_inventory: yield real_inventory diff --git a/tests/mock/interfaces.py b/tests/mock/interfaces.py index b87c5cbce..f596f696d 100644 --- a/tests/mock/interfaces.py +++ b/tests/mock/interfaces.py @@ -22,7 +22,6 @@ from contextlib import contextmanager from typing import Union from nucypher.blockchain.eth.clients import EthereumClient -from nucypher.blockchain.eth.constants import PREALLOCATION_ESCROW_CONTRACT_NAME from nucypher.blockchain.eth.networks import NetworksInventory from nucypher.blockchain.eth.registry import ( BaseContractRegistry, @@ -35,7 +34,7 @@ from tests.utils.blockchain import TesterBlockchain @contextmanager -def mock_registry_source_manager(blockchain, test_registry, mock_backend: bool = False): +def mock_registry_source_manager(test_registry): class MockRegistrySource(CanonicalRegistrySource): name = "Mock Registry Source" @@ -47,13 +46,6 @@ def mock_registry_source_manager(blockchain, test_registry, mock_backend: bool = raise ValueError(f"Somehow, MockRegistrySource is trying to get a registry for '{self.network}'. " f"Only '{TEMPORARY_DOMAIN}' is supported.'") - if not mock_backend: - factory = blockchain.get_contract_factory(contract_name=PREALLOCATION_ESCROW_CONTRACT_NAME) - preallocation_escrow_abi = factory.abi - self.allocation_template = { - "BENEFICIARY_ADDRESS": ["ALLOCATION_CONTRACT_ADDRESS", preallocation_escrow_abi] - } - def get_publication_endpoint(self) -> str: return f":mock-registry-source:/{self.network}/{self.registry_name}" @@ -61,8 +53,6 @@ def mock_registry_source_manager(blockchain, test_registry, mock_backend: bool = self.logger.debug(f"Reading registry at {self.get_publication_endpoint()}") if self.registry_name == BaseContractRegistry.REGISTRY_NAME: registry_data = test_registry.read() - elif self.registry_name == IndividualAllocationRegistry.REGISTRY_NAME: - registry_data = self.allocation_template raw_registry_data = json.dumps(registry_data) return raw_registry_data