Skip to content
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

feat: Implemented RPC Manager for RPC calls #1260

Merged
merged 25 commits into from
Dec 13, 2024

Conversation

Yashk767
Copy link
Contributor

@Yashk767 Yashk767 commented Nov 5, 2024

Description

Implemented an RPC Manager which handles RPC selection at the start selecting the best RPC out of the available endpoints. Proceeding further it handles the switching and refreshing of RPC endpoints in a sorted order of there performance.

Also introduces a blockMonitor in block module which is resposnsible for providing block number to the logs and also check for stale blocks from the current best RPC endpoint.
This is implemented in #126.

Introduced a importEndpoints command which imports the list of endpoints provided in core/endpoints.go to file $HOME/.rzr/endpoints.

Fixes https://linear.app/interstellar-research/issue/RAZ-1026

How Has This Been Tested?

Ran a staker with vote command on testnet by providing multiple active and inactive RPCs.
Analysed the refresh periods, switching when RPC is down, and when RPC endpoints are not imported.

Yashk767 and others added 21 commits November 5, 2024 15:52
* feat: introduced block monitor to keep track of blocks

* refactor: removed global variables used in logger and added blockMonitor as a field

* refactor: used refactored logger module

* fix: fixed logger global instance

* refactor: exported logrus instance field from logger struct

* refactor: fixed tests

* refactor: removed  unwanted return variables in tests

* refactor: added log for current best endpoint URL after every refresh

* fix: added endpoint validation while switching endpoints

* fix: added switched returned type while switching endpoints and removed staleBlockCallback field
@Yashk767 Yashk767 marked this pull request as ready for review November 27, 2024 10:48
@Yashk767
Copy link
Contributor Author

Yashk767 commented Dec 3, 2024

Rename RPC module to rpc

@Yashk767
Copy link
Contributor Author

Yashk767 commented Dec 3, 2024

5631ae4

Done in 5631ae4 @ashish10677

@Yashk767 Yashk767 merged commit 52d8d2a into develop Dec 13, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants