Skip to content

Commit

Permalink
Injective / inevm agent code & config changes (#3185)
Browse files Browse the repository at this point in the history
### Description

Taken from #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
- #3140 will
have all the SDK changes from the contract deployments
- #3155 will
have the infra changes to start deploying injective / inevm validators /
relayer

### Drive-by changes

<!--
Are there any minor or drive-by changes also included?
-->

### Related issues

<!--
- Fixes #[issue number here]
-->

### Backward compatibility

<!--
Are these changes backward compatible? Are there any infrastructure
implications, e.g. changes that would prohibit deploying older commits
using this infra tooling?

Yes/No
-->

### Testing

<!--
What kind of testing have these changes undergone?

None/Manual/Unit Tests
-->
  • Loading branch information
tkporter authored Jan 29, 2024
1 parent 1eaed03 commit 3bb4d87
Show file tree
Hide file tree
Showing 3 changed files with 95 additions and 9 deletions.
16 changes: 11 additions & 5 deletions rust/chains/hyperlane-cosmos/src/aggregation_ism.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -85,10 +85,16 @@ impl AggregationIsm for CosmosAggregationIsm {
let modules: ChainResult<Vec<H256>> = 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))
Expand Down
80 changes: 80 additions & 0 deletions rust/config/mainnet3_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
8 changes: 4 additions & 4 deletions rust/hyperlane-core/src/traits/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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?
Expand All @@ -54,7 +54,7 @@ impl From<ethers_core::types::TransactionReceipt> 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())
Expand Down

0 comments on commit 3bb4d87

Please sign in to comment.