-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
update trace_filter, trace block only to highest matching index #4974
Changes from 1 commit
833787a
9af97e0
3b7c2fb
b7fbe2d
c7c2c19
6a7d680
8404056
c5fcc5b
15b20b9
f6eab16
2f96b93
472cb14
5081797
ee82515
5c05aa2
d2c94d2
0e85a9c
17e88aa
d43b264
caf96fc
5dd5712
d50470b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -276,29 +276,34 @@ where | |
let mut target_blocks = Vec::new(); | ||
for block in blocks { | ||
let mut transaction_indices = HashSet::new(); | ||
let mut highest_matching_index = 0; | ||
for (tx_idx, tx) in block.body.iter().enumerate() { | ||
let from = tx.recover_signer().ok_or(BlockError::InvalidSignature)?; | ||
let to = tx.to(); | ||
if matcher.matches(from, to) { | ||
transaction_indices.insert(tx_idx as u64); | ||
let idx = tx_idx as u64; | ||
transaction_indices.insert(idx); | ||
if idx > highest_matching_index { | ||
highest_matching_index = idx; | ||
} | ||
} | ||
} | ||
if !transaction_indices.is_empty() { | ||
target_blocks.push((block.number, transaction_indices)); | ||
target_blocks.push((block.number, transaction_indices, highest_matching_index)); | ||
} | ||
} | ||
|
||
// TODO: this could be optimized to only trace the block until the highest matching index in | ||
// that block | ||
|
||
// trace all relevant blocks | ||
let mut block_traces = Vec::with_capacity(target_blocks.len()); | ||
for (num, indices) in target_blocks { | ||
for (num, indices, highest_idx) in target_blocks { | ||
let traces = self.trace_block_with( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. there's something else we need to do here: |
||
num.into(), | ||
TracingInspectorConfig::default_parity(), | ||
move |tx_info, inspector, res, _, _| { | ||
if let Some(idx) = tx_info.index { | ||
if idx > highest_idx { | ||
return Ok(None); | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is a smol improvement, however this still traces the entire block, |
||
if !indices.contains(&idx) { | ||
// only record traces for relevant transactions | ||
return Ok(None) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this check is redundant because all tx_idx are only increasing