fix: write merkle & IGP hook addresses if created by core deploy (#4607)

### Description

original:
there was a series of related problems that people are encountering with
cli deploys where the merkleTreeHook is deployed but its address is not
included in the artifacts. this PR was intended to bring parity with how
infra does it, we can also update for now to only add the merkleTreeHook
to the output to unblock the base problem people are having

update:
restricted to just `merkleTreeHook` and `interchainGasPaymaster` to
provide MVP fix


![image](https://github.com/user-attachments/assets/9f38c3a8-5240-4cbe-a224-161a7a4da8af)

### Related issues


https://github.com/hyperlane-xyz/hyperlane-registry/pull/240#discussion_r1784297872

https://github.com/hyperlane-xyz/hyperlane-registry/pull/236#issuecomment-2383922133

https://github.com/hyperlane-xyz/hyperlane-registry/pull/237#discussion_r1782564051

### Backward compatibility

yes

### Testing

manual

---------

Signed-off-by: pbio <10051819+paulbalaji@users.noreply.github.com>
pull/4625/head
Paul Balaji 2 months ago committed by GitHub
parent 7c5766e51d
commit ca86da4718
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 8
      typescript/sdk/src/core/EvmCoreModule.hardhat-test.ts
  2. 20
      typescript/sdk/src/core/EvmCoreModule.ts
  3. 2
      typescript/sdk/src/core/schemas.ts

@ -105,10 +105,12 @@ describe('EvmCoreModule', async () => {
}); });
it('should deploy ISM factories', () => { it('should deploy ISM factories', () => {
// Each ISM factory // Each ISM factory is a contract that is deployed by the core module
const deployedContracts = evmCoreModule.serialize(); // 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, (_, address) => {
expect(address).to.exist; expect(address).to.exist;
expect(address).to.not.equal(constants.AddressZero); expect(address).to.not.equal(constants.AddressZero);
}); });

@ -11,7 +11,10 @@ import {
attachContractsMap, attachContractsMap,
serializeContractsMap, serializeContractsMap,
} from '../contracts/contracts.js'; } from '../contracts/contracts.js';
import { HyperlaneAddresses } from '../contracts/types.js'; import {
HyperlaneAddresses,
HyperlaneContractsMap,
} from '../contracts/types.js';
import { DeployedCoreAddresses } from '../core/schemas.js'; import { DeployedCoreAddresses } from '../core/schemas.js';
import { CoreConfig } from '../core/types.js'; import { CoreConfig } from '../core/types.js';
import { HyperlaneProxyFactoryDeployer } from '../deploy/HyperlaneProxyFactoryDeployer.js'; import { HyperlaneProxyFactoryDeployer } from '../deploy/HyperlaneProxyFactoryDeployer.js';
@ -20,6 +23,7 @@ import {
proxyFactoryFactories, proxyFactoryFactories,
} from '../deploy/contracts.js'; } from '../deploy/contracts.js';
import { ContractVerifier } from '../deploy/verify/ContractVerifier.js'; import { ContractVerifier } from '../deploy/verify/ContractVerifier.js';
import { HookFactories } from '../hook/contracts.js';
import { EvmIsmModule } from '../ism/EvmIsmModule.js'; import { EvmIsmModule } from '../ism/EvmIsmModule.js';
import { DerivedIsmConfig } from '../ism/EvmIsmReader.js'; import { DerivedIsmConfig } from '../ism/EvmIsmReader.js';
import { HyperlaneIsmFactory } from '../ism/HyperlaneIsmFactory.js'; import { HyperlaneIsmFactory } from '../ism/HyperlaneIsmFactory.js';
@ -35,6 +39,7 @@ import {
import { EvmCoreReader } from './EvmCoreReader.js'; import { EvmCoreReader } from './EvmCoreReader.js';
import { EvmIcaModule } from './EvmIcaModule.js'; import { EvmIcaModule } from './EvmIcaModule.js';
import { HyperlaneCoreDeployer } from './HyperlaneCoreDeployer.js'; import { HyperlaneCoreDeployer } from './HyperlaneCoreDeployer.js';
import { CoreFactories } from './contracts.js';
import { CoreConfigSchema } from './schemas.js'; import { CoreConfigSchema } from './schemas.js';
export class EvmCoreModule extends HyperlaneModule< export class EvmCoreModule extends HyperlaneModule<
@ -315,9 +320,20 @@ export class EvmCoreModule extends HyperlaneModule<
) )
).address; ).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 // Set Core & extra addresses
return { return {
...ismFactoryFactories, ...ismFactoryFactories,
proxyAdmin, proxyAdmin,
mailbox: mailbox.address, mailbox: mailbox.address,
interchainAccountRouter, interchainAccountRouter,
@ -325,6 +341,8 @@ export class EvmCoreModule extends HyperlaneModule<
validatorAnnounce, validatorAnnounce,
timelockController, timelockController,
testRecipient, testRecipient,
merkleTreeHook,
interchainGasPaymaster,
}; };
} }

@ -19,6 +19,8 @@ export const DeployedCoreAddressesSchema = ProxyFactoryFactoriesSchema.extend({
timelockController: z.string().optional(), timelockController: z.string().optional(),
interchainAccountRouter: z.string(), interchainAccountRouter: z.string(),
interchainAccountIsm: z.string(), interchainAccountIsm: z.string(),
merkleTreeHook: z.string().optional(),
interchainGasPaymaster: z.string().optional(),
}); });
export type DeployedCoreAddresses = z.infer<typeof DeployedCoreAddressesSchema>; export type DeployedCoreAddresses = z.infer<typeof DeployedCoreAddressesSchema>;

Loading…
Cancel
Save