-
Notifications
You must be signed in to change notification settings - Fork 420
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: new mainnet ICA deployment & tooling (#4264)
### Description - Corresponding registry PR: hyperlane-xyz/hyperlane-registry#130 - Decided to deploy new ICA routers instead of going through the big hassle of using the existing one - Added a new script to make it easier to get / deploy an ICA ### 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
Showing
8 changed files
with
907 additions
and
273 deletions.
There are no files selected for viewing
1,031 changes: 762 additions & 269 deletions
1,031
typescript/infra/config/environments/mainnet3/middleware/accounts/verification.json
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
import { ethers } from 'ethers'; | ||
|
||
import { AccountConfig, InterchainAccount } from '@hyperlane-xyz/sdk'; | ||
import { assert, eqAddress, rootLogger } from '@hyperlane-xyz/utils'; | ||
|
||
import { getSecretRpcEndpoints } from '../src/agents/index.js'; | ||
|
||
import { getArgs as getEnvArgs, withChainRequired } from './agent-utils.js'; | ||
import { getEnvironmentConfig, getHyperlaneCore } from './core-utils.js'; | ||
|
||
function getArgs() { | ||
return withChainRequired(getEnvArgs()) | ||
.option('ownerChain', { | ||
type: 'string', | ||
description: 'Origin chain where the governing owner lives', | ||
demandOption: true, | ||
}) | ||
.option('owner', { | ||
type: 'string', | ||
description: | ||
"Address of the owner on the ownerChain. Defaults to the environment's configured owner for the ownerChain.", | ||
demandOption: false, | ||
}) | ||
.option('deploy', { | ||
type: 'boolean', | ||
description: 'Deploys the ICA if it does not exist', | ||
default: false, | ||
}) | ||
.alias('chain', 'destinationChain').argv; | ||
} | ||
|
||
async function main() { | ||
const { | ||
environment, | ||
ownerChain, | ||
chain, | ||
deploy, | ||
owner: ownerOverride, | ||
} = await getArgs(); | ||
const config = getEnvironmentConfig(environment); | ||
const multiProvider = await config.getMultiProvider(); | ||
|
||
const originOwner = ownerOverride ?? config.owners[ownerChain]?.owner; | ||
if (!originOwner) { | ||
throw new Error(`No owner found for ${ownerChain}`); | ||
} | ||
|
||
rootLogger.info(`Governance owner on ${ownerChain}: ${originOwner}`); | ||
|
||
const { chainAddresses } = await getHyperlaneCore(environment, multiProvider); | ||
const ica = InterchainAccount.fromAddressesMap(chainAddresses, multiProvider); | ||
|
||
const ownerConfig: AccountConfig = { | ||
origin: ownerChain, | ||
owner: originOwner, | ||
}; | ||
|
||
const account = await ica.getAccount(chain, ownerConfig); | ||
|
||
rootLogger.info(`ICA on ${chain}: ${account}`); | ||
|
||
if (deploy) { | ||
// Ensuring the account was deployed | ||
const deployedAccount = await ica.deployAccount(chain, ownerConfig); | ||
// This shouldn't ever happen, but let's be safe | ||
assert( | ||
eqAddress(account, deployedAccount), | ||
'Fatal mismatch between account and deployed account', | ||
); | ||
|
||
rootLogger.info( | ||
`ICA deployed or recovered on ${chain}: ${deployedAccount}`, | ||
); | ||
} | ||
} | ||
|
||
main() | ||
.then() | ||
.catch((err) => { | ||
console.error('Error:', err); | ||
process.exit(1); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters