Removes BlockchainPolicyAuthor.

pull/2861/head
Kieran Prasch 2022-01-12 13:33:17 -08:00
parent ed64aa3ac4
commit c6efd5fd06
4 changed files with 18 additions and 51 deletions

View File

@ -17,25 +17,23 @@ along with nucypher. If not, see <https://www.gnu.org/licenses/>.
import json
import maya
import os
import time
from constant_sorrow.constants import FULL, WORKER_NOT_RUNNING
from datetime import datetime
from decimal import Decimal
from typing import Callable, Union
from typing import Dict, Iterable, List, Optional, Tuple
import maya
from constant_sorrow.constants import FULL, WORKER_NOT_RUNNING
from eth_tester.exceptions import TransactionFailed as TestTransactionFailed
from eth_typing import ChecksumAddress
from eth_utils import to_canonical_address
from hexbytes import HexBytes
from typing import Callable, Union
from typing import Dict, Iterable, List, Optional, Tuple
from nucypher_core import HRAC
from web3 import Web3
from web3.exceptions import ValidationError
from web3.types import TxReceipt
from nucypher_core import HRAC
from nucypher.acumen.nicknames import Nickname
from nucypher.blockchain.economics import (
BaseEconomics,
@ -48,7 +46,6 @@ from nucypher.blockchain.eth.agents import (
MultiSigAgent,
NucypherTokenAgent,
PolicyManagerAgent,
StakersReservoir,
StakingEscrowAgent,
TokenManagerAgent,
VotingAgent,
@ -101,13 +98,12 @@ from nucypher.blockchain.eth.token import (
)
from nucypher.blockchain.eth.utils import (
calculate_period_duration,
datetime_at_period,
datetime_to_period,
prettify_eth_amount
)
from nucypher.characters.banners import STAKEHOLDER_BANNER
from nucypher.control.emitters import StdoutEmitter
from nucypher.config.constants import DEFAULT_CONFIG_ROOT
from nucypher.control.emitters import StdoutEmitter
from nucypher.crypto.powers import TransactingPower
from nucypher.policy.policies import Policy
from nucypher.types import NuNits, Period
@ -1225,6 +1221,7 @@ class Worker(NucypherTokenActor):
missing = self.staking_agent.get_missing_commitments(checksum_address=staker_address)
return missing
<<<<<<< HEAD
def verify_policy_payment(self, hrac: HRAC) -> None:
arrangements = self.policy_agent.fetch_policy_arrangements(policy_id=bytes(hrac))
members = set()
@ -1360,6 +1357,8 @@ class BlockchainPolicyAuthor(NucypherTokenActor):
blockchain_policy = BlockchainPolicy(publisher=self, *args, **kwargs)
return blockchain_policy
=======
>>>>>>> f400a6409... Removes BlockchainPolicyAuthor.
class Investigator(NucypherTokenActor):
"""

View File

@ -49,6 +49,10 @@ from nucypher_core import (
NodeMetadataPayload,
HRAC,
)
from nucypher_core.umbral import (
PublicKey, VerifiedKeyFrag, reencrypt,
)
from twisted.internet import reactor, stdio
from twisted.internet.defer import Deferred
from twisted.logger import Logger
@ -57,7 +61,6 @@ from web3.types import TxReceipt
import nucypher
from nucypher.acumen.nicknames import Nickname
from nucypher.acumen.perception import ArchivedFleetState, RemoteUrsulaStatus
from nucypher.blockchain.eth.actors import BlockchainPolicyAuthor
from nucypher.blockchain.eth.actors import ThresholdWorker
from nucypher.blockchain.eth.agents import ContractAgency
from nucypher.blockchain.eth.agents import StakingEscrowAgent
@ -95,7 +98,7 @@ from nucypher.utilities.logging import Logger
from nucypher.utilities.networking import validate_worker_ip
class Alice(Character, BlockchainPolicyAuthor):
class Alice(Character):
banner = ALICE_BANNER
_interface_class = AliceInterface
_default_crypto_powerups = [SigningPower, DecryptingPower, DelegatingPower]
@ -164,7 +167,9 @@ class Alice(Character, BlockchainPolicyAuthor):
signer = signer or Web3Signer(blockchain.client) # fallback to web3 provider by default for Alice.
self.transacting_power = TransactingPower(account=self.checksum_address, signer=signer)
self._crypto_power.consume_power_up(self.transacting_power)
# BlockchainPolicyAuthor was here
self.staking_agent = ContractAgency.get_agent(StakingEscrowAgent, registry=self.registry)
self.log = Logger(self.__class__.__name__)
if is_me:

View File

@ -6,7 +6,7 @@ import maya
from nucypher.blockchain.eth.agents import PolicyManagerAgent, SubscriptionManagerAgent
from nucypher.blockchain.eth.registry import InMemoryContractRegistry
from nucypher.blockchain.eth.utils import get_current_period, datetime_at_period, calculate_period_duration
from nucypher.core import ReencryptionRequest
from nucypher_core import ReencryptionRequest
from nucypher.policy.policies import BlockchainPolicy
from hexbytes import HexBytes
from nucypher.blockchain.economics import EconomicsFactory

View File

@ -1,37 +0,0 @@
"""
This file is part of nucypher.
nucypher is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
nucypher is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with nucypher. If not, see <https://www.gnu.org/licenses/>.
"""
import pytest
from nucypher.config.constants import TEMPORARY_DOMAIN
from nucypher.blockchain.eth.actors import BlockchainPolicyAuthor
@pytest.fixture(scope='module')
def author(testerchain, agency, test_registry):
_origin, ursula, alice, *everybody_else = testerchain.client.accounts
author = BlockchainPolicyAuthor(checksum_address=alice, registry=test_registry)
return author
def test_create_policy_author(testerchain, agency, test_registry):
_origin, ursula, alice, *everybody_else = testerchain.client.accounts
policy_author = BlockchainPolicyAuthor(checksum_address=alice,
domain=TEMPORARY_DOMAIN,
registry=test_registry)
assert policy_author.checksum_address == alice