harmony
harmony copied to clipboard
[Feature] new RPC returning a snapshot of validator all information used for EPOS election
Problem/limitation At Hand
The current RPC hmy_getAllValidatorInformation provide information that can be changed during a given epoch (ie add/remove delegation, add/remove BLS keys ..). That makes our life difficult when trying to run the econ-test which could fail if changes happened.
Which component?
- [ ] consensus
- [ ] deploy script
- [ ] wallet
- [ ] explorer
- [ ] node script
- [ ] test automation
- [ ] demo app
- [X] API/RPC
Proposed Solution
Provide a new RPC containing a snapshot of all validator information taken just before the EPOS election process. Ideally those data are the ones used for the election and we could re-use to run the economic tests.
Alternatives Considered
N/A
Additional Context
N/A
@sophoah there is already an rpc for getting validator information at a given block number. let me know if this does not suffice your need:
{"jsonrpc":"2.0","method":"hmy_getValidatorInformationByBlockNumber","params":["one1v8pukmelacy3xdap773rpg5pax3tmu40wmwr2j", "0x1aa0d"],"id":1}
That also works with hmy_getAllValidatorInformation.
Also, we have updated hmy_getSuperCommittees to reflect raw-stake of each of the elected validators (at the time of election) and median (based on the election data). https://github.com/harmony-one/harmony/pull/2880
If you have everything you need, please close the issue.
hey @gupadhyaya yeah that will work yeah, aren't we taking too much space in the DB by saving the all validator snapshot at each block ?
@sophoah snapshot is done for explorer nodes which are archival type and expected to have higher storage requirement.
Hi @gupadhyaya so I tried the new RPC, and looks like on v1 has been implemented. v2 also work but it still uses hex and not int for the block number:
{
"jsonrpc": "2.0",
"error": {
"code": -32600,
"message": "invalid character ']' looking for beginning of value"
}
}
will update the RPC doc with the current output of v1 but hope you can fix that as well. Thanks
same issue for validatorallinformation
curl --location --request POST 'https://api.s0.os.hmny.io/' --header 'Content-Type: application/json' --data-raw '{
"jsonrpc":"2.0",
"method":"hmyv2_getAllValidatorInformationByBlockNumber",
"params": [1, 1000],
"id":1
}'
{"jsonrpc":"2.0","id":1,"error":{"code":-32602,"message":"invalid argument 1: hex string without 0x prefix"}}
but this one doesn't seems to work :
curl --location --request POST 'https://api.s0.os.hmny.io/' --header 'Content-Type: application/json' --data-raw '{
> "jsonrpc":"2.0",
> "method":"hmy_getAllValidatorInformationByBlockNumber",
> "params": [0, "0x7d0"],
> "id":1
> }'
{"jsonrpc":"2.0","id":1,"error":{"code":-32000,"message":"not found address in current state one1r5sx7e64gefzy6dzzgaurvf3wzzjeac4ya0u29: at root: 0xab61482aafc361e2a0128b26c85a1830feb5636a52a9ebbaf097ec5faf01584d: address not present in state"}}