more work on operatr abstraction leaks

pull/3030/head
Kieran Prasch 2022-12-07 11:11:01 +00:00
parent 542789500c
commit e440f78b20
2 changed files with 29 additions and 19 deletions

View File

@ -2,12 +2,11 @@
import json
import time
from decimal import Decimal
from typing import Optional, Tuple
from typing import Union
from typing import Optional, Tuple, Union
import maya
import time
from constant_sorrow.constants import FULL
from eth_typing import ChecksumAddress
from eth_utils import to_checksum_address
@ -21,15 +20,16 @@ from nucypher.blockchain.eth.agents import (
AdjudicatorAgent,
ContractAgency,
NucypherTokenAgent,
PREApplicationAgent
PREApplicationAgent,
)
from nucypher.blockchain.eth.constants import NULL_ADDRESS
from nucypher.blockchain.eth.decorators import save_receipt, validate_checksum_address
from nucypher.blockchain.eth.deployers import (
AdjudicatorDeployer,
BaseContractDeployer,
NucypherTokenDeployer,
PREApplicationDeployer,
SubscriptionManagerDeployer, AdjudicatorDeployer
SubscriptionManagerDeployer,
)
from nucypher.blockchain.eth.interfaces import BlockchainInterfaceFactory
from nucypher.blockchain.eth.registry import BaseContractRegistry
@ -290,18 +290,25 @@ class Operator(BaseActor):
class OperatorError(BaseActor.ActorError):
pass
def __init__(self,
is_me: bool,
payment_method: ContractPayment,
work_tracker: Optional[WorkTracker] = None,
operator_address: Optional[ChecksumAddress] = None,
eth_provider_uri: Optional[str] = None,
*args, **kwargs):
def __init__(
self,
is_me: bool,
payment_method: ContractPayment,
work_tracker: Optional[WorkTracker] = None,
operator_address: Optional[ChecksumAddress] = None,
eth_provider_uri: Optional[str] = None,
*args,
**kwargs,
):
if not eth_provider_uri:
raise ValueError('ETH Provider URI is required to init a decentralized character.')
raise ValueError(
"ETH Provider URI is required to init a decentralized character."
)
if not payment_method:
raise ValueError('Payment method is required to init a decentralized character.')
raise ValueError(
"Payment method is required to init a decentralized character."
)
super().__init__(*args, **kwargs)

View File

@ -11,14 +11,17 @@ from eth_account.messages import encode_defunct
from eth_typing.evm import BlockNumber, ChecksumAddress
from eth_utils import to_canonical_address, to_checksum_address
from web3 import Web3
from web3.contract import Contract
from web3.types import Wei, TxReceipt
from web3._utils.threads import Timeout
from web3.contract import Contract
from web3.exceptions import TimeExhausted, TransactionNotFound
from web3.types import TxReceipt, Wei
from nucypher.blockchain.eth.constants import AVERAGE_BLOCK_TIME_IN_SECONDS
from nucypher.blockchain.middleware.retry import RetryRequestMiddleware, AlchemyRetryRequestMiddleware, \
InfuraRetryRequestMiddleware
from nucypher.blockchain.middleware.retry import (
AlchemyRetryRequestMiddleware,
InfuraRetryRequestMiddleware,
RetryRequestMiddleware,
)
from nucypher.utilities.logging import Logger
UNKNOWN_DEVELOPMENT_CHAIN_ID.bool_value(True)
@ -542,7 +545,7 @@ class EthereumTesterClient(EthereumClient):
try:
signing_key = self.w3.provider.ethereum_tester.backend._key_lookup[account]._raw_key
except KeyError:
raise self.UnknownAccount(account)
raise self.UnknownAccount(account)
return signing_key
def sign_transaction(self, transaction_dict: dict) -> bytes: