Skip to content

Commit

Permalink
Fix emitter address filtering when address key is null
Browse files Browse the repository at this point in the history
  • Loading branch information
elmattic committed Oct 1, 2024
1 parent e682a66 commit 551932e
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/rpc/methods/eth/filter/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -275,8 +275,11 @@ impl EthEventHandler {
msg_idx: i as u64,
msg_cid: message.cid(),
};
let is_match =
spec.address.iter().any(|other| other == &eth_emitter_addr);
let is_match = if spec.address.is_empty() {
true
} else {
spec.address.iter().any(|other| other == &eth_emitter_addr)
};

if is_match {
collected_events.push(ce);
Expand Down
15 changes: 15 additions & 0 deletions src/tool/subcommands/api_cmd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1538,6 +1538,21 @@ fn eth_tests_with_tipset<DB: Blockstore>(store: &Arc<DB>, shared_tipset: &Tipset
},))
.unwrap(),
),
RpcTest::identity(
EthGetLogs::request((EthFilterSpec {
from_block: None,
to_block: None,
address: vec![],
topics: None,
block_hash: Some(
EthHash::from_str(
"0xa158a536fe66e18b8cbf5c392384d840483f84732e2a2ed8d9fb68cedcffef54",
)
.unwrap(),
),
},))
.unwrap(),
),
RpcTest::identity(EthGetTransactionHashByCid::request((block_cid,)).unwrap()),
];

Expand Down

0 comments on commit 551932e

Please sign in to comment.