Use traceBlock instead of traceFilter due to bug in parity https://github.com/paritytech/parity-ethereum/issues/9822

This commit is contained in:
Evgeny Medvedev
2018-10-30 13:25:52 +07:00
parent cdbc554e77
commit 0b3f4d6be1
2 changed files with 13 additions and 8 deletions

View File

@@ -41,7 +41,8 @@ class ExportTracesJob(BaseJob):
self.web3 = web3
self.batch_work_executor = BatchWorkExecutor(batch_size, max_workers)
# TODO: use batch_size when this issue is fixed https://github.com/paritytech/parity-ethereum/issues/9822
self.batch_work_executor = BatchWorkExecutor(1, max_workers)
self.item_exporter = item_exporter
self.trace_mapper = EthTraceMapper()
@@ -57,14 +58,14 @@ class ExportTracesJob(BaseJob):
)
def _export_batch(self, block_number_batch):
assert len(block_number_batch) > 0
# TODO: Change to len(block_number_batch) > 0 when this issue is fixed
# https://github.com/paritytech/parity-ethereum/issues/9822
assert len(block_number_batch) == 1
block_number = block_number_batch[0]
filter_params = {
'fromBlock': hex(block_number_batch[0]),
'toBlock': hex(block_number_batch[-1]),
}
json_traces = self.web3.parity.traceFilter(filter_params)
# TODO: Change to traceFilter when this issue is fixed
# https://github.com/paritytech/parity-ethereum/issues/9822
json_traces = self.web3.parity.traceBlock(block_number)
for json_trace in json_traces:
trace = self.trace_mapper.json_dict_to_trace(json_trace)

View File

@@ -35,6 +35,10 @@ class MockWeb3Provider(IPCProvider):
to = params[0]['to'].lower()
data = params[0]['data']
file_name = '{}_{}_{}.json'.format(method, to, data)
# TODO: Remove this when this issue is fixed
# https://github.com/paritytech/parity-ethereum/issues/9822
elif method == 'trace_block':
file_name = 'trace_filter.json'
else:
file_name = method + '.json'
file_content = self.read_resource(file_name)