From 9149024231be92908c9ebc2ae49bea6a8c956cab Mon Sep 17 00:00:00 2001 From: nolash Date: Thu, 7 Oct 2021 16:56:44 +0200 Subject: [PATCH] Rehabilitate tests --- apps/cic-eth/cic_eth/eth/gas.py | 1 - apps/cic-eth/cic_eth/eth/nonce.py | 6 ++++-- .../cic_eth/runnable/daemons/filters/transferauth.py | 7 ++++--- apps/cic-eth/tests/task/api/test_admin.py | 4 ++-- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/apps/cic-eth/cic_eth/eth/gas.py b/apps/cic-eth/cic_eth/eth/gas.py index 86e8c3a5..435949fc 100644 --- a/apps/cic-eth/cic_eth/eth/gas.py +++ b/apps/cic-eth/cic_eth/eth/gas.py @@ -78,7 +78,6 @@ class MaxGasOracle: return MAXIMUM_FEE_UNITS -#def create_check_gas_task(tx_signed_raws_hex, chain_spec, holder_address, gas=None, tx_hashes_hex=None, queue=None): def create_check_gas_task(tx_signed_raws_hex, chain_spec, holder_address, gas=None, tx_hashes_hex=None, queue=None): """Creates a celery task signature for a check_gas task that adds the task to the outgoing queue to be processed by the dispatcher. diff --git a/apps/cic-eth/cic_eth/eth/nonce.py b/apps/cic-eth/cic_eth/eth/nonce.py index 7d1c1338..6e493ff5 100644 --- a/apps/cic-eth/cic_eth/eth/nonce.py +++ b/apps/cic-eth/cic_eth/eth/nonce.py @@ -43,7 +43,8 @@ class CustodialTaskNonceOracle(): :returns: Nonce :rtype: number """ - r = NonceReservation.release(self.address, self.uuid, session=self.session) + address = tx_normalize.wallet_address(self.address) + r = NonceReservation.release(address, self.uuid, session=self.session) return r[1] @@ -70,7 +71,8 @@ def reserve_nonce(self, chained_input, chain_spec_dict, signer_address=None): raise ValueError('invalid result when resolving address for nonce {}'.format(address)) root_id = self.request.root_id - r = NonceReservation.next(tx_normalize.wallet_address(address), root_id, session=session) + address = tx_normalize.wallet_address(address) + r = NonceReservation.next(address, root_id, session=session) logg.debug('nonce {} reserved for address {} task {}'.format(r[1], address, r[0])) session.commit() diff --git a/apps/cic-eth/cic_eth/runnable/daemons/filters/transferauth.py b/apps/cic-eth/cic_eth/runnable/daemons/filters/transferauth.py index 3ba77791..7288d349 100644 --- a/apps/cic-eth/cic_eth/runnable/daemons/filters/transferauth.py +++ b/apps/cic-eth/cic_eth/runnable/daemons/filters/transferauth.py @@ -17,6 +17,7 @@ from cic_eth_registry import CICRegistry from erc20_transfer_authorization import TransferAuthorization # local imports +from cic_eth.encode import tx_normalize from .base import SyncFilter @@ -52,9 +53,9 @@ class TransferAuthFilter(SyncFilter): r = TransferAuthorization.parse_create_request_request(tx.payload) - sender = r[0] - recipient = r[1] - token = r[2] + sender = tx_normalize.wallet_address(r[0]) + recipient = tx_normalize.wallet_address(r[1]) + token = tx_normalize.executable_address(r[2]) value = r[3] token_data = { diff --git a/apps/cic-eth/tests/task/api/test_admin.py b/apps/cic-eth/tests/task/api/test_admin.py index 71ac61f4..363fb8d7 100644 --- a/apps/cic-eth/tests/task/api/test_admin.py +++ b/apps/cic-eth/tests/task/api/test_admin.py @@ -110,8 +110,8 @@ def test_tag_account( t = api.tag_account('bar', agent_roles['CAROL'], default_chain_spec) t.get() - assert AccountRole.get_address('foo', init_database) == agent_roles['ALICE'] - assert AccountRole.get_address('bar', init_database) == agent_roles['CAROL'] + assert AccountRole.get_address('foo', init_database) == tx_normalize.wallet_address(agent_roles['ALICE']) + assert AccountRole.get_address('bar', init_database) == tx_normalize.wallet_address(agent_roles['CAROL']) def test_tx(