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

feat: update warp remote router schema #4948

Merged
merged 63 commits into from
Dec 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
c675dbb
feat(sdk): updated the RouterConfigSchema to have an optional proxyAd…
xeno097 Oct 21, 2024
b978591
refactor(sdk): defined the DeployedOwnableConfig and DeployedOwnableS…
xeno097 Oct 21, 2024
747b008
feat(sdk): updated the EvmWarpReader to add a fetchAdminProxyData met…
xeno097 Oct 21, 2024
85843da
feat(sdk): added the updateProxyAdminOwnershipTxs method to the EvmE…
xeno097 Oct 21, 2024
a55dc01
feat(cli): implemented the setExistingProxyAdmin to promt users to us…
xeno097 Oct 21, 2024
e8e9fc0
Merge branch 'main' of github.com:hyperlane-xyz/hyperlane-monorepo in…
xeno097 Oct 21, 2024
b192810
Merge branch 'main' of github.com:hyperlane-xyz/hyperlane-monorepo in…
xeno097 Oct 22, 2024
50d2047
docs(changeset): Add optional proxy admin reuse in warp route deploym…
xeno097 Oct 22, 2024
552bbb5
chore: paul pr review suggestion
xeno097 Oct 22, 2024
8082d17
fix(sdk): fixed methdo cann for fetchProxyAdminConfig
xeno097 Oct 22, 2024
cf5f0aa
feat(cli): added proxy admin and ica router ownership configurability…
xeno097 Oct 23, 2024
9440e50
feat(sdk): updated the EvmCoreModule.deploy method to check if the co…
xeno097 Oct 23, 2024
a8f4683
Merge branch 'main' of github.com:hyperlane-xyz/hyperlane-monorepo in…
xeno097 Oct 23, 2024
62c2067
chore: lee pr review changes + e2e test fix for warp route apply
xeno097 Oct 24, 2024
a03e1d0
Merge branch 'main' of github.com:hyperlane-xyz/hyperlane-monorepo in…
xeno097 Oct 24, 2024
c59ad8b
fix(sdk): fixed deriveTokenMetadata return value to exlcude fields no…
xeno097 Oct 24, 2024
7fc834d
Merge branch 'main' of github.com:hyperlane-xyz/hyperlane-monorepo in…
xeno097 Oct 24, 2024
7c5d84d
Merge branch 'xeno/warp-deploy-apply-ownership-fixes' of github.com:h…
xeno097 Oct 24, 2024
e396abc
feat(sdk): updated the EvmCoreReader to fetch the admin proxy data fo…
xeno097 Oct 24, 2024
cca3416
refactor(sdk): implemented the proxyAdminOwnershipUpdateTxs to dedup …
xeno097 Oct 25, 2024
1c8c682
test(cli): implemented testing utils for core commands testing
xeno097 Oct 25, 2024
3623d06
refactor(sdk,infra): remvoed duplicated impls of randomAddress
xeno097 Oct 25, 2024
86178c9
test(cli): updated the test e2e script to also run a anvil 1 chain on…
xeno097 Oct 25, 2024
cdadfe4
test(cli): added e2e tests for the hyperlane core commands
xeno097 Oct 25, 2024
16f9b46
Merge branch 'main' of github.com:hyperlane-xyz/hyperlane-monorepo in…
xeno097 Oct 25, 2024
7c48117
Merge branch 'main' of github.com:hyperlane-xyz/hyperlane-monorepo in…
xeno097 Oct 25, 2024
300af54
Merge branch 'xeno/warp-deploy-apply-ownership-fixes' of github.com:h…
xeno097 Oct 25, 2024
46c1dfb
refactor(cli): removed ica router proxy admin setting from core init …
xeno097 Oct 25, 2024
d58f6a7
docs(changeset): Add support for updating the mailbox proxy admin owner
xeno097 Oct 25, 2024
852405b
feat(sdk): implemented a basic version of the EvmIcaRouterReader
xeno097 Oct 30, 2024
5690926
feat(sdk): updated the deriveConfig from the EvmIcaReader to include …
xeno097 Oct 31, 2024
07cb36f
feat(sdk): started working on the EvmIcaModule.update method
xeno097 Oct 31, 2024
3a27a5a
Merge branch 'main' of github.com:hyperlane-xyz/hyperlane-monorepo in…
xeno097 Oct 31, 2024
16a18ab
feat(sdk,cli): started working on the actual logic for enrolling remo…
xeno097 Oct 31, 2024
e7a37c4
reafactor(sdk): implemented the _getEnrollRemoteIcaRoutersTxs
xeno097 Nov 1, 2024
4a7798d
Merge branch 'main' of github.com:hyperlane-xyz/hyperlane-monorepo in…
xeno097 Nov 1, 2024
1e7c304
chore: fix main merge dup code
xeno097 Nov 1, 2024
05d0275
feat(sdk,cli): completed base logic to enroll remote ica in core appl…
xeno097 Nov 1, 2024
872cb39
chore: lee pr changes
xeno097 Nov 1, 2024
f204163
test: maybe fix e2e test issues
xeno097 Nov 2, 2024
30cd02e
feat(sdk,cli): added logic to update proxy admin contract + test
xeno097 Nov 4, 2024
7798c00
fix: maybe fix e2e test part 3
xeno097 Nov 4, 2024
0986cd7
Merge branch 'xeno/core-deploy-apply-admin-proxy-ownership-fixes' of …
xeno097 Nov 5, 2024
60d8b8e
chore: self pr review changes + enroll/unenroll ica routers e2e tests
xeno097 Nov 5, 2024
fe6bb93
chore: self review part 2
xeno097 Nov 5, 2024
072fdb4
docs(changeset): Add ICAs management in core apply command
xeno097 Nov 5, 2024
516fac5
chore: self review part 3
xeno097 Nov 5, 2024
52936e1
Merge branch 'main' of github.com:hyperlane-xyz/hyperlane-monorepo in…
xeno097 Nov 7, 2024
09a918d
Merge branch 'xeno/core-deploy-apply-admin-proxy-ownership-fixes' of …
xeno097 Nov 7, 2024
53bd418
Merge branch 'main' of github.com:hyperlane-xyz/hyperlane-monorepo in…
xeno097 Nov 8, 2024
e3eee6f
Merge branch 'main' of github.com:hyperlane-xyz/hyperlane-monorepo in…
xeno097 Nov 11, 2024
84b7a4a
test(cli): increased hyp core test timeout for fixing ci
xeno097 Nov 11, 2024
2d13a2a
Merge branch 'main' of github.com:hyperlane-xyz/hyperlane-monorepo in…
xeno097 Nov 14, 2024
a072e66
fix(sdk): replaced getChainId call with getEvmChainId in ica module
xeno097 Nov 14, 2024
86c154b
Merge branch 'main' of github.com:hyperlane-xyz/hyperlane-monorepo in…
xeno097 Nov 27, 2024
73ef242
Merge branch 'main' of github.com:hyperlane-xyz/hyperlane-monorepo in…
xeno097 Nov 27, 2024
3c4be47
Merge branch 'main' of github.com:hyperlane-xyz/hyperlane-monorepo in…
xeno097 Nov 29, 2024
6323444
feat(sdk): made the interchain account prop optional in the dervied c…
xeno097 Nov 29, 2024
eaccbda
Merge branch 'main' of github.com:hyperlane-xyz/hyperlane-monorepo in…
xeno097 Dec 4, 2024
a21352c
refactor(cli,sdk): updated the warp route remote routers schema
xeno097 Dec 4, 2024
3ab922f
refactor(sdk): updated ica remote routes to use the remore router rou…
xeno097 Dec 4, 2024
fe5fde4
Merge branch 'main' of github.com:hyperlane-xyz/hyperlane-monorepo in…
xeno097 Dec 4, 2024
ca17ebb
docs(changeset): updates the warp deployment config schema to be clos…
xeno097 Dec 4, 2024
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
6 changes: 6 additions & 0 deletions .changeset/silver-peas-mate.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@hyperlane-xyz/cli': minor
'@hyperlane-xyz/sdk': minor
---

updates the warp deployment config schema to be closer to the ica routing schema
5 changes: 3 additions & 2 deletions typescript/cli/src/deploy/warp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -731,8 +731,9 @@ async function enrollRemoteRouters(

mutatedWarpRouteConfig.remoteRouters =
otherChains.reduce<RemoteRouters>((remoteRouters, otherChain) => {
remoteRouters[multiProvider.getDomainId(otherChain)] =
deployedRoutersAddresses[otherChain];
remoteRouters[multiProvider.getDomainId(otherChain)] = {
address: deployedRoutersAddresses[otherChain],
};
return remoteRouters;
}, {});

Expand Down
26 changes: 10 additions & 16 deletions typescript/sdk/src/ica/schemas.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
import { z } from 'zod';

import { ZHash } from '../metadata/customZodTypes.js';
import { RemoteRouterDomain, RemoteRouterRouter } from '../router/types.js';
import { DerivedOwnableSchema } from '../schemas.js';

export const RemoteIcaRouterConfigSchema = z.record(
z.string(),
z.object({
address: ZHash,
interchainSecurityModule: ZHash.optional(),
}),
RemoteRouterDomain,
RemoteRouterRouter.merge(
z.object({
interchainSecurityModule: ZHash.optional().describe(
'Optional ISM override to be used on the chain',
),
}),
),
);

export const IcaRouterConfigSchema = z.object({
Expand All @@ -21,23 +25,13 @@ export const IcaRouterConfigSchema = z.object({
remoteIcaRouters: RemoteIcaRouterConfigSchema.optional(),
});

export const DerivedRemoteIcaRouterConfigSchema = z.record(
z.string(),
z.object({
address: ZHash,
interchainSecurityModule: ZHash.optional().describe(
'Optional ISM override to be used on the chain',
),
}),
);

export const DerivedIcaRouterConfigSchema = DerivedOwnableSchema.merge(
z
.object({
owner: ZHash,
mailbox: ZHash,
proxyAdmin: DerivedOwnableSchema,
remoteIcaRouters: DerivedRemoteIcaRouterConfigSchema,
remoteIcaRouters: RemoteIcaRouterConfigSchema,
})
.strict(),
);
6 changes: 4 additions & 2 deletions typescript/sdk/src/router/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,10 @@ export const ForeignDeploymentConfigSchema = z.object({
foreignDeployment: z.string().optional(),
});

const RemoteRouterDomain = z.string();
const RemoteRouterRouter = z.string().startsWith('0x');
export const RemoteRouterDomain = z.string();
export const RemoteRouterRouter = z.object({
address: z.string().startsWith('0x'),
});
export const RemoteRoutersSchema = z.record(
RemoteRouterDomain,
RemoteRouterRouter,
Expand Down
12 changes: 9 additions & 3 deletions typescript/sdk/src/token/EvmERC20WarpModule.hardhat-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ import { TokenRouterConfig } from './schemas.js';
const randomRemoteRouters = (n: number) => {
const routers: RemoteRouters = {};
for (let domain = 0; domain < n; domain++) {
routers[domain] = randomAddress();
routers[domain] = {
address: randomAddress(),
};
}
return routers;
};
Expand Down Expand Up @@ -580,7 +582,9 @@ describe('EvmERC20WarpHyperlaneModule', async () => {
txs = await evmERC20WarpModule.update({
...config,
remoteRouters: {
3: randomAddress(),
3: {
address: randomAddress(),
},
},
});

Expand Down Expand Up @@ -679,7 +683,9 @@ describe('EvmERC20WarpHyperlaneModule', async () => {
...baseConfig,
type: TokenType.native,
remoteRouters: {
[domain]: randomAddress(),
[domain]: {
address: randomAddress(),
},
},
};

Expand Down
23 changes: 17 additions & 6 deletions typescript/sdk/src/token/EvmERC20WarpModule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,14 +145,25 @@ export class EvmERC20WarpModule extends HyperlaneModule<
return [];
}

// We normalize the addresses for comparison
actualConfig.remoteRouters = normalizeConfig(actualConfig.remoteRouters);
expectedConfig.remoteRouters = normalizeConfig(
expectedConfig.remoteRouters,
);
assert(actualConfig.remoteRouters, 'actualRemoteRouters is undefined');
assert(expectedConfig.remoteRouters, 'actualRemoteRouters is undefined');

// We normalize the addresses for comparison
actualConfig.remoteRouters = Object.fromEntries(
Object.entries(actualConfig.remoteRouters).map(([key, value]) => [
key,
// normalizeConfig removes the address property but we don't want to lose that info
{ ...normalizeConfig(value), address: normalizeConfig(value.address) },
]),
);
expectedConfig.remoteRouters = Object.fromEntries(
Object.entries(expectedConfig.remoteRouters).map(([key, value]) => [
key,
// normalizeConfig removes the address property but we don't want to lose that info
{ ...normalizeConfig(value), address: normalizeConfig(value.address) },
]),
);

const { remoteRouters: actualRemoteRouters } = actualConfig;
const { remoteRouters: expectedRemoteRouters } = expectedConfig;

Expand All @@ -171,7 +182,7 @@ export class EvmERC20WarpModule extends HyperlaneModule<
[
Object.keys(expectedRemoteRouters).map((k) => Number(k)),
Object.values(expectedRemoteRouters).map((a) =>
addressToBytes32(a),
addressToBytes32(a.address),
),
],
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ describe('ERC20WarpRouterReader', async () => {
);
expect(Object.keys(derivedConfig.remoteRouters!).length).to.equal(1);
expect(
derivedConfig.remoteRouters![otherChainMetadata.domainId!],
derivedConfig.remoteRouters![otherChainMetadata.domainId!].address,
).to.be.equal(warpRoute[otherChain].collateral.address);
});
});
15 changes: 12 additions & 3 deletions typescript/sdk/src/token/EvmERC20WarpRouteReader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,11 @@ import { DeployedOwnableConfig } from '../deploy/types.js';
import { EvmHookReader } from '../hook/EvmHookReader.js';
import { EvmIsmReader } from '../ism/EvmIsmReader.js';
import { MultiProvider } from '../providers/MultiProvider.js';
import { DestinationGas, RemoteRouters } from '../router/types.js';
import {
DestinationGas,
RemoteRouters,
RemoteRoutersSchema,
} from '../router/types.js';
import { ChainNameOrId } from '../types.js';
import { HyperlaneReader } from '../utils/HyperlaneReader.js';

Expand Down Expand Up @@ -267,13 +271,18 @@ export class EvmERC20WarpRouteReader extends HyperlaneReader {
);
const domains = await warpRoute.domains();

return Object.fromEntries(
const routers = Object.fromEntries(
await Promise.all(
domains.map(async (domain) => {
return [domain, bytes32ToAddress(await warpRoute.routers(domain))];
return [
domain,
{ address: bytes32ToAddress(await warpRoute.routers(domain)) },
];
}),
),
);

return RemoteRoutersSchema.parse(routers);
}

async fetchProxyAdminConfig(
Expand Down
Loading