-
Notifications
You must be signed in to change notification settings - Fork 358
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added support for Evmos in integration tests (#2606)
- Loading branch information
Showing
14 changed files
with
120 additions
and
23 deletions.
There are no files selected for viewing
2 changes: 2 additions & 0 deletions
2
...ngelog/unreleased/features/ibc-integration-test/2442-evmos-integration-tests.md
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,2 @@ | ||
- Added Evmos compatible integration tests | ||
([#2442](https://github.com/informalsystems/ibc-rs/issues/2442)) |
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 |
---|---|---|
|
@@ -41,6 +41,7 @@ | |
ibc-go-v4-simapp | ||
ibc-go-v5-simapp | ||
apalache | ||
evmos | ||
; | ||
|
||
python = nixpkgs.python3.withPackages (p: [ | ||
|
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,75 @@ | ||
use core::str::FromStr; | ||
use ibc::core::ics24_host::identifier::ChainId; | ||
use ibc_relayer::config::AddressType; | ||
|
||
use crate::error::Error; | ||
use crate::util::random::{random_u32, random_unused_tcp_port}; | ||
|
||
const COSMOS_HD_PATH: &str = "m/44'/118'/0'/0/0"; | ||
const EVMOS_HD_PATH: &str = "m/44'/60'/0'/0/0"; | ||
|
||
#[derive(Clone, Debug)] | ||
pub enum ChainType { | ||
Cosmos, | ||
Evmos, | ||
} | ||
|
||
impl ChainType { | ||
pub fn hd_path(&self) -> &str { | ||
match self { | ||
Self::Cosmos => COSMOS_HD_PATH, | ||
Self::Evmos => EVMOS_HD_PATH, | ||
} | ||
} | ||
|
||
pub fn chain_id(&self, prefix: &str, use_random_id: bool) -> ChainId { | ||
match self { | ||
Self::Cosmos => { | ||
if use_random_id { | ||
ChainId::from_string(&format!("ibc-{}-{:x}", prefix, random_u32())) | ||
} else { | ||
ChainId::from_string(&format!("ibc-{}", prefix)) | ||
} | ||
} | ||
Self::Evmos => ChainId::from_string(&format!("evmos_9000-{}", prefix)), | ||
} | ||
} | ||
|
||
// Extra arguments required to run `<chain binary> start` | ||
pub fn extra_start_args(&self) -> Vec<String> { | ||
let mut res = vec![]; | ||
let json_rpc_port = random_unused_tcp_port(); | ||
match self { | ||
Self::Cosmos => {} | ||
Self::Evmos => { | ||
res.push("--json-rpc.address".to_owned()); | ||
res.push(format!("localhost:{}", json_rpc_port)); | ||
} | ||
} | ||
res | ||
} | ||
|
||
pub fn address_type(&self) -> AddressType { | ||
match self { | ||
Self::Cosmos => AddressType::default(), | ||
Self::Evmos => AddressType::Ethermint { | ||
pk_type: "/ethermint.crypto.v1.ethsecp256k1.PubKey".to_string(), | ||
}, | ||
} | ||
} | ||
} | ||
|
||
impl FromStr for ChainType { | ||
type Err = Error; | ||
|
||
fn from_str(s: &str) -> Result<Self, Self::Err> { | ||
match s { | ||
name if name.contains("gaiad") => Ok(ChainType::Cosmos), | ||
name if name.contains("simd") => Ok(ChainType::Cosmos), | ||
name if name.contains("wasmd") => Ok(ChainType::Cosmos), | ||
name if name.contains("icad") => Ok(ChainType::Cosmos), | ||
name if name.contains("evmosd") => Ok(ChainType::Evmos), | ||
_ => Ok(ChainType::Cosmos), | ||
} | ||
} | ||
} |
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 |
---|---|---|
|
@@ -15,6 +15,7 @@ | |
*/ | ||
|
||
pub mod builder; | ||
pub mod chain_type; | ||
pub mod config; | ||
pub mod driver; | ||
pub mod exec; | ||
|
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