Remove randbytes call

This commit is contained in:
nolash 2021-11-29 15:39:16 +01:00
parent 69a0aea7ed
commit e7fcde7530
Signed by: lash
GPG Key ID: 21D2E7BB88C2A746
3 changed files with 47 additions and 7 deletions

View File

@ -38,7 +38,25 @@ logg = logging.getLogger(__name__)
class CICEth(Extension):
def __init__(self, chain_spec, resources, proof, signer=None, rpc=None, outputs_writer=None, fee_oracle=None):
"""resources will be modified
"""Implementation for the eth extension.
The state of the resources instance will be modified.
:param chain_spec: Chain Spec that extension will operate for
:type chain_spec: chainlib.chain.ChainSpec
:param resources: Chain application resources to deploy or interface with
:type resources: dict
:param proof: Proof object to publish
:type proof: cic.proof.Proof
:param signer: Signer capable of generating signatures for chain aplication deployments
:type signer: funga.signer.Signer
:param rpc: RPC adapter capable of submitting and querying the chain network node
:type rpc: chainlib.connection.RPCConnection
:param outputs_writer: Writer interface receiving the output of the processor
:type outputs_writer: cic.output.OutputWriter
:param fee_oracle: Fee oracle required by signer
:type fee_oracle: chainlib.fee.FeeOracle
"""
super(CICEth, self).__init__(chain_spec, resources, proof, signer=signer, rpc=rpc, outputs_writer=outputs_writer)
self.fee_oracle = fee_oracle

View File

@ -16,11 +16,25 @@ logg = logging.getLogger(__name__)
class EthKeystoreDirectory(DictKeystore, KeystoreDirectory):
"""Combination of DictKeystore and KeystoreDirectory
TODO: Move to funga
"""
pass
def parse_adapter(config, signer_hint):
"""Determine and instantiate signer and rpc from configuration.
If either could not be determined, None is returned.
:param config: Configuration object implementing the get() method
:type config: dict, object with get()
:param signer_hint: Signer resource description (e.g. keystore directory)
:type signer_hint: str
:rtype: tuple; chainlib.connection.RPCConnection, funga.signer.Signer
:return: RPC interface, signer interface
"""
keystore = None
if signer_hint == None:
logg.info('signer hint missing')

View File

@ -31,11 +31,19 @@ class TestCICBase(unittest.TestCase):
super(TestCICBase, self).setUp()
random.seed(42)
addresses = [
add_0x(random.randbytes(20).hex()),
add_0x(random.randbytes(20).hex()),
add_0x(random.randbytes(20).hex()),
]
f = open('/dev/urandom', 'rb')
addresses = []
for i in range(3):
address_bytes = f.read(32)
addresses.append(add_0x(address_bytes.hex()))
f.close()
# addresses = [
# add_0x(random.randbytes(20).hex()),
# add_0x(random.randbytes(20).hex()),
# add_0x(random.randbytes(20).hex()),
# ]
self.token_symbol = 'FOO'
self.token_address = add_0x(random.randbytes(32).hex())
self.token_index_address = add_0x(random.randbytes(32).hex())