diff --git a/rust/Cargo.lock b/rust/Cargo.lock index c20fa554b..0aeaa30cc 100644 --- a/rust/Cargo.lock +++ b/rust/Cargo.lock @@ -1183,6 +1183,15 @@ version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "702fc72eb24e5a1e48ce58027a675bc24edd52096d5397d4aea7c6dd9eca0bd1" +[[package]] +name = "cloudabi" +version = "0.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" +dependencies = [ + "bitflags 1.3.2", +] + [[package]] name = "cobs" version = "0.2.3" @@ -1519,7 +1528,7 @@ dependencies = [ "serde", "serde-json-wasm", "sha2 0.10.8", - "static_assertions", + "static_assertions 1.1.0", "thiserror", ] @@ -1835,7 +1844,7 @@ dependencies = [ "reqwest", "serde", "serde_json", - "static_assertions", + "static_assertions 1.1.0", "thiserror", ] @@ -2583,7 +2592,7 @@ version = "18.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7413c5f74cc903ea37386a8965a936cbeb334bd270862fdece542c1b2dcbc898" dependencies = [ - "ethereum-types", + "ethereum-types 0.14.1", "hex 0.4.3", "once_cell", "regex", @@ -2591,7 +2600,20 @@ dependencies = [ "serde_json", "sha3 0.10.8", "thiserror", - "uint", + "uint 0.9.5", +] + +[[package]] +name = "ethbloom" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3932e82d64d347a045208924002930dc105a138995ccdc1479d0f05f0359f17c" +dependencies = [ + "crunchy", + "fixed-hash 0.3.2", + "impl-rlp 0.2.1", + "impl-serde 0.2.3", + "tiny-keccak 1.5.0", ] [[package]] @@ -2606,7 +2628,21 @@ dependencies = [ "impl-rlp 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "impl-serde 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "scale-info", - "tiny-keccak", + "tiny-keccak 2.0.2", +] + +[[package]] +name = "ethereum-types" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b054df51e53f253837ea422681215b42823c02824bde982699d0dceecf6165a1" +dependencies = [ + "crunchy", + "ethbloom 0.6.4", + "ethereum-types-serialize", + "fixed-hash 0.3.2", + "serde", + "uint 0.5.0", ] [[package]] @@ -2615,14 +2651,23 @@ version = "0.14.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "02d215cbf040552efcbe99a38372fe80ab9d00268e20012b79fcd0f073edd8ee" dependencies = [ - "ethbloom", + "ethbloom 0.13.0", "fixed-hash 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "impl-codec 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "impl-rlp 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "impl-serde 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "primitive-types", "scale-info", - "uint", + "uint 0.9.5", +] + +[[package]] +name = "ethereum-types-serialize" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1873d77b32bc1891a79dad925f2acbc318ee942b38b9110f9dbc5fbeffcea350" +dependencies = [ + "serde", ] [[package]] @@ -2725,14 +2770,14 @@ dependencies = [ "open-fastrlp", "proc-macro2 1.0.70", "rand 0.8.5", - "rlp", + "rlp 0.5.2", "rlp-derive", "serde", "serde_json", "strum 0.24.1", "syn 1.0.109", "thiserror", - "tiny-keccak", + "tiny-keccak 2.0.2", "unicode-xid 0.2.4", ] @@ -2795,7 +2840,7 @@ dependencies = [ "prometheus", "serde", "serde_json", - "static_assertions", + "static_assertions 1.1.0", "tokio", ] @@ -2943,6 +2988,19 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8fcfdc7a0362c9f4444381a9e697c79d435fe65b52a37466fc2c1184cee9edc6" +[[package]] +name = "fixed-hash" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1a683d1234507e4f3bf2736eeddf0de1dc65996dc0164d57eba0a74bcf29489" +dependencies = [ + "byteorder", + "heapsize", + "rand 0.5.6", + "rustc-hex", + "static_assertions 0.2.5", +] + [[package]] name = "fixed-hash" version = "0.8.0" @@ -2952,7 +3010,7 @@ dependencies = [ "byteorder", "rand 0.8.5", "rustc-hex", - "static_assertions", + "static_assertions 1.1.0", ] [[package]] @@ -2963,7 +3021,7 @@ dependencies = [ "byteorder", "rand 0.8.5", "rustc-hex", - "static_assertions", + "static_assertions 1.1.0", ] [[package]] @@ -3037,6 +3095,12 @@ version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6c2141d6d6c8512188a7891b4b01590a45f6dac67afb4f255c4124dbb86d4eaa" +[[package]] +name = "fuchsia-cprng" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba" + [[package]] name = "fuel-abi-types" version = "0.2.1" @@ -3761,6 +3825,15 @@ dependencies = [ "stable_deref_trait", ] +[[package]] +name = "heapsize" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1679e6ea370dee694f91f1dc469bf94cf8f52051d147aec3e1f9497c6fc22461" +dependencies = [ + "winapi", +] + [[package]] name = "heck" version = "0.3.3" @@ -4073,7 +4146,7 @@ dependencies = [ "serde", "serde_json", "solana-sdk", - "static_assertions", + "static_assertions 1.1.0", "tempfile", "thiserror", "tokio", @@ -4118,9 +4191,9 @@ dependencies = [ "solana-sdk", "strum 0.25.0", "thiserror", - "tiny-keccak", + "tiny-keccak 2.0.2", "tokio", - "uint", + "uint 0.9.5", ] [[package]] @@ -4134,10 +4207,14 @@ dependencies = [ "derive-new", "hex 0.4.3", "hpl-interface", + "http", "hyper", "hyper-tls", "hyperlane-core", + "injective-protobuf", + "injective-std", "once_cell", + "protobuf", "ripemd", "serde", "serde_json", @@ -4704,13 +4781,22 @@ dependencies = [ "parity-scale-codec", ] +[[package]] +name = "impl-rlp" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f7a72f11830b52333f36e3b09a288333888bf54380fd0ac0790a3c31ab0f3c5" +dependencies = [ + "rlp 0.4.6", +] + [[package]] name = "impl-rlp" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f28220f89297a075ddc7245cd538076ee98b01f2a9c23a53a4f1105d5a322808" dependencies = [ - "rlp", + "rlp 0.5.2", ] [[package]] @@ -4718,7 +4804,16 @@ name = "impl-rlp" version = "0.3.0" source = "git+https://github.com/hyperlane-xyz/parity-common.git?branch=hyperlane#3c2a89084ccfc27b82fda29007b4e27215a75cb1" dependencies = [ - "rlp", + "rlp 0.5.2", +] + +[[package]] +name = "impl-serde" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "58e3cae7e99c7ff5a995da2cf78dd0a5383740eda71d98cf7b1910c301ac69b8" +dependencies = [ + "serde", ] [[package]] @@ -4793,6 +4888,38 @@ dependencies = [ "regex", ] +[[package]] +name = "injective-protobuf" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a52219a08aba8c17846fd23d472d1d69c817fe5b427d135273e4c7311edd6972" +dependencies = [ + "cosmwasm-std", + "ethereum-types 0.5.2", + "num 0.4.1", + "protobuf", + "protobuf-codegen-pure", + "schemars", + "serde", + "subtle-encoding", +] + +[[package]] +name = "injective-std" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd7a5b52d19dca05823c7e4b481d41b49c04a0e56f66a5c92396a6fdd3314710" +dependencies = [ + "chrono", + "cosmwasm-std", + "osmosis-std-derive", + "prost", + "prost-types", + "schemars", + "serde", + "serde-cw-value", +] + [[package]] name = "inout" version = "0.1.3" @@ -5319,7 +5446,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a53d79ba8304ac1c4f9eb3b9d281f21f7be9d4626f72ce7df4ad8fbde4f38a74" dependencies = [ "modular-bitfield-impl", - "static_assertions", + "static_assertions 1.1.0", ] [[package]] @@ -5693,7 +5820,7 @@ dependencies = [ "arrayvec", "auto_impl 1.1.0", "bytes", - "ethereum-types", + "ethereum-types 0.14.1", "open-fastrlp-derive", ] @@ -5788,6 +5915,18 @@ version = "6.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e2355d85b9a3786f481747ced0e0ff2ba35213a1f9bd406ed906554d7af805a1" +[[package]] +name = "osmosis-std-derive" +version = "0.15.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4d482a16be198ee04e0f94e10dd9b8d02332dcf33bc5ea4b255e7e25eedc5df" +dependencies = [ + "itertools 0.10.5", + "proc-macro2 1.0.70", + "quote 1.0.33", + "syn 1.0.109", +] + [[package]] name = "ouroboros" version = "0.15.6" @@ -6257,7 +6396,7 @@ dependencies = [ "impl-rlp 0.3.0 (git+https://github.com/hyperlane-xyz/parity-common.git?branch=hyperlane)", "impl-serde 0.4.0 (git+https://github.com/hyperlane-xyz/parity-common.git?branch=hyperlane)", "scale-info", - "uint", + "uint 0.9.5", ] [[package]] @@ -6383,6 +6522,28 @@ name = "protobuf" version = "2.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "106dd99e98437432fed6519dedecfade6a06a73bb7b2a1e019fdd2bee5778d94" +dependencies = [ + "bytes", +] + +[[package]] +name = "protobuf-codegen" +version = "2.28.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "033460afb75cf755fcfc16dfaed20b86468082a2ea24e05ac35ab4a099a017d6" +dependencies = [ + "protobuf", +] + +[[package]] +name = "protobuf-codegen-pure" +version = "2.28.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95a29399fc94bcd3eeaa951c715f7bea69409b2445356b00519740bcd6ddd865" +dependencies = [ + "protobuf", + "protobuf-codegen", +] [[package]] name = "psl-types" @@ -6512,6 +6673,19 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09" +[[package]] +name = "rand" +version = "0.5.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c618c47cd3ebd209790115ab837de41425723956ad3ce2e6a7f09890947cacb9" +dependencies = [ + "cloudabi", + "fuchsia-cprng", + "libc", + "rand_core 0.3.1", + "winapi", +] + [[package]] name = "rand" version = "0.7.3" @@ -6556,6 +6730,21 @@ dependencies = [ "rand_core 0.6.4", ] +[[package]] +name = "rand_core" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b" +dependencies = [ + "rand_core 0.4.2", +] + +[[package]] +name = "rand_core" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c33a3c44ca05fa6f1807d8e6743f3824e8509beca625669633be0acbdf509dc" + [[package]] name = "rand_core" version = "0.5.1" @@ -6876,6 +7065,15 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "rlp" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1190dcc8c3a512f1eef5d09bb8c84c7f39e1054e174d1795482e18f5272f2e73" +dependencies = [ + "rustc-hex", +] + [[package]] name = "rlp" version = "0.5.2" @@ -7716,6 +7914,15 @@ dependencies = [ "serde_json", ] +[[package]] +name = "serde-cw-value" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75d32da6b8ed758b7d850b6c3c08f1d7df51a4df3cb201296e63e34a78e99d4" +dependencies = [ + "serde", +] + [[package]] name = "serde-json-wasm" version = "0.5.1" @@ -9080,6 +9287,12 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" +[[package]] +name = "static_assertions" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c19be23126415861cb3a23e501d34a708f7f9b2183c5252d690941c2e69199d5" + [[package]] name = "static_assertions" version = "1.1.0" @@ -9322,7 +9535,7 @@ dependencies = [ "pin-project", "rand 0.8.5", "serde", - "static_assertions", + "static_assertions 1.1.0", "tarpc-plugins", "thiserror", "tokio", @@ -9576,6 +9789,15 @@ dependencies = [ "zeroize", ] +[[package]] +name = "tiny-keccak" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d8a021c69bb74a44ccedb824a046447e2c84a01df9e5c20779750acb38e11b2" +dependencies = [ + "crunchy", +] + [[package]] name = "tiny-keccak" version = "2.0.2" @@ -10034,6 +10256,18 @@ version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ed646292ffc8188ef8ea4d1e0e0150fb15a5c2e12ad9b8fc191ae7a8a7f3c4b9" +[[package]] +name = "uint" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "082df6964410f6aa929a61ddfafc997e4f32c62c22490e439ac351cec827f436" +dependencies = [ + "byteorder", + "crunchy", + "heapsize", + "rustc-hex", +] + [[package]] name = "uint" version = "0.9.5" @@ -10043,7 +10277,7 @@ dependencies = [ "byteorder", "crunchy", "hex 0.4.3", - "static_assertions", + "static_assertions 1.1.0", ] [[package]] diff --git a/rust/Cargo.toml b/rust/Cargo.toml index ae5fd5e37..57e5bec91 100644 --- a/rust/Cargo.toml +++ b/rust/Cargo.toml @@ -91,8 +91,11 @@ elliptic-curve = "0.12.3" getrandom = { version = "0.2", features = ["js"] } hex = "0.4.3" hpl-interface = "=0.0.6-rc3" +http = "*" hyper = "0.14" hyper-tls = "0.5.0" +injective-protobuf = "0.2.2" +injective-std = "0.1.5" itertools = "0.11.0" jobserver = "=0.1.26" jsonrpc-core = "18.0" @@ -112,6 +115,7 @@ paste = "1.0" pretty_env_logger = "0.5.0" primitive-types = "=0.12.1" prometheus = "0.13" +protobuf = "*" regex = "1.5" reqwest = "0.11" ripemd = "0.1.3" diff --git a/rust/chains/hyperlane-cosmos/Cargo.toml b/rust/chains/hyperlane-cosmos/Cargo.toml index 40b4ae2f6..b48aa3590 100644 --- a/rust/chains/hyperlane-cosmos/Cargo.toml +++ b/rust/chains/hyperlane-cosmos/Cargo.toml @@ -17,9 +17,13 @@ cosmrs = { workspace = true, features = ["cosmwasm", "tokio", "grpc", "rpc"] } derive-new = { workspace = true } hex = { workspace = true } hpl-interface.workspace = true +http = { workspace = true } hyper = { workspace = true } hyper-tls = { workspace = true } +injective-protobuf = { workspace = true } +injective-std = { workspace = true } once_cell = { workspace = true } +protobuf = { workspace = true } ripemd = { workspace = true } serde = { workspace = true } serde_json = { workspace = true } diff --git a/rust/chains/hyperlane-cosmos/src/error.rs b/rust/chains/hyperlane-cosmos/src/error.rs index 92af0bce0..2c3e1e747 100644 --- a/rust/chains/hyperlane-cosmos/src/error.rs +++ b/rust/chains/hyperlane-cosmos/src/error.rs @@ -31,9 +31,12 @@ pub enum HyperlaneCosmosError { /// Tendermint RPC Error #[error(transparent)] TendermintError(#[from] tendermint_rpc::error::Error), - /// protobuf error + /// Prost error #[error("{0}")] - Protobuf(#[from] prost::DecodeError), + Prost(#[from] prost::DecodeError), + /// Protobuf error + #[error("{0}")] + Protobuf(#[from] protobuf::ProtobufError), } impl From for ChainCommunicationError { diff --git a/rust/chains/hyperlane-cosmos/src/providers/grpc.rs b/rust/chains/hyperlane-cosmos/src/providers/grpc.rs index 9653020ad..9152dd3d4 100644 --- a/rust/chains/hyperlane-cosmos/src/providers/grpc.rs +++ b/rust/chains/hyperlane-cosmos/src/providers/grpc.rs @@ -22,13 +22,17 @@ use cosmrs::{ traits::Message, }, tx::{self, Fee, MessageExt, SignDoc, SignerInfo}, - Coin, + Any, Coin, }; use hyperlane_core::{ - ChainCommunicationError, ChainResult, ContractLocator, FixedPointNumber, U256, + ChainCommunicationError, ChainResult, ContractLocator, FixedPointNumber, HyperlaneDomain, U256, }; +use protobuf::Message as _; use serde::Serialize; -use tonic::transport::{Channel, Endpoint}; +use tonic::{ + transport::{Channel, Endpoint}, + GrpcMethod, IntoRequest, +}; use crate::HyperlaneCosmosError; use crate::{address::CosmosAddress, CosmosAmount}; @@ -80,6 +84,8 @@ pub trait WasmProvider: Send + Sync { #[derive(Debug, Clone)] /// CosmWasm GRPC provider. pub struct WasmGrpcProvider { + /// Hyperlane domain, used for special cases depending on the chain. + domain: HyperlaneDomain, /// Connection configuration. conf: ConnectionConf, /// A contract address that can be used as the default @@ -96,6 +102,7 @@ pub struct WasmGrpcProvider { impl WasmGrpcProvider { /// Create new CosmWasm GRPC Provider. pub fn new( + domain: HyperlaneDomain, conf: ConnectionConf, gas_price: CosmosAmount, locator: Option, @@ -109,6 +116,7 @@ impl WasmGrpcProvider { .transpose()?; Ok(Self { + domain, conf, contract_address, signer, @@ -251,7 +259,13 @@ impl WasmGrpcProvider { } /// Queries an account. - async fn account_query(&self, account: String) -> ChainResult { + pub async fn account_query(&self, account: String) -> ChainResult { + // Injective is a special case where their account query requires + // the use of different protobuf types. + if self.domain.is_injective() { + return self.account_query_injective(account).await; + } + let mut client = QueryAccountClient::new(self.channel.clone()); let request = tonic::Request::new(QueryAccountRequest { address: account }); @@ -271,6 +285,59 @@ impl WasmGrpcProvider { .map_err(Into::::into)?; Ok(account) } + + /// Injective-specific logic for querying an account. + async fn account_query_injective(&self, account: String) -> ChainResult { + let request = tonic::Request::new( + injective_std::types::cosmos::auth::v1beta1::QueryAccountRequest { address: account }, + ); + + // Borrowed from the logic of `QueryAccountClient` in `cosmrs`, but using injective types. + + let mut grpc_client = tonic::client::Grpc::new(self.channel.clone()); + grpc_client + .ready() + .await + .map_err(Into::::into)?; + + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static("/cosmos.auth.v1beta1.Query/Account"); + let mut req: tonic::Request< + injective_std::types::cosmos::auth::v1beta1::QueryAccountRequest, + > = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("cosmos.auth.v1beta1.Query", "Account")); + + let response: tonic::Response< + injective_std::types::cosmos::auth::v1beta1::QueryAccountResponse, + > = grpc_client + .unary(req, path, codec) + .await + .map_err(Into::::into)?; + + let mut eth_account = injective_protobuf::proto::account::EthAccount::parse_from_bytes( + response + .into_inner() + .account + .ok_or_else(|| ChainCommunicationError::from_other_str("account not present"))? + .value + .as_slice(), + ) + .map_err(Into::::into)?; + + let base_account = eth_account.take_base_account(); + let pub_key = base_account.pub_key.into_option(); + + Ok(BaseAccount { + address: base_account.address, + pub_key: pub_key.map(|pub_key| Any { + type_url: pub_key.type_url, + value: pub_key.value, + }), + account_number: base_account.account_number, + sequence: base_account.sequence, + }) + } } #[async_trait] diff --git a/rust/chains/hyperlane-cosmos/src/providers/mod.rs b/rust/chains/hyperlane-cosmos/src/providers/mod.rs index 21216f087..3128ff195 100644 --- a/rust/chains/hyperlane-cosmos/src/providers/mod.rs +++ b/rust/chains/hyperlane-cosmos/src/providers/mod.rs @@ -32,7 +32,13 @@ impl CosmosProvider { signer: Option, ) -> ChainResult { let gas_price = CosmosAmount::try_from(conf.get_minimum_gas_price().clone())?; - let grpc_client = WasmGrpcProvider::new(conf.clone(), gas_price.clone(), locator, signer)?; + let grpc_client = WasmGrpcProvider::new( + domain.clone(), + conf.clone(), + gas_price.clone(), + locator, + signer, + )?; let rpc_client = HttpClient::builder( conf.get_rpc_url() .parse() diff --git a/rust/hyperlane-core/src/chain.rs b/rust/hyperlane-core/src/chain.rs index 8f2f37db9..b89756bcf 100644 --- a/rust/hyperlane-core/src/chain.rs +++ b/rust/hyperlane-core/src/chain.rs @@ -80,6 +80,12 @@ pub enum KnownHyperlaneDomain { Gnosis = 100, Chiado = 10200, + MantaPacific = 169, + + Neutron = 1853125230, + + Injective = 6909546, + // -- Local test chains -- /// Test1 local chain Test1 = 13371, @@ -195,7 +201,7 @@ impl KnownHyperlaneDomain { many_to_one!(match self { Mainnet: [ Ethereum, Avalanche, Arbitrum, Polygon, Optimism, BinanceSmartChain, Celo, - Moonbeam, Gnosis + Moonbeam, Gnosis, MantaPacific, Neutron, Injective ], Testnet: [ Goerli, Mumbai, Fuji, ArbitrumGoerli, OptimismGoerli, BinanceSmartChainTestnet, @@ -212,11 +218,12 @@ impl KnownHyperlaneDomain { HyperlaneDomainProtocol::Ethereum: [ Ethereum, Goerli, Sepolia, Polygon, Mumbai, Avalanche, Fuji, Arbitrum, ArbitrumGoerli, Optimism, OptimismGoerli, BinanceSmartChain, BinanceSmartChainTestnet, Celo, Gnosis, - Alfajores, Moonbeam, MoonbaseAlpha, PolygonZkEvmTestnet, LineaGoerli, BaseGoerli, ScrollSepolia, Chiado, Test1, Test2, Test3 + Alfajores, Moonbeam, MoonbaseAlpha, PolygonZkEvmTestnet, LineaGoerli, BaseGoerli, ScrollSepolia, + Chiado, MantaPacific, Test1, Test2, Test3 ], HyperlaneDomainProtocol::Fuel: [FuelTest1], HyperlaneDomainProtocol::Sealevel: [SealevelTest1, SealevelTest2], - HyperlaneDomainProtocol::Cosmos: [CosmosTest99990, CosmosTest99991], + HyperlaneDomainProtocol::Cosmos: [CosmosTest99990, CosmosTest99991, Neutron, Injective], }) } } @@ -363,7 +370,7 @@ impl HyperlaneDomain { } } - pub fn is_arbitrum_nitro(&self) -> bool { + pub const fn is_arbitrum_nitro(&self) -> bool { matches!( self, HyperlaneDomain::Known( @@ -372,6 +379,10 @@ impl HyperlaneDomain { ) } + pub const fn is_injective(&self) -> bool { + matches!(self, Self::Known(KnownHyperlaneDomain::Injective)) + } + pub const fn index_mode(&self) -> IndexMode { use HyperlaneDomainProtocol::*; let protocol = self.domain_protocol();