Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

[ci] Fix #9822: trace_filter does not return failed contract creation #10140

Merged
merged 2 commits into from
Jan 11, 2019
Merged
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
42 changes: 41 additions & 1 deletion ethcore/src/trace/types/filter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ impl Filter {

let to_matches = match trace.result {
Res::Create(ref create_result) => self.to_address.matches(&create_result.address),
_ => false
_ => self.to_address.matches_all(),
};

from_matches && to_matches
Expand Down Expand Up @@ -385,4 +385,44 @@ mod tests {
assert!(f1.matches(&trace));
assert!(f2.matches(&trace));
}

#[test]
fn filter_match_failed_contract_creation_fix_9822() {

let f0 = Filter {
range: (0..0),
from_address: vec![1.into()].into(),
to_address: vec![].into(),
};

let f1 = Filter {
range: (0..0),
from_address: vec![].into(),
to_address: vec![].into(),
};

let f2 = Filter {
range: (0..0),
from_address: vec![].into(),
to_address: vec![2.into()].into(),
};

let trace = FlatTrace {
action: Action::Create(Create {
from: 1.into(),
gas: 4.into(),
init: vec![0x5],
value: 3.into(),
}),
result: Res::FailedCall(TraceError::BadInstruction),
trace_address: vec![].into_iter().collect(),
subtraces: 0
};

assert!(f0.matches(&trace));
assert!(f1.matches(&trace));
assert!(!f2.matches(&trace));
}

}