Rehabilitate tx list test in cic-eth
This commit is contained in:
parent
7485ac81ba
commit
3470399a32
@ -10,5 +10,5 @@ celery==4.4.7
|
|||||||
redis==3.5.3
|
redis==3.5.3
|
||||||
chainsyncer[sql]>=0.0.6a1,<0.1.0
|
chainsyncer[sql]>=0.0.6a1,<0.1.0
|
||||||
erc20-faucet>=0.2.4a2, <0.3.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
|
eth-address-index>=0.1.4a1,<0.2.0
|
||||||
|
@ -26,6 +26,7 @@ from chainqueue.db.enum import StatusEnum
|
|||||||
from chainqueue.sql.query import get_tx_cache
|
from chainqueue.sql.query import get_tx_cache
|
||||||
from eth_erc20 import ERC20
|
from eth_erc20 import ERC20
|
||||||
from erc20_faucet import Faucet
|
from erc20_faucet import Faucet
|
||||||
|
from potaahto.symbols import snake_and_camel
|
||||||
|
|
||||||
# local imports
|
# local imports
|
||||||
from cic_eth.queue.time import tx_times
|
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))
|
logg.debug('filter matched block {}'.format(block_height))
|
||||||
o = block_by_number(block_height)
|
o = block_by_number(block_height)
|
||||||
block = rpc.do(o)
|
block = rpc.do(o)
|
||||||
logg.debug('block {}'.format(block))
|
|
||||||
|
|
||||||
for tx_index in range(0, len(block['transactions'])):
|
for tx_index in range(0, len(block['transactions'])):
|
||||||
tx_index_bytes = tx_index.to_bytes(4, 'big')
|
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):
|
if tx_filter.check(composite):
|
||||||
logg.debug('filter matched block {} tx {}'.format(block_height, tx_index))
|
logg.debug('filter matched block {} tx {}'.format(block_height, tx_index))
|
||||||
|
|
||||||
try:
|
|
||||||
#tx = c.w3.eth.getTransactionByBlock(block_height, tx_index)
|
|
||||||
o = transaction_by_block(block['hash'], tx_index)
|
o = transaction_by_block(block['hash'], tx_index)
|
||||||
|
try:
|
||||||
tx = rpc.do(o)
|
tx = rpc.do(o)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logg.debug('false positive on block {} tx {} ({})'.format(block_height, tx_index, e))
|
logg.debug('false positive on block {} tx {} ({})'.format(block_height, tx_index, e))
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
celery==4.4.7
|
celery==4.4.7
|
||||||
chainlib-eth>=0.0.7a2,<0.1.0
|
chainlib-eth>=0.0.7a3,<0.1.0
|
||||||
semver==2.13.0
|
semver==2.13.0
|
||||||
|
@ -11,7 +11,7 @@ def test_check_gas(
|
|||||||
whoever,
|
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)
|
config.add(100, 'ETH_GAS_GIFTER_MINIMUM_BALANCE', exists_ok=True)
|
||||||
assert health(config=config)
|
assert health(config=config)
|
||||||
|
|
||||||
|
@ -20,7 +20,6 @@ from cic_eth.db.models.nonce import (
|
|||||||
logg = logging.getLogger()
|
logg = logging.getLogger()
|
||||||
|
|
||||||
|
|
||||||
# TODO: This test fails when not run alone. Identify which fixture leaves a dirty state
|
|
||||||
def test_filter_process(
|
def test_filter_process(
|
||||||
init_database,
|
init_database,
|
||||||
default_chain_spec,
|
default_chain_spec,
|
||||||
@ -31,7 +30,7 @@ def test_filter_process(
|
|||||||
init_custodial,
|
init_custodial,
|
||||||
cic_registry,
|
cic_registry,
|
||||||
foo_token,
|
foo_token,
|
||||||
celery_session_worker,
|
celery_worker,
|
||||||
):
|
):
|
||||||
|
|
||||||
b = moolb.Bloom(1024, 3)
|
b = moolb.Bloom(1024, 3)
|
||||||
@ -48,10 +47,10 @@ def test_filter_process(
|
|||||||
eth_rpc.do(o)
|
eth_rpc.do(o)
|
||||||
o = receipt(tx_hash_hex)
|
o = receipt(tx_hash_hex)
|
||||||
r = eth_rpc.do(o)
|
r = eth_rpc.do(o)
|
||||||
a = r['block_number']
|
block_bytes = r['block_number'].to_bytes(4, 'big')
|
||||||
b.add(a.to_bytes(4, 'big'))
|
b.add(block_bytes)
|
||||||
a = r['block_number'] + r['transaction_index']
|
tx_index_bytes = r['transaction_index'].to_bytes(4, 'big')
|
||||||
t.add(a.to_bytes(4, 'big'))
|
t.add(block_bytes + tx_index_bytes)
|
||||||
tx_hashes.append(tx_hash_hex)
|
tx_hashes.append(tx_hash_hex)
|
||||||
|
|
||||||
# external tx
|
# external tx
|
||||||
@ -61,10 +60,10 @@ def test_filter_process(
|
|||||||
eth_rpc.do(o)
|
eth_rpc.do(o)
|
||||||
o = receipt(tx_hash_hex)
|
o = receipt(tx_hash_hex)
|
||||||
r = eth_rpc.do(o)
|
r = eth_rpc.do(o)
|
||||||
a = r['block_number']
|
block_bytes = r['block_number'].to_bytes(4, 'big')
|
||||||
b.add(a.to_bytes(4, 'big'))
|
b.add(block_bytes)
|
||||||
a = r['block_number'] + r['transaction_index']
|
tx_index_bytes = r['transaction_index'].to_bytes(4, 'big')
|
||||||
t.add(a.to_bytes(4, 'big'))
|
t.add(block_bytes + tx_index_bytes)
|
||||||
tx_hashes.append(tx_hash_hex)
|
tx_hashes.append(tx_hash_hex)
|
||||||
|
|
||||||
init_eth_tester.mine_blocks(10)
|
init_eth_tester.mine_blocks(10)
|
||||||
|
Loading…
Reference in New Issue
Block a user