We should be able to inspect the current GRANDPA round state externally, this is particularly useful in situations where finality is stalled (e.g. due to some voters being offline).
I propose we add an RPC method grandpa_roundState that returns something like:
{
"setId": 361,
"round": 1283,
"total_weight": 100,
"thresholdWeight": 67,
"prevotes": {
"currentWeight": 79,
"missing": [
// list of addresses of authorities missing votes
]
},
"precommits": {
"currentWeight": 12,
"missing": [
// list of addresses of authorities missing votes
]
}
}
Currently this data is not exposed by the finality-grandpa crate, there's https://github.com/paritytech/finality-grandpa/issues/55 which should be tackled as part of this issue as well.
Regarding the addresses of validators that are missing votes it is a bit tricky. Ideally we'd like to expose the addresses of the stash account since these represent the main "identity" of a validator. But the client GRANDPA code only deals with session keys and it isn't trivial to fetch the associated stash keys.
cc @rphmeier
It's probably easier to just identify missing votes by grandpa pubkey. The stash key relies on state which may have been pruned, in the case that we are catching up or finality is lagging.
Also, we may have multiple live rounds at once. Which one should roundState tell us about? Maybe we should have a grandpa_liveRounds() and grandpa_roundState(set_id, round). The drawback is that it's racy with round advancement. Alternatively, we could return roundState for all live rounds.
Yes, I was going to suggest that we return the round state for all currently live rounds, something like:
{
"setId": 361,
"best": {
"round": 1283,
"total_weight": 100,
"thresholdWeight": 67,
"prevotes": {
"currentWeight": 79,
"missing": [
// list of addresses of authorities missing votes
]
},
"precommits": {
"currentWeight": 12,
"missing": [
// list of addresses of authorities missing votes
]
}
},
"background": [
{
"round": 1282,
// ... same fields as above
},
...
]
}
Done in #5375.
Most helpful comment
Yes, I was going to suggest that we return the round state for all currently live rounds, something like: