From a5ca085d6ef6bcd34761d9c33d19ad37be9aa2dc Mon Sep 17 00:00:00 2001 From: FiveMovesAhead Date: Thu, 9 Oct 2025 11:53:01 +0100 Subject: [PATCH] Move gamma magic numbers to config. --- tig-protocol/src/contracts/rewards.rs | 6 ++++-- tig-structs/src/config.rs | 8 ++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/tig-protocol/src/contracts/rewards.rs b/tig-protocol/src/contracts/rewards.rs index 72e70338..8eb353de 100644 --- a/tig-protocol/src/contracts/rewards.rs +++ b/tig-protocol/src/contracts/rewards.rs @@ -26,8 +26,10 @@ pub(crate) async fn update(cache: &mut AddBlockCache) { let active_challenge_ids = &block_data.active_ids[&ActiveType::Challenge]; let zero = PreciseNumber::from(0); - block_details.gamma_value = - 1.0258 * (1.0 - 0.8730 * (-0.0354 * active_challenge_ids.len() as f64).exp()); + block_details.gamma_value = config.rewards.gamma.a + * (1.0 + - config.rewards.gamma.b + * (-config.rewards.gamma.c * active_challenge_ids.len() as f64).exp()); let block_reward = PreciseNumber::from_f64( config .rewards diff --git a/tig-structs/src/config.rs b/tig-structs/src/config.rs index 2974c8fd..6aba62ef 100644 --- a/tig-structs/src/config.rs +++ b/tig-structs/src/config.rs @@ -120,10 +120,18 @@ serializable_struct_with_getters! { } serializable_struct_with_getters! { RewardsConfig { + gamma: GammaConfig, distribution: DistributionConfig, schedule: Vec, } } +serializable_struct_with_getters! { + GammaConfig { + a: f64, + b: f64, + c: f64, + } +} serializable_struct_with_getters! { DistributionConfig { opow: f64,