Skip to content

Commit

Permalink
Add test to check that web3 method eth_getLogs has defaults for fromB…
Browse files Browse the repository at this point in the history
…lock and toBlock
  • Loading branch information
popzxc committed Mar 7, 2022
1 parent 0b33353 commit 204675b
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions core/bin/zksync_api/src/api_server/web3/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -944,6 +944,21 @@ async fn get_logs() -> anyhow::Result<()> {
assert_eq!(log.block_number.unwrap().as_u64(), 1);
}

// Checks that request without `fromBlock` and `toBlock` is processed.
// `latest` should be assumed.
let fut = {
let (client, server) = local_client().await?;
let req = Map::new();
join(
client.call_method("eth_getLogs", Params::Array(vec![Value::Object(req)])),
server,
)
};
let _ = fut
.await
.0
.expect("Request with `fromBlock` and `toBlock` omitted has failed");

// Checks that address filter works correctly
let mut addresses = Vec::new();
{
Expand Down

0 comments on commit 204675b

Please sign in to comment.