Release/1.0.0 rc.2 (#1214)
* Updated binaries versions to 1.0.0-rc.2 * Update GitHub Action to build nym binaries * Fix contract bootstraping * Relax the active_set check * Cleanup migration * Fix validator-api mainnet config * Removed reward estimation ts-files * Removed old migration tests Co-authored-by: Mark Sinclair <mmsinclair@gmail.com> Co-authored-by: durch <durch@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
58f3a96cde
commit
dd66697884
Generated
+8
-8
@@ -581,7 +581,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "client-core"
|
||||
version = "1.0.0-rc.1"
|
||||
version = "1.0.0-rc.2"
|
||||
dependencies = [
|
||||
"config",
|
||||
"crypto",
|
||||
@@ -1594,7 +1594,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "explorer-api"
|
||||
version = "1.0.0-rc.1"
|
||||
version = "1.0.0-rc.2"
|
||||
dependencies = [
|
||||
"chrono",
|
||||
"humantime-serde",
|
||||
@@ -3043,7 +3043,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "nym-client"
|
||||
version = "1.0.0-rc.1"
|
||||
version = "1.0.0-rc.2"
|
||||
dependencies = [
|
||||
"clap 2.34.0",
|
||||
"client-core",
|
||||
@@ -3078,7 +3078,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "nym-gateway"
|
||||
version = "1.0.0-rc.1"
|
||||
version = "1.0.0-rc.2"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"async-trait",
|
||||
@@ -3124,7 +3124,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "nym-mixnode"
|
||||
version = "1.0.0-rc.1"
|
||||
version = "1.0.0-rc.2"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"bs58",
|
||||
@@ -3162,7 +3162,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "nym-network-requester"
|
||||
version = "1.0.0-rc.1"
|
||||
version = "1.0.0-rc.2"
|
||||
dependencies = [
|
||||
"clap 2.34.0",
|
||||
"dirs",
|
||||
@@ -3183,7 +3183,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "nym-socks5-client"
|
||||
version = "1.0.0-rc.1"
|
||||
version = "1.0.0-rc.2"
|
||||
dependencies = [
|
||||
"clap 2.34.0",
|
||||
"client-core",
|
||||
@@ -3219,7 +3219,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "nym-validator-api"
|
||||
version = "1.0.0-rc.1"
|
||||
version = "1.0.0-rc.2"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"async-trait",
|
||||
|
||||
@@ -26,7 +26,7 @@ clippy-all-wallet:
|
||||
cargo clippy --workspace --manifest-path nym-wallet/Cargo.toml --all-features -- -D warnings
|
||||
|
||||
test-main:
|
||||
cargo test --all-features --workspace
|
||||
cargo test --all-features --workspace --release
|
||||
|
||||
test-contracts:
|
||||
cargo test --manifest-path contracts/Cargo.toml --all-features
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "client-core"
|
||||
version = "1.0.0-rc.1"
|
||||
version = "1.0.0-rc.2"
|
||||
authors = ["Dave Hrycyszyn <futurechimp@users.noreply.github.com>"]
|
||||
edition = "2021"
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "nym-client"
|
||||
version = "1.0.0-rc.1"
|
||||
version = "1.0.0-rc.2"
|
||||
authors = ["Dave Hrycyszyn <futurechimp@users.noreply.github.com>", "Jędrzej Stuczyński <andrew@nymtech.net>"]
|
||||
edition = "2021"
|
||||
rust-version = "1.56"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "nym-socks5-client"
|
||||
version = "1.0.0-rc.1"
|
||||
version = "1.0.0-rc.2"
|
||||
authors = ["Dave Hrycyszyn <futurechimp@users.noreply.github.com>"]
|
||||
edition = "2021"
|
||||
rust-version = "1.56"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "nym-client-wasm"
|
||||
authors = ["Dave Hrycyszyn <futurechimp@users.noreply.github.com>", "Jedrzej Stuczynski <andrew@nymtech.net>"]
|
||||
version = "1.0.0-rc.1"
|
||||
version = "1.0.0-rc.2"
|
||||
edition = "2021"
|
||||
keywords = ["nym", "sphinx", "wasm", "webassembly", "privacy", "client"]
|
||||
license = "Apache-2.0"
|
||||
|
||||
@@ -21,6 +21,6 @@ pub(crate) const REWARDING_VALIDATOR_ADDRESS: &str = "n10yyd98e2tuwu0f7ypz9dy3hh
|
||||
pub(crate) fn validators() -> Vec<ValidatorDetails> {
|
||||
vec![ValidatorDetails::new(
|
||||
"https://rpc.nyx.nodes.guru/",
|
||||
Some("https://api.nyx.nodes.guru/"),
|
||||
Some("https://validator.nymtech.net/api"),
|
||||
)]
|
||||
}
|
||||
|
||||
Generated
+1
-1
@@ -41,7 +41,7 @@ checksum = "f771a5d1f5503f7f4279a30f3643d3421ba149848b89ecaaec0ea2acf04a5ac4"
|
||||
|
||||
[[package]]
|
||||
name = "bandwidth-claim"
|
||||
version = "1.0.0-rc.1"
|
||||
version = "1.0.0-rc.2"
|
||||
dependencies = [
|
||||
"bandwidth-claim-contract",
|
||||
"config",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "bandwidth-claim"
|
||||
version = "1.0.0-rc.1"
|
||||
version = "1.0.0-rc.2"
|
||||
edition = "2021"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
@@ -30,12 +30,10 @@ use crate::rewards::queries::{
|
||||
};
|
||||
use crate::rewards::storage as rewards_storage;
|
||||
use cosmwasm_std::{
|
||||
entry_point, to_binary, Addr, Deps, DepsMut, Env, MessageInfo, QueryResponse, Response,
|
||||
Storage, Uint128,
|
||||
entry_point, to_binary, Addr, Deps, DepsMut, Env, MessageInfo, QueryResponse, Response, Uint128,
|
||||
};
|
||||
use cw_storage_plus::PrimaryKey;
|
||||
use mixnet_contract_common::{
|
||||
ContractStateParams, ExecuteMsg, InstantiateMsg, MigrateMsg, QueryMsg, SphinxKey,
|
||||
ContractStateParams, ExecuteMsg, InstantiateMsg, MigrateMsg, QueryMsg,
|
||||
};
|
||||
use time::OffsetDateTime;
|
||||
|
||||
@@ -386,87 +384,7 @@ pub fn query(deps: Deps<'_>, env: Env, msg: QueryMsg) -> Result<QueryResponse, C
|
||||
}
|
||||
|
||||
#[entry_point]
|
||||
pub fn migrate(deps: DepsMut<'_>, _env: Env, _msg: MigrateMsg) -> Result<Response, ContractError> {
|
||||
use crate::mixnodes::storage::StoredMixnodeBond;
|
||||
use cw_storage_plus::{Index, IndexList, IndexedSnapshotMap, Strategy, UniqueIndex};
|
||||
use mixnet_contract_common::{Addr, IdentityKeyRef};
|
||||
|
||||
const MIXNODES_PK_NAMESPACE: &str = "mn";
|
||||
const MIXNODES_PK_CHECKPOINTS: &str = "mn__check";
|
||||
const MIXNODES_PK_CHANGELOG: &str = "mn__change";
|
||||
const MIXNODES_OWNER_IDX_NAMESPACE: &str = "mno";
|
||||
const MIXNODES_SPHINX_IDX_NAMESPACE: &str = "mns";
|
||||
|
||||
pub(crate) struct MixnodeBondIndex<'a> {
|
||||
pub(crate) owner: UniqueIndex<'a, Addr, StoredMixnodeBond>,
|
||||
}
|
||||
|
||||
impl<'a> IndexList<StoredMixnodeBond> for MixnodeBondIndex<'a> {
|
||||
fn get_indexes(
|
||||
&'_ self,
|
||||
) -> Box<dyn Iterator<Item = &'_ dyn Index<StoredMixnodeBond>> + '_> {
|
||||
let v: Vec<&dyn Index<StoredMixnodeBond>> = vec![&self.owner];
|
||||
Box::new(v.into_iter())
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn old_mixnodes<'a>(
|
||||
) -> IndexedSnapshotMap<'a, IdentityKeyRef<'a>, StoredMixnodeBond, MixnodeBondIndex<'a>> {
|
||||
let indexes = MixnodeBondIndex {
|
||||
owner: UniqueIndex::new(|d| d.owner.clone(), MIXNODES_OWNER_IDX_NAMESPACE),
|
||||
};
|
||||
IndexedSnapshotMap::new(
|
||||
MIXNODES_PK_NAMESPACE,
|
||||
MIXNODES_PK_CHECKPOINTS,
|
||||
MIXNODES_PK_CHANGELOG,
|
||||
Strategy::Never,
|
||||
indexes,
|
||||
)
|
||||
}
|
||||
|
||||
const PAGE_SIZE: usize = 50;
|
||||
|
||||
fn migrate_page(
|
||||
store: &mut dyn Storage,
|
||||
start_after: Option<String>,
|
||||
index: &mut UniqueIndex<'_, SphinxKey, StoredMixnodeBond>,
|
||||
) -> Option<String> {
|
||||
let start = start_after
|
||||
.as_deref()
|
||||
.map(cw_storage_plus::Bound::exclusive);
|
||||
|
||||
let page: Vec<_> = old_mixnodes()
|
||||
.range(store, start, None, cosmwasm_std::Order::Ascending)
|
||||
.map(|v| v.expect("failed to deserialize stored mixnode"))
|
||||
.collect();
|
||||
|
||||
let last_pk = if page.len() == PAGE_SIZE {
|
||||
Some(page.last().unwrap().0.clone())
|
||||
} else {
|
||||
None
|
||||
};
|
||||
|
||||
for (pk, mix) in page {
|
||||
index
|
||||
.save(store, &pk.joined_key(), &mix)
|
||||
.expect("failed to save new index information");
|
||||
}
|
||||
|
||||
last_pk
|
||||
}
|
||||
|
||||
// attempt to just add indices, see how it works out
|
||||
let mut sphinx_index: UniqueIndex<'_, SphinxKey, StoredMixnodeBond> = UniqueIndex::new(
|
||||
|d| d.mix_node.sphinx_key.clone(),
|
||||
MIXNODES_SPHINX_IDX_NAMESPACE,
|
||||
);
|
||||
|
||||
let mut start_after = None;
|
||||
|
||||
while let Some(new_start) = migrate_page(deps.storage, start_after.clone(), &mut sphinx_index) {
|
||||
start_after = Some(new_start)
|
||||
}
|
||||
|
||||
pub fn migrate(_deps: DepsMut<'_>, _env: Env, _msg: MigrateMsg) -> Result<Response, ContractError> {
|
||||
Ok(Default::default())
|
||||
}
|
||||
|
||||
@@ -510,216 +428,4 @@ pub mod tests {
|
||||
tests::queries::query_contract_balance(env.contract.address, deps)
|
||||
);
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod migration {
|
||||
use super::*;
|
||||
use crate::mixnodes::storage::{mixnodes, StoredMixnodeBond};
|
||||
use crate::support::tests::test_helpers;
|
||||
use cw_storage_plus::{Index, IndexList, IndexedSnapshotMap, Strategy, UniqueIndex};
|
||||
use mixnet_contract_common::{Addr, IdentityKeyRef, Layer, MixNode};
|
||||
use rand::thread_rng;
|
||||
|
||||
const MIXNODES_PK_NAMESPACE: &str = "mn";
|
||||
const MIXNODES_PK_CHECKPOINTS: &str = "mn__check";
|
||||
const MIXNODES_PK_CHANGELOG: &str = "mn__change";
|
||||
const MIXNODES_OWNER_IDX_NAMESPACE: &str = "mno";
|
||||
|
||||
pub(crate) struct MixnodeBondIndex<'a> {
|
||||
pub(crate) owner: UniqueIndex<'a, Addr, StoredMixnodeBond>,
|
||||
}
|
||||
|
||||
// IndexList is just boilerplate code for fetching a struct's indexes
|
||||
// note that from my understanding this will be converted into a macro at some point in the future
|
||||
impl<'a> IndexList<StoredMixnodeBond> for MixnodeBondIndex<'a> {
|
||||
fn get_indexes(
|
||||
&'_ self,
|
||||
) -> Box<dyn Iterator<Item = &'_ dyn Index<StoredMixnodeBond>> + '_> {
|
||||
let v: Vec<&dyn Index<StoredMixnodeBond>> = vec![&self.owner];
|
||||
Box::new(v.into_iter())
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn old_mixnodes<'a>(
|
||||
) -> IndexedSnapshotMap<'a, IdentityKeyRef<'a>, StoredMixnodeBond, MixnodeBondIndex<'a>>
|
||||
{
|
||||
let indexes = MixnodeBondIndex {
|
||||
owner: UniqueIndex::new(|d| d.owner.clone(), MIXNODES_OWNER_IDX_NAMESPACE),
|
||||
};
|
||||
IndexedSnapshotMap::new(
|
||||
MIXNODES_PK_NAMESPACE,
|
||||
MIXNODES_PK_CHECKPOINTS,
|
||||
MIXNODES_PK_CHANGELOG,
|
||||
Strategy::Never,
|
||||
indexes,
|
||||
)
|
||||
}
|
||||
|
||||
fn change_stored_bond(store: &mut dyn Storage, key: &str, height: u64) {
|
||||
// just to have something changing, update ports to some stupid values
|
||||
let mut old = old_mixnodes().load(store, key).unwrap();
|
||||
old.mix_node.mix_port += 1;
|
||||
old.mix_node.verloc_port -= 1;
|
||||
|
||||
let reward = old.accumulated_rewards.unwrap_or_default();
|
||||
old.accumulated_rewards = Some(reward + Uint128::new(42));
|
||||
|
||||
old_mixnodes().save(store, key, &old, height).unwrap()
|
||||
}
|
||||
|
||||
fn bond_old_mixnode(
|
||||
store: &mut dyn Storage,
|
||||
sender: &str,
|
||||
height: u64,
|
||||
) -> (String, String) {
|
||||
let keypair = crypto::asymmetric::identity::KeyPair::new(&mut thread_rng());
|
||||
let legit_sphix = crypto::asymmetric::encryption::KeyPair::new(&mut thread_rng());
|
||||
let key = keypair.public_key().to_base58_string();
|
||||
let key2 = legit_sphix.public_key().to_base58_string();
|
||||
|
||||
old_mixnodes()
|
||||
.save(
|
||||
store,
|
||||
&key,
|
||||
&StoredMixnodeBond {
|
||||
pledge_amount: Default::default(),
|
||||
owner: Addr::unchecked(sender),
|
||||
layer: Layer::One,
|
||||
block_height: height,
|
||||
mix_node: MixNode {
|
||||
host: "1.2.3.4".to_string(),
|
||||
mix_port: 1234,
|
||||
verloc_port: 1234,
|
||||
http_api_port: 123,
|
||||
sphinx_key: key2.clone(),
|
||||
identity_key: key.clone(),
|
||||
version: "1.2.3".to_string(),
|
||||
profit_margin_percent: 42,
|
||||
},
|
||||
proxy: None,
|
||||
accumulated_rewards: None,
|
||||
epoch_rewards: None,
|
||||
},
|
||||
height,
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
(key, key2)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn empty() {
|
||||
let mut deps = test_helpers::init_contract();
|
||||
let env = mock_env();
|
||||
assert!(migrate(deps.as_mut(), env, MigrateMsg {}).is_ok())
|
||||
}
|
||||
|
||||
fn check_mixnode(storage: &dyn Storage, owner: Addr, id: &str, expected_sphinx: &str) {
|
||||
assert_eq!(
|
||||
mixnodes().load(storage, &id).unwrap().mix_node.sphinx_key,
|
||||
expected_sphinx
|
||||
);
|
||||
assert_eq!(
|
||||
mixnodes()
|
||||
.idx
|
||||
.owner
|
||||
.item(storage, owner)
|
||||
.unwrap()
|
||||
.unwrap()
|
||||
.1
|
||||
.mix_node
|
||||
.sphinx_key,
|
||||
expected_sphinx
|
||||
);
|
||||
assert_eq!(
|
||||
mixnodes()
|
||||
.idx
|
||||
.sphinx_key
|
||||
.item(storage, expected_sphinx.to_owned())
|
||||
.unwrap()
|
||||
.unwrap()
|
||||
.1
|
||||
.mix_node
|
||||
.sphinx_key,
|
||||
expected_sphinx
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn single_bond() {
|
||||
let mut deps = test_helpers::init_contract();
|
||||
let env = mock_env();
|
||||
|
||||
let (id, sphinx) = bond_old_mixnode(deps.as_mut().storage, "bob", 42);
|
||||
|
||||
assert!(migrate(deps.as_mut(), env, MigrateMsg {}).is_ok());
|
||||
check_mixnode(deps.as_ref().storage, Addr::unchecked("bob"), &id, &sphinx);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn multiple_bonds() {
|
||||
let mut deps = test_helpers::init_contract();
|
||||
let env = mock_env();
|
||||
|
||||
let (id1, sphinx1) = bond_old_mixnode(deps.as_mut().storage, "bob", 42);
|
||||
let (id2, sphinx2) = bond_old_mixnode(deps.as_mut().storage, "alice", 43);
|
||||
let (id3, sphinx3) = bond_old_mixnode(deps.as_mut().storage, "eve", 44);
|
||||
|
||||
assert!(migrate(deps.as_mut(), env, MigrateMsg {}).is_ok());
|
||||
check_mixnode(
|
||||
deps.as_ref().storage,
|
||||
Addr::unchecked("bob"),
|
||||
&id1,
|
||||
&sphinx1,
|
||||
);
|
||||
check_mixnode(
|
||||
deps.as_ref().storage,
|
||||
Addr::unchecked("alice"),
|
||||
&id2,
|
||||
&sphinx2,
|
||||
);
|
||||
check_mixnode(
|
||||
deps.as_ref().storage,
|
||||
Addr::unchecked("eve"),
|
||||
&id3,
|
||||
&sphinx3,
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn multiple_bonds_with_history() {
|
||||
let mut deps = test_helpers::init_contract();
|
||||
let env = mock_env();
|
||||
|
||||
let (id1, sphinx1) = bond_old_mixnode(deps.as_mut().storage, "bob", 42);
|
||||
let (id2, sphinx2) = bond_old_mixnode(deps.as_mut().storage, "alice", 43);
|
||||
let (id3, sphinx3) = bond_old_mixnode(deps.as_mut().storage, "eve", 44);
|
||||
|
||||
// make alice change her bond multiple times
|
||||
change_stored_bond(deps.as_mut().storage, &id2, 1234);
|
||||
change_stored_bond(deps.as_mut().storage, &id2, 4326);
|
||||
change_stored_bond(deps.as_mut().storage, &id2, 432576);
|
||||
change_stored_bond(deps.as_mut().storage, &id2, 5474746);
|
||||
|
||||
assert!(migrate(deps.as_mut(), env, MigrateMsg {}).is_ok());
|
||||
check_mixnode(
|
||||
deps.as_ref().storage,
|
||||
Addr::unchecked("bob"),
|
||||
&id1,
|
||||
&sphinx1,
|
||||
);
|
||||
check_mixnode(
|
||||
deps.as_ref().storage,
|
||||
Addr::unchecked("alice"),
|
||||
&id2,
|
||||
&sphinx2,
|
||||
);
|
||||
check_mixnode(
|
||||
deps.as_ref().storage,
|
||||
Addr::unchecked("eve"),
|
||||
&id3,
|
||||
&sphinx3,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,9 +27,8 @@ pub fn try_write_rewarded_set(
|
||||
return Err(ContractError::Unauthorized);
|
||||
}
|
||||
|
||||
// sanity check to make sure the sending validator is in sync with the contract state
|
||||
// (i.e. so that we'd known that top k nodes are actually expected to be active)
|
||||
if active_set_size != state.params.mixnode_active_set_size {
|
||||
// We don't want more then we need, less should be fine, as we could have less nodes bonded overall
|
||||
if active_set_size > state.params.mixnode_active_set_size {
|
||||
return Err(ContractError::UnexpectedActiveSetSize {
|
||||
received: active_set_size,
|
||||
expected: state.params.mixnode_active_set_size,
|
||||
@@ -43,15 +42,16 @@ pub fn try_write_rewarded_set(
|
||||
});
|
||||
}
|
||||
|
||||
let last_update = storage::CURRENT_REWARDED_SET_HEIGHT.load(deps.storage)?;
|
||||
let block_height = env.block.height;
|
||||
|
||||
if last_update + crate::constants::REWARDED_SET_REFRESH_BLOCKS > block_height {
|
||||
return Err(ContractError::TooFrequentRewardedSetUpdate {
|
||||
last_update,
|
||||
minimum_delay: crate::constants::REWARDED_SET_REFRESH_BLOCKS,
|
||||
current_height: block_height,
|
||||
});
|
||||
if let Some(last_update) = storage::CURRENT_REWARDED_SET_HEIGHT.may_load(deps.storage)? {
|
||||
if last_update + crate::constants::REWARDED_SET_REFRESH_BLOCKS > block_height {
|
||||
return Err(ContractError::TooFrequentRewardedSetUpdate {
|
||||
last_update,
|
||||
minimum_delay: crate::constants::REWARDED_SET_REFRESH_BLOCKS,
|
||||
current_height: block_height,
|
||||
});
|
||||
}
|
||||
}
|
||||
let num_nodes = rewarded_set.len();
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "explorer-api"
|
||||
version = "1.0.0-rc.1"
|
||||
version = "1.0.0-rc.2"
|
||||
edition = "2021"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
|
||||
[package]
|
||||
name = "nym-gateway"
|
||||
version = "1.0.0-rc.1"
|
||||
version = "1.0.0-rc.2"
|
||||
authors = ["Dave Hrycyszyn <futurechimp@users.noreply.github.com>", "Jędrzej Stuczyński <andrew@nymtech.net>"]
|
||||
description = "Implementation of the Nym Mixnet Gateway"
|
||||
edition = "2021"
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
|
||||
[package]
|
||||
name = "nym-mixnode"
|
||||
version = "1.0.0-rc.1"
|
||||
version = "1.0.0-rc.2"
|
||||
authors = [
|
||||
"Dave Hrycyszyn <futurechimp@users.noreply.github.com>",
|
||||
"Jędrzej Stuczyński <andrew@nymtech.net>",
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { useContext, useEffect, useState } from 'react';
|
||||
import { ClientContext } from '../../context/main';
|
||||
import {
|
||||
getMixnodeRewardEstimation,
|
||||
// getMixnodeRewardEstimation,
|
||||
getMixnodeStakeSaturation,
|
||||
getMixnodeStatus,
|
||||
minorToMajor,
|
||||
@@ -33,14 +33,6 @@ export const useSettingsState = (shouldUpdate: boolean) => {
|
||||
}
|
||||
};
|
||||
|
||||
const getRewardEstimation = async (mixnodeKey: string) => {
|
||||
const newRewardEstimation = await getMixnodeRewardEstimation(mixnodeKey);
|
||||
if (newRewardEstimation) {
|
||||
const toMajor = await minorToMajor(newRewardEstimation.estimated_total_node_reward.toString());
|
||||
setRewardEstimation(parseInt(toMajor.amount, Number(10)));
|
||||
}
|
||||
};
|
||||
|
||||
const getMixnodeInclusionProbability = async (mixnodeKey: string) => {
|
||||
const probability = await getInclusionProbability(mixnodeKey);
|
||||
if (probability) {
|
||||
@@ -64,7 +56,6 @@ export const useSettingsState = (shouldUpdate: boolean) => {
|
||||
(async () => {
|
||||
await getStatus(mixnodeDetails?.mix_node.identity_key);
|
||||
await getStakeSaturation(mixnodeDetails?.mix_node.identity_key);
|
||||
await getRewardEstimation(mixnodeDetails?.mix_node.identity_key);
|
||||
await getMixnodeInclusionProbability(mixnodeDetails?.mix_node.identity_key);
|
||||
})();
|
||||
} else {
|
||||
|
||||
@@ -6,7 +6,7 @@ import {
|
||||
InclusionProbabilityResponse,
|
||||
MixnodeStatusResponse,
|
||||
Operation,
|
||||
RewardEstimationResponse,
|
||||
// RewardEstimationResponse,
|
||||
StakeSaturationResponse,
|
||||
TMixnodeBondDetails,
|
||||
TPagedDelegations,
|
||||
@@ -38,11 +38,6 @@ export const getMixnodeStakeSaturation = async (identity: string): Promise<Stake
|
||||
return res;
|
||||
};
|
||||
|
||||
export const getMixnodeRewardEstimation = async (identity: string): Promise<RewardEstimationResponse> => {
|
||||
const res: RewardEstimationResponse = await invoke('mixnode_reward_estimation', { identity });
|
||||
return res;
|
||||
};
|
||||
|
||||
export const getMixnodeStatus = async (identity: string): Promise<MixnodeStatusResponse> => {
|
||||
const res: MixnodeStatusResponse = await invoke('mixnode_status', { identity });
|
||||
return res;
|
||||
|
||||
@@ -12,7 +12,6 @@ export * from './network';
|
||||
export * from './operation';
|
||||
export * from './originalvestingresponse';
|
||||
export * from './rewardedsetnodestatus';
|
||||
export * from './rewardestimationresponse';
|
||||
export * from './stakesaturationresponse';
|
||||
export * from './stateparams';
|
||||
export * from './tauritxresult';
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
[package]
|
||||
name = "nym-network-requester"
|
||||
version = "1.0.0-rc.1"
|
||||
version = "1.0.0-rc.2"
|
||||
authors = ["Dave Hrycyszyn <futurechimp@users.noreply.github.com>", "Jędrzej Stuczyński <andrew@nymtech.net>"]
|
||||
edition = "2021"
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
[package]
|
||||
name = "nym-validator-api"
|
||||
version = "1.0.0-rc.1"
|
||||
version = "1.0.0-rc.2"
|
||||
authors = [
|
||||
"Dave Hrycyszyn <futurechimp@users.noreply.github.com>",
|
||||
"Jędrzej Stuczyński <andrew@nymtech.net>",
|
||||
|
||||
Reference in New Issue
Block a user