From 8525fc686b1ddc5ab2a5c276faf8516f82557c70 Mon Sep 17 00:00:00 2001 From: pbio <10051819+paulbalaji@users.noreply.github.com> Date: Thu, 3 Oct 2024 14:37:59 +0100 Subject: [PATCH 1/3] fix: write merkle & IGP hook addresses if created by core deploy Signed-off-by: pbio <10051819+paulbalaji@users.noreply.github.com> --- typescript/sdk/src/core/EvmCoreModule.ts | 20 +++++++++++++++++++- typescript/sdk/src/core/schemas.ts | 2 ++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/typescript/sdk/src/core/EvmCoreModule.ts b/typescript/sdk/src/core/EvmCoreModule.ts index 1ab4ef649e..f8f726c524 100644 --- a/typescript/sdk/src/core/EvmCoreModule.ts +++ b/typescript/sdk/src/core/EvmCoreModule.ts @@ -11,7 +11,10 @@ import { attachContractsMap, serializeContractsMap, } from '../contracts/contracts.js'; -import { HyperlaneAddresses } from '../contracts/types.js'; +import { + HyperlaneAddresses, + HyperlaneContractsMap, +} from '../contracts/types.js'; import { DeployedCoreAddresses } from '../core/schemas.js'; import { CoreConfig } from '../core/types.js'; import { HyperlaneProxyFactoryDeployer } from '../deploy/HyperlaneProxyFactoryDeployer.js'; @@ -20,6 +23,7 @@ import { proxyFactoryFactories, } from '../deploy/contracts.js'; import { ContractVerifier } from '../deploy/verify/ContractVerifier.js'; +import { HookFactories } from '../hook/contracts.js'; import { EvmIsmModule } from '../ism/EvmIsmModule.js'; import { DerivedIsmConfig } from '../ism/EvmIsmReader.js'; import { HyperlaneIsmFactory } from '../ism/HyperlaneIsmFactory.js'; @@ -35,6 +39,7 @@ import { import { EvmCoreReader } from './EvmCoreReader.js'; import { EvmIcaModule } from './EvmIcaModule.js'; import { HyperlaneCoreDeployer } from './HyperlaneCoreDeployer.js'; +import { CoreFactories } from './contracts.js'; import { CoreConfigSchema } from './schemas.js'; export class EvmCoreModule extends HyperlaneModule< @@ -315,9 +320,20 @@ export class EvmCoreModule extends HyperlaneModule< ) ).address; + // Obtain addresses of every contract created by the deployer + // and extract only the merkleTreeHook and interchainGasPaymaster + const serializedContracts = serializeContractsMap( + coreDeployer.deployedContracts as HyperlaneContractsMap< + CoreFactories & HookFactories + >, + ); + const { merkleTreeHook, interchainGasPaymaster } = + serializedContracts[chainName]; + // Set Core & extra addresses return { ...ismFactoryFactories, + proxyAdmin, mailbox: mailbox.address, interchainAccountRouter, @@ -325,6 +341,8 @@ export class EvmCoreModule extends HyperlaneModule< validatorAnnounce, timelockController, testRecipient, + merkleTreeHook, + interchainGasPaymaster, }; } diff --git a/typescript/sdk/src/core/schemas.ts b/typescript/sdk/src/core/schemas.ts index 79b08bf24a..569bb2ee08 100644 --- a/typescript/sdk/src/core/schemas.ts +++ b/typescript/sdk/src/core/schemas.ts @@ -19,6 +19,8 @@ export const DeployedCoreAddressesSchema = ProxyFactoryFactoriesSchema.extend({ timelockController: z.string().optional(), interchainAccountRouter: z.string(), interchainAccountIsm: z.string(), + merkleTreeHook: z.string().optional(), + interchainGasPaymaster: z.string().optional(), }); export type DeployedCoreAddresses = z.infer; From d33d27a01322b4d8130d6f87afa3ba3f7ded01b8 Mon Sep 17 00:00:00 2001 From: pbio <10051819+paulbalaji@users.noreply.github.com> Date: Thu, 3 Oct 2024 15:00:49 +0100 Subject: [PATCH 2/3] fix tests Signed-off-by: pbio <10051819+paulbalaji@users.noreply.github.com> --- typescript/sdk/src/core/EvmCoreModule.hardhat-test.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/typescript/sdk/src/core/EvmCoreModule.hardhat-test.ts b/typescript/sdk/src/core/EvmCoreModule.hardhat-test.ts index 408ea4e2b2..673e23c503 100644 --- a/typescript/sdk/src/core/EvmCoreModule.hardhat-test.ts +++ b/typescript/sdk/src/core/EvmCoreModule.hardhat-test.ts @@ -105,10 +105,12 @@ describe('EvmCoreModule', async () => { }); it('should deploy ISM factories', () => { - // Each ISM factory - const deployedContracts = evmCoreModule.serialize(); + // Each ISM factory is a contract that is deployed by the core module + // Ignore IGP because it's not part of the default config + const { interchainGasPaymaster: _, ...coreContracts } = + evmCoreModule.serialize(); - objMap(deployedContracts as any, (_, address) => { + objMap(coreContracts as any, (name, address) => { expect(address).to.exist; expect(address).to.not.equal(constants.AddressZero); }); From 36226b480093724a9c3118c1377d30d1e313f1d3 Mon Sep 17 00:00:00 2001 From: Paul Balaji <10051819+paulbalaji@users.noreply.github.com> Date: Fri, 4 Oct 2024 01:04:05 +0100 Subject: [PATCH 3/3] Update typescript/sdk/src/core/EvmCoreModule.hardhat-test.ts --- typescript/sdk/src/core/EvmCoreModule.hardhat-test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/typescript/sdk/src/core/EvmCoreModule.hardhat-test.ts b/typescript/sdk/src/core/EvmCoreModule.hardhat-test.ts index 673e23c503..13f81f92e0 100644 --- a/typescript/sdk/src/core/EvmCoreModule.hardhat-test.ts +++ b/typescript/sdk/src/core/EvmCoreModule.hardhat-test.ts @@ -110,7 +110,7 @@ describe('EvmCoreModule', async () => { const { interchainGasPaymaster: _, ...coreContracts } = evmCoreModule.serialize(); - objMap(coreContracts as any, (name, address) => { + objMap(coreContracts as any, (_, address) => { expect(address).to.exist; expect(address).to.not.equal(constants.AddressZero); });