From 5c753c07946042e217f7e8a209f0cce6a4b67b2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C4=99drzej=20Stuczy=C5=84ski?= Date: Tue, 23 Jan 2024 13:53:31 +0000 Subject: [PATCH] added new whitelist entries to the config --- nym-validator-rewarder/src/config/mod.rs | 20 +++++++++++++++---- nym-validator-rewarder/src/config/template.rs | 14 ++++++++++++- nym-validator-rewarder/src/rewarder/mod.rs | 2 +- 3 files changed, 30 insertions(+), 6 deletions(-) diff --git a/nym-validator-rewarder/src/config/mod.rs b/nym-validator-rewarder/src/config/mod.rs index 9003d32ceb..5460afa095 100644 --- a/nym-validator-rewarder/src/config/mod.rs +++ b/nym-validator-rewarder/src/config/mod.rs @@ -9,7 +9,7 @@ use nym_config::{ must_get_home, read_config_from_toml_file, save_formatted_config_to_file, NymConfigTemplate, DEFAULT_CONFIG_DIR, DEFAULT_CONFIG_FILENAME, DEFAULT_DATA_DIR, NYM_DIR, }; -use nym_validator_client::nyxd::Coin; +use nym_validator_client::nyxd::{AccountId, Coin}; use serde::{Deserialize, Serialize}; use serde_with::{serde_as, DisplayFromStr}; use std::io; @@ -238,19 +238,26 @@ pub struct NyxdScraper { // TODO: debug with everything that's currently hardcoded in the scraper } -#[derive(Debug, Clone, Deserialize, Serialize, Copy)] +#[derive(Debug, Clone, Deserialize, Serialize)] pub struct BlockSigning { /// Specifies whether credential issuance for block signing is enabled. pub enabled: bool, + + /// List of validators that will receive rewards for block signing. + /// If not on the list, the validator will be treated as if it had 0 voting power. + pub whitelist: Vec, } impl Default for BlockSigning { fn default() -> Self { - BlockSigning { enabled: true } + BlockSigning { + enabled: true, + whitelist: vec![], + } } } -#[derive(Debug, Clone, Deserialize, Serialize, Copy)] +#[derive(Debug, Clone, Deserialize, Serialize)] pub struct IssuanceMonitor { /// Specifies whether credential issuance monitoring (and associated rewards) are enabled. pub enabled: bool, @@ -264,6 +271,10 @@ pub struct IssuanceMonitor { /// The sampling rate of the issued credentials pub sampling_rate: f64, + + /// List of validators that will receive rewards for credential issuance. + /// If not on the list, the validator will be treated as if it hadn't issued a single credential. + pub whitelist: Vec, } impl Default for IssuanceMonitor { @@ -273,6 +284,7 @@ impl Default for IssuanceMonitor { run_interval: DEFAULT_MONITOR_RUN_INTERVAL, min_validate_per_issuer: DEFAULT_MONITOR_MIN_VALIDATE, sampling_rate: DEFAULT_MONITOR_SAMPLING_RATE, + whitelist: vec![], } } } diff --git a/nym-validator-rewarder/src/config/template.rs b/nym-validator-rewarder/src/config/template.rs index 17ba1f9649..89ad6ecea4 100644 --- a/nym-validator-rewarder/src/config/template.rs +++ b/nym-validator-rewarder/src/config/template.rs @@ -40,7 +40,13 @@ credential_verification = {{ rewarding.ratios.credential_verification }} [block_signing] # Specifies whether credential issuance for block signing is enabled. enabled = {{ block_signing.enabled }} - + +# List of validators that will receive rewards for block signing. +# If not on the list, the validator will be treated as if it had 0 voting power. +whitelist = [ + # needs to be manually populated +] + [issuance_monitor] # Specifies whether credential issuance monitoring (and associated rewards) are enabled. @@ -54,6 +60,12 @@ min_validate_per_issuer = {{ issuance_monitor.min_validate_per_issuer }} # The sampling rate of the issued credentials sampling_rate = {{ issuance_monitor.sampling_rate }} + +# List of validators that will receive rewards for credential issuance. +# If not on the list, the validator will be treated as if it hadn't issued a single credential. +whitelist = [ + # needs to be manually populated +] [nyxd_scraper] # Url to the websocket endpoint of a validator, for example `wss://rpc.nymtech.net/websocket` diff --git a/nym-validator-rewarder/src/rewarder/mod.rs b/nym-validator-rewarder/src/rewarder/mod.rs index f58b3ce63f..da937d0fc1 100644 --- a/nym-validator-rewarder/src/rewarder/mod.rs +++ b/nym-validator-rewarder/src/rewarder/mod.rs @@ -239,7 +239,7 @@ impl Rewarder { if let Some(ref credential_issuance) = self.credential_issuance { credential_issuance.start_monitor( - self.config.issuance_monitor, + self.config.issuance_monitor.clone(), self.nyxd_client.clone(), task_manager.subscribe(), );