Skip to content

Commit

Permalink
feat/Node: RewardsParameters to protocol (#1409)
Browse files Browse the repository at this point in the history
* rewardsParams

* spaces fix

* u64 change

* Update bindings/nodejs/lib/types/models/info/node-info-protocol.ts

Co-authored-by: DaughterOfMars <[email protected]>

* updated rust

---------

Co-authored-by: DaughterOfMars <[email protected]>
  • Loading branch information
Brord van Wierst and DaughterOfMars authored Oct 16, 2023
1 parent de89ba4 commit 38dd082
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 3 deletions.
40 changes: 40 additions & 0 deletions bindings/nodejs/lib/types/models/info/node-info-protocol.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,46 @@ export interface ProtocolParameters {
* The parameters used by signaling protocol parameters upgrade.
*/
versionSignaling: VersionSignalingParameters;
/**
* Rewards Parameters defines the parameters that are used to calculate Mana rewards.
*/
rewardsParameters: RewardsParameters;
}

/**
* Rewards Parameters defines the parameters that are used to calculate Mana rewards.
*/
export interface RewardsParameters {
/**
* The number of validation blocks that should be issued by a selected validator
* per slot during its epoch duties.
*/
validationBlocksPerSlot: number;
/**
* Profit Margin Exponent is used for shift operation for calculation of profit margin.
*/
profitMarginExponent: number;
/**
* The length in epochs of the bootstrapping phase.
*/
bootstrappingDuration: number;
/**
* Mana Share Coefficient is the coefficient used for calculation of initial rewards.
*/
manaShareCoefficient: u64;
/**
* Decay Balancing Constant Exponent is the exponent used for calculation of the initial reward.
*/
decayBalancingConstantExponent: number;
/**
* Decay Balancing Constant is an integer approximation calculated based on chosen Decay Balancing Constant Exponent.
*/
decayBalancingConstant: u64;
/**
* Pool Coefficient Exponent is the exponent used for shifting operation
* in the pool rewards calculations.
*/
poolCoefficientExponent: number;
}

/**
Expand Down
4 changes: 2 additions & 2 deletions sdk/src/types/block/mana/rewards.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use crate::types::block::{slot::EpochIndex, Error};
#[getset(get_copy = "pub")]
pub struct RewardsParameters {
/// The number of validation blocks that should be issued by a selected validator per slot during its epoch duties.
validator_blocks_per_slot: u8,
validation_blocks_per_slot: u8,
/// Used for shift operation during calculation of profit margin.
profit_margin_exponent: u8,
/// The length of the bootstrapping phase in epochs.
Expand All @@ -37,7 +37,7 @@ impl Default for RewardsParameters {
fn default() -> Self {
// TODO: use actual values
Self {
validator_blocks_per_slot: Default::default(),
validation_blocks_per_slot: Default::default(),
profit_margin_exponent: Default::default(),
bootstrapping_duration: Default::default(),
mana_share_coefficient: Default::default(),
Expand Down
2 changes: 1 addition & 1 deletion sdk/tests/types/protocol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
// "activationOffset":7
// },
// "rewardsParameters":{
// "validatorBlocksPerSlot":10,
// "validationBlocksPerSlot":10,
// "profitMarginExponent":8,
// "bootstrappingDuration":"1154",
// "manaShareCoefficient":"2",
Expand Down

0 comments on commit 38dd082

Please sign in to comment.