From 91e61df693a1dbe7763f59804c5d046d66ddc41f Mon Sep 17 00:00:00 2001 From: voidash Date: Tue, 7 Jan 2025 00:11:56 +0545 Subject: [PATCH] resolve comments --- bin/bridge-client/src/args.rs | 2 +- bin/bridge-client/src/errors.rs | 5 +++++ crates/bridge-exec/src/errors.rs | 2 +- .../{ => tests}/fn_bridge_deposit_seq_unreliable.py | 6 +++--- functional-tests/utils/utils.py | 11 +++++++++++ 5 files changed, 21 insertions(+), 5 deletions(-) rename functional-tests/{ => tests}/fn_bridge_deposit_seq_unreliable.py (94%) diff --git a/bin/bridge-client/src/args.rs b/bin/bridge-client/src/args.rs index 9bfd28b8b..1c4bf35ef 100644 --- a/bin/bridge-client/src/args.rs +++ b/bin/bridge-client/src/args.rs @@ -100,7 +100,7 @@ pub(crate) struct Cli { )] pub duty_timeout_duration: Option, - /// Max retries for when rpc server fails during duty polling + /// Max retries for when RPC server fails during duty polling #[argh( option, description = "max retries for when RPC server fails during duty polling" diff --git a/bin/bridge-client/src/errors.rs b/bin/bridge-client/src/errors.rs index b64aafd28..b32c0f546 100644 --- a/bin/bridge-client/src/errors.rs +++ b/bin/bridge-client/src/errors.rs @@ -6,17 +6,22 @@ pub enum InitError { InvalidMode(String), } +/// Errors that can occur while polling for duties. #[derive(Debug, Clone, Error)] pub enum PollDutyError { + /// An error occurred with the RPC client. #[error("RPC client: {0}")] Rpc(String), + /// Failed to fetch a WebSocket client from the pool. #[error("fetching WebSocket client from pool failed")] WsPool, } +/// Errors related to task management. #[derive(Debug, Clone, Error)] pub enum TaskManagerError { + /// Maximum number of retries has been exceeded. #[error("Maximum retries exceeded. Num retries {0}")] MaxRetry(u16), } diff --git a/crates/bridge-exec/src/errors.rs b/crates/bridge-exec/src/errors.rs index 531b152bf..7983c306a 100644 --- a/crates/bridge-exec/src/errors.rs +++ b/crates/bridge-exec/src/errors.rs @@ -49,7 +49,7 @@ pub enum ExecError { Xpriv, /// Error getting the WebSocket client from pool - #[error("fetching websocket client from pool failed")] + #[error("fetching WebSocket client from pool failed")] WsPool, } diff --git a/functional-tests/fn_bridge_deposit_seq_unreliable.py b/functional-tests/tests/fn_bridge_deposit_seq_unreliable.py similarity index 94% rename from functional-tests/fn_bridge_deposit_seq_unreliable.py rename to functional-tests/tests/fn_bridge_deposit_seq_unreliable.py index 0875914cf..fd76d5ffb 100644 --- a/functional-tests/fn_bridge_deposit_seq_unreliable.py +++ b/functional-tests/tests/fn_bridge_deposit_seq_unreliable.py @@ -1,9 +1,9 @@ import flexitest -import testenv -from constants import SATS_TO_WEI -from rollup_params_cfg import RollupConfig +from envs import testenv +from envs.rollup_params_cfg import RollupConfig from utils import get_bridge_pubkey, wait_until, wait_until_with_value +from utils.constants import SATS_TO_WEI @flexitest.register diff --git a/functional-tests/utils/utils.py b/functional-tests/utils/utils.py index 3b023393a..a3e770da7 100644 --- a/functional-tests/utils/utils.py +++ b/functional-tests/utils/utils.py @@ -518,3 +518,14 @@ def cl_slot_to_block_id(seqrpc, slot): def el_slot_to_block_id(rethrpc, block_num): """Get EL block hash from block number using Ethereum RPC.""" return rethrpc.eth_getBlockByNumber(hex(block_num), False)["hash"] + + +def check_sequencer_down(seqrpc): + """ + Returns True if sequencer RPC is down + """ + try: + seqrpc.strata_protocolVersion() + return False + except RuntimeError: + return True