Skip to content

Commit

Permalink
ignore reverted transactions from liquidation classifier (flashbots#317)
Browse files Browse the repository at this point in the history
  • Loading branch information
pintail-xyz authored Dec 5, 2022
1 parent d917ae7 commit 0e42ab6
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
3 changes: 3 additions & 0 deletions mev_inspect/liquidations.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ def get_liquidations(classified_traces: List[ClassifiedTrace]) -> List[Liquidati
if _is_child_liquidation(trace, parent_liquidations):
continue

if trace.error == "Reverted":
continue

if trace.classification == Classification.liquidate:

parent_liquidations.append(trace)
Expand Down
1 change: 1 addition & 0 deletions tests/blocks/15049646.json

Large diffs are not rendered by default.

15 changes: 15 additions & 0 deletions tests/test_compound.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,3 +115,18 @@ def test_c_token_liquidation(trace_classifier: TraceClassifier):

for liquidation in liquidations:
assert liquidation in result


def test_reverted_liquidation(trace_classifier: TraceClassifier):
block_number = 15049646
transaction_hash = (
"0x6dd0d8be8a77651f64ef399b47fbc87011bd796b43349c3164ff7da965e0b345"
)

block = load_test_block(block_number)
classified_traces = trace_classifier.classify(block.traces)
result = get_liquidations(classified_traces)

assert transaction_hash not in [
liquidation.transaction_hash for liquidation in result
]

0 comments on commit 0e42ab6

Please sign in to comment.