Skip to content

Commit

Permalink
copying from production
Browse files Browse the repository at this point in the history
  • Loading branch information
Kunal Arora committed Jun 30, 2023
1 parent 38c8f8b commit 4b00e15
Show file tree
Hide file tree
Showing 19 changed files with 2,647 additions and 92 deletions.
6 changes: 0 additions & 6 deletions rust/utils/run-locally/src/bin/no_metadata_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -215,12 +215,6 @@ fn main() -> ExitCode {
sleep(Duration::from_secs(10));

let deploy_env = hashmap! {"ALLOW_LEGACY_MULTISIG_ISM" => "true"};
println!("Deploying hyperlane core contracts...");
build_cmd(
&["yarn", "deploy-core"],
Some("../typescript/infra"),
Some(&deploy_env),
);

println!("Deploying hook contracts...");
build_cmd(
Expand Down
1 change: 1 addition & 0 deletions typescript/helloworld/.github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @nambrot @yorhodes
99 changes: 99 additions & 0 deletions typescript/helloworld/.github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
name: ci

on:
# Triggers the workflow on push or pull request events but only for the main branch
push:
branches: [main]
pull_request:
branches: [main]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

jobs:
install:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
with:
path: .//node_modules
key: ${{ runner.os }}-yarn-cache-${{ hashFiles('./yarn.lock') }}

- name: yarn-install
# Check out the lockfile from main, reinstall, and then
# verify the lockfile matches what was committed.
run: |
yarn install
CHANGES=$(git status -s)
if [[ ! -z $CHANGES ]]; then
echo "Changes found: $CHANGES"
git diff
exit 1
fi
build:
runs-on: ubuntu-latest
needs: [install]
steps:
- uses: actions/checkout@v2

- name: yarn-cache
uses: actions/cache@v2
with:
path: .//node_modules
key: ${{ runner.os }}-yarn-cache-${{ hashFiles('./yarn.lock') }}

- name: build-cache
uses: actions/cache@v2
with:
path: ./*
key: ${{ github.sha }}

- name: build
run: yarn run build

prettier:
runs-on: ubuntu-latest
needs: [install]
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
with:
path: .//node_modules
key: ${{ runner.os }}-yarn-cache-${{ hashFiles('./yarn.lock') }}

- name: prettier
run: |
yarn run prettier
CHANGES=$(git status -s)
if [[ ! -z $CHANGES ]]; then
echo "Changes found: $CHANGES"
exit 1
fi
lint:
runs-on: ubuntu-latest
needs: [install]
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
with:
path: .//node_modules
key: ${{ runner.os }}-yarn-cache-${{ hashFiles('./yarn.lock') }}

- name: lint
run: yarn run lint

test:
runs-on: ubuntu-latest
needs: [build]
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
with:
path: ./*
key: ${{ github.sha }}

- name: test
run: yarn run test
550 changes: 550 additions & 0 deletions typescript/helloworld/.yarn/plugins/@yarnpkg/plugin-version.cjs

Large diffs are not rendered by default.

785 changes: 785 additions & 0 deletions typescript/helloworld/.yarn/releases/yarn-3.2.0.cjs

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions typescript/helloworld/.yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
nodeLinker: node-modules

plugins:
- path: .yarn/plugins/@yarnpkg/plugin-version.cjs
spec: "@yarnpkg/plugin-version"

yarnPath: .yarn/releases/yarn-3.2.0.cjs
1 change: 0 additions & 1 deletion typescript/infra/config/environments/test/igp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ function getGasOracles(local: TestChains) {
export const igp: ChainMap<OverheadIgpConfig> = objMap(
owners,
(chain, owner) => {
console.log('getGasOracle: ', getGasOracles(chain));
return {
owner,
beneficiary: owner,
Expand Down
1 change: 0 additions & 1 deletion typescript/infra/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@
"repository": "https://github.com/hyperlane-xyz/hyperlane-monorepo",
"scripts": {
"deploy-core": "ts-node scripts/deploy.ts -e test --context hyperlane -m core",
"deploy-core-for-hooks": "ts-node scripts/deploy.ts -e test --context hyperlane -m core -h true",
"deploy-igp": "ts-node scripts/deploy.ts -e test --context hyperlane -m igp",
"deploy-ism": "ts-node scripts/deploy.ts -e test --context hyperlane -m ism",
"deploy-hook": "ts-node scripts/deploy.ts -e test --context hyperlane -m hook",
Expand Down
64 changes: 26 additions & 38 deletions typescript/infra/scripts/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {
MultiProvider,
objMap,
} from '@hyperlane-xyz/sdk';
import { changeTestAddress, getMainnetAddress } from '@hyperlane-xyz/sdk';

import { testConfigs } from '../config/environments/test/chains';
import { deployEnvToSdkEnv } from '../src/config/environment';
Expand All @@ -34,19 +35,14 @@ import {
getEnvironmentDirectory,
getModuleDirectory,
getRouterConfig,
withHooks,
withModuleAndFork,
} from './utils';

async function main() {
const { module, fork, environment, hooks } = await withHooks(
withModuleAndFork(getArgs()),
).argv;
const { module, fork, environment } = await withModuleAndFork(getArgs()).argv;
const envConfig = getEnvironmentConfig(environment);
const multiProvider = await envConfig.getMultiProvider();

console.log('Hooks: ', hooks);

if (fork) {
await useLocalProvider(multiProvider, fork);

Expand All @@ -67,44 +63,36 @@ async function main() {
if (module === Modules.ISM_FACTORY) {
config = objMap(envConfig.core, (chain) => true);
deployer = new HyperlaneIsmFactoryDeployer(multiProvider);
}
// else if (module === Modules.CORE && hooks) {
// config['test1'] = envConfig.core.test1;
// config['test2'] = envConfig.core.test2;
// }
else if (module === Modules.CORE) {
// config = envConfig.core;
const hookProvider = new MultiProvider(testConfigs);

// anvil --fork-url https://rpc.ankr.com/optimism --chain-id 31337 --port 8546
const ethForked = new providers.JsonRpcProvider('http://localhost:8546');
// anvil --fork-url https://rpc.ankr.com/optimism --chain-id 31337 --port 8547
const opForked = new providers.JsonRpcProvider('http://localhost:8547');

hookProvider.setSigner(
'test1',
ethForked.getSigner('0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266'),
);
hookProvider.setSigner(
'test2',
opForked.getSigner('0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266'),
);
hookProvider.setSigner(
'test3',
ethForked.getSigner('0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266'),
);

config['test1'] = envConfig.core.test1;
config['test2'] = envConfig.core.test2;
} else if (module === Modules.CORE) {
config = envConfig.core;

const ismFactory = HyperlaneIsmFactory.fromEnvironment(
deployEnvToSdkEnv[environment],
hookProvider,
multiProvider,
);
deployer = new HyperlaneCoreDeployer(hookProvider, ismFactory);
deployer = new HyperlaneCoreDeployer(multiProvider, ismFactory);
} else if (module === Modules.HOOK) {
const hookProvider = new MultiProvider(testConfigs);

console.log('HOOKed');

const ethMailboxAddress = await getMainnetAddress('ethereum', 'mailbox');
const opMailboxAddress = await getMainnetAddress('optimism', 'mailbox');

if (!ethMailboxAddress || !opMailboxAddress) {
throw new Error('Failed to get mailbox addresses');
}

console.log('ETH: ', ethMailboxAddress);
console.log('OP: ', opMailboxAddress);

await changeTestAddress('test1', 'mailbox', ethMailboxAddress);
await changeTestAddress(
'test2',
'mailbox',
'0x35231d4c2D8B8ADcB5617A638A0c4548684c7C70',
);

// anvil --fork-url https://rpc.ankr.com/optimism --chain-id 31337 --port 8546
const ethForked = new providers.JsonRpcProvider('http://localhost:8546');
// anvil --fork-url https://rpc.ankr.com/optimism --chain-id 31337 --port 8547
Expand All @@ -123,8 +111,8 @@ async function main() {
throw new Error(`No hook config for ${environment}`);
}
config = envConfig.hooks;

deployer = new HyperlaneHookDeployer(hookProvider);
deployer;
} else if (module === Modules.INTERCHAIN_GAS_PAYMASTER) {
config = envConfig.igp;
deployer = new HyperlaneIgpDeployer(multiProvider);
Expand Down
7 changes: 0 additions & 7 deletions typescript/infra/scripts/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,6 @@ export function withContext<T>(args: yargs.Argv<T>) {
.demandOption('context');
}

export function withHooks<T>(args: yargs.Argv<T>) {
return args
.describe('hooks', 'hooks to deploy')
.boolean('hooks')
.alias('h', 'hook');
}

export function withAgentRole<T>(args: yargs.Argv<T>) {
return args
.describe('role', 'agent roles')
Expand Down
56 changes: 26 additions & 30 deletions typescript/sdk/src/consts/environments/test.json
Original file line number Diff line number Diff line change
@@ -1,37 +1,33 @@
{
"test1": {
"storageGasOracle": "0xb868Cc77A95a65F42611724AF05Aa2d3B6Ec05F2",
"validatorAnnounce": "0x9155497EAE31D432C0b13dBCc0615a37f55a2c87",
"proxyAdmin": "0xE2b5bDE7e80f89975f7229d78aD9259b2723d11F",
"mailbox": "0x46d4674578a2daBbD0CEAB0500c6c7867999db34",
"interchainGasPaymaster": "0x9338CA7d556248055f5751d85cDA7aD6eF254433",
"defaultIsmInterchainGasPaymaster": "0x7Cf4be31f546c04787886358b9486ca3d62B9acf",
"legacyMultisigIsm": "0x9fE46736679d2D9a65F0992F2272dE9f3c7fa6e0",
"merkleRootMultisigIsm": "0x5FbDB2315678afecb367f032d93F642f64180aa3",
"messageIdMultisigIsm": "0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512",
"aggregationIsm": "0xCf7Ed3AccA5a467e9e704C703E8D87F634fB0Fc9",
"routingIsm": "0xDc64a140Aa3E981100a9becA4E685f962f0cF6C9",
"merkleRootMultisigIsmFactory": "0x572316aC11CB4bc5daf6BDae68f43EA3CCE3aE0e",
"messageIdMultisigIsmFactory": "0x975Ab64F4901Af5f0C96636deA0b9de3419D0c2F",
"aggregationIsmFactory": "0x4593ed9CbE6003e687e5e77368534bb04b162503",
"routingIsmFactory": "0xCd7c00Ac6dc51e8dCc773971Ac9221cC582F3b1b"
"storageGasOracle": "0xc9a103990A8dB11b4f627bc5CD1D0c2685484Ec5",
"validatorAnnounce": "0x9bBdef63594D5FFc2f370Fe52115DdFFe97Bc524",
"proxyAdmin": "0x75EE15Ee1B4A75Fa3e2fDF5DF3253c25599cc659",
"mailbox": "0x35231d4c2D8B8ADcB5617A638A0c4548684c7C70",
"interchainGasPaymaster": "0x6cA0B6D22da47f091B7613223cD4BB03a2d77918",
"defaultIsmInterchainGasPaymaster": "0x56f52c0A1ddcD557285f7CBc782D3d83096CE1Cc",
"multisigIsm": "0xec48E52D960E54a179f70907bF28b105813877ee",
"testRecipient": "0x36FdA966CfffF8a9Cdc814f546db0e6378bFef35",
"interchainQueryRouter": "0x234b19282985882d6d6fd54dEBa272271f4eb784",
"interchainAccountRouter": "0x5fD075C2157567F7F80e6cB20dDd75F40905bd87",
"interchainAccountIsm": "0x943303Ad7D2B87BB363E0BACC901486337d9B316",
"aggregationIsmFactory": "0x30B3Ef3e98B1FF72f03f71f68115E18F203Ec794",
"routingIsmFactory": "0xBF30B4F328d1F6AC47ecCcF23836F3CbB2422c9f"
},
"test2": {
"storageGasOracle": "0xA21DDc1f17dF41589BC6A5209292AED2dF61Cc94",
"validatorAnnounce": "0x9d4454B023096f34B160D6B654540c56A1F81688",
"proxyAdmin": "0x4826533B4897376654Bb4d4AD88B7faFD0C98528",
"mailbox": "0x8f86403A4DE0BB5791fa46B8e795C547942fE4Cf",
"interchainGasPaymaster": "0x2F54D1563963fC04770E85AF819c89Dc807f6a06",
"defaultIsmInterchainGasPaymaster": "0x9849832a1d8274aaeDb1112ad9686413461e7101",
"legacyMultisigIsm": "0xa513E6E4b8f2a923D98304ec87F64353C4D5C853",
"merkleRootMultisigIsm": "0x5FC8d32690cc91D4c39d9d3abcBD16989F875707",
"messageIdMultisigIsm": "0x0165878A594ca255338adfa4d48449f69242Eb8F",
"aggregationIsm": "0x2279B7A0a67DB372996a5FaB50D91eAA73d2eBe6",
"routingIsm": "0x8A791620dd6260079BF849Dc5567aDC3F2FdC318",
"merkleRootMultisigIsmFactory": "0x8ac87219a0F5639BC01b470F87BA2b26356CB2B9",
"messageIdMultisigIsmFactory": "0x94fFA1C7330845646CE9128450F8e6c3B5e44F86",
"aggregationIsmFactory": "0xCa1D199b6F53Af7387ac543Af8e8a34455BBe5E0",
"routingIsmFactory": "0xdF46e54aAadC1d55198A4a8b4674D7a4c927097A"
"storageGasOracle": "0x27e88AeB8EA4B159d81df06355Ea3d20bEB1de38",
"validatorAnnounce": "0x9bBdef63594D5FFc2f370Fe52115DdFFe97Bc524",
"proxyAdmin": "0xE047cb95FB3b7117989e911c6afb34771183fC35",
"mailbox": "0x35231d4c2D8B8ADcB5617A638A0c4548684c7C70",
"interchainGasPaymaster": "0x6cA0B6D22da47f091B7613223cD4BB03a2d77918",
"defaultIsmInterchainGasPaymaster": "0x56f52c0A1ddcD557285f7CBc782D3d83096CE1Cc",
"multisigIsm": "0xAab1D11E2063Bae5EB01fa946cA8d2FDe3db05D5",
"testRecipient": "0x36FdA966CfffF8a9Cdc814f546db0e6378bFef35",
"interchainQueryRouter": "0x234b19282985882d6d6fd54dEBa272271f4eb784",
"interchainAccountRouter": "0x652e2F475Af7b1154817E09f5408f9011037492a",
"interchainAccountIsm": "0x3de63b62BeF9Da290F51f856cA9F3dB4225EDc05",
"aggregationIsmFactory": "0xb7d42f065E32eB6fCAac7ef83902c56164328fE2",
"routingIsmFactory": "0x4ef980034E631CC0CFb3b065aB793611f1B6511A"
},
"test3": {
"storageGasOracle": "0x325c8Df4CFb5B068675AFF8f62aA668D1dEc3C4B",
Expand Down
11 changes: 2 additions & 9 deletions typescript/sdk/src/core/HyperlaneCoreDeployer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ export class HyperlaneCoreDeployer extends HyperlaneDeployer<
[domain],
[owner, defaultIsmAddress],
);
this.logger('Mailbox address: ', mailbox.address, 'on chain: ', chain);
return mailbox;
}

Expand Down Expand Up @@ -98,18 +97,12 @@ export class HyperlaneCoreDeployer extends HyperlaneDeployer<
.getProvider(chain)
.getBlockNumber();

// const ism = await this.deployIsm(chain, config.defaultIsm);
const ism = await this.deployIsm(chain, config.defaultIsm);
const proxyAdmin = await this.deployContract(chain, 'proxyAdmin', []);

// default ISM
const prodISM =
chain === 'test1'
? '0xec48E52D960E54a179f70907bF28b105813877ee'
: '0xAab1D11E2063Bae5EB01fa946cA8d2FDe3db05D5';

const mailbox = await this.deployMailbox(
chain,
prodISM,
ism,
proxyAdmin.address,
config.owner,
);
Expand Down
Loading

0 comments on commit 4b00e15

Please sign in to comment.