Skip to content

Commit

Permalink
fix:
Browse files Browse the repository at this point in the history
  • Loading branch information
uri-99 committed Dec 10, 2024
1 parent fea61ca commit 3bc849f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
6 changes: 2 additions & 4 deletions batcher/aligned-batcher/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -405,18 +405,16 @@ impl Batcher {
.await
.send(Message::binary(serialized_protocol_version_msg))
.await?;

let mut incoming_filter = incoming.try_filter(|msg| future::ready(msg.is_binary()));

let mut incoming_filter = incoming.try_filter(|msg| future::ready(msg.is_binary()));
let future_msg = incoming_filter.try_next();

// timeout to prevent a DOS attack
match timeout(Duration::from_secs(CONNECTION_TIMEOUT*10), future_msg).await {
match timeout(Duration::from_secs(CONNECTION_TIMEOUT), future_msg).await {
Ok(Ok(Some(msg))) => {
self.clone().handle_message(msg, outgoing.clone()).await?;
}
Err(elapsed) => {
info!("timeout here");
warn!("[{}] {}", &addr, elapsed);
self.metrics.user_error(&["user_timeout", ""]);
self.metrics.open_connections.dec();
Expand Down
2 changes: 1 addition & 1 deletion batcher/aligned-sdk/src/core/constants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ pub const CONSTANT_GAS_COST: u128 =
+ BATCHER_SUBMISSION_BASE_GAS_COST;
pub const DEFAULT_MAX_FEE_PER_PROOF: u128 =
ADDITIONAL_SUBMISSION_GAS_COST_PER_PROOF * 100_000_000_000; // gas_price = 100 Gwei = 0.0000001 ether (high gas price)
pub const CONNECTION_TIMEOUT: u64 = 5; // 5 secs
pub const CONNECTION_TIMEOUT: u64 = 30; // 30 secs

// % modifiers: (100% is x1, 10% is x0.1, 1000% is x10)
pub const RESPOND_TO_TASK_FEE_LIMIT_PERCENTAGE_MULTIPLIER: u128 = 250; // fee_for_aggregator -> respondToTaskFeeLimit modifier
Expand Down

0 comments on commit 3bc849f

Please sign in to comment.