-
Notifications
You must be signed in to change notification settings - Fork 182
Fix eth_new_block_filter test #6112
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
Conversation
WalkthroughAdjusts the eth_newBlockFilter stateful test to accept an additional valid outcome (both empty hash lists) and removes the ignore reason from its registration, enabling the test without an explicit ignore rationale. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested reviewers
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing touches
🧪 Generate unit tests
Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (2)
src/tool/subcommands/api_cmd/stateful_tests.rs (2)
407-411: Avoid false positives: re-poll once if both lists are empty before passingAllowing both empty is reasonable post-GoldenWeek, but it weakens the assertion: the test can pass even if the filter never yields hashes after an apply. Do a single extra tipset wait and re-poll to reduce flakiness while still accommodating empty deltas.
Apply this diff:
if let EthFilterResult::Hashes(hashes) = filter_result { verify_hashes(&hashes).await?; - anyhow::ensure!( - (prev_hashes.is_empty() && hashes.is_empty()) || prev_hashes != hashes, - ); + if prev_hashes.is_empty() && hashes.is_empty() { + // Second-chance: avoid passing on transient emptiness (ref. #6069) + next_tipset(client).await?; + let filter_result2 = client + .call(EthGetFilterChanges::request((filter_id.clone(),))?) + .await?; + if let EthFilterResult::Hashes(hashes2) = filter_result2 { + verify_hashes(&hashes2).await?; + anyhow::ensure!( + !(prev_hashes.is_empty() && hashes2.is_empty()), + "eth_newBlockFilter produced no hashes after two consecutive tipsets" + ); + } else { + anyhow::bail!("expecting blocks"); + } + } else { + anyhow::ensure!(prev_hashes != hashes); + }
637-641: Good to un-ignore; optionally include EthGetBlockByHash in used_methods for accurate filteringThis test uses EthGetBlockByHash in verify_hashes; adding it improves method-based filtering/discovery.
with_methods!( - eth_new_block_filter().name("eth_newBlockFilter works"), + eth_new_block_filter().name("eth_newBlockFilter works"), EthNewBlockFilter, EthGetFilterChanges, - EthUninstallFilter + EthUninstallFilter, + EthGetBlockByHash ),
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
src/tool/subcommands/api_cmd/stateful_tests.rs(2 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
src/tool/subcommands/api_cmd/stateful_tests.rs (2)
src/rpc/methods/eth.rs (1)
is_empty(460-465)src/rpc/methods/eth/types.rs (1)
is_empty(565-570)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
- GitHub Check: Build forest binaries on Linux AMD64
- GitHub Check: tests
- GitHub Check: tests-release
LesnyRumcajs
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this make sense @elmattic ?
Yes, only if one of the two blocks has no transactions, then we need to ensure that the hashes are different. This was a corner case that was overlooked. |
Summary of changes
Changes introduced in this pull request:
Reference issue to close (if applicable)
Closes #6069
Other information and links
Change checklist
Summary by CodeRabbit