Skip to content

Commit

Permalink
Explorer: tweak selection probability categories (nymtech#1503)
Browse files Browse the repository at this point in the history
* validator-api: tweak SelectionChance

* wallet: update SelectionChance colorMap

* changelog: add note
  • Loading branch information
octol authored Aug 9, 2022
1 parent d918b69 commit 30e73ee
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 14 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ Post 1.0.0 release, the changelog format is based on [Keep a Changelog](https://
- multisig-contract: Limit the proposal creating functionality to one address (coconut-bandwidth-contract address) ([#1457])
- All binaries and cosmwasm blobs are configured at runtime now; binaries are configured using environment variables or .env files and contracts keep the configuration parameters in storage ([#1463])
- gateway, network-statistics: include gateway id in the sent statistical data ([#1478])
- network explorer: tweak how active set probability is shown ([#1503])


[#1249]: https://github.com/nymtech/nym/pull/1249
Expand Down Expand Up @@ -79,6 +80,7 @@ Post 1.0.0 release, the changelog format is based on [Keep a Changelog](https://
[#1482]: https://github.com/nymtech/nym/pull/1482
[#1487]: https://github.com/nymtech/nym/pull/1487
[#1496]: https://github.com/nymtech/nym/pull/1496
[#1503]: https://github.com/nymtech/nym/pull/1503

## [nym-connect-v1.0.1](https://github.com/nymtech/nym/tree/nym-connect-v1.0.1) (2022-07-22)

Expand Down
4 changes: 0 additions & 4 deletions nym-wallet/src/pages/settings/system-variables.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,14 @@ const DataField = ({ title, info, Indicator }: { title: string; info: string; In
);

const colorMap: { [key in SelectionChance]: string } = {
VeryLow: 'error.main',
Low: 'error.main',
Moderate: 'warning.main',
High: 'success.main',
VeryHigh: 'success.main',
};

const textMap: { [key in SelectionChance]: string } = {
VeryLow: 'Very low',
Low: 'Low',
Moderate: 'Moderate',
High: 'High',
VeryHigh: 'Very high',
};

Expand Down
2 changes: 1 addition & 1 deletion ts-packages/types/src/types/rust/SelectionChance.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export type SelectionChance = 'VeryHigh' | 'High' | 'Moderate' | 'Low' | 'VeryLow';
export type SelectionChance = 'VeryHigh' | 'Moderate' | 'Low';
12 changes: 3 additions & 9 deletions validator-api/validator-api-requests/src/models.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,20 +101,16 @@ pub type StakeSaturation = f32;
)]
pub enum SelectionChance {
VeryHigh,
High,
Moderate,
Low,
VeryLow,
}

impl From<f64> for SelectionChance {
fn from(p: f64) -> SelectionChance {
match p {
p if p >= 1. => SelectionChance::VeryHigh,
p if p > 0.9 => SelectionChance::High,
p if p > 0.7 => SelectionChance::Moderate,
p if p > 0.5 => SelectionChance::Low,
_ => SelectionChance::VeryLow,
p if p > 0.15 => SelectionChance::VeryHigh,
p if p >= 0.05 => SelectionChance::Moderate,
_ => SelectionChance::Low,
}
}
}
Expand All @@ -123,10 +119,8 @@ impl fmt::Display for SelectionChance {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
SelectionChance::VeryHigh => write!(f, "VeryHigh"),
SelectionChance::High => write!(f, "High"),
SelectionChance::Moderate => write!(f, "Moderate"),
SelectionChance::Low => write!(f, "Low"),
SelectionChance::VeryLow => write!(f, "VeryLow"),
}
}
}
Expand Down

0 comments on commit 30e73ee

Please sign in to comment.