diff --git a/rust/hyperlane-core/src/chain.rs b/rust/hyperlane-core/src/chain.rs index 94c2c5c44e..ad28765a5f 100644 --- a/rust/hyperlane-core/src/chain.rs +++ b/rust/hyperlane-core/src/chain.rs @@ -101,8 +101,8 @@ pub enum KnownHyperlaneDomain { ScrollSepolia = 534351, /// Cosmos local chains - CosmosTest26657 = 26657, - CosmosTest26658 = 26658, + CosmosTest99990 = 99990, + CosmosTest99991 = 99991, } #[derive(Clone)] @@ -200,7 +200,7 @@ impl KnownHyperlaneDomain { Goerli, Mumbai, Fuji, ArbitrumGoerli, OptimismGoerli, BinanceSmartChainTestnet, Alfajores, MoonbaseAlpha, Sepolia, PolygonZkEvmTestnet, LineaGoerli, BaseGoerli, ScrollSepolia, Chiado ], - LocalTestChain: [Test1, Test2, Test3, FuelTest1, SealevelTest1, SealevelTest2, CosmosTest26657, CosmosTest26658], + LocalTestChain: [Test1, Test2, Test3, FuelTest1, SealevelTest1, SealevelTest2, CosmosTest99990, CosmosTest99991], }) } @@ -215,7 +215,7 @@ impl KnownHyperlaneDomain { ], HyperlaneDomainProtocol::Fuel: [FuelTest1], HyperlaneDomainProtocol::Sealevel: [SealevelTest1, SealevelTest2], - HyperlaneDomainProtocol::Cosmos: [CosmosTest26657, CosmosTest26658], + HyperlaneDomainProtocol::Cosmos: [CosmosTest99990, CosmosTest99991], }) } } diff --git a/rust/utils/run-locally/src/cosmos/link.rs b/rust/utils/run-locally/src/cosmos/link.rs index 1e65aa4b25..1cd1efe287 100644 --- a/rust/utils/run-locally/src/cosmos/link.rs +++ b/rust/utils/run-locally/src/cosmos/link.rs @@ -93,10 +93,10 @@ fn link_network( ) { let validator_addr = validator.addr(hrp); - let dest_domain = if network.domain == 26657 { - 26658 + let dest_domain = if network.domain == 99990 { + 99991 } else { - 26657 + 99990 }; // hook routing diff --git a/rust/utils/run-locally/src/cosmos/mod.rs b/rust/utils/run-locally/src/cosmos/mod.rs index 1ecb26dc0c..e60b98e01f 100644 --- a/rust/utils/run-locally/src/cosmos/mod.rs +++ b/rust/utils/run-locally/src/cosmos/mod.rs @@ -173,6 +173,7 @@ pub struct CosmosNetwork { pub launch_resp: CosmosResp, pub deployments: Deployments, pub chain_id: String, + pub metrics_port: u32, pub domain: u32, } @@ -182,17 +183,17 @@ impl Drop for CosmosNetwork { } } -impl From<(CosmosResp, Deployments, String, u32)> for CosmosNetwork { - fn from(v: (CosmosResp, Deployments, String, u32)) -> Self { +impl From<(CosmosResp, Deployments, String, u32, u32)> for CosmosNetwork { + fn from(v: (CosmosResp, Deployments, String, u32, u32)) -> Self { Self { launch_resp: v.0, deployments: v.1, chain_id: v.2, - domain: v.3, + metrics_port: v.3, + domain: v.4, } } } - pub struct CosmosHyperlaneStack { pub validators: Vec, pub relayer: AgentHandles, @@ -258,7 +259,7 @@ fn launch_cosmos_validator( .hyp_env("ORIGINCHAINNAME", agent_config.name) .hyp_env("REORGPERIOD", "100") .hyp_env("DB", validator_base_db.to_str().unwrap()) - .hyp_env("METRICSPORT", agent_config.domain_id.to_string()) + .hyp_env("METRICSPORT", agent_config.metrics_port.to_string()) .hyp_env("VALIDATOR_SIGNER_TYPE", agent_config.signer.typ) .hyp_env("VALIDATOR_KEY", agent_config.signer.key.clone()) .hyp_env("VALIDATOR_PREFIX", "osmo") @@ -274,6 +275,7 @@ fn launch_cosmos_validator( fn launch_cosmos_relayer( agent_config_path: PathBuf, relay_chains: Vec, + metrics: u32, debug: bool, ) -> AgentHandles { let relayer_bin = concat_path(format!("../../{AGENT_BIN_PATH}"), "relayer"); @@ -290,7 +292,7 @@ fn launch_cosmos_relayer( .hyp_env("ALLOWLOCALCHECKPOINTSYNCERS", "true") .hyp_env("TRACING_LEVEL", if debug { "debug" } else { "info" }) .hyp_env("GASPAYMENTENFORCEMENT", "[{\"type\": \"none\"}]") - .hyp_env("METRICSPORT", 9093.to_string()) + .hyp_env("METRICSPORT", metrics.to_string()) .spawn("RLY"); relayer @@ -347,7 +349,8 @@ fn run_locally() { }; let port_start = 26600u32; - let domain_start = 26657u32; + let metrics_port_start = 9090u32; + let domain_start = 99990u32; let node_count = 2; let nodes = (0..node_count) @@ -355,10 +358,11 @@ fn run_locally() { ( launch_cosmos_node(CosmosConfig { node_port_base: port_start + (i * 10), - chain_id: format!("cosmos-test-{}", i + 26657), + chain_id: format!("cosmos-test-{}", i + domain_start), ..default_config.clone() }), - format!("cosmos-test-{}", i + 26657), + format!("cosmos-test-{}", i + domain_start), + metrics_port_start + i, domain_start + i, ) }) @@ -371,8 +375,8 @@ fn run_locally() { let nodes = nodes .into_iter() - .map(|v| (v.0.join(), v.1, v.2)) - .map(|(launch_resp, chain_id, domain)| { + .map(|v| (v.0.join(), v.1, v.2, v.3)) + .map(|(launch_resp, chain_id, metrics_port, domain)| { let deployments = deploy_cw_hyperlane( launch_resp.cli(&osmosisd), launch_resp.endpoint.clone(), @@ -381,14 +385,14 @@ fn run_locally() { domain, ); - (launch_resp, deployments, chain_id, domain) + (launch_resp, deployments, chain_id, metrics_port, domain) }) .collect::>(); // nodes with base deployments let nodes = nodes .into_iter() - .map(|v| (v.0, v.1.join(), v.2, v.3)) + .map(|v| (v.0, v.1.join(), v.2, v.3, v.4)) .map(|v| v.into()) .collect::>(); @@ -448,9 +452,11 @@ fn run_locally() { .into_values() .map(|agent_config| launch_cosmos_validator(agent_config, agent_config_path.clone(), debug)) .collect::>(); + let hpl_rly_metrics_port = metrics_port_start + node_count + 1u32; let hpl_rly = launch_cosmos_relayer( agent_config_path, agent_config_out.chains.into_keys().collect::>(), + hpl_rly_metrics_port, debug, ); @@ -516,7 +522,7 @@ fn run_locally() { let mut failure_occurred = false; loop { // look for the end condition. - if termination_invariants_met(dispatched_messages).unwrap_or(false) { + if termination_invariants_met(hpl_rly_metrics_port, dispatched_messages).unwrap_or(false) { // end condition reached successfully break; } else if (Instant::now() - loop_start).as_secs() > TIMEOUT_SECS { @@ -536,7 +542,7 @@ fn run_locally() { } } -fn termination_invariants_met(_messages_expected: u32) -> eyre::Result { +fn termination_invariants_met(_metrics_port: u32, _messages_expected: u32) -> eyre::Result { Ok(true) // TODO: uncomment once CI passes consistently on Ubuntu // let gas_payments_scraped = fetch_metric( diff --git a/rust/utils/run-locally/src/cosmos/types.rs b/rust/utils/run-locally/src/cosmos/types.rs index 8632687b15..138cd3522d 100644 --- a/rust/utils/run-locally/src/cosmos/types.rs +++ b/rust/utils/run-locally/src/cosmos/types.rs @@ -113,6 +113,7 @@ pub struct AgentUrl { pub struct AgentConfig { pub name: String, pub domain_id: u32, + pub metrics_port: u32, pub mailbox: String, pub interchain_gas_paymaster: String, pub validator_announce: String, @@ -144,6 +145,7 @@ impl AgentConfig { AgentConfig { name: format!("cosmostest{}", network.domain), domain_id: network.domain, + metrics_port: network.metrics_port, mailbox: to_hex_addr(&network.deployments.mailbox), interchain_gas_paymaster: to_hex_addr(&network.deployments.igp), validator_announce: to_hex_addr(&network.deployments.va),