heimdall
heimdall copied to clipboard
server: add sync_info endpoint from tendermint
Description
This PR adds a new generic endpoint to heimdall called /sync_info
which responds with the current sync status of the node. The aim behind this change is to expose an API via heimdall directly for bor/erigon to query and find the latest block info instead of querying the /status
endpoint of tendermint (which is generally not configured in bor/erigon to query).
The /status
endpoint of tendermint also exposes some validator and p2p info which is not needed and hence the endpoint is named as sync info. I believe validator info should be kept behind tendermint's port and p2p info is available via another endpoint named node_info
.
Skipping making swagger changes for this PR as it's too sophisticated and doesn't seem immediately relevant.
Example response:
{
"height": "0",
"result": {
"latest_block_hash": "F5BA4E109B8F63FD5F419CEB263B63064E87E73686364F164CAE8CA85CA73373",
"latest_app_hash": "511BEB8CC884BF57697E806920177C23B8867FDD1DB353FE01D52FBC9990E0D5",
"latest_block_height": "3505042",
"latest_block_time": "2024-07-03T10:41:48.749488068Z",
"catching_up": false
}
}
Changes
- [ ] Bugfix (non-breaking change that solves an issue)
- [ ] Hotfix (change that solves an urgent issue, and requires immediate attention)
- [x] New feature (non-breaking change that adds functionality)
- [ ] Breaking change (change that is not backwards-compatible and/or changes current functionality)
- [ ] Changes only for a subset of nodes
Breaking changes
Please complete this section if any breaking changes have been made, otherwise delete it
Nodes audience
In case this PR includes changes that must be applied only to a subset of nodes, please specify how you handled it (e.g. by adding a flag with a default value...)
Checklist
- [ ] I have added at least 2 reviewer or the whole pos-v1 team
- [ ] I have added sufficient documentation in code
- [ ] I will be resolving comments - if any - by pushing each fix in a separate commit and linking the commit hash in the comment reply
Cross repository changes
- [ ] This PR requires changes to bor
- In case link the PR here:
- [ ] This PR requires changes to matic-cli
- In case link the PR here:
Testing
- [ ] I have added unit tests
- [ ] I have added tests to CI
- [ ] I have tested this code manually on local environment
- [ ] I have tested this code manually on remote devnet using express-cli
- [ ] I have tested this code manually on mumbai or amoy
- [ ] I have created new e2e tests into express-cli
Manual tests
Please complete this section with the steps you performed if you ran manual tests for this functionality, otherwise delete it
Additional comments
Please post additional comments in this section if you have them, otherwise delete it