Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix failing test #5

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
17 changes: 8 additions & 9 deletions src/rpc_cache_handler/eth_get_logs.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
use alloy_primitives::B256;
use anyhow::{bail, Context};
use serde_json::Value;
use std::str::FromStr;

use crate::rpc_cache_handler::common::require_array_params;
use crate::rpc_cache_handler::{common, RpcCacheHandler};
Expand All @@ -25,13 +23,14 @@ impl RpcCacheHandler for Handler {
bail!("params[0] not a filter object");
}

let mut block_tag = None;

if let Some(block_hash) = filter["blockHash"].as_str() {
if let Ok(block_hash) = B256::from_str(block_hash) {
block_tag = Some(format!("{:#x}", block_hash));
}
}
let mut block_tag = if !filter["blockHash"].is_null() {
Some(
common::extract_and_format_block_hash(&filter["blockHash"])
.context("expect a valid block hash")?,
)
} else {
None
};

if block_tag.is_none() {
let from_block = if !filter["fromBlock"].is_null() {
Expand Down