fix: reuse default validators for CLI (#2922)
### Description - if the default multisig config contains the config for the chain we want to deploy on and we've not explicitiy provided a config, the CLI will use the default config ### Drive-by changes - ignoring the ismType in `multisig-ism.yaml` and deploying messageIdMultisig for all multisig configs provided indiscriminately. Also, added a note regarding this in the `example/multisig-ism.yaml` file. (otherwise we end up using `MultisigIsmConfig` and `MultisigConfig` interchangeably like in the `buildIgpConfig` which leads to confusion) **NOTE**: this doesn't affect our inability to not deploy the same multisig with different types for different remote chains because the config provided is origin specific, eg, you cannot use goerli multisig as messageId for arbitrumsepolia and for scrollsepolia as merkleRoot. - moved `buildMultisigIsmConfigs` to sdk as an effort to dedupe the two variations in infra and cli. ### Related issues - aimed at https://github.com/hyperlane-xyz/issues/issues/530#issuecomment-1802766305 ### Backward compatibility Yes ### Testing Manual --------- Co-authored-by: Trevor Porter <trkporter@ucdavis.edu> Co-authored-by: Daniel Savu <23065004+daniel-savu@users.noreply.github.com> Co-authored-by: J M Rossy <jm.rossy@gmail.com> Co-authored-by: Nam Chu Hoai <nambrot@googlemail.com> Co-authored-by: Rohan Shrothrium <shrothriumrohan@gmail.com> Co-authored-by: Rohan Shrothrium <rohan.shrothrium@intellecteu.com> Co-authored-by: Mattie Conover <git@mconover.dev> Co-authored-by: Yorke Rhodes <yorke@hyperlane.xyz>pull/2923/head
parent
00a91f8e68
commit
69d87c90c0
@ -0,0 +1,27 @@ |
||||
import { objFilter, objMap } from '@hyperlane-xyz/utils'; |
||||
|
||||
import { ChainMap, ChainName } from '../types'; |
||||
|
||||
import { MultisigConfig, MultisigIsmConfig } from './types'; |
||||
|
||||
// build multisigIsmConfig from multisigConfig
|
||||
// eg. for { sepolia (local), arbitrumsepolia, scrollsepolia }
|
||||
// arbitrumsepolia => Ism, scrollsepolia => Ism
|
||||
export const buildMultisigIsmConfigs = ( |
||||
type: MultisigIsmConfig['type'], |
||||
local: ChainName, |
||||
chains: ChainName[], |
||||
multisigConfigs: ChainMap<MultisigConfig>, |
||||
): ChainMap<MultisigIsmConfig> => { |
||||
return objMap( |
||||
objFilter( |
||||
multisigConfigs, |
||||
(chain, config): config is MultisigConfig => |
||||
chain !== local && chains.includes(chain), |
||||
), |
||||
(_, config) => ({ |
||||
...config, |
||||
type, |
||||
}), |
||||
); |
||||
}; |
Loading…
Reference in new issue