Skip to content

Commit

Permalink
Add regression test for block number underflow
Browse files Browse the repository at this point in the history
  • Loading branch information
sveitser committed Nov 8, 2024
1 parent 88c5a09 commit b926708
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,3 +106,21 @@ impl SequencerClient {
Ok(balance)
}
}

#[cfg(test)]
mod tests {
use super::*;
// Regression test for a bug where the block number underflowed. This test would panic
// on the previous implementation, as long as overflow checks are enabled.
#[async_std::test]
async fn test_regression_block_number_underflow() {
let client = SequencerClient::new("http://localhost:3030".parse().unwrap());
assert_eq!(
client
.get_espresso_balance(Address::zero(), Some(0))
.await
.unwrap(),
0.into()
)
}
}

0 comments on commit b926708

Please sign in to comment.