Skip to content

Commit

Permalink
Merge branch 'main' into rossy/codespell
Browse files Browse the repository at this point in the history
  • Loading branch information
jmrossy authored Mar 26, 2024
2 parents 80725fe + 7913d72 commit a43d113
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 11 deletions.
3 changes: 2 additions & 1 deletion typescript/sdk/src/core/CoreDeployer.hardhat-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,8 @@ describe('core', async () => {

// 3x1 for aggregation ISM deploy
// 3x1 for setting ISM transaction for mailbox
const numTransactions = 2 * TestChains.length;
// 3x1 for setting ISM transaction for test recipient
const numTransactions = 3 * TestChains.length;
const nonceAfter = await signer.getTransactionCount();
expect(nonceAfter).to.equal(nonceBefore + numTransactions);
});
Expand Down
6 changes: 4 additions & 2 deletions typescript/sdk/src/core/HyperlaneCoreDeployer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,6 @@ export class HyperlaneCoreDeployer extends HyperlaneDeployer<
chain: ChainName,
interchainSecurityModule?: IsmConfig,
): Promise<TestRecipient> {
this.testRecipient.cacheAddressesMap(this.cachedAddresses);
const testRecipient = await this.testRecipient.deployContracts(chain, {
interchainSecurityModule,
});
Expand Down Expand Up @@ -249,7 +248,10 @@ export class HyperlaneCoreDeployer extends HyperlaneDeployer<
};
}

const testRecipient = await this.deployTestRecipient(chain);
const testRecipient = await this.deployTestRecipient(
chain,
this.cachedAddresses[chain].interchainSecurityModule,
);

const contracts = {
mailbox,
Expand Down
7 changes: 6 additions & 1 deletion typescript/sdk/src/core/TestRecipientDeployer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ export const testRecipientFactories = {
testRecipient: new TestRecipient__factory(),
};

// TODO move this and related configs to the SDK
export class TestRecipientDeployer extends HyperlaneDeployer<
TestRecipientConfig,
typeof testRecipientFactories
Expand All @@ -45,15 +44,21 @@ export class TestRecipientDeployer extends HyperlaneDeployer<
chain: ChainName,
config: TestRecipientConfig,
): Promise<TestRecipientContracts> {
this.logger(`Deploying TestRecipient on ${chain}`, config);
const testRecipient = await this.deployContract(chain, 'testRecipient', []);
if (config.interchainSecurityModule) {
this.logger(`Checking TestRecipient ISM on ${chain}`);
await this.configureIsm(
chain,
testRecipient,
config.interchainSecurityModule,
(tr) => tr.interchainSecurityModule(),
(tr, ism) => tr.populateTransaction.setInterchainSecurityModule(ism),
);
} else {
this.logger(
`WARNING: No ISM config provided for TestRecipient on ${chain}`,
);
}
return {
testRecipient,
Expand Down
15 changes: 8 additions & 7 deletions typescript/sdk/src/deploy/HyperlaneDeployer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -659,18 +659,19 @@ export abstract class HyperlaneDeployer<
const current = await ownable.owner();
const owner = config.ownerOverrides?.[contractName as K] ?? config.owner;
if (!eqAddress(current, owner)) {
this.logger(
`Transferring ownership of ${contractName} to ${owner} on ${chain}`,
);
const receipt = await this.runIfOwner(chain, ownable, () =>
this.multiProvider.handleTx(
this.logger('Current owner and config owner to not match');
const receipt = await this.runIfOwner(chain, ownable, () => {
this.logger(
`Transferring ownership of ${contractName} to ${owner} on ${chain}`,
);
return this.multiProvider.handleTx(
chain,
ownable.transferOwnership(
owner,
this.multiProvider.getTransactionOverrides(chain),
),
),
);
);
});
if (receipt) receipts.push(receipt);
}
}
Expand Down

0 comments on commit a43d113

Please sign in to comment.