Files
nym/nym-api/src/nym_contract_cache/cache/data.rs
T
Jon Häggblad 87cb8a6b20 Sign when announcing service providers to the directory contract (#3459)
* create_payload and call from nym-cli

* Remove some commented out code

* wip

* Service announce now compiles

* Fix other compilation issues

* Move ServiceDetails into Service

* Move service_id inside Service type

* wip: start sorting out tests

* wip: sorting out testing

* wip: first announce test now works

* wip: more work on announce test

* Move nonce

* Add check for nonce

* Extract out some helpers to separate files

* reenable state::services tests

* wip: start going through the integration tests

* All integration tests reenabled

* Remove some unused stuff

* Iterate on integration tests

* More iteration on test setup

* Rename to test_setup.rs

* Add more tests specific to signing

* Tweak

* Another nonce test and reorg

* Rename to announce.rs and delete.rs

* Tidy

* Make some inner modules private

* Use IdentityKey alias

* Update nym-api contract cache

* Fix that nym-cli was asking for signing nonce from wrong contract

* Add sign comment to network-requester

* Uploaded updated service provider contract to qwerty

* Allow large enum variant

* lock files

* Remove dbg

* Move error.rs to service-provider common

* Update code for moving errors.rs to common crate

* Rename to SpContractError

* constants module not pub

* lock file

* rustfmt

* Move IdentityKey type to contract-common

* clippy
2023-06-05 10:32:58 +02:00

49 lines
1.7 KiB
Rust

// Copyright 2022-2023 - Nym Technologies SA <contact@nymtech.net>
// SPDX-License-Identifier: Apache-2.0
use crate::support::caching::Cache;
use nym_mixnet_contract_common::{
families::FamilyHead, GatewayBond, IdentityKey, Interval, MixId, MixNodeDetails,
RewardingParams,
};
use nym_name_service_common::NameEntry;
use nym_service_provider_directory_common::Service;
use std::collections::HashSet;
pub(crate) struct ValidatorCacheData {
pub(crate) mixnodes: Cache<Vec<MixNodeDetails>>,
pub(crate) gateways: Cache<Vec<GatewayBond>>,
pub(crate) mixnodes_blacklist: Cache<HashSet<MixId>>,
pub(crate) gateways_blacklist: Cache<HashSet<IdentityKey>>,
pub(crate) rewarded_set: Cache<Vec<MixNodeDetails>>,
pub(crate) active_set: Cache<Vec<MixNodeDetails>>,
pub(crate) current_reward_params: Cache<Option<RewardingParams>>,
pub(crate) current_interval: Cache<Option<Interval>>,
pub(crate) mix_to_family: Cache<Vec<(IdentityKey, FamilyHead)>>,
pub(crate) service_providers: Cache<Vec<Service>>,
pub(crate) registered_names: Cache<Vec<NameEntry>>,
}
impl ValidatorCacheData {
pub(crate) fn new() -> Self {
ValidatorCacheData {
mixnodes: Cache::default(),
gateways: Cache::default(),
rewarded_set: Cache::default(),
active_set: Cache::default(),
mixnodes_blacklist: Cache::default(),
gateways_blacklist: Cache::default(),
current_interval: Cache::default(),
current_reward_params: Cache::default(),
mix_to_family: Cache::default(),
service_providers: Cache::default(),
registered_names: Cache::default(),
}
}
}