Node family management (#1670)
* Family management messages * Add family queries * Add queries to client * Layer assignment message * Paged family queries, annotate mixnodes with family * Add layer assignments to epoch operations * Remove family layer peristence * Add NotImplemented error for kick Co-authored-by: Jędrzej Stuczyński <jedrzej.stuczynski@gmail.com>
This commit is contained in:
@@ -5,6 +5,7 @@ use crate::nymd_client::Client;
|
||||
use crate::storage::ValidatorApiStorage;
|
||||
use ::time::OffsetDateTime;
|
||||
use anyhow::Result;
|
||||
use mixnet_contract_common::families::FamilyHead;
|
||||
use mixnet_contract_common::mixnode::MixNodeDetails;
|
||||
use mixnet_contract_common::reward_params::{Performance, RewardingParams};
|
||||
use mixnet_contract_common::{
|
||||
@@ -141,7 +142,11 @@ impl<C> ValidatorCacheRefresher<C> {
|
||||
interval_reward_params: RewardingParams,
|
||||
current_interval: Interval,
|
||||
rewarded_set: &HashMap<MixId, RewardedSetNodeStatus>,
|
||||
mix_to_family: Vec<(IdentityKey, FamilyHead)>,
|
||||
) -> Vec<MixNodeBondAnnotated> {
|
||||
let mix_to_family = mix_to_family
|
||||
.into_iter()
|
||||
.collect::<HashMap<IdentityKey, FamilyHead>>();
|
||||
let mut annotated = Vec::new();
|
||||
for mixnode in mixnodes {
|
||||
let stake_saturation = mixnode
|
||||
@@ -174,6 +179,10 @@ impl<C> ValidatorCacheRefresher<C> {
|
||||
current_interval,
|
||||
);
|
||||
|
||||
let family = mix_to_family
|
||||
.get(&mixnode.bond_information.identity().to_string())
|
||||
.cloned();
|
||||
|
||||
annotated.push(MixNodeBondAnnotated {
|
||||
mixnode_details: mixnode,
|
||||
stake_saturation,
|
||||
@@ -181,6 +190,7 @@ impl<C> ValidatorCacheRefresher<C> {
|
||||
performance,
|
||||
estimated_operator_apy,
|
||||
estimated_delegators_apy,
|
||||
family,
|
||||
});
|
||||
}
|
||||
annotated
|
||||
@@ -226,10 +236,18 @@ impl<C> ValidatorCacheRefresher<C> {
|
||||
let mixnodes = self.nymd_client.get_mixnodes().await?;
|
||||
let gateways = self.nymd_client.get_gateways().await?;
|
||||
|
||||
let mix_to_family = self.nymd_client.get_all_family_members().await?;
|
||||
|
||||
let rewarded_set = self.get_rewarded_set_map().await;
|
||||
|
||||
let mixnodes = self
|
||||
.annotate_node_with_details(mixnodes, rewarding_params, current_interval, &rewarded_set)
|
||||
.annotate_node_with_details(
|
||||
mixnodes,
|
||||
rewarding_params,
|
||||
current_interval,
|
||||
&rewarded_set,
|
||||
mix_to_family,
|
||||
)
|
||||
.await;
|
||||
|
||||
let (rewarded_set, active_set) =
|
||||
@@ -322,6 +340,7 @@ impl ValidatorCache {
|
||||
})
|
||||
}
|
||||
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
async fn update_cache(
|
||||
&self,
|
||||
mixnodes: Vec<MixNodeBondAnnotated>,
|
||||
|
||||
Reference in New Issue
Block a user