-
Notifications
You must be signed in to change notification settings - Fork 39
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(platform)!: total credits on platform query and fix for reward distribution #2032
Conversation
…/platform into feat/totalCreditsOnPlatformQuery
@@ -109,6 +82,15 @@ pub struct CoreConfig { | |||
pub check_tx_rpc: CheckTxCoreRpcConfig, | |||
} | |||
|
|||
impl Default for CoreConfig { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor: this impl
can be derived
use lazy_static::lazy_static; | ||
use std::collections::HashMap; | ||
|
||
lazy_static! { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor: preferable to use LazyCell
@@ -38,10 +40,21 @@ impl<C> Platform<C> { | |||
return Ok(None); | |||
}; | |||
|
|||
let start_block_core_height = if unpaid_epoch.epoch_index == 0 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor: use constant GENESIS_EPOCH
Issue being fixed or feature implemented
While we could ask Platform for the total number of credits in Platform, this was not taking into consideration promised rewards due to the core block height increase.
What was done?
Created a new query that will get the total number of credits in Platform, but also the current unpaid epoch and it's start block height. With all this information we can calculate the total credits in Platform with rewards taken into account. Something that should match what Core has (except if there are identity funding state transactions that have not been used).
How Has This Been Tested?
Added a few tests to make sure this was working.
Breaking Changes
This is not a breaking change.
Checklist:
For repository code-owners and collaborators only