-
Notifications
You must be signed in to change notification settings - Fork 493
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
goal: Added consensus upgrade fields to node status api & goal output #4800
goal: Added consensus upgrade fields to node status api & goal output #4800
Conversation
Eric (or someone) can you let me know what else is expected? I'm unsure what's required for testing in particular. I can't really test for correct values if there's not an upgrade going on, for example. |
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.
Also, the go-algorand repo requires you to tag your PR with one of New Feature, Enhancement, Bug-Fix, Not-Yet-Enabled, Skip-Release-Notes. And I think the title has to be something like |
Codecov Report
@@ Coverage Diff @@
## master #4800 +/- ##
==========================================
- Coverage 53.70% 53.62% -0.08%
==========================================
Files 433 433
Lines 54050 54106 +56
==========================================
- Hits 29028 29017 -11
- Misses 22776 22840 +64
- Partials 2246 2249 +3
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
Please approve |
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.
I left a couple suggestions. Did you have a chance to review Eric's suggestion? There may be an existing tests you can hook into.
@@ -781,6 +798,14 @@ func (v2 *Handlers) GetStatus(ctx echo.Context) error { | |||
CatchpointAcquiredBlocks: &stat.CatchpointCatchupAcquiredBlocks, | |||
} | |||
|
|||
if upgradePropose != "" { |
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.
This also needs to check that the vote has not finished:
if upgradePropose != "" { | |
if upgradePropose != "" && latestBlkHdr.NextProtocolVoteBefore > stat.LastRound { |
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.
done
cmd/goal/node.go
Outdated
@@ -458,6 +459,34 @@ func makeStatusString(stat model.NodeStatusResponse) string { | |||
if stat.StoppedAtUnsupportedRound { | |||
statusString = statusString + "\n" + fmt.Sprintf(catchupStoppedOnUnsupported, stat.LastRound) | |||
} | |||
|
|||
if stat.UpgradePropose != nil { |
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.
Same as below, no need to display this once the vote is complete.
if stat.UpgradePropose != nil { | |
if stat.UpgradePropose != nil && stat.LastVersion != stat.NextVersion { |
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.
done
upgradePropose := string(latestBlkHdr.UpgradeVote.UpgradePropose) | ||
if upgradePropose != "" && latestBlkHdr.NextProtocolVoteBefore > stat.LastRound { | ||
votesToGo := uint64(latestBlkHdr.NextProtocolVoteBefore) - uint64(stat.LastRound) | ||
consensus := config.Consensus[protocol.ConsensusCurrentVersion] | ||
upgradeVoteRounds := consensus.UpgradeVoteRounds | ||
upgradeThreshold := consensus.UpgradeThreshold | ||
votes := uint64(upgradeVoteRounds) - votesToGo | ||
votesYes := latestBlkHdr.UpgradeState.NextProtocolApprovals | ||
votesNo := votes - votesYes | ||
upgradeDelay := uint64(latestBlkHdr.UpgradeVote.UpgradeDelay) | ||
|
||
response.UpgradePropose = &upgradePropose | ||
response.UpgradeThreshold = &upgradeThreshold | ||
response.UpgradeApprove = &latestBlkHdr.UpgradeApprove | ||
response.UpgradeDelay = &upgradeDelay | ||
response.UpgradeNo = &votesNo | ||
} |
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.
Discussed offline, but I think it's useful to write down here for posterity...
I think it's important to put this logic in the node.Status
function.
Reason being is that the Status
call uses the ledger.BlockHdr
call used above internally to fill in the output. So the following sequence of events becomes problematic.
- Node.Status is called returning status info for the latest round, round X.
- Either agreement or catchup advances the latest round in the ledger to X+1.
- Ledger.BlockHdr is called for the latest round, X+1.
Now the data in latestBlkHdr
potentially conflicts the data in stat
.
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.
done
@winder The values don't look right to me either. But the field names and their sources come directly from the ticket as far as I can tell:
The no votes is a computed value, as per the ticket based on a formula in node-ui. votes - votes yes where ...and it looks to me like that's what my code does, though perhaps I'm getting one or more of these fields from the wrong data structure? What I'm really not sure of is how "Upgrade proposal" could be empty. Investigating further |
It looks like you have the correct values, but we should just figure out how to label them for the user to make sure what they represent is clear. I made a diagram to help refresh my memory about how these formulas relate to each other. It looks like your formula is slightly wrong, you need to get the proposal round first: For reference, I think this is pretty clear. But the goal command / API have more constraints. What do you think about the following:
Once scheduled
|
I don't see how that's possible. That's just ConsensusUpgradeThreshold! |
@mciccarello and I chatted a bit about this. Here is what I propose:
And I like what @winder suggests for the "once scheduled" note. |
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.
Looks good!
Tested with mainnet:
During vote:
Time since last block: 0.0s
Sync Time: 35.3s
Last consensus protocol: https://github.com/algorandfoundation/specs/tree/433d8e9a7274b6fca703d91213e05c7e6a589e69
Next consensus protocol: https://github.com/algorandfoundation/specs/tree/433d8e9a7274b6fca703d91213e05c7e6a589e69
Round for next consensus protocol: 25231779
Next consensus protocol supported: true
Last Catchpoint:
Consensus upgrate state: Voting
Yes votes: 2427
No votes: 174
Votes remaining: 7399
Yes votes required: 9000
Vote window close round: 25239177
Genesis ID: mainnet-v1.0
Genesis hash: wGHE2Pwdvd7S12BL5FaOP20EGYesN73ktiC1qzkkit8=
After vote:
Time since last block: 0.1s
Sync Time: 596.7s
Last consensus protocol: https://github.com/algorandfoundation/specs/tree/433d8e9a7274b6fca703d91213e05c7e6a589e69
Next consensus protocol: https://github.com/algorandfoundation/specs/tree/44fa607d6051730f5264526bf3c108d51f0eadb6
Round for next consensus protocol: 25379177
Next consensus protocol supported: true
Last Catchpoint:
Consensus upgrade state: Scheduled
Genesis ID: mainnet-v1.0
Genesis hash: wGHE2Pwdvd7S12BL5FaOP20EGYesN73ktiC1qzkkit8=
Summary
Test Plan