feat(api/xdpos): upgrade GetMasternodesByNumber to support TipUpgradeReward#2422
feat(api/xdpos): upgrade GetMasternodesByNumber to support TipUpgradeReward#2422wanwiset25 wants to merge 3 commits into
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 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 |
| Epoch uint64 | ||
| Number uint64 | ||
| Round types.Round | ||
| TipUpgradeReward bool // whether the protector/observer tiers are active at this block |
There was a problem hiding this comment.
we don't need this flag at json response, you can make it lowercase tipUpgradeReward
There was a problem hiding this comment.
do you mean we can infer from the returned Protectornodes or Standbynodes ?
There was a problem hiding this comment.
Pull request overview
This PR extends the XDPoS_getMasternodesByNumber RPC response to reflect the node reward tiers introduced by the TIPUpgradeReward fork by partitioning the standby pool into Protector, Observer, and remaining Standbynodes for post-fork blocks.
Changes:
- Extends
MasternodesStatuswithTipUpgradeReward,Protector*, andObserver*fields. - Updates
GetMasternodesByNumberto split the standby slice into tiered segments whenTIPUpgradeRewardis active. - Adds clarifying comments about tier semantics (snapshot-consistent vs reward-hook live state).
- rename Protector/Observer fields to Protectornodes/Observernodes - omit empty outputs - rename standbynodes > standbyPool to prevent confusion
Proposed changes
Extend the XDPoS_getMasternodesByNumber RPC so its response reflects the node tiers introduced by the TIPUpgradeReward fork.
For blocks before TIPUpgradeReward, behavior is unchanged
For blocks from TIPUpgradeReward onward, the standby pool is split into the reward tiers: the top MaxProtectorNodes become Protector, the next MaxObverserNodes become Observer, and the remainder stays in Standbynodes.
Types of changes
What types of changes does your code introduce to XDC network?
Put an
✅in the boxes that applyImpacted Components
Which parts of the codebase does this PR touch?
Put an
✅in the boxes that applyChecklist
Put an
✅in the boxes once you have confirmed below actions (or provide reasons on not doing so) that