Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enroll additional validators on v3 mainnet #2888

Merged
merged 11 commits into from
Nov 10, 2023
6 changes: 2 additions & 4 deletions typescript/infra/fork.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ else
fi

# kill all child processes on exit
trap 'kill $(jobs -p)' EXIT
trap 'jobs -p | xargs -r kill' EXIT

# exit 1 on any subsequent failures
set -e

anvil --fork-url $RPC_URL --block-time 1 --silent > /dev/null &
anvil --fork-url $RPC_URL --silent > /dev/null &
ANVIL_PID=$!

while ! cast bn &> /dev/null; do
Expand All @@ -44,5 +44,3 @@ yarn ts-node ./scripts/check-deploy.ts -e $ENVIRONMENT -f $FORK_CHAIN --govern -

echo "=== Run $MODULE checker against forked $ENVIRONMENT after governance ==="
yarn ts-node ./scripts/check-deploy.ts -e $ENVIRONMENT -f $FORK_CHAIN -m $MODULE

kill $ANVIL_PID
40 changes: 13 additions & 27 deletions typescript/infra/scripts/check-deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,10 @@ import {
InterchainAccountChecker,
InterchainQuery,
InterchainQueryChecker,
filterChainMapToProtocol,
} from '@hyperlane-xyz/sdk';
import { ProtocolType } from '@hyperlane-xyz/utils';

import { Contexts } from '../config/contexts';
import { deployEnvToSdkEnv } from '../src/config/environment';
import { helloWorldRouterConfig } from '../src/config/helloworld/config';
import { HyperlaneAppGovernor } from '../src/govern/HyperlaneAppGovernor';
import { HyperlaneCoreGovernor } from '../src/govern/HyperlaneCoreGovernor';
import { HyperlaneIgpGovernor } from '../src/govern/HyperlaneIgpGovernor';
Expand All @@ -27,7 +24,6 @@ import { getHelloWorldApp } from './helloworld/utils';
import {
Modules,
getEnvironmentConfig,
getProxiedRouterConfig,
getArgs as getRootArgs,
withContext,
withModuleAndFork,
Expand All @@ -43,23 +39,30 @@ function getArgs() {
async function check() {
const { fork, govern, module, environment, context } = await getArgs();
const config = getEnvironmentConfig(environment);
const multiProvider = await config.getMultiProvider();
let multiProvider = await config.getMultiProvider();

// must rotate to forked provider before building core contracts
if (fork) {
await useLocalProvider(multiProvider, fork);

if (govern) {
multiProvider = multiProvider.extendChainMetadata({
[fork]: { blocks: { confirmations: 0 } },
});

const owner = config.core[fork].owner;
const signer = await impersonateAccount(owner);
multiProvider.setSigner(fork, signer);
}
}

let governor: HyperlaneAppGovernor<any, any>;
const env = deployEnvToSdkEnv[environment];
const core = HyperlaneCore.fromEnvironment(env, multiProvider);
const ismFactory = HyperlaneIsmFactory.fromEnvironment(env, multiProvider);
const routerConfig = core.getRouterConfig(config.owners);

let governor: HyperlaneAppGovernor<any, any>;
if (module === Modules.CORE) {
const core = HyperlaneCore.fromEnvironment(env, multiProvider);
const ismFactory = HyperlaneIsmFactory.fromEnvironment(env, multiProvider);
const checker = new HyperlaneCoreChecker(
multiProvider,
core,
Expand All @@ -72,11 +75,6 @@ async function check() {
const checker = new HyperlaneIgpChecker(multiProvider, igp, config.igp);
governor = new HyperlaneIgpGovernor(checker, config.owners);
} else if (module === Modules.INTERCHAIN_ACCOUNTS) {
const routerConfig = filterChainMapToProtocol(
await getProxiedRouterConfig(environment, multiProvider),
ProtocolType.Ethereum,
multiProvider,
);
const ica = InterchainAccount.fromEnvironment(env, multiProvider);
const checker = new InterchainAccountChecker(
multiProvider,
Expand All @@ -85,10 +83,6 @@ async function check() {
);
governor = new ProxiedRouterGovernor(checker, config.owners);
} else if (module === Modules.INTERCHAIN_QUERY_SYSTEM) {
const routerConfig = await getProxiedRouterConfig(
environment,
multiProvider,
);
const iqs = InterchainQuery.fromEnvironment(env, multiProvider);
const checker = new InterchainQueryChecker(
multiProvider,
Expand All @@ -103,19 +97,11 @@ async function check() {
Role.Deployer,
Contexts.Hyperlane, // Owner should always be from the hyperlane context
);
const hwConfig = await helloWorldRouterConfig(
environment,
context,
multiProvider,
);
const ismFactory = HyperlaneIsmFactory.fromEnvironment(
deployEnvToSdkEnv[environment],
multiProvider,
);
const ismFactory = HyperlaneIsmFactory.fromEnvironment(env, multiProvider);
const checker = new HelloWorldChecker(
multiProvider,
app,
hwConfig,
routerConfig,
ismFactory,
);
governor = new ProxiedRouterGovernor(checker, config.owners);
Expand Down
102 changes: 22 additions & 80 deletions typescript/infra/scripts/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ import { prompt } from 'prompts';
import { HelloWorldDeployer } from '@hyperlane-xyz/helloworld';
import {
ChainMap,
Chains,
HypERC20Config,
HypERC20Deployer,
HyperlaneCore,
HyperlaneCoreDeployer,
HyperlaneDeployer,
Expand All @@ -15,14 +12,8 @@ import {
HyperlaneProxyFactoryDeployer,
InterchainAccountDeployer,
InterchainQueryDeployer,
IsmType,
LiquidityLayerDeployer,
TokenType,
} from '@hyperlane-xyz/sdk';
import {
TokenConfig,
TokenDecimals,
} from '@hyperlane-xyz/sdk/dist/token/config';
import { objMap } from '@hyperlane-xyz/utils';

import { Contexts } from '../config/contexts';
Expand All @@ -40,8 +31,6 @@ import {
getContractAddressesSdkFilepath,
getEnvironmentConfig,
getModuleDirectory,
getProxiedRouterConfig,
getRouterConfig,
withContext,
withModuleAndFork,
} from './utils';
Expand All @@ -54,17 +43,22 @@ async function main() {
environment,
} = await withContext(withModuleAndFork(getArgs())).argv;
const envConfig = getEnvironmentConfig(environment);
const multiProvider = await envConfig.getMultiProvider();
const env = deployEnvToSdkEnv[environment];

let multiProvider = await envConfig.getMultiProvider();

// TODO: make this more generic
const deployerAddress =
environment === 'testnet4'
? '0xfaD1C94469700833717Fa8a3017278BC1cA8031C'
: '0xa7ECcdb9Be08178f896c26b7BbD8C3D4E844d9Ba';

if (fork) {
multiProvider = multiProvider.extendChainMetadata({
[fork]: { blocks: { confirmations: 0 } },
});
await useLocalProvider(multiProvider, fork);

// TODO: make this more generic
const deployerAddress =
environment === 'testnet4'
? '0xfaD1C94469700833717Fa8a3017278BC1cA8031C'
: '0xa7ECcdb9Be08178f896c26b7BbD8C3D4E844d9Ba';

const signer = await impersonateAccount(deployerAddress);
multiProvider.setSharedSigner(signer);
}
Expand All @@ -81,65 +75,20 @@ async function main() {
multiProvider,
);
deployer = new HyperlaneCoreDeployer(multiProvider, ismFactory);
} else if (module === Modules.WARP) {
const owner = '0xa7ECcdb9Be08178f896c26b7BbD8C3D4E844d9Ba';
const neutronRouter =
'0x9c504f7d878445228bef5684f9028cb388f63e58bf1077db75876c7651b9a71f';
const ismFactory = HyperlaneIsmFactory.fromAddressesMap(
getAddresses(environment, Modules.PROXY_FACTORY),
multiProvider,
);
const tokenConfig: TokenConfig & TokenDecimals = {
type: TokenType.synthetic,
name: 'TIA',
symbol: 'TIA.n',
decimals: 6,
totalSupply: 0,
};
const core = HyperlaneCore.fromEnvironment(
deployEnvToSdkEnv[environment],
multiProvider,
);
const routerConfig = core.getRouterConfig(owner);
const targetChains = [Chains.arbitrum];
config = Object.fromEntries(
targetChains.map((chain) => {
const warpRouterConfig: HypERC20Config = {
...routerConfig[chain],
...tokenConfig,
interchainSecurityModule: {
type: IsmType.MESSAGE_ID_MULTISIG,
validators: [
'0xa9b8c1f4998f781f958c63cfcd1708d02f004ff0',
'0xb65438a014fb05fbadcfe35bc6e25d372b6ba460',
'0xc79503a3e3011535a9c60f6d21f76f59823a38bd',
'0x42fa752defe92459370a052b6387a87f7de9b80c',
'0x54b2cca5091b098a1a993dec03c4d1ee9af65999',
'0x47aa126e05933b95c5eb90b26e6b668d84f4b25a',
],
threshold: 4,
},
// foreignDeployment: neutronRouter,
gas: 600_000,
};
return [chain, warpRouterConfig];
}),
);
deployer = new HypERC20Deployer(multiProvider, ismFactory);
} else if (module === Modules.INTERCHAIN_GAS_PAYMASTER) {
config = envConfig.igp;
deployer = new HyperlaneIgpDeployer(multiProvider);
} else if (module === Modules.INTERCHAIN_ACCOUNTS) {
config = await getProxiedRouterConfig(environment, multiProvider);
const core = HyperlaneCore.fromEnvironment(env, multiProvider);
config = core.getRouterConfig(envConfig.owners);
deployer = new InterchainAccountDeployer(multiProvider);
} else if (module === Modules.INTERCHAIN_QUERY_SYSTEM) {
config = await getProxiedRouterConfig(environment, multiProvider);
const core = HyperlaneCore.fromEnvironment(env, multiProvider);
config = core.getRouterConfig(envConfig.owners);
deployer = new InterchainQueryDeployer(multiProvider);
} else if (module === Modules.LIQUIDITY_LAYER) {
const routerConfig = await getProxiedRouterConfig(
environment,
multiProvider,
);
const core = HyperlaneCore.fromEnvironment(env, multiProvider);
const routerConfig = core.getRouterConfig(envConfig.owners);
if (!envConfig.liquidityLayerConfig) {
throw new Error(`No liquidity layer config for ${environment}`);
}
Expand All @@ -165,16 +114,9 @@ async function main() {
}));
deployer = new TestQuerySenderDeployer(multiProvider);
} else if (module === Modules.HELLO_WORLD) {
config = await getRouterConfig(
environment,
multiProvider,
true, // use deployer as owner
);
const ismFactory = HyperlaneIsmFactory.fromAddressesMap(
getAddresses(environment, Modules.PROXY_FACTORY),
multiProvider,
);
deployer = new HelloWorldDeployer(multiProvider, ismFactory);
const core = HyperlaneCore.fromEnvironment(env, multiProvider);
config = core.getRouterConfig(deployerAddress);
deployer = new HelloWorldDeployer(multiProvider);
} else {
console.log(`Skipping ${module}, deployer unimplemented`);
return;
Expand Down Expand Up @@ -212,7 +154,7 @@ async function main() {
: undefined;

// prompt for confirmation
if (environment === 'mainnet3' || environment === 'testnet4') {
if ((environment === 'mainnet3' || environment === 'testnet4') && !fork) {
console.log(JSON.stringify(config, null, 2));
const { value: confirmed } = await prompt({
type: 'confirm',
Expand Down
103 changes: 0 additions & 103 deletions typescript/infra/scripts/helloworld/deploy.ts

This file was deleted.

Loading
Loading