Skip to content

Commit 066c526

Browse files
feat: configurable reconnection attempts on web socket (#288)
Co-authored-by: jotabulacios <jbulacios@fi.uba.ar>
1 parent 9355ca6 commit 066c526

3 files changed

Lines changed: 6 additions & 2 deletions

File tree

batcher/src/config/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ pub struct BatcherConfigFromYaml {
1212
pub batch_size_interval: usize,
1313
pub max_proof_size: usize,
1414
pub max_batch_size: usize,
15+
pub eth_ws_reconnects: usize,
1516
}
1617

1718
#[derive(Debug, Deserialize)]

batcher/src/lib.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,11 @@ impl Batcher {
4949
let deployment_output =
5050
ContractDeploymentOutput::new(config.aligned_layer_deployment_config_file_path);
5151

52-
let eth_ws_provider = Provider::connect(&config.eth_ws_url)
52+
let eth_ws_provider = Provider::connect_with_reconnects(
53+
&config.eth_ws_url, config.batcher.eth_ws_reconnects)
5354
.await
5455
.expect("Failed to get ethereum websocket provider");
55-
56+
5657
let eth_rpc_provider =
5758
eth::get_provider(config.eth_rpc_url.clone()).expect("Failed to get provider");
5859

@@ -105,6 +106,7 @@ impl Batcher {
105106
tx: Arc<Sender<Message>>,
106107
) -> Result<(), anyhow::Error> {
107108
let mut stream = self.eth_ws_provider.subscribe_blocks().await?;
109+
108110
while let Some(block) = stream.next().await {
109111
let batcher = self.clone();
110112
let tx = tx.clone();

config-files/config.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ batcher:
2323
batch_size_interval: 999999999
2424
max_proof_size: 67108864 # 64 MiB
2525
max_batch_size: 268435456 # 256 MiB
26+
eth_ws_reconnects: 99999999999999
2627

2728
## Aggregator Configurations
2829
aggregator:

0 commit comments

Comments
 (0)