Skip to content

Commit

Permalink
Connection queries for Relayer (informalsystems#136)
Browse files Browse the repository at this point in the history
* Initial implementation of proto files required for connection. Proto files generated but replacing connection mod breaks the build

* Removed reference to MerklePrefix

* Implemented logic to proto_unmarshall the connection using prost informalsystems#130

* Trimmed the proto file, fixed commitments. Ready for review. (informalsystems#130)

* Fixed a couple of nits

* Fix for unused_qualifications h/t @gregszabo @andynog.

* Fixing unit testing since CommitPrefix was changed, failed to cargo build informalsystems#136

* Replaced prost compilation with dependency on ibc-proto crate.

* Better error propagation in connection query.

* Fixed error handling when specifying height (-h) parameter in a query connection. Doesn't throw exception anymore. Show error message. informalsystems#130

* Added validation for versions in ConnectionEnd unmarshalling

* Implemented fmt::Debug trait for CommitPrefix to properly display its value (string instead of vector of bytes). Assumes value is valid utf-8. informalsystems#136

Co-authored-by: Andy Nogueira <me@andynogueira.dev>
  • Loading branch information
adizere and andynog authored Jul 14, 2020
1 parent 124b141 commit 900d34d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
5 changes: 3 additions & 2 deletions relayer/cli/src/commands/query/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ impl Runnable for QueryConnectionEndCmd {
};
status_info!("Options", "{:?}", opts);

let chain = TendermintChain::from_config(chain_config).unwrap();
// run with proof:
// cargo run --bin relayer -- -c simple_config.toml query connection end ibc0 ibconeconnection
//
Expand All @@ -89,16 +90,16 @@ impl Runnable for QueryConnectionEndCmd {
//
// Note: currently both fail in amino_unmarshal_binary_length_prefixed().
// To test this start a Gaia node and configure a client using the go relayer.
let chain = TendermintChain::from_config(chain_config).unwrap();
let res = block_on(query_connection(
&chain,
opts.height,
opts.connection_id.clone(),
opts.proof,
));

match res {
Ok(cs) => status_info!("connection query result: ", "{:?}", cs.connection),
Err(e) => status_info!("connection query error: ", "{:?}", e),
Err(e) => status_info!("connection query error", "{}", e),
}
}
}
Expand Down
5 changes: 4 additions & 1 deletion relayer/relay/src/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@ where
.map_err(|e| error::Kind::Rpc.context(e))?;

if !abci_response.code.is_ok() {
todo!() // TODO: Fail with response log
// Fail with response log
return Err(error::Kind::Rpc
.context(abci_response.log.to_string())
.into());
}

// Data that is not from trusted node or subspace query needs verification
Expand Down

0 comments on commit 900d34d

Please sign in to comment.