Skip to content

Commit

Permalink
feat: add validator operator aliases to default multisig config (#4896)
Browse files Browse the repository at this point in the history
### Description

feat: add validator operator aliases to default multisig config

tldr:
updated this type and anywhere it's been used

![image](https://github.com/user-attachments/assets/ab055c4f-2fef-4513-a0ff-c574021859c8)

- updates `MultisigConfig.validators` type from Address[] to
ValidatorConfig[]
- `ValidatorConfig` includes both an address + an alias, to be able to
track the operator aliases in-code
- update any usage of `defaultMultisigConfigs` and `MultisigConfig` type
- add `multisigConfigToIsmConfig` helper method to easily convert to
`MultisigIsmConfig` format (ie. no aliases)

this will simplify the logic in
#4774, and
enable us to auto-generate the default ISMs docs page after an SDK
update

### Drive-by changes

<!--
Are there any minor or drive-by changes also included?
-->

### Related issues

<!--
- Fixes #[issue number here]
-->

### Backward compatibility

<!--
Are these changes backward compatible? Are there any infrastructure
implications, e.g. changes that would prohibit deploying older commits
using this infra tooling?

Yes/No
-->

### Testing

- added extra tests to ensure address/aliases are somewhat sound
- `yarn tsx scripts/check/check-validator-announce.ts -e mainnet3` still
looks good

---------

Signed-off-by: pbio <[email protected]>
  • Loading branch information
paulbalaji authored Nov 27, 2024
1 parent e32ee59 commit 4b35374
Show file tree
Hide file tree
Showing 16 changed files with 1,275 additions and 457 deletions.
6 changes: 6 additions & 0 deletions .changeset/four-meals-cheat.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@hyperlane-xyz/cli': minor
'@hyperlane-xyz/sdk': minor
---

Changed the type of defaultMultisigConfigs, to track validator aliases in addition to their addresses.
6 changes: 3 additions & 3 deletions typescript/cli/src/config/multisig.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { confirm, input } from '@inquirer/prompts';
import { z } from 'zod';

import { ChainMap, MultisigConfig, ZHash } from '@hyperlane-xyz/sdk';
import { ChainMap, MultisigIsmConfig, ZHash } from '@hyperlane-xyz/sdk';
import {
Address,
isValidAddress,
Expand Down Expand Up @@ -33,7 +33,7 @@ export function readMultisigConfig(filePath: string) {
);
}
const parsedConfig = result.data;
const formattedConfig: ChainMap<MultisigConfig> = objMap(
const formattedConfig: ChainMap<Omit<MultisigIsmConfig, 'type'>> = objMap(
parsedConfig,
(_, config) => {
if (config.threshold > config.validators.length)
Expand All @@ -50,7 +50,7 @@ export function readMultisigConfig(filePath: string) {
return {
threshold: config.threshold,
validators: validators,
} as MultisigConfig;
};
},
);
logGreen(`All multisig configs in ${filePath} are valid`);
Expand Down
13 changes: 5 additions & 8 deletions typescript/infra/config/environments/mainnet3/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {
ProtocolFeeHookConfig,
RoutingIsmConfig,
defaultMultisigConfigs,
multisigConfigToIsmConfig,
} from '@hyperlane-xyz/sdk';
import { Address, objMap } from '@hyperlane-xyz/utils';

Expand All @@ -32,15 +33,11 @@ export const core: ChainMap<CoreConfig> = objMap(
.map((origin) => [origin, defaultMultisigConfigs[origin]]),
);

const merkleRoot = (multisig: MultisigConfig): MultisigIsmConfig => ({
type: IsmType.MERKLE_ROOT_MULTISIG,
...multisig,
});
const merkleRoot = (multisig: MultisigConfig): MultisigIsmConfig =>
multisigConfigToIsmConfig(IsmType.MERKLE_ROOT_MULTISIG, multisig);

const messageIdIsm = (multisig: MultisigConfig): MultisigIsmConfig => ({
type: IsmType.MESSAGE_ID_MULTISIG,
...multisig,
});
const messageIdIsm = (multisig: MultisigConfig): MultisigIsmConfig =>
multisigConfigToIsmConfig(IsmType.MESSAGE_ID_MULTISIG, multisig);

const routingIsm: RoutingIsmConfig = {
type: IsmType.ROUTING,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {
ChainMap,
IsmType,
MultisigConfig,
TokenRouterConfig,
TokenType,
buildAggregationIsmConfigs,
Expand Down Expand Up @@ -42,89 +43,125 @@ const xERC20: Record<(typeof chainsToDeploy)[number], string> = {
sei: '0x6DCfbF4729890043DFd34A93A2694E5303BA2703', // redEth
};

export const ezEthValidators = {
export const ezEthValidators: ChainMap<MultisigConfig> = {
arbitrum: {
threshold: 1,
validators: [
'0x9bccfad3bd12ef0ee8ae839dd9ed7835bccadc9d', // Everclear
'0xc27032c6bbd48c20005f552af3aaa0dbf14260f3', // Renzo
{
address: '0x9bccfad3bd12ef0ee8ae839dd9ed7835bccadc9d',
alias: 'Everclear',
},
{ address: '0xc27032c6bbd48c20005f552af3aaa0dbf14260f3', alias: 'Renzo' },
],
},
optimism: {
threshold: 1,
validators: [
'0x6f4cb8e96db5d44422a4495faa73fffb9d30e9e2', // Everclear
'0xe2593d205f5e7f74a50fa900824501084e092ebd', // Renzo
{
address: '0x6f4cb8e96db5d44422a4495faa73fffb9d30e9e2',
alias: 'Everclear',
},
{ address: '0xe2593d205f5e7f74a50fa900824501084e092ebd', alias: 'Renzo' },
],
},
base: {
threshold: 1,
validators: [
'0x25ba4ee5268cbfb8d69bac531aa10368778702bd', // Renzo
'0x9ec803b503e9c7d2611e231521ef3fde73f7a21c', // Everclear
{ address: '0x25ba4ee5268cbfb8d69bac531aa10368778702bd', alias: 'Renzo' },
{
address: '0x9ec803b503e9c7d2611e231521ef3fde73f7a21c',
alias: 'Everclear',
},
],
},
blast: {
threshold: 1,
validators: [
'0x1652d8ba766821cf01aeea34306dfc1cab964a32', // Everclear
'0x54bb0036f777202371429e062fe6aee0d59442f9', // Renzo
{
address: '0x1652d8ba766821cf01aeea34306dfc1cab964a32',
alias: 'Everclear',
},
{ address: '0x54bb0036f777202371429e062fe6aee0d59442f9', alias: 'Renzo' },
],
},
bsc: {
threshold: 1,
validators: [
'0x3156db97a3b3e2dcc3d69fddfd3e12dc7c937b6d', // Renzo
'0x9a0326c43e4713ae2477f09e0f28ffedc24d8266', // Everclear
{ address: '0x3156db97a3b3e2dcc3d69fddfd3e12dc7c937b6d', alias: 'Renzo' },
{
address: '0x9a0326c43e4713ae2477f09e0f28ffedc24d8266',
alias: 'Everclear',
},
],
},
mode: {
threshold: 1,
validators: [
'0x456fbbe05484fc9f2f38ea09648424f54d6872be', // Everclear
'0x7e29608c6e5792bbf9128599ca309be0728af7b4', // Renzo
{
address: '0x456fbbe05484fc9f2f38ea09648424f54d6872be',
alias: 'Everclear',
},
{ address: '0x7e29608c6e5792bbf9128599ca309be0728af7b4', alias: 'Renzo' },
],
},
linea: {
threshold: 1,
validators: [
'0x06a5a2a429560034d38bf62ca6d470942535947e', // Everclear
'0xcb3e44edd2229860bdbaa58ba2c3817d111bee9a', // Renzo
{
address: '0x06a5a2a429560034d38bf62ca6d470942535947e',
alias: 'Everclear',
},
{ address: '0xcb3e44edd2229860bdbaa58ba2c3817d111bee9a', alias: 'Renzo' },
],
},
ethereum: {
threshold: 1,
validators: [
'0x1fd889337f60986aa57166bc5ac121efd13e4fdd', // Everclear
'0xc7f7b94a6baf2fffa54dfe1dde6e5fcbb749e04f', // Renzo
{
address: '0x1fd889337f60986aa57166bc5ac121efd13e4fdd',
alias: 'Everclear',
},
{ address: '0xc7f7b94a6baf2fffa54dfe1dde6e5fcbb749e04f', alias: 'Renzo' },
],
},
fraxtal: {
threshold: 1,
validators: [
'0x25b3a88f7cfd3c9f7d7e32b295673a16a6ddbd91', // luganodes
'0xe986f457965227a05dcf984c8d0c29e01253c44d', // Renzo
{
address: '0x25b3a88f7cfd3c9f7d7e32b295673a16a6ddbd91',
alias: 'Luganodes',
},
{ address: '0xe986f457965227a05dcf984c8d0c29e01253c44d', alias: 'Renzo' },
],
},
zircuit: {
threshold: 1,
validators: [
'0x1da9176c2ce5cc7115340496fa7d1800a98911ce', // Renzo
'0x7ac6584c068eb2a72d4db82a7b7cd5ab34044061', // luganodes
{ address: '0x1da9176c2ce5cc7115340496fa7d1800a98911ce', alias: 'Renzo' },
{
address: '0x7ac6584c068eb2a72d4db82a7b7cd5ab34044061',
alias: 'Luganodes',
},
],
},
taiko: {
threshold: 1,
validators: [
'0x2f007c82672f2bb97227d4e3f80ac481bfb40a2a', // luganodes
'0xd4F6000d8e1108bd4998215d51d5dF559BdB43a1', // Renzo
{
address: '0x2f007c82672f2bb97227d4e3f80ac481bfb40a2a',
alias: 'Luganodes',
},
{ address: '0xd4F6000d8e1108bd4998215d51d5dF559BdB43a1', alias: 'Renzo' },
],
},
sei: {
threshold: 1,
validators: [
'0x7a0f4a8672f603e0c12468551db03f3956d10910', // luganodes
'0x952df7f0cb8611573a53dd7cbf29768871d9f8b0', // Renzo
{
address: '0x7a0f4a8672f603e0c12468551db03f3956d10910',
alias: 'Luganodes',
},
{ address: '0x952df7f0cb8611573a53dd7cbf29768871d9f8b0', alias: 'Renzo' },
],
},
};
Expand Down
13 changes: 5 additions & 8 deletions typescript/infra/config/environments/testnet4/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {
ProtocolFeeHookConfig,
RoutingIsmConfig,
defaultMultisigConfigs,
multisigConfigToIsmConfig,
} from '@hyperlane-xyz/sdk';
import { Address, ProtocolType, objMap } from '@hyperlane-xyz/utils';

Expand All @@ -35,15 +36,11 @@ export const core: ChainMap<CoreConfig> = objMap(
.map((origin) => [origin, defaultMultisigConfigs[origin]]),
);

const merkleRoot = (multisig: MultisigConfig): MultisigIsmConfig => ({
type: IsmType.MERKLE_ROOT_MULTISIG,
...multisig,
});
const merkleRoot = (multisig: MultisigConfig): MultisigIsmConfig =>
multisigConfigToIsmConfig(IsmType.MERKLE_ROOT_MULTISIG, multisig);

const messageIdIsm = (multisig: MultisigConfig): MultisigIsmConfig => ({
type: IsmType.MESSAGE_ID_MULTISIG,
...multisig,
});
const messageIdIsm = (multisig: MultisigConfig): MultisigIsmConfig =>
multisigConfigToIsmConfig(IsmType.MESSAGE_ID_MULTISIG, multisig);

const routingIsm: RoutingIsmConfig = {
type: IsmType.ROUTING,
Expand Down
6 changes: 2 additions & 4 deletions typescript/infra/config/multisigIsm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
MultisigIsmConfig,
buildMultisigIsmConfigs,
defaultMultisigConfigs,
multisigConfigToIsmConfig,
} from '@hyperlane-xyz/sdk';

import { DeployEnvironment } from '../src/config/environment.js';
Expand Down Expand Up @@ -40,8 +41,5 @@ export const multisigIsm = (
? rcMultisigIsmConfigs
: defaultMultisigConfigs;

return {
...configs[remote],
type,
};
return multisigConfigToIsmConfig(type, configs[remote]);
};
Loading

0 comments on commit 4b35374

Please sign in to comment.