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

Tracking epoch_stake distribution #1406

Closed
rdlrt opened this issue May 16, 2023 · 3 comments · Fixed by #1484
Closed

Tracking epoch_stake distribution #1406

rdlrt opened this issue May 16, 2023 · 3 comments · Fixed by #1484
Labels
bug Something isn't working

Comments

@rdlrt
Copy link
Contributor

rdlrt commented May 16, 2023

Problem Report
Post an epoch transition, the only way for us to know the status for epoch_stake distribution is querying the logs for total epoch stake distributions, and checking status manually for number of entries populated for the epoch in database):

grep -r 'Inserted.*.EpochStake for EpochNo ' dbsync*
# dbsync-20230510073605.json:{"app":[],"at":"2023-05-11T01:34:53.50Z","data":{"kind":"LogMessage","message":"Inserted 1277714 EpochStake for EpochNo 411"},"env":"<unknown>:00000","host":"","loc":null,"msg":"","ns":["db-sync-node"],"pid":"31654","sev":"Info","thread":"706479"}
# dbsync-20230515073731.json:{"app":[],"at":"2023-05-16T01:40:06.39Z","data":{"kind":"LogMessage","message":"Inserted 1278735 EpochStake for EpochNo 412"},"env":"<unknown>:00000","host":"","loc":null,"msg":"","ns":["db-sync-node"],"pid":"31654","sev":"Info","thread":"706479"}

First of all, it would be nice to have epoch_stake available before epoch transition (as it's already available in ledger approximately 2/3rd of previous epoch), even if not - it is essential to be able to check status without having to check logs (eg: an entry in meta or epoch [or a seperate table] containing amount of stake additions similar to what we see in the logs.

Additional Context

Since JSON logging against a file is not a common option, it makes implementation much more difficult than it needs to be to track status before being able to consume information in epoch_stake table. This is especially true for docker/kubernetes implementations which often do not make use of file-based logging and makes things difficult to rely on.
As far as I know, this is the only information that's present in log and not database - would be nice to not involve touching/knowing environment logs in scripts

@xray-robot
Copy link

Related to #797

@kderme
Copy link
Contributor

kderme commented May 26, 2023

I think we can have it available earlier

as it's already available in ledger approximately 2/3rd of previous epoch

I think it's available even earlier, almost the beginning of the previous epoch. How did you infer the 2/3?

@rdlrt
Copy link
Contributor Author

rdlrt commented Jun 2, 2023

I think it's available even earlier, almost the beginning of the previous epoch. How did you infer the 2/3?

You're right indeed, it should be available in an epoch earlier (sorry the 2/3rd of epoch reference is incorrect, I confused with next epoch's nonce - which is finalised by 6*k/10 of epoch). So ye - would be great to not have to wait post epoch transition for active stake, and if we can get previous epoch's stake sooner too - that'd be very welcome.

(PS: For koios endpoints, we did end up artificially creating snapshot information by based on delta tx , MIR/reward/withdrawals/etc - which ofcourse runs once and takes ~10-20 min, but is one of those additional band-aids that we can get rid of, and something that will not be doable with prune options)

kderme added a commit that referenced this issue Jul 13, 2023
kderme added a commit that referenced this issue Aug 16, 2023
kderme added a commit that referenced this issue Aug 16, 2023
kderme added a commit that referenced this issue Aug 16, 2023
kderme added a commit that referenced this issue Aug 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
3 participants