tycho_collator/validator/rpc/
mod.rs1use std::sync::Arc;
2use std::time::Duration;
3
4use futures_util::future::Future;
5use serde::{Deserialize, Serialize};
6use tycho_network::PeerId;
7use tycho_util::serde_helpers;
8
9pub use self::client::ValidatorClient;
10pub use self::service::ValidatorService;
11use crate::validator::proto;
12
13mod client;
14mod service;
15
16#[derive(Debug, Clone, Serialize, Deserialize)]
18#[serde(default)]
19pub struct ExchangeSignaturesBackoff {
20 #[serde(with = "serde_helpers::humantime")]
21 pub min_interval: Duration,
22 #[serde(with = "serde_helpers::humantime")]
23 pub max_interval: Duration,
24 pub factor: f32,
25}
26
27impl Default for ExchangeSignaturesBackoff {
28 fn default() -> Self {
29 Self {
30 min_interval: Duration::from_millis(50),
31 max_interval: Duration::from_secs(1),
32 factor: 1.5,
33 }
34 }
35}
36
37pub trait ExchangeSignatures: Send + Sync + 'static {
38 type Err: std::fmt::Debug + Send;
39
40 fn exchange_signatures(
41 &self,
42 peer_id: &PeerId,
43 block_seqno: u32,
44 signature: Arc<[u8; 64]>,
45 ) -> impl Future<Output = Result<proto::Exchange, Self::Err>> + Send;
46}