Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved error messages for client state/consensus queries #1795

Merged
merged 2 commits into from
Jan 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion modules/src/core/ics02_client/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ define_error! {
},

EmptyConsensusStateResponse
| _ | { "the client state was not found" },
| _ | { "the client consensus state was not found" },

UnknownHeaderType
{ header_type: String }
Expand Down
21 changes: 19 additions & 2 deletions relayer/src/foreign_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,10 +139,22 @@ define_error! {
}
[ RelayerError ]
|e| {
format_args!("failed while querying Tx for client {0} on chain id: {1}",
format_args!("failed while querying for client {0} on chain id {1}",
e.client_id, e.chain_id)
},

ClientConsensusQuery
{
client_id: ClientId,
chain_id: ChainId,
height: Height
}
[ RelayerError ]
|e| {
format_args!("failed while querying for client consensus state {0} on chain id {1} for height {2}",
e.client_id, e.chain_id, e.height)
},

ClientUpgrade
{
client_id: ClientId,
Expand Down Expand Up @@ -1043,7 +1055,12 @@ impl<DstChain: ChainHandle, SrcChain: ChainHandle> ForeignClient<DstChain, SrcCh
.dst_chain
.query_consensus_state(self.id.clone(), height, Height::zero())
.map_err(|e| {
ForeignClientError::client_query(self.id.clone(), self.dst_chain.id(), e)
ForeignClientError::client_consensus_query(
self.id.clone(),
self.dst_chain.id(),
height,
e,
)
})?;

Ok(res)
Expand Down