Skip to content

Commit

Permalink
feat: add weETHs warp route, some drive-by cleanup (#4826)
Browse files Browse the repository at this point in the history
### Description

- Deploys weETHs between Ethereum and Eclipsemainnet
- Removes all the warp route generation scripts in favor of a single one
- Renames some things throughout infra to be closer to the canonical
warp IDs (e.g. add all chain names, sort them, etc)
- Removes a bunch of now unnecessary ts-ignores
- Moves toward using router configs for non-EVM chains in the warp
configs

Waiting to merge
hyperlane-xyz/hyperlane-registry#362 before
updating the registryrc in here so the warp config checker works

### 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 Nov 6, 2024
1 parent f0e8f74 commit e6f9d5c
Show file tree
Hide file tree
Showing 29 changed files with 281 additions and 145 deletions.
5 changes: 5 additions & 0 deletions .changeset/shy-taxis-suffer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@hyperlane-xyz/utils': patch
---

Added a mustGet helper
22 changes: 15 additions & 7 deletions rust/sealevel/client/src/warp_route.rs
Original file line number Diff line number Diff line change
Expand Up @@ -192,19 +192,25 @@ impl RouterDeployer<TokenConfig> for WarpRouteDeployer {
app_config: &TokenConfig,
program_id: Pubkey,
) {
if let Some(ata_payer_funding_amount) = self.ata_payer_funding_amount {
if matches!(
app_config.token_type,
TokenType::Collateral(_) | TokenType::Synthetic(_)
) {
fund_ata_payer_up_to(ctx, client, program_id, ata_payer_funding_amount);
let try_fund_ata_payer = |ctx: &mut Context, client: &RpcClient| {
if let Some(ata_payer_funding_amount) = self.ata_payer_funding_amount {
if matches!(
app_config.token_type,
TokenType::Collateral(_) | TokenType::Synthetic(_)
) {
fund_ata_payer_up_to(ctx, client, program_id, ata_payer_funding_amount);
}
}
}
};

let (token_pda, _token_bump) =
Pubkey::find_program_address(hyperlane_token_pda_seeds!(), &program_id);
if account_exists(client, &token_pda).unwrap() {
println!("Warp route token already exists, skipping init");

// Fund the ATA payer up to the specified amount.
try_fund_ata_payer(ctx, client);

return;
}

Expand Down Expand Up @@ -398,6 +404,8 @@ impl RouterDeployer<TokenConfig> for WarpRouteDeployer {
println!("Set the {authority} authority to the mint account. Status: {status}");
}
}

try_fund_ata_payer(ctx, client);
}

/// Sets gas router configs on all deployable chains.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"eclipsemainnet": {
"hex": "0x6196f9127d2caa0f4265d0870d077e6bf979c585b87cceb7537fc6d2c81729b7",
"base58": "7Zx4wU1QAw98MfvnPFqRh1oyumek7G5VAX6TKB3U1tcn"
},
"ethereum": {
"hex": "0x000000000000000000000000ef899e92da472e014be795ecce948308958e25a2",
"base58": "1111111111114LZDAaWurQERWF32Wqjijy9NWQRX"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"eclipsemainnet": {
"type": "synthetic",
"decimals": 9,
"remoteDecimals": 18,
"name": "Super Symbiotic LRT",
"symbol": "weETHs",
"uri": "https://raw.githubusercontent.com/hyperlane-xyz/hyperlane-registry/6ce62e9330ae1af0786f60d9fe6da8541b6b2988/deployments/warp_routes/weETHs/metadata.json",
"interchainGasPaymaster": "3Wp4qKkgf4tjXz1soGyTSndCgBPLZFSrZkiDZ8Qp9EEj"
},
"ethereum": {
"type": "collateral",
"decimals": 18,
"token": "0x917cee801a67f933f2e6b33fc0cd1ed2d5909d88",
"foreignDeployment": "0xef899e92DA472E014bE795Ecce948308958E25A2"
}
}
4 changes: 2 additions & 2 deletions typescript/infra/config/environments/mainnet3/agent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -402,13 +402,13 @@ const metricAppContexts = [
{
name: 'eclipse_usdc',
matchingList: matchingList(
getWarpAddresses(WarpRouteIds.EthereumEclipseUSDC),
getWarpAddresses(WarpRouteIds.EclipseEthereumSolanaUSDC),
),
},
{
name: 'eclipse_teth',
matchingList: matchingList(
getWarpAddresses(WarpRouteIds.EthereumEclipseTETH),
getWarpAddresses(WarpRouteIds.EclipseEthereumTETH),
),
},
{
Expand Down
2 changes: 1 addition & 1 deletion typescript/infra/config/environments/mainnet3/funding.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export const keyFunderConfig: KeyFunderConfig<
> = {
docker: {
repo: 'gcr.io/abacus-labs-dev/hyperlane-monorepo',
tag: 'b1366fa-20241101-173610',
tag: '1b067fe-20241106-190859',
},
// We're currently using the same deployer/key funder key as mainnet2.
// To minimize nonce clobbering we offset the key funder cron
Expand Down
4 changes: 2 additions & 2 deletions typescript/infra/config/environments/mainnet3/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { helloWorld } from './helloworld.js';
import { igp } from './igp.js';
import { infrastructure } from './infrastructure.js';
import { bridgeAdapterConfigs, relayerConfig } from './liquidityLayer.js';
import { ethereumChainOwners } from './owners.js';
import { chainOwners } from './owners.js';
import { supportedChainNames } from './supportedChainNames.js';
import { checkWarpDeployConfig } from './warp/checkWarpDeploy.js';

Expand Down Expand Up @@ -48,7 +48,7 @@ export const environment: EnvironmentConfig = {
agents,
core,
igp,
owners: ethereumChainOwners,
owners: chainOwners,
infra: infrastructure,
helloWorld,
keyFunderConfig,
Expand Down
27 changes: 27 additions & 0 deletions typescript/infra/config/environments/mainnet3/owners.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,3 +179,30 @@ export const ethereumChainOwners: ChainMap<OwnableConfig> = Object.fromEntries(
];
}),
);

export const chainOwners: ChainMap<OwnableConfig> = {
...ethereumChainOwners,
solanamainnet: {
// Squads multisig
owner: 'BNGDJ1h9brgt6FFVd8No1TVAH48Fp44d7jkuydr1URwJ',
},
eclipsemainnet: {
owner: 'B32qTbw8iDcVdagMAMBfDFCef88N1KtfRG5QoPVzbj5K',
},
injective: {
// Native multisig
owner: 'inj1ac6qpt57vhtfzdecd2an052elwgenwtxcn9chl',
},
neutron: {
// Da0Da0 multisig
owner: 'neutron1fqf5mprg3f5hytvzp3t7spmsum6rjrw80mq8zgkc0h6rxga0dtzqws3uu7',
},
// We intentionally cause issues if these were to be used, but satisfy the types
// and ensure there's an entry for each supported chain.
stride: {
owner: 'n/a - nothing owned here',
},
osmosis: {
owner: 'n/a - nothing owned here',
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,12 @@ import {
} from '@hyperlane-xyz/sdk';

import { tokens } from '../../../../../src/config/warp.js';
import { DEPLOYER } from '../../owners.js';

export const getEthereumEclipseUSDCWarpConfig = async (
export const getEclipseEthereumSolanaUSDCWarpConfig = async (
routerConfig: ChainMap<RouterConfig>,
): Promise<ChainMap<TokenRouterConfig>> => {
// @ts-ignore - foreignDeployment configs don't conform to the TokenRouterConfig
const eclipsemainnet: TokenRouterConfig = {
...routerConfig.eclipsemainnet,
type: TokenType.synthetic,
foreignDeployment: 'D6k6T3G74ij6atCtBiWBs5TbFa1hFVcrFUSGZHuV7q3Z',
gas: 300_000,
Expand All @@ -27,6 +26,9 @@ export const getEthereumEclipseUSDCWarpConfig = async (
token: tokens.ethereum.USDC,
};

// Intentionally don't enroll Solana to avoid transferring
// directly between Solana and Ethereum

return {
eclipsemainnet,
ethereum,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,15 @@ import {
} from '@hyperlane-xyz/sdk';

import { tokens } from '../../../../../src/config/warp.js';
import { getRegistry as getMainnet3Registry } from '../../chains.js';

export const getEclipseEthereumUSDTWarpConfig = async (
export const getEclipseEthereumSolanaUSDTWarpConfig = async (
routerConfig: ChainMap<RouterConfig>,
): Promise<ChainMap<TokenRouterConfig>> => {
const registry = await getMainnet3Registry();

// @ts-ignore - foreignDeployment configs don't conform to the TokenRouterConfig
const eclipsemainnet: TokenRouterConfig = {
...routerConfig.eclipsemainnet,
type: TokenType.synthetic,
foreignDeployment: '5g5ujyYUNvdydwyDVCpZwPpgYRqH5RYJRi156cxyE3me',
gas: 300_000,
mailbox: (await registry.getChainAddresses('eclipsemainnet'))!.mailbox,
owner: '9bRSUPjfS3xS6n5EfkJzHFTRDa4AHLda8BU2pP4HoWnf',
interchainSecurityModule: ethers.constants.AddressZero,
};
let ethereum: TokenRouterConfig = {
Expand All @@ -31,6 +26,9 @@ export const getEclipseEthereumUSDTWarpConfig = async (
interchainSecurityModule: ethers.constants.AddressZero,
};

// Intentionally don't enroll Solana to avoid transferring
// directly between Solana and Ethereum

return {
eclipsemainnet,
ethereum,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,11 @@ import {
TokenType,
} from '@hyperlane-xyz/sdk';

import { DEPLOYER } from '../../owners.js';

export const getEthereumEclipseTETHWarpConfig = async (
routerConfig: ChainMap<RouterConfig>,
): Promise<ChainMap<TokenRouterConfig>> => {
// @ts-ignore - foreignDeployment configs don't conform to the TokenRouterConfig
const eclipsemainnet: TokenRouterConfig = {
...routerConfig.eclipsemainnet,
type: TokenType.synthetic,
foreignDeployment: 'BJa3fPvvjKx8gRCWunoSrWBbsmieub37gsGpjp4BfTfW',
gas: 300_000,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,18 @@ import {
} from '@hyperlane-xyz/sdk';

import { tokens } from '../../../../../src/config/warp.js';
import { getRegistry as getMainnet3Registry } from '../../chains.js';
import { DEPLOYER } from '../../owners.js';

export const getEclipseEthereumWBTCWarpConfig = async (
routerConfig: ChainMap<RouterConfig>,
): Promise<ChainMap<TokenRouterConfig>> => {
const registry = await getMainnet3Registry();

// @ts-ignore - foreignDeployment configs don't conform to the TokenRouterConfig
const eclipsemainnet: TokenRouterConfig = {
...routerConfig.eclipsemainnet,
type: TokenType.synthetic,
foreignDeployment: 'A7EGCDYFw5R7Jfm6cYtKvY8dmkrYMgwRCJFkyQwpHTYu',
gas: 300_000,
mailbox: (await registry.getChainAddresses('eclipsemainnet'))!.mailbox,
owner: '9bRSUPjfS3xS6n5EfkJzHFTRDa4AHLda8BU2pP4HoWnf',
interchainSecurityModule: ethers.constants.AddressZero,
};

let ethereum: TokenRouterConfig = {
...routerConfig.ethereum,
type: TokenType.collateral,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import { ethers } from 'ethers';

import {
ChainMap,
RouterConfig,
TokenRouterConfig,
TokenType,
} from '@hyperlane-xyz/sdk';

import { tokens } from '../../../../../src/config/warp.js';
import { DEPLOYER } from '../../owners.js';

export const getEclipseEthereumWeEthsWarpConfig = async (
routerConfig: ChainMap<RouterConfig>,
): Promise<ChainMap<TokenRouterConfig>> => {
const eclipsemainnet: TokenRouterConfig = {
...routerConfig.eclipsemainnet,
type: TokenType.synthetic,
foreignDeployment: '7Zx4wU1QAw98MfvnPFqRh1oyumek7G5VAX6TKB3U1tcn',
gas: 300_000,
interchainSecurityModule: ethers.constants.AddressZero,
};

let ethereum: TokenRouterConfig = {
...routerConfig.ethereum,
type: TokenType.collateral,
token: tokens.ethereum.weETHs,
interchainSecurityModule: ethers.constants.AddressZero,
owner: DEPLOYER,
};

return {
eclipsemainnet,
ethereum,
};
};
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,21 @@ import {
} from '@hyperlane-xyz/sdk';

export const getEclipseStrideTiaWarpConfig = async (
_routerConfig: ChainMap<RouterConfig>,
routerConfig: ChainMap<RouterConfig>,
): Promise<ChainMap<TokenRouterConfig>> => {
// @ts-ignore - foreignDeployment configs don't conform to the TokenRouterConfig
const eclipsemainnet: TokenRouterConfig = {
...routerConfig.eclipsemainnet,
type: TokenType.synthetic,
foreignDeployment: 'BpXHAiktwjx7fN6M9ST9wr6qKAsH27wZFhdHEhReJsR6',
gas: 300_000,
};

// @ts-ignore - foreignDeployment configs don't conform to the TokenRouterConfig
const stride: TokenRouterConfig = {
...routerConfig.stride,
type: TokenType.collateral,
foreignDeployment:
'stride1pvtesu3ve7qn7ctll2x495mrqf2ysp6fws68grvcu6f7n2ajghgsh2jdj6',
token: 'stutia',
};

return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,22 @@ import {
} from '@hyperlane-xyz/sdk';

export const getEclipseStrideStTiaWarpConfig = async (
_routerConfig: ChainMap<RouterConfig>,
routerConfig: ChainMap<RouterConfig>,
): Promise<ChainMap<TokenRouterConfig>> => {
// @ts-ignore - foreignDeployment configs don't conform to the TokenRouterConfig
const eclipsemainnet: TokenRouterConfig = {
...routerConfig.eclipsemainnet,
type: TokenType.synthetic,
foreignDeployment: 'tKUHyJ5NxhnwU94JUmzh1ekukDcHHX8mZF6fqxbMwX6',
gas: 300_000,
};

// @ts-ignore - foreignDeployment configs don't conform to the TokenRouterConfig
const stride: TokenRouterConfig = {
...routerConfig.stride,
type: TokenType.collateral,
foreignDeployment:
'stride134axwdlam929m3mar3wv95nvkyep7mr87ravkqcpf8dfe3v0pjlqwrw6ee',
token:
'ibc/BF3B4F53F3694B66E13C23107C84B6485BD2B96296BB7EC680EA77BBA75B4801',
};

return {
Expand Down
5 changes: 3 additions & 2 deletions typescript/infra/config/environments/mainnet3/warp/warpIds.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,17 @@ export enum WarpRouteIds {
ArbitrumEthereumZircuitAMPHRETH = 'AMPHRETH/arbitrum-ethereum-zircuit',
ArbitrumNeutronEclip = 'ECLIP/arbitrum-neutron',
ArbitrumNeutronTIA = 'TIA/arbitrum-neutron',
EclipseEthereumSolanaUSDC = 'USDC/eclipsemainnet-ethereum-solanamainnet',
EclipseEthereumSolanaUSDT = 'USDT/eclipsemainnet-ethereum-solanamainnet',
EclipseEthereumTETH = 'tETH/eclipsemainnet-ethereum',
EclipseEthereumWBTC = 'WBTC/eclipsemainnet-ethereum',
EclipseEthereumWeETHs = 'weETHs/eclipsemainnet-ethereum',
EclipseSolanaSOL = 'SOL/eclipsemainnet-solanamainnet',
EclipseSolanaWIF = 'WIF/eclipsemainnet-solanamainnet',
EclipseStrideSTTIA = 'stTIA/eclipse-stride',
EclipseStrideTIA = 'TIA/eclipse-stride',
EthereumInevmUSDC = 'USDC/ethereum-inevm',
EthereumInevmUSDT = 'USDT/ethereum-inevm',
EthereumEclipseTETH = 'tETH/eclipsemainnet-ethereum',
EthereumEclipseUSDC = 'USDC/eclipsemainnet-ethereum-solanamainnet',
EthereumSeiFastUSD = 'FASTUSD/ethereum-sei',
EthereumVictionETH = 'ETH/ethereum-viction',
EthereumVictionUSDC = 'USDC/ethereum-viction',
Expand Down
Loading

0 comments on commit e6f9d5c

Please sign in to comment.