Rehabilitate tx list test in cic-eth

This commit is contained in:
nolash 2021-07-25 18:05:13 +02:00
parent 7485ac81ba
commit 3470399a32
Signed by untrusted user who does not match committer: lash
GPG Key ID: 21D2E7BB88C2A746
5 changed files with 14 additions and 16 deletions

View File

@ -10,5 +10,5 @@ celery==4.4.7
redis==3.5.3
chainsyncer[sql]>=0.0.6a1,<0.1.0
erc20-faucet>=0.2.4a2, <0.3.0
chainlib-eth>=0.0.7a2,<0.1.0
chainlib-eth>=0.0.7a3,<0.1.0
eth-address-index>=0.1.4a1,<0.2.0

View File

@ -26,6 +26,7 @@ from chainqueue.db.enum import StatusEnum
from chainqueue.sql.query import get_tx_cache
from eth_erc20 import ERC20
from erc20_faucet import Faucet
from potaahto.symbols import snake_and_camel
# local imports
from cic_eth.queue.time import tx_times
@ -107,7 +108,6 @@ def list_tx_by_bloom(self, bloomspec, address, chain_spec_dict):
logg.debug('filter matched block {}'.format(block_height))
o = block_by_number(block_height)
block = rpc.do(o)
logg.debug('block {}'.format(block))
for tx_index in range(0, len(block['transactions'])):
tx_index_bytes = tx_index.to_bytes(4, 'big')
@ -115,9 +115,8 @@ def list_tx_by_bloom(self, bloomspec, address, chain_spec_dict):
if tx_filter.check(composite):
logg.debug('filter matched block {} tx {}'.format(block_height, tx_index))
o = transaction_by_block(block['hash'], tx_index)
try:
#tx = c.w3.eth.getTransactionByBlock(block_height, tx_index)
o = transaction_by_block(block['hash'], tx_index)
tx = rpc.do(o)
except Exception as e:
logg.debug('false positive on block {} tx {} ({})'.format(block_height, tx_index, e))

View File

@ -1,3 +1,3 @@
celery==4.4.7
chainlib-eth>=0.0.7a2,<0.1.0
chainlib-eth>=0.0.7a3,<0.1.0
semver==2.13.0

View File

@ -11,7 +11,7 @@ def test_check_gas(
whoever,
):
config.add(str(default_chain_spec), 'CIC_CHAIN_SPEC', exists_ok=True)
config.add(str(default_chain_spec), 'CHAIN_SPEC', exists_ok=True)
config.add(100, 'ETH_GAS_GIFTER_MINIMUM_BALANCE', exists_ok=True)
assert health(config=config)

View File

@ -20,7 +20,6 @@ from cic_eth.db.models.nonce import (
logg = logging.getLogger()
# TODO: This test fails when not run alone. Identify which fixture leaves a dirty state
def test_filter_process(
init_database,
default_chain_spec,
@ -31,7 +30,7 @@ def test_filter_process(
init_custodial,
cic_registry,
foo_token,
celery_session_worker,
celery_worker,
):
b = moolb.Bloom(1024, 3)
@ -48,10 +47,10 @@ def test_filter_process(
eth_rpc.do(o)
o = receipt(tx_hash_hex)
r = eth_rpc.do(o)
a = r['block_number']
b.add(a.to_bytes(4, 'big'))
a = r['block_number'] + r['transaction_index']
t.add(a.to_bytes(4, 'big'))
block_bytes = r['block_number'].to_bytes(4, 'big')
b.add(block_bytes)
tx_index_bytes = r['transaction_index'].to_bytes(4, 'big')
t.add(block_bytes + tx_index_bytes)
tx_hashes.append(tx_hash_hex)
# external tx
@ -61,10 +60,10 @@ def test_filter_process(
eth_rpc.do(o)
o = receipt(tx_hash_hex)
r = eth_rpc.do(o)
a = r['block_number']
b.add(a.to_bytes(4, 'big'))
a = r['block_number'] + r['transaction_index']
t.add(a.to_bytes(4, 'big'))
block_bytes = r['block_number'].to_bytes(4, 'big')
b.add(block_bytes)
tx_index_bytes = r['transaction_index'].to_bytes(4, 'big')
t.add(block_bytes + tx_index_bytes)
tx_hashes.append(tx_hash_hex)
init_eth_tester.mine_blocks(10)