-
Notifications
You must be signed in to change notification settings - Fork 326
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add retry for packet relay failures and relayer restructure (#547)
* Add retry, collect events and msgs in Link * Flatten Connection and Channel structs and use them from CLIs * some renaming * Remove MsgCollector and use the Link from the CLIs. Cleanup the CLI and make them consistent with the handshake CLIs. * relayer/client bit of cleanup * Restructure relayer code * Add retries in packet relayer loop * Cleanup packet CLIs and relayer loop output * Fix for abiding by log_level in start command * Add cli_utils for chain validation, change params to ChainId, add required * Change start CLI to take the two chain-ids * Refactored error hierarchy in relayer objects * Remove panics from event processing, update instructions * Add relayer listen command in doc Co-authored-by: Adi Seredinschi <[email protected]>
- Loading branch information
1 parent
294f42b
commit 9d0a7b8
Showing
26 changed files
with
2,273 additions
and
2,218 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
use abscissa_core::config; | ||
|
||
use ibc::ics24_host::identifier::ChainId; | ||
use relayer::chain::handle::ChainHandle; | ||
use relayer::chain::runtime::ChainRuntime; | ||
use relayer::chain::CosmosSDKChain; | ||
|
||
use crate::application::CliApp; | ||
use crate::error::{Error, Kind}; | ||
|
||
/// Pair of chain handlers that are used by most CLIs. | ||
pub struct ChainHandlePair { | ||
/// Source chain handle | ||
pub src: Box<dyn ChainHandle>, | ||
/// Destination chain handle | ||
pub dst: Box<dyn ChainHandle>, | ||
} | ||
|
||
/// Create the source and destination chain handlers from the configuration and chain identifiers | ||
pub fn chain_handlers_from_chain_id( | ||
config: &config::Reader<CliApp>, | ||
src_chain_id: &ChainId, | ||
dst_chain_id: &ChainId, | ||
) -> Result<ChainHandlePair, Error> { | ||
let src_config = config | ||
.find_chain(src_chain_id) | ||
.ok_or_else(|| "missing source chain in configuration file".to_string()); | ||
|
||
let dst_config = config | ||
.find_chain(dst_chain_id) | ||
.ok_or_else(|| "missing destination chain configuration file".to_string()); | ||
|
||
let (src_chain_config, dst_chain_config) = match (src_config, dst_config) { | ||
(Ok(s), Ok(d)) => (s, d), | ||
(Err(e), _) | (_, Err(e)) => { | ||
return Err(Kind::Config.context(e).into()); | ||
} | ||
}; | ||
|
||
let src_chain_res = ChainRuntime::<CosmosSDKChain>::spawn(src_chain_config.clone()) | ||
.map_err(|e| Kind::Runtime.context(e)); | ||
let src = match src_chain_res { | ||
Ok((handle, _)) => handle, | ||
Err(e) => { | ||
return Err(e.into()); | ||
} | ||
}; | ||
|
||
let dst_chain_res = ChainRuntime::<CosmosSDKChain>::spawn(dst_chain_config.clone()) | ||
.map_err(|e| Kind::Runtime.context(e)); | ||
let dst = match dst_chain_res { | ||
Ok((handle, _)) => handle, | ||
Err(e) => { | ||
return Err(e.into()); | ||
} | ||
}; | ||
|
||
Ok(ChainHandlePair { src, dst }) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.