diff --git a/core/lib/config/src/configs/consensus.rs b/core/lib/config/src/configs/consensus.rs index 7f5450551af2..c2e2e66b9c75 100644 --- a/core/lib/config/src/configs/consensus.rs +++ b/core/lib/config/src/configs/consensus.rs @@ -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. /// diff --git a/core/lib/protobuf_config/src/consensus.rs b/core/lib/protobuf_config/src/consensus.rs index 869ec2fb9df0..ceec0a8d3ea6 100644 --- a/core/lib/protobuf_config/src/consensus.rs +++ b/core/lib/protobuf_config/src/consensus.rs @@ -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 => { @@ -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()?)) @@ -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(), diff --git a/core/lib/protobuf_config/src/proto/core/consensus.proto b/core/lib/protobuf_config/src/proto/core/consensus.proto index 73b9d467e5f0..a8c84b871b8a 100644 --- a/core/lib/protobuf_config/src/proto/core/consensus.proto +++ b/core/lib/protobuf_config/src/proto/core/consensus.proto @@ -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 diff --git a/core/node/consensus/src/config.rs b/core/node/consensus/src/config.rs index 4ad7a551ab42..80763c82247a 100644 --- a/core/node/consensus/src/config.rs +++ b/core/node/consensus/src/config.rs @@ -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, @@ -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")?,