Skip to content

Commit

Permalink
Merge branch 'v3' into verify-v3
Browse files Browse the repository at this point in the history
  • Loading branch information
yorhodes committed Oct 23, 2023
2 parents 81a092a + 6769f55 commit b56294e
Show file tree
Hide file tree
Showing 13 changed files with 93 additions and 59 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/rust-skipped.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: rust

on:
pull_request:
branches: [main]
branches: [main, v3]
paths-ignore:
- 'rust/**'

Expand Down
18 changes: 9 additions & 9 deletions rust/config/testnet4_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -190,14 +190,14 @@
"aggregationHookFactory": "0xa1145B39F1c7Ef9aA593BC1DB1634b00CC020942",
"routingIsmFactory": "0xea12ECFD1f241da323e93F12b4ed936403990190",
"proxyAdmin": "0xb12282d2E838Aa5f2A4F9Ee5f624a77b7199A078",
"mailbox": "0x89280d0b68a246B276a910A518531E2a861CEb65",
"validatorAnnounce": "0x07b68177DE487200969261174b98FD067561Ab46",
"defaultIsm": "0xEf7cacD303D1886b3dE396B45a184d16f39248E0",
"merkleTreeHook": "0xb6752a47541DAFaF17752FB2899BC1f138A03091",
"storageGasOracle": "0x124EBCBC018A5D4Efe639f02ED86f95cdC3f6498",
"interchainGasPaymaster": "0x0dD20e410bdB95404f71c5a4e7Fa67B892A5f949",
"aggregationHook": "0x3d675bB93250Ab7603F40cbb9194bae210784627",
"protocolFee": "0x3eF0a63B8976b838704Bcc93C78C56b6653E5a39",
"mailbox": "0xF9F6F5646F478d5ab4e20B0F910C92F1CCC9Cc6D",
"merkleTreeHook": "0xc6cbF39A747f5E28d1bDc8D9dfDAb2960Abd5A8f",
"validatorAnnounce": "0xf09701B0a93210113D175461b6135a96773B5465",
"index": {
"from": 33950052
}
Expand Down Expand Up @@ -295,14 +295,14 @@
"aggregationHookFactory": "0x6bc243963f80AEa80948e8538bB114d4122DD9c5",
"routingIsmFactory": "0xd16c3f34d6A2e62185aC61f76F83D3AA1E969018",
"proxyAdmin": "0x0EdB3604D230963ecE9d83963164CFe2fDef576B",
"mailbox": "0xc4796aAbcE2A9D774Ce4603f5Db5fB1605791dbd",
"validatorAnnounce": "0x0bbE9b20372B29e65B3feF370b22369561893231",
"defaultIsm": "0x8BbdB0023ef47992b3E83E2B1B290D72A7477EfE",
"merkleTreeHook": "0xeE2842C22F15e69cD443378aa8fbD1fE16E59Ed3",
"storageGasOracle": "0xeC34c715ee6d050b2172E8aF650Db779561266C1",
"interchainGasPaymaster": "0x0cD26594ea6c6526927C0F5225AC09F6288e7140",
"aggregationHook": "0x2dF77b3efe9B8f9aEDf7bFC86f40B048178d8116",
"protocolFee": "0x9293B8dAcA7933765de499C992B0Fa86Bb104b0f",
"merkleTreeHook": "0x28c294C61D3dE053462d2Cfa5d5f8c8D70605A59",
"mailbox": "0x49cfd6Ef774AcAb14814D699e3F7eE36Fdfba932",
"validatorAnnounce": "0x3c182AD9cA8A71bc107Ef440C2667E8360e1158E",
"index": {
"from": 9816044
}
Expand Down Expand Up @@ -599,14 +599,14 @@
"aggregationHookFactory": "0x160C28C92cA453570aD7C031972b58d5Dd128F72",
"routingIsmFactory": "0x3603458990BfEb30f99E61B58427d196814D8ce1",
"proxyAdmin": "0x97Bbc6bBaFa5Ce3b2FA966c121Af63bD09e940f8",
"mailbox": "0x33AbaF6708be03Bdf0595DA0745A7111b01dB8c7",
"validatorAnnounce": "0x71B1BF7C99BEef0545eAFf441372cb6413d9367c",
"defaultIsm": "0x97FE534674A0fA312b730C946A8A8AC9DcF90100",
"merkleTreeHook": "0xa5075B2AcA697944273d67B57a3340a0730632A3",
"storageGasOracle": "0x71775B071F77F1ce52Ece810ce084451a3045FFe",
"interchainGasPaymaster": "0x6f2756380FD49228ae25Aa7F2817993cB74Ecc56",
"aggregationHook": "0xe3147d5618f5e2e100690B50ec923009a4cde14A",
"protocolFee": "0x13AC3349Cb159fE86A22cf42DdA803D9f7309DB5",
"mailbox": "0xfFAEF09B3cd11D9b20d1a19bECca54EEC2884766",
"merkleTreeHook": "0x4917a9746A7B6E0A57159cCb7F5a6744247f2d0d",
"validatorAnnounce": "0xE6105C59480a1B7DD3E4f28153aFdbE12F4CfCD9",
"index": {
"from": 4432735
}
Expand Down
10 changes: 8 additions & 2 deletions typescript/helloworld/src/test/deploy.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import { ethers } from 'hardhat';
import {
ChainMap,
HyperlaneContractsMap,
HyperlaneIsmFactory,
HyperlaneProxyFactoryDeployer,
MultiProvider,
TestCoreApp,
TestCoreDeployer,
Expand All @@ -26,8 +28,12 @@ describe('deploy', async () => {
before(async () => {
const [signer] = await ethers.getSigners();
multiProvider = MultiProvider.createTestMultiProvider({ signer });

const coreDeployer = new TestCoreDeployer(multiProvider);
const ismFactoryDeployer = new HyperlaneProxyFactoryDeployer(multiProvider);
const ismFactory = new HyperlaneIsmFactory(
await ismFactoryDeployer.deploy(multiProvider.mapKnownChains(() => ({}))),
multiProvider,
);
const coreDeployer = new TestCoreDeployer(multiProvider, ismFactory);
core = await coreDeployer.deployApp();
config = core.getRouterConfig(signer.address);
deployer = new HelloWorldDeployer(multiProvider);
Expand Down
9 changes: 8 additions & 1 deletion typescript/helloworld/src/test/helloworld.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import { ethers } from 'hardhat';
import {
ChainMap,
Chains,
HyperlaneIsmFactory,
HyperlaneProxyFactoryDeployer,
MultiProvider,
TestCoreApp,
TestCoreDeployer,
Expand All @@ -30,7 +32,12 @@ describe('HelloWorld', async () => {
before(async () => {
[signer] = await ethers.getSigners();
multiProvider = MultiProvider.createTestMultiProvider({ signer });
coreApp = await new TestCoreDeployer(multiProvider).deployApp();
const ismFactoryDeployer = new HyperlaneProxyFactoryDeployer(multiProvider);
const ismFactory = new HyperlaneIsmFactory(
await ismFactoryDeployer.deploy(multiProvider.mapKnownChains(() => ({}))),
multiProvider,
);
coreApp = await new TestCoreDeployer(multiProvider, ismFactory).deployApp();
config = coreApp.getRouterConfig(signer.address);

localDomain = multiProvider.getDomainId(localChain);
Expand Down
6 changes: 3 additions & 3 deletions typescript/infra/config/environments/testnet4/agent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ const hyperlane: RootAgentConfig = {
rpcConsensusType: RpcConsensusType.Fallback,
docker: {
repo,
tag: 'cfaf553-20231009-174623',
tag: '65ac90a-20231020-192310',
},
blacklist: [
...releaseCandidateHelloworldMatchingList,
Expand All @@ -66,15 +66,15 @@ const hyperlane: RootAgentConfig = {
rpcConsensusType: RpcConsensusType.Fallback,
docker: {
repo,
tag: 'cfaf553-20231009-174623',
tag: '65ac90a-20231020-192310',
},
chains: validatorChainConfig(Contexts.Hyperlane),
},
scraper: {
rpcConsensusType: RpcConsensusType.Fallback,
docker: {
repo,
tag: 'cfaf553-20231009-174623',
tag: '65ac90a-20231020-192310',
},
},
};
Expand Down
36 changes: 2 additions & 34 deletions typescript/sdk/src/core/TestCoreDeployer.ts
Original file line number Diff line number Diff line change
@@ -1,45 +1,13 @@
import {
TestInterchainGasPaymaster__factory,
TestMailbox__factory,
TestMultisigIsm__factory,
} from '@hyperlane-xyz/core';

import { TestChains } from '../consts/chains';
import { HyperlaneContracts } from '../contracts/types';
import { HyperlaneIsmFactory } from '../ism/HyperlaneIsmFactory';
import { MultiProvider } from '../providers/MultiProvider';
import { testCoreConfig } from '../test/testUtils';
import { ChainMap, ChainName } from '../types';
import { ChainMap } from '../types';

import { HyperlaneCoreDeployer } from './HyperlaneCoreDeployer';
import { TestCoreApp } from './TestCoreApp';
import { CoreFactories, coreFactories } from './contracts';

const testCoreFactories = {
...coreFactories,
mailbox: new TestMailbox__factory(),
interchainGasPaymaster: new TestInterchainGasPaymaster__factory(),
testIsm: new TestMultisigIsm__factory(),
};
import { CoreFactories } from './contracts';

export class TestCoreDeployer extends HyperlaneCoreDeployer {
constructor(public readonly multiProvider: MultiProvider) {
const ismFactory = new HyperlaneIsmFactory({}, multiProvider);
super(multiProvider, ismFactory);
}

// deploy a test ISM instead of a real ISM
async deployIsm(chain: ChainName): Promise<string> {
const testIsm = await this.deployContractFromFactory(
chain,
testCoreFactories.testIsm,
'testIsm',
[],
);
await testIsm.setAccept(true);
return testIsm.address;
}

async deploy(): Promise<ChainMap<HyperlaneContracts<CoreFactories>>> {
return super.deploy(testCoreConfig(TestChains));
}
Expand Down
10 changes: 9 additions & 1 deletion typescript/sdk/src/core/testHyperlaneDeploy.hardhat-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import { TestMailbox, TestRecipient__factory } from '@hyperlane-xyz/core';
import { addressToBytes32 } from '@hyperlane-xyz/utils';

import { Chains } from '../consts/chains';
import { HyperlaneProxyFactoryDeployer } from '../deploy/HyperlaneProxyFactoryDeployer';
import { HyperlaneIsmFactory } from '../ism/HyperlaneIsmFactory';
import { MultiProvider } from '../providers/MultiProvider';

import { TestCoreApp } from './TestCoreApp';
Expand All @@ -27,7 +29,13 @@ describe('TestCoreDeployer', async () => {
const [signer] = await ethers.getSigners();

const multiProvider = MultiProvider.createTestMultiProvider({ signer });
const deployer = new TestCoreDeployer(multiProvider);

const ismFactoryDeployer = new HyperlaneProxyFactoryDeployer(multiProvider);
const ismFactory = new HyperlaneIsmFactory(
await ismFactoryDeployer.deploy(multiProvider.mapKnownChains(() => ({}))),
multiProvider,
);
const deployer = new TestCoreDeployer(multiProvider, ismFactory);
testCoreApp = await deployer.deployApp();

const recipient = await new TestRecipient__factory(signer).deploy();
Expand Down
16 changes: 16 additions & 0 deletions typescript/sdk/src/ism/HyperlaneIsmFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
StaticAddressSetFactory,
StaticAggregationIsm__factory,
StaticThresholdAddressSetFactory,
TestMultisigIsm__factory,
} from '@hyperlane-xyz/core';
import { Address, eqAddress, formatMessage, warn } from '@hyperlane-xyz/utils';

Expand Down Expand Up @@ -107,6 +108,8 @@ export class HyperlaneIsmFactory extends HyperlaneApp<FactoryFactories> {
} else if (config.type === ModuleType.AGGREGATION) {
this.logger(`Deploying Aggregation ISM to ${chain}`);
contract = await this.deployAggregationIsm(chain, config, origin);
} else if (config.type === ModuleType.TEST_ISM) {
contract = await this.deployTestIsm(chain);
} else {
throw new Error(`Unsupported ISM type`);
}
Expand Down Expand Up @@ -214,6 +217,13 @@ export class HyperlaneIsmFactory extends HyperlaneApp<FactoryFactories> {
return IAggregationIsm__factory.connect(address, signer);
}

private async deployTestIsm(chain: ChainName) {
const signer = this.multiProvider.getSigner(chain);
const factory = new TestMultisigIsm__factory(signer);
const contract = await factory.deploy();
return contract;
}

async deployStaticAddressSet(
chain: ChainName,
factory: StaticThresholdAddressSetFactory | StaticAddressSetFactory,
Expand Down Expand Up @@ -355,6 +365,9 @@ export async function moduleCanCertainlyVerify(
}
return verified >= destModule.threshold;
}
case ModuleType.TEST_ISM: {
return true;
}
}
}
}
Expand Down Expand Up @@ -513,6 +526,9 @@ export function collectValidators(
aggregatedValidators.forEach((set) => {
validators = validators.concat([...set]);
});
} else if (config.type === ModuleType.TEST_ISM) {
// This is just a TestISM
return new Set([]);
} else {
throw new Error('Unsupported ModuleType');
}
Expand Down
12 changes: 10 additions & 2 deletions typescript/sdk/src/ism/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
IRoutingIsm,
StaticMerkleRootMultisigIsm,
StaticMessageIdMultisigIsm,
TestMultisigIsm,
} from '@hyperlane-xyz/core';
import type { Address } from '@hyperlane-xyz/utils';

Expand All @@ -16,7 +17,8 @@ export type DeployedIsm =
| IAggregationIsm
| IRoutingIsm
| StaticMessageIdMultisigIsm
| StaticMerkleRootMultisigIsm;
| StaticMerkleRootMultisigIsm
| TestMultisigIsm;

export enum ModuleType {
UNUSED,
Expand All @@ -25,6 +27,7 @@ export enum ModuleType {
LEGACY_MULTISIG, // DEPRECATED
MERKLE_ROOT_MULTISIG,
MESSAGE_ID_MULTISIG,
TEST_ISM,
}

export type MultisigConfig = {
Expand All @@ -36,6 +39,10 @@ export type MultisigIsmConfig = MultisigConfig & {
type: ModuleType.MERKLE_ROOT_MULTISIG | ModuleType.MESSAGE_ID_MULTISIG;
};

export type TestMultisigIsmConfig = MultisigConfig & {
type: ModuleType.TEST_ISM;
};

export type RoutingIsmConfig = {
type: ModuleType.ROUTING;
owner: Address;
Expand All @@ -52,4 +59,5 @@ export type IsmConfig =
| Address
| RoutingIsmConfig
| MultisigIsmConfig
| AggregationIsmConfig;
| AggregationIsmConfig
| TestMultisigIsmConfig;
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import { Chains } from '../../consts/chains';
import { HyperlaneContractsMap } from '../../contracts/types';
import { TestCoreApp } from '../../core/TestCoreApp';
import { TestCoreDeployer } from '../../core/TestCoreDeployer';
import { HyperlaneProxyFactoryDeployer } from '../../deploy/HyperlaneProxyFactoryDeployer';
import { HyperlaneIsmFactory } from '../../ism/HyperlaneIsmFactory';
import { MultiProvider } from '../../providers/MultiProvider';
import { RouterConfig } from '../../router/types';
import { ChainMap } from '../../types';
Expand All @@ -35,7 +37,12 @@ describe.skip('InterchainAccounts', async () => {
before(async () => {
[signer] = await ethers.getSigners();
multiProvider = MultiProvider.createTestMultiProvider({ signer });
coreApp = await new TestCoreDeployer(multiProvider).deployApp();
const ismFactoryDeployer = new HyperlaneProxyFactoryDeployer(multiProvider);
const ismFactory = new HyperlaneIsmFactory(
await ismFactoryDeployer.deploy(multiProvider.mapKnownChains(() => ({}))),
multiProvider,
);
coreApp = await new TestCoreDeployer(multiProvider, ismFactory).deployApp();
config = coreApp.getRouterConfig(signer.address);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ import { chainMetadata } from '../../consts/chainMetadata';
import { Chains } from '../../consts/chains';
import { TestCoreApp } from '../../core/TestCoreApp';
import { TestCoreDeployer } from '../../core/TestCoreDeployer';
import { HyperlaneProxyFactoryDeployer } from '../../deploy/HyperlaneProxyFactoryDeployer';
import { HyperlaneIsmFactory } from '../../ism/HyperlaneIsmFactory';
import { MultiProvider } from '../../providers/MultiProvider';
import { ChainMap } from '../../types';

Expand Down Expand Up @@ -53,7 +55,12 @@ describe.skip('LiquidityLayerRouter', async () => {
before(async () => {
[signer] = await ethers.getSigners();
multiProvider = MultiProvider.createTestMultiProvider({ signer });
coreApp = await new TestCoreDeployer(multiProvider).deployApp();
const ismFactoryDeployer = new HyperlaneProxyFactoryDeployer(multiProvider);
const ismFactory = new HyperlaneIsmFactory(
await ismFactoryDeployer.deploy(multiProvider.mapKnownChains(() => ({}))),
multiProvider,
);
coreApp = await new TestCoreDeployer(multiProvider, ismFactory).deployApp();
const routerConfig = coreApp.getRouterConfig(signer.address);

const mockTokenF = new MockToken__factory(signer);
Expand Down
9 changes: 8 additions & 1 deletion typescript/sdk/src/middleware/query/queries.hardhat-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ import { Chains } from '../../consts/chains';
import { HyperlaneContractsMap } from '../../contracts/types';
import { TestCoreApp } from '../../core/TestCoreApp';
import { TestCoreDeployer } from '../../core/TestCoreDeployer';
import { HyperlaneProxyFactoryDeployer } from '../../deploy/HyperlaneProxyFactoryDeployer';
import { HyperlaneIsmFactory } from '../../ism/HyperlaneIsmFactory';
import { MultiProvider } from '../../providers/MultiProvider';
import { RouterConfig } from '../../router/types';
import { ChainMap } from '../../types';
Expand Down Expand Up @@ -41,7 +43,12 @@ describe.skip('InterchainQueryRouter', async () => {
before(async () => {
[signer] = await ethers.getSigners();
multiProvider = MultiProvider.createTestMultiProvider({ signer });
coreApp = await new TestCoreDeployer(multiProvider).deployApp();
const ismFactoryDeployer = new HyperlaneProxyFactoryDeployer(multiProvider);
const ismFactory = new HyperlaneIsmFactory(
await ismFactoryDeployer.deploy(multiProvider.mapKnownChains(() => ({}))),
multiProvider,
);
coreApp = await new TestCoreDeployer(multiProvider, ismFactory).deployApp();
config = coreApp.getRouterConfig(signer.address);
});

Expand Down
6 changes: 3 additions & 3 deletions typescript/sdk/src/test/testUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
CoinGeckoSimplePriceParams,
} from '../gas/token-prices';
import { HookType } from '../hook/types';
import { ModuleType, MultisigIsmConfig } from '../ism/types';
import { ModuleType, TestMultisigIsmConfig } from '../ism/types';
import { RouterConfig } from '../router/types';
import { ChainMap, ChainName } from '../types';

Expand Down Expand Up @@ -45,8 +45,8 @@ const nonZeroAddress = ethers.constants.AddressZero.replace('00', '01');

// dummy config as TestInbox and TestOutbox do not use deployed ISM
export function testCoreConfig(chains: ChainName[]): ChainMap<CoreConfig> {
const multisigIsm: MultisigIsmConfig = {
type: ModuleType.MERKLE_ROOT_MULTISIG,
const multisigIsm: TestMultisigIsmConfig = {
type: ModuleType.TEST_ISM,
validators: [nonZeroAddress],
threshold: 1,
};
Expand Down

0 comments on commit b56294e

Please sign in to comment.