fix: avoid block_discovery panic after block validation rejection#1235
Conversation
Bug: heavy_test_block_with_incorrect_pd_base_fee_gets_rejected exposed a race where a bad parent block was correctly rejected for a PdBaseFeeUpdate shadow transaction mismatch, but a descendant was still processed afterward. Error: block_discovery panicked with "Parent block ... should be in the block tree!" after the rejected parent had already been removed, which cascaded into service shutdown and SendError failures in the test harness.` Fix: return PreviousBlockNotFound instead of panicking when the parent disappears during block discovery, and make block_tree invalid-result cleanup idempotent when a descendant was already removed as part of ancestor cleanup.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughReplaces panics with Result-based errors in block discovery, tightens cache-removal logic after validation, and stages a mempool test's mining sequence to wait for ingress proofs and raw-mempool confirmation before full migration mining. (47 words) Changes
Sequence Diagram(s)(silently omitted — changes are refactoring/bugfixes and a test sequencing change that do not introduce a new multi-component control flow requiring diagrams) Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
⚠️ Performance Alert ⚠️
Possible performance regression was detected for benchmark.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 1.20.
| Benchmark suite | Current: ba1c2c7 | Previous: 9725fe9 | Ratio |
|---|---|---|---|
parallel_verification/testing |
3.659624 ms/iter (± 4.064656) |
2.54714 ms/iter (± 0.211408) |
1.44 |
This comment was automatically generated by workflow using github-action-benchmark.
|
Benchmark results: https://irys-xyz.github.io/irys/dev/bench/1235%2Fmerge/index.html |
|
@coderabbitai full review |
JesseTheRobot
left a comment
There was a problem hiding this comment.
LGTM, some nonblocking nits
Bug: heavy_test_block_with_incorrect_pd_base_fee_gets_rejected (on the feat/pd branch) exposed a race where a bad parent block was correctly rejected for a PdBaseFeeUpdate shadow transaction mismatch, but a descendant was still processed afterward.
Error: block_discovery panicked with "Parent block ... should be in the block tree!" after the rejected parent had already been removed, which cascaded into service shutdown and SendError failures in the test harness.`
Fix: return PreviousBlockNotFound instead of panicking when the parent disappears during block discovery, and make block_tree invalid-result cleanup idempotent when a descendant was already removed as part of ancestor cleanup.
Checklist
Summary by CodeRabbit
Bug Fixes
Tests