Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(dynamic config): Refactor and make several config fields reloadable at runtime #8240

Merged
merged 112 commits into from
Jan 19, 2023
Merged
Show file tree
Hide file tree
Changes from 110 commits
Commits
Show all changes
112 commits
Select commit Hold shift + click to select a range
40d0710
neard: reload key for clients when recv SIGHUP
yanganto Nov 25, 2022
efb319c
update rpc servers
yanganto Nov 25, 2022
94de8b7
Revert "update rpc servers"
yanganto Nov 28, 2022
dd99f29
Revert "neard: reload key for clients when recv SIGHUP"
yanganto Nov 28, 2022
9aed32b
restarting to reload key base on config change
yanganto Nov 29, 2022
33e8cf2
try to reset logger
yanganto Dec 1, 2022
50e55ba
Merge branch 'master' into reload
yanganto Dec 1, 2022
76ea5a0
Add watch_config feature to reload signer key
yanganto Dec 1, 2022
2cfd460
Update core/o11y/src/lib.rs
yanganto Dec 5, 2022
839221d
Update neard/src/cli.rs
yanganto Dec 5, 2022
0c4ab4c
fix log on restarting
yanganto Dec 5, 2022
a73e1e8
Remove watch config
yanganto Dec 5, 2022
7444ced
Merge branch 'master' into reload
yanganto Dec 5, 2022
08ed4fb
Merge branch 'master' into reload
yanganto Dec 7, 2022
07e9fb1
refactor: ExtCostsConfig as simple map of costs (#8115)
jakmeier Dec 7, 2022
caad73d
Migrate remaining routing tests to network crate (#8168)
saketh-are Dec 7, 2022
72c57da
Added create_test_signer function that simplifies tests (#8176)
mm-near Dec 7, 2022
7a57975
Fix a bug in processing skips approvals when there are forks (#8165)
mzhangmzz Dec 7, 2022
f8ac73d
[fix] Fix localnet config - local ports should be set to true (#8180)
wacban Dec 7, 2022
136ae4d
[doc] Fix a link to the testing page in the CONTRIBUTING.md (#8172)
wacban Dec 8, 2022
1d0d5c7
removed edge field from Connection (#8160)
pompon0 Dec 8, 2022
acb2dd1
reject imported memories early (#8146)
Ekleog-NEAR Dec 8, 2022
4ced6e5
runtime: simplify MemoryLike trait (#8155)
mina86 Dec 8, 2022
a773d49
feat(indexer): add a validate_genesis option to the config (#8137)
marcelo-gonzalez Dec 8, 2022
89fb46e
gas: fix the computation of `self.promises_gas` (#8179)
nagisa Dec 8, 2022
6982b0c
runtime: don’t unnecessarily copy promise indices (#8175)
mina86 Dec 9, 2022
d0b9d1b
build(deps): bump certifi from 2021.10.8 to 2022.12.7 in /debug_scrip…
dependabot[bot] Dec 9, 2022
de7caf7
Update SECURITY.md (#8183)
bowenwang1996 Dec 9, 2022
4b2ab27
Add TIER1 network debug page (#8181)
saketh-are Dec 9, 2022
56d9b43
deprecating AnnounceAccount (#8182)
pompon0 Dec 12, 2022
8a55567
migrated connect_to_unbanned_peer test (#8196)
pompon0 Dec 12, 2022
21498d9
[chore] cleanup after shardnet (#8171)
wacban Dec 12, 2022
416b0a8
doc: add text about re-request reviews (#8208)
akhi3030 Dec 12, 2022
21d927e
[feat] Add --tracked-shards cmd line arg to the LocalnetCmd (#8187)
wacban Dec 12, 2022
421ee30
[header sync] Use a new algorithm for deriving locators (#8178)
robin-near Dec 12, 2022
c29e727
refactor: improve trie prefetching (#8205)
pugachAG Dec 13, 2022
7cf2aec
attempt to deflake test_dropping_duplicate_messages (#8204)
pompon0 Dec 13, 2022
036a157
added info about TIER1 to the CHANGELOG (#8209)
pompon0 Dec 13, 2022
ac980e5
refactor: fix clippy erasing_op warning (#8219)
pugachAG Dec 14, 2022
559c1ff
build(deps): bump secp256k1 from 0.24.0 to 0.24.2 (#8189)
dependabot[bot] Dec 14, 2022
d3e5dc1
refactor: disable clippy for near-test-contracts (#8213)
pugachAG Dec 14, 2022
6f75c2e
document findings on database format (#8216)
Ekleog-NEAR Dec 14, 2022
eb76982
DynConfig+LogConfig
nikurt Dec 14, 2022
08c5549
DynConfig+LogConfig+ClientConfig
nikurt Dec 14, 2022
812d023
Make use of the dynamic client config
nikurt Dec 14, 2022
d8600c7
Moved Consensus to chain-configs
nikurt Dec 15, 2022
15ecb9b
move Consensus into an Arc<Mutex<>>
nikurt Dec 15, 2022
1cf16f6
Use broadcast::{Sender,Receiver} to get notified about config changes…
nikurt Dec 19, 2022
47fdfe3
TIER1 debug: fix usage of AccountKey vs PeerId (#8220)
saketh-are Dec 14, 2022
eff74a1
primitives: get rid of Cursor (#8194)
mina86 Dec 14, 2022
bd4e3f3
runtime: create common unit tests for MemoryLike implementations (#8226)
mina86 Dec 15, 2022
15ad411
refactor: Remove unnecessary `#[allow(dead_code)]` macros (#8222)
akhi3030 Dec 15, 2022
027d185
refactor: improve documentation and variable naming (#8223)
akhi3030 Dec 15, 2022
da103a4
runtime: avoid copying register values unnecessarily (#8224)
mina86 Dec 15, 2022
dbd0db8
use nextest for better test isolation (#8207)
pompon0 Dec 16, 2022
46a9ccf
doc: Fix typo in parameter_definition.md (#8233)
aborg-dev Dec 16, 2022
cc402e3
runtime: add vmstate::Registers unit tests (#8231)
mina86 Dec 16, 2022
f9d9883
removed redundant test and unused code (#8229)
pompon0 Dec 16, 2022
c7fc343
[Debug UI] New debug UI with last blocks view migrated and new cluste…
robin-near Dec 16, 2022
74a3ded
Merge branch 'master' into nikurt-dyn-config
nikurt Dec 19, 2022
e82c32a
Remove introduced Arc<Mutex<>>.
jakmeier Dec 7, 2022
243959b
Compile fix
nikurt Dec 20, 2022
7e0d81f
Fix compilation of tests
nikurt Dec 21, 2022
5fdf49d
Fix compilation of tests
nikurt Dec 21, 2022
d480b24
Fix compilation of benches
nikurt Dec 21, 2022
b6ce295
Merge branch 'master' into nikurt-dyn-config
nikurt Dec 21, 2022
cad64b5
runtime: move get_vec_from_memory_or_register into separate function …
mina86 Dec 21, 2022
d0bddae
Improve adversenet script (#8256)
mzhangmzz Dec 21, 2022
b34044d
refactor: clean up busy waiting in prefetcher blocking get (#8215)
pugachAG Dec 22, 2022
81fe8b3
feat(estimator): Send/exec action costs (#8251)
jakmeier Dec 22, 2022
51e1526
wasmer2: do not re-validate wasm code after instrumentation (#8007)
Ekleog-NEAR Dec 22, 2022
6c918f2
features: remove the memory_stats feature and near-rust-allocator-pro…
marcelo-gonzalez Dec 22, 2022
7ed418c
logging: print out the part ords in chunk request/response debug logs…
marcelo-gonzalez Dec 22, 2022
582d521
neard: reload key for clients when recv SIGHUP
yanganto Nov 25, 2022
367806d
update rpc servers
yanganto Nov 25, 2022
42d9026
Revert "update rpc servers"
yanganto Nov 28, 2022
e55f6d5
Revert "neard: reload key for clients when recv SIGHUP"
yanganto Nov 28, 2022
14d7b91
restarting to reload key base on config change
yanganto Nov 29, 2022
72513a3
migrated connect_to_unbanned_peer test (#8196)
pompon0 Dec 12, 2022
919971f
DynConfig+LogConfig
nikurt Dec 14, 2022
df57a94
DynConfig+LogConfig+ClientConfig
nikurt Dec 14, 2022
601214c
Use broadcast::{Sender,Receiver} to get notified about config changes…
nikurt Dec 19, 2022
2b99076
runtime: add vmstate::Registers unit tests (#8231)
mina86 Dec 16, 2022
50beb90
Remove introduced Arc<Mutex<>>.
jakmeier Dec 7, 2022
234e024
Re-do to explicitly use MutableConfigValue
nikurt Dec 23, 2022
bd7b885
Merge
nikurt Dec 23, 2022
e9f4ec1
Merge branch 'master' into nikurt-dyn-config
nikurt Dec 23, 2022
92f27eb
compilation
nikurt Dec 25, 2022
a4bd016
Undo mutability of block production config fields
nikurt Jan 2, 2023
47460f6
Undo mutability of block production config fields
nikurt Jan 2, 2023
f20049c
Undo mutability of block production config fields
nikurt Jan 2, 2023
32cee62
Metrics
nikurt Jan 3, 2023
82ec3a0
Merge branch 'master' into nikurt-dyn-config
nikurt Jan 5, 2023
74d5709
Add more metrics and warnings if configs are not valid.
nikurt Jan 5, 2023
ce214e3
Better formatting for the metric fields
nikurt Jan 5, 2023
8bd9407
Merge branch 'master' into nikurt-dyn-config
nikurt Jan 5, 2023
95bdb32
Merge
nikurt Jan 5, 2023
e6bc874
Merge
nikurt Jan 5, 2023
3c8e079
compilation fix
nikurt Jan 6, 2023
7cb4ab0
Merge branch 'master' into nikurt-dyn-config
nikurt Jan 9, 2023
3a19e65
Merge
nikurt Jan 9, 2023
e7060d6
Merge
nikurt Jan 9, 2023
e6167a5
Addressed more comments
nikurt Jan 10, 2023
592fd7d
Addressed more comments
nikurt Jan 10, 2023
fe4f393
Addressed more comments
nikurt Jan 10, 2023
b9c9abc
Comments
nikurt Jan 12, 2023
3ba626f
Merge branch 'master' into nikurt-dyn-config
nikurt Jan 17, 2023
5d000c7
config_updater fixes
nikurt Jan 17, 2023
446c339
Merge branch 'master' into nikurt-dyn-config
nikurt Jan 17, 2023
7ed8aa1
config_updater fixes
nikurt Jan 17, 2023
8931bd0
Merge branch 'master' into nikurt-dyn-config
nikurt Jan 19, 2023
6f09a9c
try_update tuning
nikurt Jan 19, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 7 additions & 1 deletion chain/client/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ use near_chain::{
BlockProcessingArtifact, BlockStatus, Chain, ChainGenesis, ChainStoreAccess,
DoneApplyChunkCallback, Doomslug, DoomslugThresholdMode, Provenance, RuntimeAdapter,
};
use near_chain_configs::ClientConfig;
use near_chain_configs::{ClientConfig, UpdateableClientConfig};
use near_chunks::ShardsManager;
use near_network::types::{
HighestHeightPeerInfo, NetworkRequests, PeerManagerAdapter, ReasonForBan,
Expand Down Expand Up @@ -149,6 +149,12 @@ pub struct Client {
flat_storage_creator: Option<FlatStorageCreator>,
}

impl Client {
pub(crate) fn update_client_config(&self, update_client_config: UpdateableClientConfig) {
self.config.expected_shutdown.update(update_client_config.expected_shutdown);
}
}

// Debug information about the upcoming block.
#[derive(Default)]
pub struct BlockDebugStatus {
Expand Down
44 changes: 31 additions & 13 deletions chain/client/src/client_actor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ use crate::adapter::{
RecvPartialEncodedChunkRequest, RecvPartialEncodedChunkResponse, SetNetworkInfo, StateResponse,
};
use crate::client::{Client, EPOCH_START_INFO_BLOCKS};
use crate::config_updater::ConfigUpdater;
use crate::debug::new_network_info_view;
use crate::info::{display_sync_status, InfoHelper};
use crate::metrics::PARTIAL_ENCODED_CHUNK_RESPONSE_DELAY;
Expand Down Expand Up @@ -38,7 +39,6 @@ use near_chunks::logic::cares_about_shard_this_or_next_epoch;
use near_client_primitives::types::{
Error, GetNetworkInfo, NetworkInfoResponse, Status, StatusError, StatusSyncInfo, SyncStatus,
};
use near_dyn_configs::EXPECTED_SHUTDOWN_AT;
#[cfg(feature = "test_features")]
use near_network::types::NetworkAdversarialMessage;
use near_network::types::ReasonForBan;
Expand Down Expand Up @@ -69,7 +69,7 @@ use std::collections::HashMap;
use std::sync::Arc;
use std::thread;
use std::time::{Duration, Instant};
use tokio::sync::oneshot;
use tokio::sync::broadcast;
use tracing::{debug, error, info, trace, warn};

/// Multiplier on `max_block_time` to wait until deciding that chain stalled.
Expand Down Expand Up @@ -116,7 +116,10 @@ pub struct ClientActor {

/// Synchronization measure to allow graceful shutdown.
/// Informs the system when a ClientActor gets dropped.
shutdown_signal: Option<oneshot::Sender<()>>,
shutdown_signal: Option<broadcast::Sender<()>>,

/// Manages updating the config.
config_updater: Option<ConfigUpdater>,
}

/// Blocks the program until given genesis time arrives.
Expand Down Expand Up @@ -152,8 +155,9 @@ impl ClientActor {
enable_doomslug: bool,
rng_seed: RngSeed,
ctx: &Context<ClientActor>,
shutdown_signal: Option<oneshot::Sender<()>>,
shutdown_signal: Option<broadcast::Sender<()>>,
adv: crate::adversarial::Controls,
config_updater: Option<ConfigUpdater>,
) -> Result<Self, Error> {
let state_parts_arbiter = Arbiter::new();
let self_addr = ctx.address();
Expand Down Expand Up @@ -222,7 +226,8 @@ impl ClientActor {

#[cfg(feature = "sandbox")]
fastforward_delta: 0,
shutdown_signal: shutdown_signal,
shutdown_signal,
config_updater,
})
}
}
Expand Down Expand Up @@ -1129,14 +1134,20 @@ impl ClientActor {
/// Returns the delay before the next time `check_triggers` should be called, which is
/// min(time until the closest trigger, 1 second).
fn check_triggers(&mut self, ctx: &mut Context<ClientActor>) -> Duration {
if let Some(config_updater) = &mut self.config_updater {
config_updater.update_if_needed(&|updateable_client_config| {
self.client.update_client_config(updateable_client_config)
});
}

// Check block height to trigger expected shutdown
if let Ok(head) = self.client.chain.head() {
let block_height_to_shutdown =
EXPECTED_SHUTDOWN_AT.load(std::sync::atomic::Ordering::Relaxed);
if block_height_to_shutdown > 0 && head.height >= block_height_to_shutdown {
info!(target: "client", "Expected shutdown triggered: head block({}) >= ({})", head.height, block_height_to_shutdown);
if let Some(tx) = self.shutdown_signal.take() {
let _ = tx.send(()); // Ignore send signal fail, it will send again in next trigger
if let Some(block_height_to_shutdown) = self.client.config.expected_shutdown.get() {
if head.height >= block_height_to_shutdown {
info!(target: "client", "Expected shutdown triggered: head block({}) >= ({:?})", head.height, block_height_to_shutdown);
if let Some(tx) = self.shutdown_signal.take() {
let _ = tx.send(()); // Ignore send signal fail, it will send again in next trigger
}
}
}
}
Expand Down Expand Up @@ -1755,7 +1766,12 @@ impl ClientActor {
fn log_summary(&mut self) {
let _span = tracing::debug_span!(target: "client", "log_summary").entered();
let _d = delay_detector::DelayDetector::new(|| "client log summary".into());
self.info_helper.log_summary(&self.client, &self.node_id, &self.network_info)
self.info_helper.log_summary(
&self.client,
&self.node_id,
&self.network_info,
&self.config_updater,
)
}
}

Expand Down Expand Up @@ -1970,8 +1986,9 @@ pub fn start_client(
network_adapter: Arc<dyn PeerManagerAdapter>,
validator_signer: Option<Arc<dyn ValidatorSigner>>,
telemetry_actor: Addr<TelemetryActor>,
sender: Option<oneshot::Sender<()>>,
sender: Option<broadcast::Sender<()>>,
adv: crate::adversarial::Controls,
config_updater: Option<ConfigUpdater>,
) -> (Addr<ClientActor>, ArbiterHandle) {
let client_arbiter = Arbiter::new();
let client_arbiter_handle = client_arbiter.handle();
Expand All @@ -1990,6 +2007,7 @@ pub fn start_client(
ctx,
sender,
adv,
config_updater,
)
.unwrap()
});
Expand Down
53 changes: 53 additions & 0 deletions chain/client/src/config_updater.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
use near_chain_configs::UpdateableClientConfig;
use near_dyn_configs::{UpdateableConfigLoaderError, UpdateableConfigs};
use std::sync::Arc;
use tokio::sync::broadcast::Receiver;

#[derive(Debug)]
pub enum ClientConfigUpdateError {}

/// Manages updating the config encapsulating.
pub struct ConfigUpdater {
/// Receives config updates while the node is running.
rx_config_update: Receiver<Result<UpdateableConfigs, Arc<UpdateableConfigLoaderError>>>,

/// Represents the latest Error of reading the dynamically reloadable configs.
updateable_configs_error: Option<Arc<UpdateableConfigLoaderError>>,
}

impl ConfigUpdater {
pub fn new(
rx_config_update: Receiver<Result<UpdateableConfigs, Arc<UpdateableConfigLoaderError>>>,
) -> Self {
Self { rx_config_update, updateable_configs_error: None }
}

pub fn update_if_needed(&mut self, update_client_config_fn: &dyn Fn(UpdateableClientConfig)) {
nikurt marked this conversation as resolved.
Show resolved Hide resolved
// Check if any of the configs were updated. If they did, the receiver
// will contain a clone of the new configs.
while let Ok(maybe_updateable_configs) = self.rx_config_update.try_recv() {
match maybe_updateable_configs {
Ok(updateable_configs) => {
if let Some(client_config) = updateable_configs.client_config {
update_client_config_fn(client_config);
tracing::info!(target: "config", "Updated ClientConfig");
}
self.updateable_configs_error = None;
}
Err(err) => {
self.updateable_configs_error = Some(err.clone());
}
}
}
}

/// Prints an error if it's present.
pub fn report_status(&self) {
if let Some(updateable_configs_error) = &self.updateable_configs_error {
tracing::warn!(
target: "stats",
"Dynamically updateable configs are not valid. Please fix this ASAP otherwise the node will probably crash after restart: {}",
*updateable_configs_error);
}
}
}
10 changes: 8 additions & 2 deletions chain/client/src/info.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use crate::config_updater::ConfigUpdater;
use crate::{metrics, rocksdb_metrics, SyncStatus};
use actix::Addr;
use itertools::Itertools;
Expand Down Expand Up @@ -125,6 +126,7 @@ impl InfoHelper {
client: &crate::client::Client,
node_id: &PeerId,
network_info: &NetworkInfo,
config_updater: &Option<ConfigUpdater>,
) {
let is_syncing = client.sync_status.is_syncing();
let head = unwrap_or_return!(client.chain.head());
Expand Down Expand Up @@ -190,6 +192,7 @@ impl InfoHelper {
.unwrap_or(0),
statistics,
&client.config,
config_updater,
);
self.log_chain_processing_info(client, &head.epoch_id);
}
Expand All @@ -206,6 +209,7 @@ impl InfoHelper {
protocol_upgrade_block_height: BlockHeight,
statistics: Option<StoreStatistics>,
client_config: &ClientConfig,
config_updater: &Option<ConfigUpdater>,
) {
let use_colour = matches!(self.log_summary_style, LogSummaryStyle::Colored);
let paint = |colour: ansi_term::Colour, text: Option<String>| match text {
Expand Down Expand Up @@ -268,12 +272,14 @@ impl InfoHelper {
paint(ansi_term::Colour::Blue, machine_info_log),
);
if catchup_status_log != "" {
info!(target:"stats", "Catchups\n{}", catchup_status_log);
info!(target: "stats", "Catchups\n{}", catchup_status_log);
}
if let Some(statistics) = statistics {
rocksdb_metrics::export_stats_as_metrics(statistics);
}

if let Some(config_updater) = &config_updater {
config_updater.report_status();
}
let (cpu_usage, memory_usage) = proc_info.unwrap_or_default();
let is_validator = validator_info.map(|v| v.is_validator).unwrap_or_default();
(metrics::IS_VALIDATOR.set(is_validator as i64));
Expand Down
2 changes: 2 additions & 0 deletions chain/client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,14 @@ pub use crate::adapter::{
};
pub use crate::client::Client;
pub use crate::client_actor::{start_client, ClientActor};
pub use crate::config_updater::ConfigUpdater;
pub use crate::view_client::{start_view_client, ViewClientActor};

pub mod adapter;
pub mod adversarial;
mod client;
mod client_actor;
mod config_updater;
pub mod debug;
mod info;
mod metrics;
Expand Down
1 change: 1 addition & 0 deletions chain/client/src/test_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,7 @@ pub fn setup(
ctx,
None,
adv,
None,
)
.unwrap();
(genesis_block, client, view_client_addr)
Expand Down
2 changes: 2 additions & 0 deletions core/chain-configs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,15 @@ anyhow.workspace = true
chrono.workspace = true
derive_more.workspace = true
num-rational.workspace = true
once_cell.workspace = true
serde.workspace = true
serde_json.workspace = true
sha2.workspace = true
smart-default.workspace = true
tracing.workspace = true

near-crypto = { path = "../crypto" }
near-o11y = { path = "../o11y" }
near-primitives = { path = "../primitives" }

[features]
Expand Down
13 changes: 10 additions & 3 deletions core/chain-configs/src/client_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ use std::time::Duration;

use serde::{Deserialize, Serialize};

use near_primitives::types::{AccountId, BlockHeightDelta, Gas, NumBlocks, NumSeats, ShardId};
use crate::MutableConfigValue;
use near_primitives::types::{
AccountId, BlockHeight, BlockHeightDelta, Gas, NumBlocks, NumSeats, ShardId,
};
use near_primitives::version::Version;

pub const TEST_STATE_SYNC_TIMEOUT: u64 = 5;
Expand Down Expand Up @@ -70,14 +73,17 @@ impl GCConfig {
}
}

#[derive(Clone, Serialize, Deserialize)]
/// ClientConfig where some fields can be updated at runtime.
#[derive(Clone)]
pub struct ClientConfig {
/// Version of the binary.
pub version: Version,
/// Chain id for status.
pub chain_id: String,
/// Listening rpc port for status.
pub rpc_addr: Option<String>,
/// Graceful shutdown at expected block height.
pub expected_shutdown: MutableConfigValue<Option<BlockHeight>>,
/// Duration to check for producing / skipping block.
pub block_production_tracking_delay: Duration,
/// Minimum duration before producing block.
Expand Down Expand Up @@ -182,10 +188,11 @@ impl ClientConfig {
because non-archival nodes must save trie changes in order to do do garbage collection."
);

ClientConfig {
Self {
version: Default::default(),
chain_id: "unittest".to_string(),
rpc_addr: Some("0.0.0.0:3030".to_string()),
expected_shutdown: MutableConfigValue::new(None, "expected_shutdown"),
block_production_tracking_delay: Duration::from_millis(std::cmp::max(
10,
min_block_prod_time / 5,
Expand Down
3 changes: 3 additions & 0 deletions core/chain-configs/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
mod client_config;
mod genesis_config;
pub mod genesis_validate;
mod metrics;
mod updateable_config;

pub use client_config::{
ClientConfig, GCConfig, LogSummaryStyle, DEFAULT_GC_NUM_EPOCHS_TO_KEEP,
Expand All @@ -10,3 +12,4 @@ pub use genesis_config::{
get_initial_supply, stream_records_from_file, Genesis, GenesisChangeConfig, GenesisConfig,
GenesisRecords, GenesisValidationMode, ProtocolConfig, ProtocolConfigView,
};
pub use updateable_config::{MutableConfigValue, UpdateableClientConfig};
11 changes: 11 additions & 0 deletions core/chain-configs/src/metrics.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
use near_o11y::metrics::{try_create_int_gauge_vec, IntGaugeVec};
use once_cell::sync::Lazy;

pub static CONFIG_MUTABLE_FIELD: Lazy<IntGaugeVec> = Lazy::new(|| {
try_create_int_gauge_vec(
"near_config_mutable_field",
"Timestamp and value of a mutable config field",
&["field_name", "timestamp", "value"],
)
.unwrap()
});
Loading