Files
nym/validator-api/src/config/template.rs
T
Jędrzej Stuczyński 6c6e16035a Feature/optional bandwidth bypass (#965)
* Removed outdated constant

* ClaimFreeTestnetBandwidth ClientControlRequest

* Configuration option for the testnet mode in gateway

* Made testnet mode deserialize to default value if not present

* Fixed testnet mode override

* Testnet config options for clients and validator api

* Changed error message for when gateway is not using testnet mode

* Incorporated testnet mode into gateway client

* Activating testnet mode based on config values

* Allowing clippy warnings

* Fixed use of moved value in wasm build

Co-authored-by: Bogdan-Ștefan Neacșu <bogdan@nymtech.net>
2021-12-17 18:55:33 +02:00

116 lines
4.5 KiB
Rust

// Copyright 2021 - Nym Technologies SA <contact@nymtech.net>
// SPDX-License-Identifier: Apache-2.0
pub(crate) fn config_template() -> &'static str {
r#"
# This is a TOML config file.
# For more information, see https://github.com/toml-lang/toml
##### main base validator-api config options #####
[base]
# Validator server to which the API will be getting information about the network.
local_validator = '{{ base.local_validator }}'
# Address of the validator contract managing the network.
mixnet_contract_address = '{{ base.mixnet_contract_address }}'
##### network monitor config options #####
[network_monitor]
# Specifies whether network monitoring service is enabled in this process.
enabled = {{ network_monitor.enabled }}
# Indicates whether this validator api is running in a testnet mode, thus attempting
# to claim bandwidth without presenting bandwidth credentials.
testnet_mode = {{ network_monitor.testnet_mode }}
# Specifies list of all validators on the network issuing coconut credentials.
# A special care must be taken to ensure they are in correct order.
# The list must also contain THIS validator that is running the test
all_validator_apis = [
{{#each network_monitor.all_validator_apis }}
'{{this}}',
{{/each}}
]
# Specifies the interval at which the network monitor sends the test packets.
run_interval = '{{ network_monitor.run_interval }}'
# Specifies interval at which we should be sending ping packets to all active gateways
# in order to keep the websocket connections alive.
gateway_ping_interval = '{{ network_monitor.gateway_ping_interval }}'
# Specifies maximum rate (in packets per second) of test packets being sent to gateway
gateway_sending_rate = {{ network_monitor.gateway_sending_rate }}
# Maximum number of gateway clients the network monitor will try to talk to concurrently.
max_concurrent_gateway_clients = {{ network_monitor.max_concurrent_gateway_clients }}
# Maximum allowed time for receiving gateway response.
gateway_response_timeout = '{{ network_monitor.gateway_response_timeout }}'
# Maximum allowed time for the gateway connection to get established.
gateway_connection_timeout = '{{ network_monitor.gateway_connection_timeout }}'
# Specifies the duration the monitor is going to wait after sending all measurement
# packets before declaring nodes unreachable.
packet_delivery_timeout = '{{ network_monitor.packet_delivery_timeout }}'
# Path to directory containing public/private keys used for bandwidth token purchase.
# Those are saved in case of emergency, to be able to reclaim bandwidth tokens.
# The public key is the name of the file, while the private key is the content.
backup_bandwidth_token_keys_dir = '{{ network_monitor.backup_bandwidth_token_keys_dir }}'
# Ethereum private key.
eth_private_key = '{{ network_monitor.eth_private_key }}'
# Addess to an Ethereum full node.
eth_endpoint = '{{ network_monitor.eth_endpoint }}'
# Desired number of test routes to be constructed (and working) during a monitor test run.
test_routes = {{ network_monitor.test_routes }}
# The minimum number of test routes that need to be constructed (and working) in order for
# a monitor test run to be valid.
minimum_test_routes = {{ network_monitor.minimum_test_routes }}
# Number of test packets sent via each pseudorandom route to verify whether they work correctly,
# before using them for testing the rest of the network.
route_test_packets = {{ network_monitor.route_test_packets }}
# Number of test packets sent to each node during regular monitor test run.
per_node_test_packets = {{ network_monitor.per_node_test_packets }}
[node_status_api]
# Path to the database file containing uptime statuses for all mixnodes and gateways.
database_path = '{{ node_status_api.database_path }}'
##### rewarding config options #####
[rewarding]
# Specifies whether rewarding service is enabled in this process.
enabled = {{ rewarding.enabled }}
# Mnemonic (currently of the network monitor) used for rewarding
mnemonic = '{{ rewarding.mnemonic }}'
# Datetime of the first rewarding epoch of the current length used for referencing
# starting time of any subsequent epoch.
first_rewarding_epoch = '{{ rewarding.first_rewarding_epoch }}'
# Current length of the epoch. If modified `first_rewarding_epoch` should also get changed.
epoch_length = '{{ rewarding.epoch_length }}'
# Specifies the minimum percentage of monitor test run data present in order to
# distribute rewards for given epoch.
# Note, only values in range 0-100 are valid
minimum_epoch_monitor_threshold = {{ rewarding.minimum_epoch_monitor_threshold }}
"#
}