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

Make the API queries more robust in case of a network restart #4064

Closed
Tracked by #4000
Leo-Besancon opened this issue Jun 12, 2023 · 2 comments · Fixed by #4071
Closed
Tracked by #4000

Make the API queries more robust in case of a network restart #4064

Leo-Besancon opened this issue Jun 12, 2023 · 2 comments · Fixed by #4071
Labels

Comments

@Leo-Besancon
Copy link
Collaborator

Leo-Besancon commented Jun 12, 2023

Some API queries do not respond the expected result in case we are waiting for a network restart.
For example, the get_stakers() list is empty if we query a cycle that is no longer in the pos_history. We should query the stakers list with the cycle of the last_start_period in that case, not the cycle associated with the current time.

@aoudiamoncef
Copy link
Contributor

Hi @Leo-Besancon

Where could we found last_start_period ? in gRPC side, we have a dedicated filed called context which gives information about the execution of the query, we could add a message or anything to inform the caller that's It's not the current cycle but a previous one etc

@aoudiamoncef aoudiamoncef added enhancement New feature or request api Issues related to the API labels Jun 12, 2023
@Leo-Besancon
Copy link
Collaborator Author

Hey @aoudiamoncef! I'm not 100% sure yet, but I think this should not be resolved at the API level directly. It's more that the info queried by the API should be more resilient.
For example, the get_stakers api point calls get_cycle_active_rolls, that calls get_all_roll_counts(cycle) in the pos_final_state.rs file.
I think it's this last function (that has access to the last_start_period from the final_state) that should handle this case :)

@Leo-Besancon Leo-Besancon linked a pull request Jun 13, 2023 that will close this issue
7 tasks
@Leo-Besancon Leo-Besancon changed the title Make the API queries more robust in case of a newtork restart Make the API queries more robust in case of a network restart Jun 13, 2023
@AurelienFT AurelienFT removed enhancement New feature or request api Issues related to the API labels Jun 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants