-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Conversation
Don't test contract address against empty array in trace filtering
@@ -127,7 +132,7 @@ impl Filter { | |||
}; | |||
|
|||
action || match trace.result { | |||
Res::Create(ref create) => self.to_address.matches(&create.address), | |||
Res::Create(ref create) => self.to_address.stricly_matches(&create.address), |
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.
Couldn't we replace L124 with self.to_address.matches(&create.address)
and remove this ||
? (strictly_matches
would not be required at all)
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.
Yes that would be totally equivalent.
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.
However the address
field is in the result
part of the trace, not in the action
self.matches_all() || self.list.contains(address) | ||
} | ||
self.matches_all() || self.stricly_matches(address) | ||
} |
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.
extra space here
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.
actually the issue here is that this whole line is using spaces instead of tabs for indentation.
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.
Yep just saw that
} | ||
|
||
/// Returns true if address matches at least one of the searched addresses. | ||
pub fn stricly_matches(&self, address: &Address) -> bool { |
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.
strictly*
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.
Arh...
Action::Call(ref call) => { | ||
let from_matches = self.from_address.matches(&call.from); | ||
let to_matches = self.to_address.matches(&call.to); | ||
from_matches && to_matches | ||
} | ||
Action::Create(ref create) => { | ||
let from_matches = self.from_address.matches(&create.from); | ||
let to_matches = self.to_address.matches_all(); | ||
|
||
let to_matches = match trace.result { |
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.
Hmm, now that I saw it's coming from result
I'm not sure if it's equivalent.
@debris is it possible that trace.action
is Action::Call
but the result is Res::Create
somehow?
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.
No. To be honest, there should be just one enum. Having two is just a performance workaround to avoid unnecessary copying data when trace is created.
Fixes #2751
Don't test contract address against empty
toAddress
array in trace filtering.