@@ -4,6 +4,7 @@ use alloy::providers::{Provider, ProviderBuilder, WsConnect};
44use alloy:: pubsub:: SubscriptionStream ;
55use alloy:: rpc:: types:: { Block , BlockNumberOrTag , Filter , Header , Log } ;
66use alloy:: sol_types:: SolEventInterface ;
7+ use alloy:: transports:: ws:: WebSocketConfig ;
78use anyhow:: { anyhow, Result } ;
89use fhevm_engine_common:: telemetry;
910use futures_util:: stream:: StreamExt ;
@@ -187,7 +188,9 @@ impl InfiniteLogIter {
187188 }
188189
189190 async fn get_chain_id ( & self ) -> anyhow:: Result < ChainId > {
190- let ws = WsConnect :: new ( & self . url ) ;
191+ let config = WebSocketConfig :: default ( )
192+ . max_message_size ( Some ( 256 * 1024 * 1024 ) ) ; // 256MB
193+ let ws = WsConnect :: new ( & self . url ) . with_config ( config) ;
191194 let provider = ProviderBuilder :: new ( ) . connect_ws ( ws) . await ?;
192195 Ok ( provider. get_chain_id ( ) . await ?)
193196 }
@@ -599,8 +602,13 @@ impl InfiniteLogIter {
599602
600603 async fn new_log_stream ( & mut self , not_initialized : bool ) {
601604 let mut retry = 20 ;
605+ let config = WebSocketConfig :: default ( )
606+ . max_message_size ( Some ( 256 * 1024 * 1024 ) ) ; // 256MB
607+
602608 loop {
603- let ws = WsConnect :: new ( & self . url ) . with_max_retries ( 0 ) ; // disabled, alloy skips events
609+ let ws = WsConnect :: new ( & self . url )
610+ . with_max_retries ( 0 )
611+ . with_config ( config) ; // disabled, alloy skips events
604612
605613 match ProviderBuilder :: new ( ) . connect_ws ( ws) . await {
606614 Ok ( provider) => {
0 commit comments