d8c84cc4d6
* wip * wip: wrap node's sphinx key with a manager * wip: choosing correct key for packet processing * further propagation of key rotation information * attaching key rotation information to reply surbs * added basic key rotation information to mixnet contract * wip: introducing cached queries for key rotation info from nym api * unified nym-api contract cache refreshing * finish packet decoding * multi api client + retrieving rotation id * rotating sphinx key files * logic for migrating config file * wip: putting new sphinx keys to self described endpoints * processing loop of KeyRotationController * fixed sphinx key loading * rotating bloomfilters * wired up KeyRotationController * flushing bloomfilters to disk and loading * most of nym-node changes * post rebase fixes * fixes due to backwards compatible hostkeys * split http state.rs file * dont use deprecated fields * fixed backwards compatible deserialisation of host information * split up node describe cache * added a dedicated CacheRefresher listener to perform full refresh outside the set interval * controlling announced sphinx keys within nym-api * retrieving rotation id when pulling topology * split nym-nodes http handlers * v2 nym-api endpoints to retrieve nodes with additional metadata information * bug fixes... * additional bugfixes and guards against stuck epoch * testnet manager: set first nym-api as the rewarder * fixed host information deserialisation * fixed panic during first key rotation * post rebase fixes * clippy * more guards against stuck epochs * added helper method to reset node's sphinx key * instantiate mixnet contract with custom key rotation validity * additional bugfixes and debugging nym-api deadlock * passing shutdown to nym apis client * remove dead test * post rebasing fixes * missing MixnetQueryClient variants * remove usage of deprecated methods in sdk example * fix: incorrect method signature * post rebasing fixes * attempt to retrieve key rotation id before doing any config migration work * ignore tests relying on networking behaviour * allow networking failures in certain tests
71 lines
2.2 KiB
Rust
71 lines
2.2 KiB
Rust
// Copyright 2022-2023 - Nym Technologies SA <contact@nymtech.net>
|
|
// SPDX-License-Identifier: GPL-3.0-only
|
|
|
|
use nym_api_requests::legacy::{LegacyGatewayBondWithId, LegacyMixNodeDetailsWithLayer};
|
|
use nym_api_requests::models::ConfigScoreDataResponse;
|
|
use nym_contracts_common::ContractBuildInformation;
|
|
use nym_mixnet_contract_common::{
|
|
ConfigScoreParams, HistoricalNymNodeVersionEntry, Interval, KeyRotationState, NymNodeDetails,
|
|
RewardingParams,
|
|
};
|
|
use nym_topology::CachedEpochRewardedSet;
|
|
use nym_validator_client::nyxd::AccountId;
|
|
use std::collections::HashMap;
|
|
|
|
#[derive(Clone)]
|
|
pub(crate) struct ConfigScoreData {
|
|
pub(crate) config_score_params: ConfigScoreParams,
|
|
pub(crate) nym_node_version_history: Vec<HistoricalNymNodeVersionEntry>,
|
|
}
|
|
|
|
impl From<ConfigScoreData> for ConfigScoreDataResponse {
|
|
fn from(value: ConfigScoreData) -> Self {
|
|
ConfigScoreDataResponse {
|
|
parameters: value.config_score_params.into(),
|
|
version_history: value
|
|
.nym_node_version_history
|
|
.into_iter()
|
|
.map(Into::into)
|
|
.collect(),
|
|
}
|
|
}
|
|
}
|
|
|
|
pub(crate) struct ContractCacheData {
|
|
pub(crate) legacy_mixnodes: Vec<LegacyMixNodeDetailsWithLayer>,
|
|
pub(crate) legacy_gateways: Vec<LegacyGatewayBondWithId>,
|
|
pub(crate) nym_nodes: Vec<NymNodeDetails>,
|
|
pub(crate) rewarded_set: CachedEpochRewardedSet,
|
|
|
|
pub(crate) config_score_data: ConfigScoreData,
|
|
pub(crate) current_reward_params: RewardingParams,
|
|
pub(crate) current_interval: Interval,
|
|
pub(crate) key_rotation_state: KeyRotationState,
|
|
|
|
pub(crate) contracts_info: CachedContractsInfo,
|
|
}
|
|
|
|
type ContractAddress = String;
|
|
pub type CachedContractsInfo = HashMap<ContractAddress, CachedContractInfo>;
|
|
|
|
#[derive(Clone)]
|
|
pub struct CachedContractInfo {
|
|
pub(crate) address: Option<AccountId>,
|
|
pub(crate) base: Option<cw2::ContractVersion>,
|
|
pub(crate) detailed: Option<ContractBuildInformation>,
|
|
}
|
|
|
|
impl CachedContractInfo {
|
|
pub fn new(
|
|
address: Option<&AccountId>,
|
|
base: Option<cw2::ContractVersion>,
|
|
detailed: Option<ContractBuildInformation>,
|
|
) -> Self {
|
|
Self {
|
|
address: address.cloned(),
|
|
base,
|
|
detailed,
|
|
}
|
|
}
|
|
}
|