diff --git a/apps/cic-eth/cic_eth/eth/gas.py b/apps/cic-eth/cic_eth/eth/gas.py index 40f569af..7e32bf04 100644 --- a/apps/cic-eth/cic_eth/eth/gas.py +++ b/apps/cic-eth/cic_eth/eth/gas.py @@ -9,7 +9,10 @@ from hexathon import ( ) #from chainlib.eth.constant import ZERO_ADDRESS from chainlib.chain import ChainSpec -from chainlib.eth.address import is_checksum_address +from chainlib.eth.address import ( + is_checksum_address, + to_checksum_address, + ) from chainlib.connection import RPCConnection from chainqueue.db.enum import StatusBits from chainqueue.sql.tx import cache_tx_dict @@ -179,6 +182,7 @@ def check_gas(self, tx_hashes_hex, chain_spec_dict, txs_hex=[], address=None, ga :return: Signed raw transaction data list :rtype: param txs, unchanged """ + rpc_format_address = None if address != None: if not is_checksum_address(address): raise ValueError('invalid address {}'.format(address)) @@ -195,7 +199,6 @@ def check_gas(self, tx_hashes_hex, chain_spec_dict, txs_hex=[], address=None, ga txs.append(tx) chain_spec = ChainSpec.from_dict(chain_spec_dict) - logg.debug('txs {} tx_hashes {}'.format(txs, tx_hashes)) addresspass = None if len(txs) == 0: @@ -211,13 +214,15 @@ def check_gas(self, tx_hashes_hex, chain_spec_dict, txs_hex=[], address=None, ga raise ValueError('txs passed to check gas must all have same sender; had {} got {}'.format(address, tx['from'])) addresspass.append(address) + rpc_format_address = add_0x(to_checksum_address(address)) + queue = self.request.delivery_info.get('routing_key') conn = RPCConnection.connect(chain_spec) gas_balance = 0 try: - o = balance(address) + o = balance(rpc_format_address) r = conn.do(o) conn.disconnect() gas_balance = abi_decode_single(ABIContractType.UINT256, r) diff --git a/apps/cic-eth/tests/filters/test_callback_filter.py b/apps/cic-eth/tests/filters/test_callback_filter.py index 79168ae5..4b99de12 100644 --- a/apps/cic-eth/tests/filters/test_callback_filter.py +++ b/apps/cic-eth/tests/filters/test_callback_filter.py @@ -225,4 +225,4 @@ def test_callback_filter_filter( fltr.filter(eth_rpc, mockblock, tx, init_database) assert mock.results.get('transfer') != None - assert mock.results['transfer']['destination_token'] == foo_token + assert mock.results['transfer']['destination_token'] == strip_0x(foo_token) diff --git a/apps/cic-eth/tests/filters/test_transferauth_filter.py b/apps/cic-eth/tests/filters/test_transferauth_filter.py index 850640a9..ac84139a 100644 --- a/apps/cic-eth/tests/filters/test_transferauth_filter.py +++ b/apps/cic-eth/tests/filters/test_transferauth_filter.py @@ -78,4 +78,4 @@ def test_filter_transferauth( c = ERC20(default_chain_spec) approve = c.parse_approve_request(approve_tx['data']) - assert approve[0] == agent_roles['BOB'] + assert approve[0] == strip_0x(agent_roles['BOB'])