Skip to content

Commit

Permalink
use duration
Browse files Browse the repository at this point in the history
  • Loading branch information
brunoffranca committed Dec 17, 2024
1 parent 0ba08d2 commit b974be2
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 13 deletions.
2 changes: 1 addition & 1 deletion core/lib/config/src/configs/consensus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ pub struct ConsensusConfig {
pub max_payload_size: usize,

/// View timeout duration in milliseconds.
pub view_timeout: usize,
pub view_timeout: time::Duration,

/// Maximal allowed size of the sync-batch payloads in bytes.
///
Expand Down
8 changes: 2 additions & 6 deletions core/lib/protobuf_config/src/consensus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,10 +134,6 @@ impl ProtoRepr for proto::Config {
.and_then(|x| Ok((*x).try_into()?))
.context("max_payload_size")?;

let view_timeout = required(&self.view_timeout)
.and_then(|x| Ok((*x).try_into()?))
.context("view_timeout")?;

let max_batch_size = match self.max_batch_size {
Some(x) => x.try_into().context("max_batch_size")?,
None => {
Expand All @@ -158,7 +154,7 @@ impl ProtoRepr for proto::Config {
.context("server_addr")?,
public_addr: Host(required(&self.public_addr).context("public_addr")?.clone()),
max_payload_size,
view_timeout,
view_timeout: required(&self.view_timeout).context("view_timeout")?,
max_batch_size,
gossip_dynamic_inbound_limit: required(&self.gossip_dynamic_inbound_limit)
.and_then(|x| Ok((*x).try_into()?))
Expand Down Expand Up @@ -192,7 +188,7 @@ impl ProtoRepr for proto::Config {
server_addr: Some(this.server_addr.to_string()),
public_addr: Some(this.public_addr.0.clone()),
max_payload_size: Some(this.max_payload_size.try_into().unwrap()),
view_timeout: Some(this.view_timeout.try_into().unwrap()),
view_timeout: Some(this.view_timeout.build()),
max_batch_size: Some(this.max_batch_size.try_into().unwrap()),
gossip_dynamic_inbound_limit: Some(
this.gossip_dynamic_inbound_limit.try_into().unwrap(),
Expand Down
2 changes: 1 addition & 1 deletion core/lib/protobuf_config/src/proto/core/consensus.proto
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ message Config {
optional uint64 max_batch_size = 10; // required; bytes

// View timeout for the consensus protocol.
optional uint64 view_timeout = 13; // required; milliseconds
optional std.Duration view_timeout = 13; // required; milliseconds

// Inbound connections that should be unconditionally accepted on the gossip network.
repeated string gossip_static_inbound = 5; // required; NodePublicKey
Expand Down
6 changes: 1 addition & 5 deletions core/node/consensus/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,11 +152,6 @@ pub(super) fn executor(

let mut rpc = executor::RpcConfig::default();
rpc.get_block_rate = cfg.rpc().get_block_rate();
// Disable batch syncing, because it is not implemented.
rpc.get_batch_rate = limiter::Rate {
burst: 0,
refresh: time::Duration::ZERO,
};

let debug_page = cfg.debug_page_addr.map(|addr| network::debug_page::Config {
addr,
Expand All @@ -169,6 +164,7 @@ pub(super) fn executor(
server_addr: cfg.server_addr,
public_addr: net::Host(cfg.public_addr.0.clone()),
max_payload_size: cfg.max_payload_size,
view_timeout: cfg.view_timeout,
node_key: node_key(secrets)
.context("node_key")?
.context("missing node_key")?,
Expand Down

0 comments on commit b974be2

Please sign in to comment.