x/bor: add target producer id in producer planned downtime#567
x/bor: add target producer id in producer planned downtime#567kamuikatsurgi wants to merge 5 commits intodevelopfrom
Conversation
There was a problem hiding this comment.
Claude Code Review
This repository is configured for manual code reviews. Comment @claude review to trigger a review.
Tip: disable this comment in your organization's Code Review settings.
|
@claude review for the PR diff, and check for the broader consensus issues across the codebase. |
|
Claude finished @kamuikatsurgi's task in 1m 48s —— View job Review: x/bor target producer id in producer planned downtime
Overall AssessmentClean, well-structured change. The feature is properly height-gated via Consensus-Critical Observations1. The side handler ( This is fine as defense-in-depth at the calling layers, but worth noting that if 2. Side handler votes VOTE_NO on CalculateProducerSet failure for target validation — If This is mitigated by the fact that this only fires when 3. Determinism is maintained — confirmed The
All good here. Height Gate Values4. All All chains (mainnet, mumbai, amoy) have If the intent is to coordinate activation at a specific block height (as is typical for consensus-affecting changes), the TBD values should be set before merging. If immediate activation is intentional, the Code Quality5. Duplicated "is target in candidates" logic across three files The same linear search pattern appears in:
Consider extracting a small helper like 6. Nit: blank line removal in The diff removes a blank line between the comment Test CoverageTests are comprehensive and well-structured:
Missing test: SummaryThe change is well-designed with proper height-gating and graceful fallthrough. The main items to address before merge:
| |
There was a problem hiding this comment.
Pull request overview
This PR extends the Bor planned-downtime flow to allow a producer to optionally request a specific replacement producer via a new target_producer_id field on MsgSetProducerDowntime, and threads that preference through span creation/producer selection (with fallthrough to the existing round-robin behavior when not eligible).
Changes:
- Add
target_producer_idtoMsgSetProducerDowntimeprotobuf/API types and propagate it through constructors and CLI wiring. - Update
SelectNextSpanProducer/AddNewVeBlopSpanto optionally honor a requested target producer (height-gated). - Add/extend keeper and type tests to cover target selection and fallthrough paths.
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
proto/heimdallv2/bor/tx.proto |
Adds target_producer_id to the downtime message schema. |
x/bor/types/tx.pb.go |
Regenerated protobuf Go types/codec for the new field. |
api/heimdallv2/bor/tx.pulsar.go |
Regenerated Pulsar fast-reflection code to include the new field. |
x/bor/types/msg.go |
Extends NewMsgSetProducerDowntime to accept and set targetProducerID. |
x/bor/types/msg_test.go |
Adds coverage for the new constructor parameter. |
x/bor/client/cli/flags.go |
Introduces the --target-producer-id CLI flag name constant. |
x/bor/client/cli/tx.go |
Reads the new CLI flag and populates MsgSetProducerDowntime. |
x/bor/keeper/veblop.go |
Threads targetProducerID into producer selection and tries to honor it when eligible. |
x/bor/keeper/veblop_test.go |
Adds selection tests for honoring/falling-through from a target producer. |
x/bor/keeper/side_msg_server.go |
Side-handler validation for target producer (height-gated) + passes target into span creation. |
x/bor/keeper/side_msg_server_test.go |
Adds tests around downtime validation boundaries and target-producer handling. |
x/bor/keeper/msg_server.go |
Adds msg-server validation for TargetProducerId (height-gated). |
x/bor/keeper/msg_server_test.go |
Adds msg-server tests for target producer accept/reject scenarios. |
helper/config.go |
Adds targetProducerOverrideHeight config knob and getter. |
app/abci.go |
Updates AddNewVeBlopSpan callsites for the new function signature (passes 0). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report❌ Patch coverage is ❌ Your patch check has failed because the patch coverage (57.8%) is below the target coverage (90.0%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## develop #567 +/- ##
=========================================
+ Coverage 41.6% 41.8% +0.2%
=========================================
Files 172 172
Lines 17499 17601 +102
=========================================
+ Hits 7296 7374 +78
- Misses 9124 9148 +24
Partials 1079 1079
... and 2 files with indirect coverage changes
🚀 New features to boost your workflow:
|
Code reviewNo issues found. Checked for bugs and CLAUDE.md compliance. |
|
@claude review |
|
Claude finished @kamuikatsurgi's task in 3m 36s —— View job Review: x/bor target producer id in producer planned downtime
Overall AssessmentWell-structured change since the latest commit (17abc78). The height-gating, defense-in-depth self-target guard in Issues1. Redundant condition checks — Both files have two sequential // Block 1: rejects if target != 0 AND height < fork
if msg.TargetProducerId != types.RoundRobinDefault && height < forkHeight {
return error
}
// Block 2: validates if target != 0 AND height >= fork
if msg.TargetProducerId != types.RoundRobinDefault && height >= forkHeight {
// validation...
}After block 1 returns on if msg.TargetProducerId != types.RoundRobinDefault {
if height < forkHeight {
return error // or VOTE_NO
}
// validation...
}Not a bug, but cleaner and avoids evaluating 2. Validation strictness asymmetry between
This is consistent with the "best effort" design, but it's worth noting that a user could submit a message that appears valid but whose target is silently ignored. Consider adding a comment near the // NOTE: we validate against the full candidate set here; at execution time
// SelectNextSpanProducer further filters by active validators and falls
// through to round-robin if the target is no longer in the active set.3. Height gate values still TBD — All Looks Good
Summary
|
|
Looks good overall. Could you test a case where a cluster is half upgraded before the HF, a heimdall node with new version send out a rotation message request with target candidate, and make sure the consensus won't halt? Last time when the propose down time message was introduced, we had to add a check here. |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 17 out of 17 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Good catch, I added checks there as well similar to what we had for |



Description
target_producer_idonMsgSetProducerDowntime