refactor: propagate an error if block tree rejects a block#1137
Conversation
📝 WalkthroughWalkthroughAdds a new Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 3 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
⚔️ Resolve merge conflicts (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 |
JesseTheRobot
left a comment
There was a problem hiding this comment.
LGTM - I'll put this in with the peer ID change into the RC
6a101f3 to
bae7128
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@crates/chain/tests/validation/poa_cases.rs`:
- Around line 93-97: Replace the hard-coded literal 20 passed into
genesis_node.wait_until_height_confirmed with the existing seconds_to_wait
variable to avoid divergence if the timeout value changes; update the call using
genesis_node.wait_until_height_confirmed(new_block.height,
seconds_to_wait).await? so it uses seconds_to_wait consistently.
| // Wait for the data block to be confirmed and migrated to the block index, | ||
| // so that poa_is_valid can look up block bounds for chunk offsets. | ||
| genesis_node | ||
| .wait_until_height_confirmed(new_block.height, 20) | ||
| .await?; |
There was a problem hiding this comment.
🧹 Nitpick | 🔵 Trivial
Use the seconds_to_wait variable instead of the magic number 20.
Line 21 defines seconds_to_wait = 20 for exactly this purpose. Using the literal 20 here is inconsistent and will silently diverge if the constant is updated.
Proposed fix
genesis_node
- .wait_until_height_confirmed(new_block.height, 20)
+ .wait_until_height_confirmed(new_block.height, seconds_to_wait)
.await?;📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| // Wait for the data block to be confirmed and migrated to the block index, | |
| // so that poa_is_valid can look up block bounds for chunk offsets. | |
| genesis_node | |
| .wait_until_height_confirmed(new_block.height, 20) | |
| .await?; | |
| genesis_node | |
| .wait_until_height_confirmed(new_block.height, seconds_to_wait) | |
| .await?; |
🤖 Prompt for AI Agents
In `@crates/chain/tests/validation/poa_cases.rs` around lines 93 - 97, Replace the
hard-coded literal 20 passed into genesis_node.wait_until_height_confirmed with
the existing seconds_to_wait variable to avoid divergence if the timeout value
changes; update the call using
genesis_node.wait_until_height_confirmed(new_block.height,
seconds_to_wait).await? so it uses seconds_to_wait consistently.
* propagate errors from the block tree when it cannot add a block
Describe the changes
Related Issue(s)
Please link to the issue(s) that will be closed with this PR.
Checklist
Additional Context
Add any other context about the pull request here.
Summary by CodeRabbit