Modify Vladimir to use InMemorySigner.

pull/3491/head
derekpierre 2024-04-26 17:33:24 -04:00
parent c7480e4bf5
commit 2b4b0ad9f5
No known key found for this signature in database
1 changed files with 2 additions and 26 deletions

View File

@ -4,7 +4,7 @@ from unittest.mock import Mock, patch
from nucypher_core import NodeMetadata from nucypher_core import NodeMetadata
from nucypher.blockchain.eth.signers.software import Web3Signer from nucypher.blockchain.eth.signers.software import InMemorySigner
from nucypher.characters.lawful import Alice, Ursula from nucypher.characters.lawful import Alice, Ursula
from nucypher.config.constants import TEMPORARY_DOMAIN_NAME from nucypher.config.constants import TEMPORARY_DOMAIN_NAME
from nucypher.crypto.powers import CryptoPower from nucypher.crypto.powers import CryptoPower
@ -49,8 +49,6 @@ class Vladimir(Ursula):
crypto_power = CryptoPower(power_ups=target_ursula._default_crypto_powerups) crypto_power = CryptoPower(power_ups=target_ursula._default_crypto_powerups)
cls.attach_transacting_key(blockchain=eth_blockchain)
# Vladimir does not care about payment. # Vladimir does not care about payment.
bogus_pre_payment_method = FreeReencryptions() bogus_pre_payment_method = FreeReencryptions()
bogus_pre_payment_method.provider = Mock() bogus_pre_payment_method.provider = Mock()
@ -73,7 +71,7 @@ class Vladimir(Ursula):
network_middleware=cls.network_middleware, network_middleware=cls.network_middleware,
checksum_address=cls.fraud_address, checksum_address=cls.fraud_address,
operator_address=cls.fraud_address, operator_address=cls.fraud_address,
signer=Web3Signer(eth_blockchain.client), signer=InMemorySigner(private_key=cls.fraud_key),
eth_endpoint=eth_blockchain.endpoint, eth_endpoint=eth_blockchain.endpoint,
polygon_endpoint=polygon_blockchain.endpoint, polygon_endpoint=polygon_blockchain.endpoint,
pre_payment_method=bogus_pre_payment_method, pre_payment_method=bogus_pre_payment_method,
@ -114,28 +112,6 @@ class Vladimir(Ursula):
return vladimir return vladimir
@classmethod
def attach_transacting_key(cls, blockchain):
"""
Upload Vladimir's ETH keys to the keychain via web3.
"""
try:
from eth_tester.exceptions import ValidationError
except ImportError:
raise DevelopmentInstallationRequired(
importable_name="eth_tester.exceptions.ValidationError"
)
try:
password = 'iamverybadass'
blockchain.w3.provider.ethereum_tester.add_account(cls.fraud_key, password=password)
except (ValidationError,):
# check if Vlad's key is already on the keystore...
if cls.fraud_address in blockchain.client.accounts:
return True
else:
raise
return True
class Amonia(Alice): class Amonia(Alice):
""" """