Error message to indicate if there are no validators (#2099)

### Description

Adds a more descriptive error message for failing to reach validator
quorum when there are no validators defined.

### Drive-by changes

No

### Related issues

- Fixes #2031 

### Backward compatibility

_Are these changes backward compatible?_

Yes

_Are there any infrastructure implications, e.g. changes that would
prohibit deploying older commits using this infra tooling?_

None


### Testing

_What kind of testing have these changes undergone?_

None
asaj/ci-try
Mattie Conover 2 years ago committed by GitHub
parent e756732964
commit 910e5c84e9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 29
      rust/agents/relayer/src/msg/metadata/base.rs
  2. 22
      rust/agents/relayer/src/msg/metadata/multisig.rs

@ -1,22 +1,22 @@
use async_trait::async_trait;
use hyperlane_core::accumulator::merkle::Proof;
use num_derive::FromPrimitive;
use num_traits::FromPrimitive;
use std::str::FromStr;
use std::sync::Arc;
use std::{collections::HashMap, fmt::Debug};
use async_trait::async_trait;
use derive_new::new;
use eyre::{Context, Result};
use num_derive::FromPrimitive;
use num_traits::FromPrimitive;
use tokio::sync::RwLock;
use tracing::{debug, instrument, warn};
use hyperlane_base::{
ChainConf, CheckpointSyncer, CheckpointSyncerConf, CoreMetrics, MultisigCheckpointSyncer,
};
use hyperlane_core::accumulator::merkle::Proof;
use hyperlane_core::{
HyperlaneMessage, MultisigIsm, MultisigSignedCheckpoint, RoutingIsm, ValidatorAnnounce, H160,
H256,
HyperlaneDomain, HyperlaneMessage, MultisigIsm, MultisigSignedCheckpoint, RoutingIsm,
ValidatorAnnounce, H160, H256,
};
use crate::merkle_tree_builder::MerkleTreeBuilder;
@ -41,11 +41,8 @@ pub enum SupportedIsmTypes {
#[async_trait]
pub trait MetadataBuilder: Send + Sync {
#[allow(clippy::async_yields_async)]
async fn build(
&self,
ism_address: H256,
message: &HyperlaneMessage,
) -> eyre::Result<Option<Vec<u8>>>;
async fn build(&self, ism_address: H256, message: &HyperlaneMessage)
-> Result<Option<Vec<u8>>>;
}
#[derive(Clone, new)]
@ -78,7 +75,7 @@ impl MetadataBuilder for BaseMetadataBuilder {
&self,
ism_address: H256,
message: &HyperlaneMessage,
) -> eyre::Result<Option<Vec<u8>>> {
) -> Result<Option<Vec<u8>>> {
const CTX: &str = "When fetching module type";
let ism = self
.chain_setup
@ -106,7 +103,11 @@ impl MetadataBuilder for BaseMetadataBuilder {
}
impl BaseMetadataBuilder {
pub fn clone_with_incremented_depth(&self) -> eyre::Result<BaseMetadataBuilder> {
pub fn domain(&self) -> &HyperlaneDomain {
&self.chain_setup.domain
}
pub fn clone_with_incremented_depth(&self) -> Result<BaseMetadataBuilder> {
let mut cloned = self.clone();
cloned.depth += 1;
if cloned.depth > cloned.max_depth {
@ -162,7 +163,7 @@ impl BaseMetadataBuilder {
pub async fn build_checkpoint_syncer(
&self,
validators: &[H256],
) -> eyre::Result<MultisigCheckpointSyncer> {
) -> Result<MultisigCheckpointSyncer> {
let storage_locations = self
.validator_announce
.get_announced_storage_locations(validators)

@ -1,14 +1,14 @@
use async_trait::async_trait;
use ethers::abi::Token;
use hyperlane_core::accumulator::merkle::Proof;
use std::collections::HashMap;
use std::fmt::Debug;
use std::ops::Deref;
use async_trait::async_trait;
use derive_new::new;
use ethers::abi::Token;
use eyre::Context;
use tracing::{debug, info, instrument};
use hyperlane_core::accumulator::merkle::Proof;
use hyperlane_core::{
HyperlaneMessage, MultisigIsm, MultisigSignedCheckpoint, SignatureWithSigner, H256,
};
@ -48,10 +48,18 @@ impl MetadataBuilder for MultisigIsmMetadataBuilder {
let Some(checkpoint) = self.fetch_checkpoint(&validators, threshold.into(), message)
.await.context(CTX)?
else {
info!(
?validators, threshold,
"Could not fetch metadata: Unable to reach quorum"
);
if validators.is_empty() {
info!(
ism=%multisig_ism.address(),
chain=%self.base.domain().name(),
"Could not fetch metadata: No validator set for chain is configured on the recipient's ISM"
);
} else {
info!(
?validators, threshold, ism=%multisig_ism.address(),
"Could not fetch metadata: Unable to reach quorum"
);
}
return Ok(None);
};

Loading…
Cancel
Save