You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When a user account stakes tokens with a validator, they receive staking rewards at the end of each epoch. Even though the reward is auto-staked and not technically in the end users' possession yet, users want to see the number of ROSE that they received each epoch. This is a highly requested feature. Oasis Monitor used to provide it, but currently no explorer does.
It would be good to expose slashing of staked funds in the same way.
**Suggestion from OP
I suggest we expose this as synthetic events. It's a little unprincipled because we normally only expose events emitted by the chain, but it's the natural place to show these.
Implementation:
This will require us to keep track of some historical values, likely validators' balances and shares at the end of each epoch (What about slashing? Can happen at any time.). Possible approach:
introduce a new table or two for historical values
at the end of fast-sync, backfill the table(s) and generate events
during slow sync, at the start of each epoch, add rows to historical tables and generate events
Helpful reading: Split 2023 presentation on technicalities of staking rewards: [redacted]
**Alternative
We should consider exposing this in a custom endpoint that returns the rewards for each epoch in a given year. The events table is already quite large and inserting ~5 years of epochs(44k) with ~30k (delegator/delegatee) pairs would easily create an additional 1 billion synthetic events.
Calculating the per-epoch staking rewards for a given account is likely too slow to be done on request, but we can test and confirm. Otherwise, it could be done in a secondary analyzer or a materialized view.
The text was updated successfully, but these errors were encountered:
When a user account stakes tokens with a validator, they receive staking rewards at the end of each epoch. Even though the reward is auto-staked and not technically in the end users' possession yet, users want to see the number of ROSE that they received each epoch. This is a highly requested feature. Oasis Monitor used to provide it, but currently no explorer does.
It would be good to expose slashing of staked funds in the same way.
**Suggestion from OP
I suggest we expose this as synthetic events. It's a little unprincipled because we normally only expose events emitted by the chain, but it's the natural place to show these.
Implementation:
This will require us to keep track of some historical values, likely validators' balances and shares at the end of each epoch (What about slashing? Can happen at any time.). Possible approach:
introduce a new table or two for historical values
at the end of fast-sync, backfill the table(s) and generate events
during slow sync, at the start of each epoch, add rows to historical tables and generate events
Helpful reading: Split 2023 presentation on technicalities of staking rewards: [redacted]
**Alternative
We should consider exposing this in a custom endpoint that returns the rewards for each epoch in a given year. The events table is already quite large and inserting ~5 years of epochs(44k) with ~30k (delegator/delegatee) pairs would easily create an additional 1 billion synthetic events.
Calculating the per-epoch staking rewards for a given account is likely too slow to be done on request, but we can test and confirm. Otherwise, it could be done in a secondary analyzer or a materialized view.
The text was updated successfully, but these errors were encountered: