Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add trace_id and status field values to ExtractGethTracesJob #400

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions ethereumetl/jobs/extract_geth_traces_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@
from ethereumetl.mappers.trace_mapper import EthTraceMapper
from ethereumetl.mappers.geth_trace_mapper import EthGethTraceMapper

from ethereumetl.service.trace_id_calculator import calculate_trace_ids
from ethereumetl.service.trace_status_calculator import calculate_trace_statuses


class ExtractGethTracesJob(BaseJob):
def __init__(
Expand All @@ -51,6 +54,10 @@ def _extract_geth_traces(self, geth_traces):
for geth_trace_dict in geth_traces:
geth_trace = self.geth_trace_mapper.json_dict_to_geth_trace(geth_trace_dict)
traces = self.trace_mapper.geth_trace_to_traces(geth_trace)

calculate_trace_statuses(traces)
Copy link
Member

@medvedev1088 medvedev1088 Oct 14, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Geth traces don't have transaction_hash in them so status calculation is not correct. calculate_trace_statuses needs to be accommodated to geth traces

calculate_trace_ids(traces)

for trace in traces:
self.item_exporter.export_item(self.trace_mapper.trace_to_dict(trace))

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
block_number,transaction_hash,transaction_index,from_address,to_address,value,input,output,trace_type,call_type,reward_type,gas,gas_used,subtraces,trace_address,error,status,trace_id
1000690,,0,0xaf21e07e5a929d16026a7b4d88f3906a8d2e4942,0x5b3c526b152b1f3d8eabe2ec27f49b904ad51cad,64655529900000002048,0x,0x,call,call,,0,0,0,,,,
1000690,,1,0xacdee28d8ca76187883831a37f551a5904cdf191,0xa7e3cf952ea8d9438a26ee346c295f1ada328ae1,0,0x606060405260026101086000505560405161015638038061015683398101604052805160805160a051919092019190808383815160019081018155600090600160a060020a0332169060029060038390559183525061010260205260408220555b82518110156100eb57828181518110156100025790602001906020020151600160a060020a03166002600050826002016101008110156100025790900160005081905550806002016101026000506000858481518110156100025790602001906020020151600160a060020a0316815260200190815260200160002060005081905550600101610060565b81600060005081905550505050806101056000508190555061010f62015180420490565b61010755505050506031806101256000396000f3003660008037602060003660003473273930d21e01ee25e4c219b63259d214872220a261235a5a03f21560015760206000f30000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000052b7d2dcc80cd2e40000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000acdee28d8ca76187883831a37f551a5904cdf191,0x3660008037602060003660003473273930d21e01ee25e4c219b63259d214872220a261235a5a03f21560015760206000f3,create,,,954720,160631,0,,,,
1000690,,0,0xaf21e07e5a929d16026a7b4d88f3906a8d2e4942,0x5b3c526b152b1f3d8eabe2ec27f49b904ad51cad,64655529900000002048,0x,0x,call,call,,0,0,0,,,1,call_1000690_0
1000690,,1,0xacdee28d8ca76187883831a37f551a5904cdf191,0xa7e3cf952ea8d9438a26ee346c295f1ada328ae1,0,0x606060405260026101086000505560405161015638038061015683398101604052805160805160a051919092019190808383815160019081018155600090600160a060020a0332169060029060038390559183525061010260205260408220555b82518110156100eb57828181518110156100025790602001906020020151600160a060020a03166002600050826002016101008110156100025790900160005081905550806002016101026000506000858481518110156100025790602001906020020151600160a060020a0316815260200190815260200160002060005081905550600101610060565b81600060005081905550505050806101056000508190555061010f62015180420490565b61010755505050506031806101256000396000f3003660008037602060003660003473273930d21e01ee25e4c219b63259d214872220a261235a5a03f21560015760206000f30000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000052b7d2dcc80cd2e40000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000acdee28d8ca76187883831a37f551a5904cdf191,0x3660008037602060003660003473273930d21e01ee25e4c219b63259d214872220a261235a5a03f21560015760206000f3,create,,,954720,160631,0,,,1,create_1000690_0
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
block_number,transaction_hash,transaction_index,from_address,to_address,value,input,output,trace_type,call_type,reward_type,gas,gas_used,subtraces,trace_address,error,status,trace_id
1000895,,0,0xad9253df75b066c67aff5cdd9d6d2b9245444726,0x627da06356442122f08e2203c749978151e55800,1000000000000000000,0x,,call,call,,0,0,0,,out of gas,,
1000895,,1,0x9288fe5be3be048b5c7a68bfd4b9a0746b7e4a00,0xe05ff93a9978bbb48356accc74088f3841fc5d72,1100000000000000000,0x,0x,call,call,,100000,0,0,,,,
1000895,,0,0xad9253df75b066c67aff5cdd9d6d2b9245444726,0x627da06356442122f08e2203c749978151e55800,1000000000000000000,0x,,call,call,,0,0,0,,out of gas,0,call_1000895_1
1000895,,1,0x9288fe5be3be048b5c7a68bfd4b9a0746b7e4a00,0xe05ff93a9978bbb48356accc74088f3841fc5d72,1100000000000000000,0x,0x,call,call,,100000,0,0,,,1,call_1000895_0
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
block_number,transaction_hash,transaction_index,from_address,to_address,value,input,output,trace_type,call_type,reward_type,gas,gas_used,subtraces,trace_address,error,status,trace_id
1000000,,0,0x39fa8c5f2793459d6622857e7d9fbb4bd91766d3,0xc083e9947cf02b8ffc7d3090ae9aea72df98fd47,100000000000000000000,0x,0x0000000000000000000000000000000000000000000000000000000000000000,call,call,,108244,8244,1,,,,
1000000,,0,0xc083e9947cf02b8ffc7d3090ae9aea72df98fd47,0x273930d21e01ee25e4c219b63259d214872220a2,100000000000000000000,0x,0x0000000000000000000000000000000000000000000000000000000000000000,call,callcode,,101462,1444,0,0,,,
1000000,,1,0x32be343b94f860124dc4fee278fdcbd38c102d88,0xdf190dc7190dfba737d7777a163445b7fff16133,437194980000000000,0x,0x,call,call,,29000,0,0,,,,
1000000,,0,0x39fa8c5f2793459d6622857e7d9fbb4bd91766d3,0xc083e9947cf02b8ffc7d3090ae9aea72df98fd47,100000000000000000000,0x,0x0000000000000000000000000000000000000000000000000000000000000000,call,call,,108244,8244,1,,,1,call_1000000_1
1000000,,0,0xc083e9947cf02b8ffc7d3090ae9aea72df98fd47,0x273930d21e01ee25e4c219b63259d214872220a2,100000000000000000000,0x,0x0000000000000000000000000000000000000000000000000000000000000000,call,callcode,,101462,1444,0,0,,1,call_1000000_2
1000000,,1,0x32be343b94f860124dc4fee278fdcbd38c102d88,0xdf190dc7190dfba737d7777a163445b7fff16133,437194980000000000,0x,0x,call,call,,29000,0,0,,,1,call_1000000_0
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
block_number,transaction_hash,transaction_index,from_address,to_address,value,input,output,trace_type,call_type,reward_type,gas,gas_used,subtraces,trace_address,error,status,trace_id
1011973,,0,0x83973747eec131bf9a08ac64fb1a518e891bdf4b,0x474faa5018639791952fae334e2911700ac7fe9b,0,0x41c0e1b5,0x,call,call,,68728,232,1,,,,
1011973,,0,,,,,,suicide,,,,,0,0,,,
1011973,,0,0x83973747eec131bf9a08ac64fb1a518e891bdf4b,0x474faa5018639791952fae334e2911700ac7fe9b,0,0x41c0e1b5,0x,call,call,,68728,232,1,,,1,call_1011973_0
1011973,,0,,,,,,suicide,,,,,0,0,,1,suicide_1011973_0