Skip to content

Commit

Permalink
feat(protocol_upgrade) - implemented multiple protocol version upgrad…
Browse files Browse the repository at this point in the history
…es in one release (#11368)

Implemented the feature described in #10911. 

It may or may not be needed for the congestion control and stateless
validation release but it should be useful in general and I just want to
take this variable out of the equation.
  • Loading branch information
wacban authored May 29, 2024
1 parent ccfbdeb commit 62bc785
Show file tree
Hide file tree
Showing 12 changed files with 513 additions and 194 deletions.
15 changes: 10 additions & 5 deletions chain/client/src/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -361,10 +361,11 @@ pub(crate) static CURRENT_PROTOCOL_VERSION: Lazy<IntGauge> = Lazy::new(|| {
.unwrap()
});

pub(crate) static NODE_PROTOCOL_UPGRADE_VOTING_START: Lazy<IntGauge> = Lazy::new(|| {
try_create_int_gauge(
pub(crate) static NODE_PROTOCOL_UPGRADE_VOTING_START: Lazy<IntGaugeVec> = Lazy::new(|| {
try_create_int_gauge_vec(
"near_node_protocol_upgrade_voting_start",
"Time in seconds since Unix epoch determining when node will start voting for the protocol upgrade; zero if there is no schedule for the voting")
"Time in seconds since Unix epoch determining when node will start voting for the protocol upgrade; zero if there is no schedule for the voting",
&["protocol_version"])
.unwrap()
});

Expand Down Expand Up @@ -404,8 +405,12 @@ pub(crate) static PRODUCE_AND_DISTRIBUTE_CHUNK_TIME: Lazy<HistogramVec> = Lazy::
/// `neard_version` argument.
pub(crate) fn export_version(neard_version: &near_primitives::version::Version) {
NODE_PROTOCOL_VERSION.set(near_primitives::version::PROTOCOL_VERSION.into());
NODE_PROTOCOL_UPGRADE_VOTING_START
.set(near_primitives::version::PROTOCOL_UPGRADE_SCHEDULE.timestamp());
let schedule = near_primitives::version::PROTOCOL_UPGRADE_SCHEDULE;
for (datetime, protocol_version) in schedule.schedule().iter() {
NODE_PROTOCOL_UPGRADE_VOTING_START
.with_label_values(&[&protocol_version.to_string()])
.set(datetime.timestamp());
}
NODE_DB_VERSION.set(near_store::metadata::DB_VERSION.into());
NODE_BUILD_INFO.reset();
NODE_BUILD_INFO
Expand Down
Loading

0 comments on commit 62bc785

Please sign in to comment.