Skip to content

Commit

Permalink
test: add decode revert test
Browse files Browse the repository at this point in the history
  • Loading branch information
mattsse committed Feb 15, 2024
1 parent 552f47c commit 9714c66
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/tracing/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,4 +80,11 @@ mod tests {
let reason = maybe_revert_reason(&encoded).unwrap();
assert_eq!(reason, "my revert");
}

#[test]
fn decode_revert_reason_with_error() {
let err = hex!("08c379a000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000024556e697377617056323a20494e53554646494349454e545f494e5055545f414d4f554e5400000000000000000000000000000000000000000000000000000080");
let reason = maybe_revert_reason(&err[..]).unwrap();
assert_eq!(reason, "UniswapV2: INSUFFICIENT_INPUT_AMOUNT");
}
}

0 comments on commit 9714c66

Please sign in to comment.