Compare commits

..

4 Commits

Author SHA1 Message Date
493a4db663
bump version
Signed-off-by: Uncle Stretch <uncle.stretch@ghostchain.io>
2025-01-23 21:59:01 +03:00
9e045ca6cc
make two decimals for reward_details
Signed-off-by: Uncle Stretch <uncle.stretch@ghostchain.io>
2025-01-23 21:58:23 +03:00
a365acc2a1
update points for piecewise linear, based on the casper v0.0.3 curve
Signed-off-by: Uncle Stretch <uncle.stretch@ghostchain.io>
2025-01-23 21:55:07 +03:00
44bd27e8f0
fix for the reward history range
Signed-off-by: Uncle Stretch <uncle.stretch@ghostchain.io>
2025-01-23 21:53:09 +03:00
4 changed files with 51 additions and 43 deletions

View File

@ -2,7 +2,7 @@
name = "ghost-eye" name = "ghost-eye"
authors = ["str3tch <stretch@ghostchain.io>"] authors = ["str3tch <stretch@ghostchain.io>"]
description = "Application for interacting with Casper/Ghost nodes that are exposing RPC only to the localhost" description = "Application for interacting with Casper/Ghost nodes that are exposing RPC only to the localhost"
version = "0.3.15" version = "0.3.16"
edition = "2021" edition = "2021"
[dependencies] [dependencies]

View File

@ -44,7 +44,7 @@ impl RewardDetails {
"blocked".to_string() "blocked".to_string()
} else { } else {
let result = self.commission as f64 / 1_000_000_000.0; let result = self.commission as f64 / 1_000_000_000.0;
format!("{:.1}%", result) format!("{:.2}%", result)
} }
} }
} }

View File

@ -1,47 +1,46 @@
use subxt::ext::sp_runtime::Perbill; use subxt::ext::sp_runtime::Perbill;
// generated outside, based on params // generated outside, based on params
// MIN_INFLATION: u32 = 0_025_000; // MIN_INFLATION: u32 = 0_006_900;
// MAX_INFLATION: u32 = 0_100_000; // MAX_INFLATION: u32 = 0_690_000;
// IDEAL_STAKE: u32 = 0_750_000; // IDEAL_STAKE: u32 = 0_690_000;
// FALLOFF: u32 = 0_050_000; // FALLOFF: u32 = 0_050_000;
// MAX_PIECE_COUNT: u32 = 40; // MAX_PIECE_COUNT: u32 = 40;
const PIECEWISE_LINEAR_POUNTS: [(Perbill, Perbill); 33] = [ const PIECEWISE_LINEAR_POUNTS: [(Perbill, Perbill); 32] = [
(Perbill::from_parts(0), Perbill::from_parts(25000000)), (Perbill::from_parts(0), Perbill::from_parts(6900000)),
(Perbill::from_parts(750000000), Perbill::from_parts(100000000)), (Perbill::from_parts(690000000), Perbill::from_parts(690000000)),
(Perbill::from_parts(758333000), Perbill::from_parts(91817000)), (Perbill::from_parts(692740000), Perbill::from_parts(664536000)),
(Perbill::from_parts(766666000), Perbill::from_parts(84528000)), (Perbill::from_parts(695588000), Perbill::from_parts(639072000)),
(Perbill::from_parts(774999000), Perbill::from_parts(78033000)), (Perbill::from_parts(698554000), Perbill::from_parts(613608000)),
(Perbill::from_parts(783331000), Perbill::from_parts(72248000)), (Perbill::from_parts(701647000), Perbill::from_parts(588144000)),
(Perbill::from_parts(791663000), Perbill::from_parts(67094000)), (Perbill::from_parts(704879000), Perbill::from_parts(562680000)),
(Perbill::from_parts(799996000), Perbill::from_parts(62502000)), (Perbill::from_parts(708262000), Perbill::from_parts(537216000)),
(Perbill::from_parts(808328000), Perbill::from_parts(58411000)), (Perbill::from_parts(711811000), Perbill::from_parts(511752000)),
(Perbill::from_parts(816661000), Perbill::from_parts(54766000)), (Perbill::from_parts(715545000), Perbill::from_parts(486288000)),
(Perbill::from_parts(824993000), Perbill::from_parts(51519000)), (Perbill::from_parts(719482000), Perbill::from_parts(460824000)),
(Perbill::from_parts(833325000), Perbill::from_parts(48626000)), (Perbill::from_parts(723646000), Perbill::from_parts(435360000)),
(Perbill::from_parts(841656000), Perbill::from_parts(46049000)), (Perbill::from_parts(728066000), Perbill::from_parts(409896000)),
(Perbill::from_parts(849988000), Perbill::from_parts(43753000)), (Perbill::from_parts(732774000), Perbill::from_parts(384432000)),
(Perbill::from_parts(858321000), Perbill::from_parts(41707000)), (Perbill::from_parts(737811000), Perbill::from_parts(358968000)),
(Perbill::from_parts(866651000), Perbill::from_parts(39885000)), (Perbill::from_parts(743227000), Perbill::from_parts(333504000)),
(Perbill::from_parts(874984000), Perbill::from_parts(38261000)), (Perbill::from_parts(749083000), Perbill::from_parts(308040000)),
(Perbill::from_parts(883313000), Perbill::from_parts(36815000)), (Perbill::from_parts(755456000), Perbill::from_parts(282576000)),
(Perbill::from_parts(891646000), Perbill::from_parts(35526000)), (Perbill::from_parts(762447000), Perbill::from_parts(257112000)),
(Perbill::from_parts(899976000), Perbill::from_parts(34378000)), (Perbill::from_parts(770189000), Perbill::from_parts(231648000)),
(Perbill::from_parts(908308000), Perbill::from_parts(33355000)), (Perbill::from_parts(778863000), Perbill::from_parts(206184000)),
(Perbill::from_parts(916636000), Perbill::from_parts(32444000)), (Perbill::from_parts(788725000), Perbill::from_parts(180720000)),
(Perbill::from_parts(924968000), Perbill::from_parts(31632000)), (Perbill::from_parts(800151000), Perbill::from_parts(155256000)),
(Perbill::from_parts(933295000), Perbill::from_parts(30909000)), (Perbill::from_parts(813735000), Perbill::from_parts(129792000)),
(Perbill::from_parts(941619000), Perbill::from_parts(30265000)), (Perbill::from_parts(830484000), Perbill::from_parts(104328000)),
(Perbill::from_parts(949946000), Perbill::from_parts(29691000)), (Perbill::from_parts(852337000), Perbill::from_parts(78864000)),
(Perbill::from_parts(958265000), Perbill::from_parts(29180000)), (Perbill::from_parts(877801000), Perbill::from_parts(57460000)),
(Perbill::from_parts(966598000), Perbill::from_parts(28724000)), (Perbill::from_parts(903265000), Perbill::from_parts(42422000)),
(Perbill::from_parts(974925000), Perbill::from_parts(28318000)), (Perbill::from_parts(928728000), Perbill::from_parts(31857000)),
(Perbill::from_parts(983258000), Perbill::from_parts(27956000)), (Perbill::from_parts(954189000), Perbill::from_parts(24435000)),
(Perbill::from_parts(991578000), Perbill::from_parts(27634000)), (Perbill::from_parts(979651000), Perbill::from_parts(19220000)),
(Perbill::from_parts(999899000), Perbill::from_parts(27347000)), (Perbill::from_parts(1000000000), Perbill::from_parts(16291000)),
(Perbill::from_parts(1000000000), Perbill::from_parts(27343000)),
]; ];
const MAXIMUM_INFLATION: Perbill = Perbill::from_parts(100000000); const MAXIMUM_INFLATION: Perbill = Perbill::from_parts(690000000);
pub fn calculate_for_fraction(n: u128, d: u128) -> (Perbill, Perbill) { pub fn calculate_for_fraction(n: u128, d: u128) -> (Perbill, Perbill) {
let n = n.min(d.clone()); let n = n.min(d.clone());
@ -111,5 +110,5 @@ pub fn prepare_perbill_fraction_string(value: Perbill) -> String {
m /= 10; m /= 10;
} }
format!("{}.{}%", units, rest / m) format!("{}.{:02}%", units, rest / m)
} }

View File

@ -283,9 +283,18 @@ pub async fn get_validator_staking_results(
) -> Result<()> { ) -> Result<()> {
let (start, end) = super::raw_calls::historical::stored_range(api, None) let (start, end) = super::raw_calls::historical::stored_range(api, None)
.await? .await?
.map(|range| (range.0.saturating_div(6), range.1.saturating_div(6))) .map(|range| {
(
range.0
.saturating_div(6)
.saturating_sub(1),
range.1
.saturating_div(6)
.saturating_sub(1),
)
})
.unwrap_or((0, 0)); .unwrap_or((0, 0));
for era_index in start..end.saturating_sub(2) { for era_index in start..end {
get_validator_staking_result(action_tx, api, account_id, era_index).await?; get_validator_staking_result(action_tx, api, account_id, era_index).await?;
} }
Ok(()) Ok(())