From 2e4b4e484eb8e04df5a1b77079e160f1cd6ad460 Mon Sep 17 00:00:00 2001 From: Jonas Bostoen Date: Fri, 6 Dec 2024 10:40:39 +0100 Subject: [PATCH] fix(cli): log unexpected contract errors --- bolt-cli/src/commands/operators.rs | 21 +++++++++++++++++---- bolt-cli/src/commands/validators.rs | 6 +++++- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/bolt-cli/src/commands/operators.rs b/bolt-cli/src/commands/operators.rs index 06e712f8..76563ab4 100644 --- a/bolt-cli/src/commands/operators.rs +++ b/bolt-cli/src/commands/operators.rs @@ -4,6 +4,7 @@ use alloy::{ primitives::{utils::format_ether, Bytes}, providers::{Provider, ProviderBuilder, WalletProvider}, signers::{local::PrivateKeySigner, SignerSync}, + sol_types::SolInterface, }; use eyre::Context; use tracing::{info, warn}; @@ -175,7 +176,10 @@ impl OperatorsCommand { BoltEigenLayerMiddlewareErrors::NotOperator(_) => { eyre::bail!("Operator not registered in EigenLayer") } - _ => unreachable!(), + other => unreachable!( + "Unexpected error with selector {:?}", + other.selector() + ), } } } @@ -225,7 +229,10 @@ impl OperatorsCommand { BoltEigenLayerMiddlewareErrors::NotRegistered(_) => { eyre::bail!("Operator not registered in bolt") } - _ => unreachable!(), + other => unreachable!( + "Unexpected error with selector {:?}", + other.selector() + ), } } } @@ -314,7 +321,10 @@ impl OperatorsCommand { BoltSymbioticMiddlewareErrors::NotOperator(_) => { eyre::bail!("Operator not registered in Symbiotic") } - _ => unreachable!(), + other => unreachable!( + "Unexpected error with selector {:?}", + other.selector() + ), } } } @@ -365,7 +375,10 @@ impl OperatorsCommand { BoltSymbioticMiddlewareErrors::NotRegistered(_) => { eyre::bail!("Operator not registered in bolt") } - _ => unreachable!(), + other => unreachable!( + "Unexpected error with selector {:?}", + other.selector() + ), } } } diff --git a/bolt-cli/src/commands/validators.rs b/bolt-cli/src/commands/validators.rs index fbb0c2ef..6ce825fb 100644 --- a/bolt-cli/src/commands/validators.rs +++ b/bolt-cli/src/commands/validators.rs @@ -2,6 +2,7 @@ use alloy::{ network::EthereumWallet, providers::{Provider, ProviderBuilder}, signers::local::PrivateKeySigner, + sol_types::SolInterface, }; use ethereum_consensus::crypto::PublicKey as BlsPublicKey; use eyre::Context; @@ -91,7 +92,10 @@ impl ValidatorsCommand { BoltValidatorsErrors::InvalidAuthorizedOperator(_) => { eyre::bail!("Invalid authorized operator") } - _ => eyre::bail!("Unknown contract error"), + other => unreachable!( + "Unexpected error with selector {:?}", + other.selector() + ), } } }