Skip to content
Merged
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
23 changes: 11 additions & 12 deletions src/tool/subcommands/api_cmd/stateful_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -514,6 +514,14 @@ fn eth_new_pending_transaction_filter(tx: TestTransaction) -> RpcTestScenario {
let result = if let EthFilterResult::Hashes(prev_hashes) = filter_result {
let cid = invoke_contract(&client, &tx).await?;

// Get the Eth transaction hash for our CID directly, rather than
// reverse-mapping every hash from the filter results back to CIDs
// (which is fragile — the mapping can return None for recent txns).
let tx_hash = client
.call(EthGetTransactionHashByCid::request((cid,))?)
.await?
.context("no Eth transaction hash for CID")?;

wait_pending_message(&client, cid).await?;

let filter_result = client
Expand All @@ -526,19 +534,9 @@ fn eth_new_pending_transaction_filter(tx: TestTransaction) -> RpcTestScenario {
"prev_hashes={prev_hashes:?} hashes={hashes:?}"
);

let mut cids = vec![];
for hash in &hashes {
if let Some(cid) = client
.call(EthGetMessageCidByTransactionHash::request((*hash,))?)
.await?
{
cids.push(cid);
}
}

anyhow::ensure!(
cids.contains(&cid),
"CID missing from filter results: cid={cid:?} cids={cids:?} hashes={hashes:?}"
hashes.contains(&tx_hash),
"transaction hash missing from filter results: tx_hash={tx_hash:?} cid={cid:?} hashes={hashes:?}"
);

Ok(())
Expand Down Expand Up @@ -665,6 +663,7 @@ pub(super) async fn create_tests(tx: TestTransaction) -> Vec<RpcTestScenario> {
.name("eth_newPendingTransactionFilter works"),
EthNewPendingTransactionFilter,
EthGetFilterChanges,
EthGetTransactionHashByCid,
EthUninstallFilter
),
with_methods!(
Expand Down
Loading