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

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

Merged
merged 3 commits into from
Oct 4, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions typescript/sdk/src/core/EvmCoreModule.hardhat-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
paulbalaji marked this conversation as resolved.
Show resolved Hide resolved
expect(address).to.exist;
expect(address).to.not.equal(constants.AddressZero);
});
Expand Down
20 changes: 19 additions & 1 deletion typescript/sdk/src/core/EvmCoreModule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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';
Expand All @@ -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<
Expand Down Expand Up @@ -315,16 +320,29 @@ 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,
interchainAccountIsm,
validatorAnnounce,
timelockController,
testRecipient,
merkleTreeHook,
interchainGasPaymaster,
};
}

Expand Down
2 changes: 2 additions & 0 deletions typescript/sdk/src/core/schemas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<typeof DeployedCoreAddressesSchema>;
Loading