From f8f042be660f52f5e1820ffe03f05632ce1f62e0 Mon Sep 17 00:00:00 2001 From: Kunal Arora <55632507+aroralanuk@users.noreply.github.com> Date: Fri, 2 Feb 2024 15:18:43 -0500 Subject: [PATCH] feat:removing igp from preset hook config (#3215) ### Description - To simplify the PI deployment, I've removed the igp from preset hook config which PI deployers use if they don't provide a hook config via the CLI. - This means we don't need to deploy IGP or storage gas oracles and the PI deployer can spin up relayer with gas enforcement policy set to false. ### Drive-by changes None ### Related issues None ### Backward compatibility Yes ### Testing Manual --- .changeset/friendly-peas-roll.md | 5 +++ typescript/cli/src/config/hooks.ts | 54 ++---------------------------- typescript/cli/src/deploy/core.ts | 11 +----- 3 files changed, 8 insertions(+), 62 deletions(-) create mode 100644 .changeset/friendly-peas-roll.md diff --git a/.changeset/friendly-peas-roll.md b/.changeset/friendly-peas-roll.md new file mode 100644 index 00000000000..d21ea273ec0 --- /dev/null +++ b/.changeset/friendly-peas-roll.md @@ -0,0 +1,5 @@ +--- +'@hyperlane-xyz/cli': patch +--- + +Removed IGP from preset hook config diff --git a/typescript/cli/src/config/hooks.ts b/typescript/cli/src/config/hooks.ts index 6392d60f952..0c0f49111cc 100644 --- a/typescript/cli/src/config/hooks.ts +++ b/typescript/cli/src/config/hooks.ts @@ -9,10 +9,7 @@ import { GasOracleContractType, HookType, HooksConfig, - MultisigConfig, chainMetadata, - defaultMultisigConfigs, - multisigIsmVerificationCost, } from '@hyperlane-xyz/sdk'; import { Address, @@ -83,41 +80,7 @@ export function isValidHookConfigMap(config: any) { return HooksConfigMapSchema.safeParse(config).success; } -export function presetHookConfigs( - owner: Address, - local: ChainName, - destinationChains: ChainName[], - multisigConfig?: MultisigConfig, -): HooksConfig { - const gasOracleType = destinationChains.reduce< - ChainMap - >((acc, chain) => { - acc[chain] = GasOracleContractType.StorageGasOracle; - return acc; - }, {}); - const overhead = destinationChains.reduce>((acc, chain) => { - let validatorThreshold: number; - let validatorCount: number; - if (multisigConfig) { - validatorThreshold = multisigConfig.threshold; - validatorCount = multisigConfig.validators.length; - } else if (local in defaultMultisigConfigs) { - validatorThreshold = defaultMultisigConfigs[local].threshold; - validatorCount = defaultMultisigConfigs[local].validators.length; - } else { - // default values - // fix here: https://github.com/hyperlane-xyz/issues/issues/773 - validatorThreshold = 2; - validatorCount = 3; - } - acc[chain] = multisigIsmVerificationCost( - validatorThreshold, - validatorCount, - ); - return acc; - }, {}); - - // TODO improve types here to avoid need for `as` casts +export function presetHookConfigs(owner: Address): HooksConfig { return { required: { type: HookType.PROTOCOL_FEE, @@ -127,20 +90,7 @@ export function presetHookConfigs( owner: owner, }, default: { - type: HookType.AGGREGATION, - hooks: [ - { - type: HookType.MERKLE_TREE, - }, - { - type: HookType.INTERCHAIN_GAS_PAYMASTER, - owner: owner, - beneficiary: owner, - gasOracleType, - overhead, - oracleKey: owner, - }, - ], + type: HookType.MERKLE_TREE, }, }; } diff --git a/typescript/cli/src/deploy/core.ts b/typescript/cli/src/deploy/core.ts index 5f9537e132d..6295632aca1 100644 --- a/typescript/cli/src/deploy/core.ts +++ b/typescript/cli/src/deploy/core.ts @@ -328,7 +328,6 @@ async function executeDeploy({ chains, defaultIsms, hooksConfig, - multisigConfigs, ); const coreContracts = await coreDeployer.deploy(coreConfigs); @@ -391,17 +390,9 @@ function buildCoreConfigMap( chains: ChainName[], defaultIsms: ChainMap, hooksConfig: ChainMap, - multisigConfigs: ChainMap, ): ChainMap { return chains.reduce>((config, chain) => { - const hooks = - hooksConfig[chain] ?? - presetHookConfigs( - owner, - chain, - chains.filter((c) => c !== chain), - multisigConfigs[chain], // if no multisig config, uses default 2/3 - ); + const hooks = hooksConfig[chain] ?? presetHookConfigs(owner); config[chain] = { owner, defaultIsm: defaultIsms[chain],