From 3bb4d87dda8bca2e5a9a4a95336da994117cc14b Mon Sep 17 00:00:00 2001 From: Trevor Porter Date: Mon, 29 Jan 2024 14:44:14 +0000 Subject: [PATCH] Injective / inevm agent code & config changes (#3185) ### Description Taken from https://github.com/hyperlane-xyz/hyperlane-monorepo/pull/3155 but without any of the ancillary things like changes to the SDK or infra. Merging to get an image off `main` that works w/ injective. Branch plan is: - after this is merged, an image off main can be used to run an agent against injective/inevm - https://github.com/hyperlane-xyz/hyperlane-monorepo/pull/3140 will have all the SDK changes from the contract deployments - https://github.com/hyperlane-xyz/hyperlane-monorepo/pull/3155 will have the infra changes to start deploying injective / inevm validators / relayer ### Drive-by changes ### Related issues ### Backward compatibility ### Testing --- .../hyperlane-cosmos/src/aggregation_ism.rs | 16 ++-- rust/config/mainnet3_config.json | 80 +++++++++++++++++++ rust/hyperlane-core/src/traits/mod.rs | 8 +- 3 files changed, 95 insertions(+), 9 deletions(-) diff --git a/rust/chains/hyperlane-cosmos/src/aggregation_ism.rs b/rust/chains/hyperlane-cosmos/src/aggregation_ism.rs index d18a6577cd..df41c440b3 100644 --- a/rust/chains/hyperlane-cosmos/src/aggregation_ism.rs +++ b/rust/chains/hyperlane-cosmos/src/aggregation_ism.rs @@ -11,7 +11,7 @@ use crate::{ use async_trait::async_trait; use hyperlane_core::{ AggregationIsm, ChainResult, ContractLocator, HyperlaneChain, HyperlaneContract, - HyperlaneDomain, HyperlaneMessage, HyperlaneProvider, RawHyperlaneMessage, H256, + HyperlaneDomain, HyperlaneMessage, HyperlaneProvider, RawHyperlaneMessage, H160, H256, }; use tracing::instrument; @@ -85,10 +85,16 @@ impl AggregationIsm for CosmosAggregationIsm { let modules: ChainResult> = response .validators .iter() - // The returned values are Bech32-decoded Cosmos addresses. - // Since they are not EOAs but rather contracts, they are 32 bytes long and - // need to be parsed directly as an `H256`. - .map(|module| H256::from_str(module).map_err(Into::into)) + .map(|module| { + // The returned values are Bech32-decoded Cosmos addresses. + // Since they are not EOAs but rather contracts, they can be 32 bytes long and + // need to be parsed directly as an `H256`. + if let Ok(res) = H256::from_str(module) { + return Ok(res); + } + // If the address is not 32 bytes long, it is a 20-byte address + H160::from_str(module).map(H256::from).map_err(Into::into) + }) .collect(); Ok((modules?, response.threshold)) diff --git a/rust/config/mainnet3_config.json b/rust/config/mainnet3_config.json index 147bb642ef..8aab9dcf46 100644 --- a/rust/config/mainnet3_config.json +++ b/rust/config/mainnet3_config.json @@ -450,6 +450,37 @@ "prefix": "neutron" } }, + "injective": { + "name": "injective", + "domainId": "6909546", + "chainId": "injective-1", + "mailbox": "0x0f7fb53961d70687e352aa55cb329ca76edc0c19", + "interchainGasPaymaster": "0x27ae52298e5b53b34b7ae0ca63e05845c31e1f59", + "validatorAnnounce": "0x1fb225b2fcfbe75e614a1d627de97ff372242eed", + "merkleTreeHook": "0x568ad3638447f07def384969f4ea39fae3802962", + "protocol": "cosmos", + "finalityBlocks": 1, + "rpcUrls": [ + { + "http": "https://rpc-injective.goldenratiostaking.net:443" + } + ], + "grpcUrl": "https://injective-grpc.publicnode.com/", + "canonicalAsset": "inj", + "bech32Prefix": "inj", + "gasPrice": { + "amount": "700000000", + "denom": "inj" + }, + "contractAddressBytes": 20, + "index": { + "from": 58419500, + "chunk": 100000 + }, + "blocks": { + "reorgPeriod": 1 + } + }, "moonbeam": { "chainId": 1284, "domainId": 1284, @@ -497,6 +528,55 @@ "from": 4720894 } }, + "inevm": { + "blockExplorers": [ + { + "apiUrl": "https://inevm.calderaexplorer.xyz/api", + "family": "blockscout", + "name": "Caldera inEVM Explorer", + "url": "https://inevm.calderaexplorer.xyz/" + } + ], + "blocks": { + "confirmations": 1, + "estimateBlockTime": 3, + "reorgPeriod": 0 + }, + "chainId": 2525, + "domainId": 2525, + "displayName": "Injective EVM", + "displayNameShort": "inEVM", + "name": "inevm", + "nativeToken": { + "decimals": 18, + "name": "Injective", + "symbol": "INJ" + }, + "protocol": "ethereum", + "rpcUrls": [ + { + "http": "https://inevm.calderachain.xyz/http" + } + ], + "merkleRootMultisigIsmFactory": "0x2C1FAbEcd7bFBdEBF27CcdB67baADB38b6Df90fC", + "messageIdMultisigIsmFactory": "0x8b83fefd896fAa52057798f6426E9f0B080FCCcE", + "aggregationIsmFactory": "0x8F7454AC98228f3504Bb91eA3D8Adafe6406110A", + "aggregationHookFactory": "0xEb9FcFDC9EfDC17c1EC5E1dc085B98485da213D6", + "routingIsmFactory": "0x1052eF3419f26Bec74Ed7CEf4a4FA6812Bc09908", + "domainRoutingIsm": "0xBD70Ea9D599a0FC8158B026797177773C3445730", + "proxyAdmin": "0x0761b0827849abbf7b0cC09CE14e1C93D87f5004", + "storageGasOracle": "0x6119E37Bd66406A1Db74920aC79C15fB8411Ba76", + "interchainGasPaymaster": "0x19dc38aeae620380430C200a6E990D5Af5480117", + "merkleTreeHook": "0x0972954923a1e2b2aAb04Fa0c4a0797e5989Cd65", + "aggregationHook": "0xe0dDb5dE7D52918237cC1Ae131F29dcAbcb0F62B", + "protocolFee": "0x0D63128D887159d63De29497dfa45AFc7C699AE4", + "mailbox": "0x2f2aFaE1139Ce54feFC03593FeE8AB2aDF4a85A7", + "validatorAnnounce": "0x15ab173bDB6832f9b64276bA128659b0eD77730B", + "interchainSecurityModule": "0xBD70Ea9D599a0FC8158B026797177773C3445730", + "index": { + "from": 18972465 + } + }, "optimism": { "chainId": 10, "domainId": 10, diff --git a/rust/hyperlane-core/src/traits/mod.rs b/rust/hyperlane-core/src/traits/mod.rs index 1b82599895..e85b04f4a6 100644 --- a/rust/hyperlane-core/src/traits/mod.rs +++ b/rust/hyperlane-core/src/traits/mod.rs @@ -15,7 +15,7 @@ pub use routing_ism::*; pub use signing::*; pub use validator_announce::*; -use crate::{FixedPointNumber, U256}; +use crate::{FixedPointNumber, H512, U256}; mod aggregation_ism; mod ccip_read_ism; @@ -38,11 +38,11 @@ mod validator_announce; #[derive(Debug, Clone)] pub struct TxOutcome { /// The transaction identifier/hash - pub transaction_id: crate::H512, + pub transaction_id: H512, /// True if executed, false otherwise (reverted, etc.) pub executed: bool, /// Amount of gas used on this transaction. - pub gas_used: crate::U256, + pub gas_used: U256, /// Price paid for the gas pub gas_price: FixedPointNumber, // TODO: more? What can be abstracted across all chains? @@ -54,7 +54,7 @@ impl From for TxOutcome { Self { transaction_id: t.transaction_hash.into(), executed: t.status.unwrap().low_u32() == 1, - gas_used: t.gas_used.map(Into::into).unwrap_or(crate::U256::zero()), + gas_used: t.gas_used.map(Into::into).unwrap_or(U256::zero()), gas_price: t .effective_gas_price .and_then(|price| U256::from(price).try_into().ok())