From efa9025f5ece51efe6f6b08ae39601c2f1bca493 Mon Sep 17 00:00:00 2001 From: Mohammed Hussan Date: Wed, 5 Jun 2024 10:12:34 +0100 Subject: [PATCH] chore(infra): Remove RpcConsensusType usage in infra now that SmartProvider is used instead (#3882) ### Description Removed references to RpcConsensusType where TS-based providers are used in infra ### Drive-by changes ### Related issues ### Backward compatibility ### Testing --- .../config/environments/mainnet3/funding.ts | 3 --- .../environments/mainnet3/helloworld.ts | 4 --- .../config/environments/mainnet3/index.ts | 2 -- .../environments/mainnet3/liquidityLayer.ts | 2 -- .../config/environments/testnet4/funding.ts | 3 --- .../environments/testnet4/helloworld.ts | 4 --- .../config/environments/testnet4/index.ts | 2 -- .../environments/testnet4/middleware.ts | 3 --- .../helloworld-kathy/templates/_helpers.tpl | 4 --- .../helm/key-funder/templates/cron-job.yaml | 4 --- .../templates/circle-relayer-deployment.yaml | 4 --- .../templates/portal-relayer-deployment.yaml | 4 --- typescript/infra/scripts/agent-utils.ts | 1 - .../scripts/agents/update-agent-config.ts | 1 - .../funding/fund-keys-from-deployer.ts | 7 ------ typescript/infra/scripts/helloworld/kathy.ts | 13 ---------- typescript/infra/scripts/helloworld/utils.ts | 5 ---- typescript/infra/src/config/chain.ts | 25 +++++-------------- typescript/infra/src/config/environment.ts | 2 -- typescript/infra/src/config/funding.ts | 3 +-- .../infra/src/config/helloworld/types.ts | 3 +-- typescript/infra/src/config/middleware.ts | 3 --- typescript/infra/src/funding/key-funder.ts | 1 - typescript/infra/src/helloworld/kathy.ts | 1 - .../src/middleware/liquidity-layer-relayer.ts | 1 - 25 files changed, 8 insertions(+), 97 deletions(-) diff --git a/typescript/infra/config/environments/mainnet3/funding.ts b/typescript/infra/config/environments/mainnet3/funding.ts index 80c0efc97..25e01b03d 100644 --- a/typescript/infra/config/environments/mainnet3/funding.ts +++ b/typescript/infra/config/environments/mainnet3/funding.ts @@ -1,5 +1,3 @@ -import { RpcConsensusType } from '@hyperlane-xyz/sdk'; - import { KeyFunderConfig } from '../../../src/config/funding.js'; import { Role } from '../../../src/roles.js'; import { Contexts } from '../../contexts.js'; @@ -23,7 +21,6 @@ export const keyFunderConfig: KeyFunderConfig = { [Contexts.Hyperlane]: [Role.Relayer, Role.Kathy], [Contexts.ReleaseCandidate]: [Role.Relayer, Role.Kathy], }, - connectionType: RpcConsensusType.Fallback, // desired balance config desiredBalancePerChain: { arbitrum: '0.5', diff --git a/typescript/infra/config/environments/mainnet3/helloworld.ts b/typescript/infra/config/environments/mainnet3/helloworld.ts index 4f15ba912..0df01f1d7 100644 --- a/typescript/infra/config/environments/mainnet3/helloworld.ts +++ b/typescript/infra/config/environments/mainnet3/helloworld.ts @@ -1,5 +1,3 @@ -import { RpcConsensusType } from '@hyperlane-xyz/sdk'; - import { HelloWorldConfig, HelloWorldKathyRunMode, @@ -26,7 +24,6 @@ export const hyperlane: HelloWorldConfig = { }, messageSendTimeout: 1000 * 60 * 8, // 8 min messageReceiptTimeout: 1000 * 60 * 20, // 20 min - connectionType: RpcConsensusType.Fallback, cyclesBetweenEthereumMessages: 1, // Skip 1 cycle of Ethereum, i.e. send/receive Ethereum messages every 5 days (not great since we still send like 12 in that cycle) }, }; @@ -46,7 +43,6 @@ export const releaseCandidate: HelloWorldConfig = { }, messageSendTimeout: 1000 * 60 * 8, // 8 min messageReceiptTimeout: 1000 * 60 * 20, // 20 min - connectionType: RpcConsensusType.Fallback, }, }; diff --git a/typescript/infra/config/environments/mainnet3/index.ts b/typescript/infra/config/environments/mainnet3/index.ts index 6a765693f..94c76e53a 100644 --- a/typescript/infra/config/environments/mainnet3/index.ts +++ b/typescript/infra/config/environments/mainnet3/index.ts @@ -1,5 +1,4 @@ import { IRegistry } from '@hyperlane-xyz/registry'; -import { RpcConsensusType } from '@hyperlane-xyz/sdk'; import { getKeysForRole, @@ -42,7 +41,6 @@ export const environment: EnvironmentConfig = { getMultiProvider: async ( context: Contexts = Contexts.Hyperlane, role: Role = Role.Deployer, - _connectionType?: RpcConsensusType, useSecrets?: boolean, ) => getMultiProviderForRole( diff --git a/typescript/infra/config/environments/mainnet3/liquidityLayer.ts b/typescript/infra/config/environments/mainnet3/liquidityLayer.ts index ac311f447..0f3a6d287 100644 --- a/typescript/infra/config/environments/mainnet3/liquidityLayer.ts +++ b/typescript/infra/config/environments/mainnet3/liquidityLayer.ts @@ -2,7 +2,6 @@ import { BridgeAdapterConfig, BridgeAdapterType, ChainMap, - RpcConsensusType, } from '@hyperlane-xyz/sdk'; import { LiquidityLayerRelayerConfig } from '../../../src/config/middleware.js'; @@ -50,5 +49,4 @@ export const relayerConfig: LiquidityLayerRelayerConfig = { namespace: environment, prometheusPushGateway: 'http://prometheus-prometheus-pushgateway.monitoring.svc.cluster.local:9091', - connectionType: RpcConsensusType.Single, }; diff --git a/typescript/infra/config/environments/testnet4/funding.ts b/typescript/infra/config/environments/testnet4/funding.ts index 5bd203227..085586548 100644 --- a/typescript/infra/config/environments/testnet4/funding.ts +++ b/typescript/infra/config/environments/testnet4/funding.ts @@ -1,5 +1,3 @@ -import { RpcConsensusType } from '@hyperlane-xyz/sdk'; - import { KeyFunderConfig } from '../../../src/config/funding.js'; import { Role } from '../../../src/roles.js'; import { Contexts } from '../../contexts.js'; @@ -23,7 +21,6 @@ export const keyFunderConfig: KeyFunderConfig = { [Contexts.Hyperlane]: [Role.Relayer, Role.Kathy], [Contexts.ReleaseCandidate]: [Role.Relayer, Role.Kathy], }, - connectionType: RpcConsensusType.Fallback, // desired balance config desiredBalancePerChain: { alfajores: '5', diff --git a/typescript/infra/config/environments/testnet4/helloworld.ts b/typescript/infra/config/environments/testnet4/helloworld.ts index e6f094c7d..e8c10ba0e 100644 --- a/typescript/infra/config/environments/testnet4/helloworld.ts +++ b/typescript/infra/config/environments/testnet4/helloworld.ts @@ -1,5 +1,3 @@ -import { RpcConsensusType } from '@hyperlane-xyz/sdk'; - import { HelloWorldConfig, HelloWorldKathyRunMode, @@ -26,7 +24,6 @@ export const hyperlaneHelloworld: HelloWorldConfig = { }, messageSendTimeout: 1000 * 60 * 10, // 10 min messageReceiptTimeout: 1000 * 60 * 20, // 20 min - connectionType: RpcConsensusType.Fallback, }, }; @@ -45,7 +42,6 @@ export const releaseCandidateHelloworld: HelloWorldConfig = { }, messageSendTimeout: 1000 * 60 * 8, // 8 min messageReceiptTimeout: 1000 * 60 * 20, // 20 min - connectionType: RpcConsensusType.Fallback, }, }; diff --git a/typescript/infra/config/environments/testnet4/index.ts b/typescript/infra/config/environments/testnet4/index.ts index b93de05c9..1d1204083 100644 --- a/typescript/infra/config/environments/testnet4/index.ts +++ b/typescript/infra/config/environments/testnet4/index.ts @@ -1,5 +1,4 @@ import { IRegistry } from '@hyperlane-xyz/registry'; -import { RpcConsensusType } from '@hyperlane-xyz/sdk'; import { objMerge } from '@hyperlane-xyz/utils'; import { @@ -44,7 +43,6 @@ export const environment: EnvironmentConfig = { getMultiProvider: async ( context: Contexts = Contexts.Hyperlane, role: Role = Role.Deployer, - _connectionType?: RpcConsensusType, useSecrets?: boolean, ) => getMultiProviderForRole( diff --git a/typescript/infra/config/environments/testnet4/middleware.ts b/typescript/infra/config/environments/testnet4/middleware.ts index 607b4a3f6..cf3d2782c 100644 --- a/typescript/infra/config/environments/testnet4/middleware.ts +++ b/typescript/infra/config/environments/testnet4/middleware.ts @@ -1,5 +1,3 @@ -import { RpcConsensusType } from '@hyperlane-xyz/sdk'; - import { LiquidityLayerRelayerConfig } from '../../../src/config/middleware.js'; import { environment } from './chains.js'; @@ -12,5 +10,4 @@ export const liquidityLayerRelayerConfig: LiquidityLayerRelayerConfig = { namespace: environment, prometheusPushGateway: 'http://prometheus-prometheus-pushgateway.monitoring.svc.cluster.local:9091', - connectionType: RpcConsensusType.Single, }; diff --git a/typescript/infra/helm/helloworld-kathy/templates/_helpers.tpl b/typescript/infra/helm/helloworld-kathy/templates/_helpers.tpl index 12b1e0db9..286fd126a 100644 --- a/typescript/infra/helm/helloworld-kathy/templates/_helpers.tpl +++ b/typescript/infra/helm/helloworld-kathy/templates/_helpers.tpl @@ -91,10 +91,6 @@ The helloworld-kathy container {{- if .Values.hyperlane.cycleOnce }} - --cycle-once {{- end }} -{{- if .Values.hyperlane.connectionType }} - - --connection-type - - {{ .Values.hyperlane.connectionType }} -{{- end }} {{- if .Values.hyperlane.cyclesBetweenEthereumMessages }} - --cycles-between-ethereum-messages - "{{ .Values.hyperlane.cyclesBetweenEthereumMessages }}" diff --git a/typescript/infra/helm/key-funder/templates/cron-job.yaml b/typescript/infra/helm/key-funder/templates/cron-job.yaml index 610ebf8bb..b89122281 100644 --- a/typescript/infra/helm/key-funder/templates/cron-job.yaml +++ b/typescript/infra/helm/key-funder/templates/cron-job.yaml @@ -29,10 +29,6 @@ spec: - --contexts-and-roles - {{ $context }}={{ join "," $roles }} {{- end }} -{{- if .Values.hyperlane.connectionType }} - - --connection-type - - {{ .Values.hyperlane.connectionType }} -{{- end }} {{- range $chain, $balance := .Values.hyperlane.desiredBalancePerChain }} - --desired-balance-per-chain - {{ $chain }}={{ $balance }} diff --git a/typescript/infra/helm/liquidity-layer-relayers/templates/circle-relayer-deployment.yaml b/typescript/infra/helm/liquidity-layer-relayers/templates/circle-relayer-deployment.yaml index 02dc71378..a41589924 100644 --- a/typescript/infra/helm/liquidity-layer-relayers/templates/circle-relayer-deployment.yaml +++ b/typescript/infra/helm/liquidity-layer-relayers/templates/circle-relayer-deployment.yaml @@ -21,10 +21,6 @@ spec: - ./typescript/infra/scripts/middleware/circle-relayer.ts - -e - {{ .Values.hyperlane.runEnv }} -{{- if .Values.hyperlane.connectionType }} - - --connection-type - - {{ .Values.hyperlane.connectionType }} -{{- end }} envFrom: - secretRef: name: liquidity-layer-env-var-secret diff --git a/typescript/infra/helm/liquidity-layer-relayers/templates/portal-relayer-deployment.yaml b/typescript/infra/helm/liquidity-layer-relayers/templates/portal-relayer-deployment.yaml index 8f1828424..933210d8d 100644 --- a/typescript/infra/helm/liquidity-layer-relayers/templates/portal-relayer-deployment.yaml +++ b/typescript/infra/helm/liquidity-layer-relayers/templates/portal-relayer-deployment.yaml @@ -21,10 +21,6 @@ spec: - ./typescript/infra/scripts/middleware/portal-relayer.ts - -e - {{ .Values.hyperlane.runEnv }} -{{- if .Values.hyperlane.connectionType }} - - --connection-type - - {{ .Values.hyperlane.connectionType }} -{{- end }} envFrom: - secretRef: name: liquidity-layer-env-var-secret diff --git a/typescript/infra/scripts/agent-utils.ts b/typescript/infra/scripts/agent-utils.ts index 3ac0f5ebd..5f814e827 100644 --- a/typescript/infra/scripts/agent-utils.ts +++ b/typescript/infra/scripts/agent-utils.ts @@ -9,7 +9,6 @@ import { CoreConfig, MultiProtocolProvider, MultiProvider, - RpcConsensusType, collectValidators, } from '@hyperlane-xyz/sdk'; import { diff --git a/typescript/infra/scripts/agents/update-agent-config.ts b/typescript/infra/scripts/agents/update-agent-config.ts index 127f4bf16..6b0ed65fd 100644 --- a/typescript/infra/scripts/agents/update-agent-config.ts +++ b/typescript/infra/scripts/agents/update-agent-config.ts @@ -7,7 +7,6 @@ async function main() { const envConfig = getEnvironmentConfig(environment); let multiProvider = await envConfig.getMultiProvider( - undefined, undefined, undefined, // Don't use secrets diff --git a/typescript/infra/scripts/funding/fund-keys-from-deployer.ts b/typescript/infra/scripts/funding/fund-keys-from-deployer.ts index 000034581..b949b9a32 100644 --- a/typescript/infra/scripts/funding/fund-keys-from-deployer.ts +++ b/typescript/infra/scripts/funding/fund-keys-from-deployer.ts @@ -9,7 +9,6 @@ import { ChainName, HyperlaneIgp, MultiProvider, - RpcConsensusType, } from '@hyperlane-xyz/sdk'; import { Address, objFilter, objMap, rootLogger } from '@hyperlane-xyz/utils'; @@ -177,11 +176,6 @@ async function main() { ) .coerce('desired-kathy-balance-per-chain', parseBalancePerChain) - .string('connection-type') - .describe('connection-type', 'The provider connection type to use for RPCs') - .default('connection-type', RpcConsensusType.Single) - .demandOption('connection-type') - .boolean('skip-igp-claim') .describe('skip-igp-claim', 'If true, never claims funds from the IGP') .default('skip-igp-claim', false).argv; @@ -191,7 +185,6 @@ async function main() { const multiProvider = await config.getMultiProvider( Contexts.Hyperlane, // Always fund from the hyperlane context Role.Deployer, // Always fund from the deployer - argv.connectionType, ); let contextFunders: ContextFunder[]; diff --git a/typescript/infra/scripts/helloworld/kathy.ts b/typescript/infra/scripts/helloworld/kathy.ts index 4e39ab14f..f3cbb1a49 100644 --- a/typescript/infra/scripts/helloworld/kathy.ts +++ b/typescript/infra/scripts/helloworld/kathy.ts @@ -11,7 +11,6 @@ import { MultiProtocolCore, MultiProvider, ProviderType, - RpcConsensusType, TypedTransactionReceipt, resolveOrDeployAccountOwner, } from '@hyperlane-xyz/sdk'; @@ -128,16 +127,6 @@ function getKathyArgs() { chainStrs.map((chainStr: string) => assertChain(chainStr)), ) - .string('connection-type') - .describe('connection-type', 'The provider connection type to use for RPCs') - .default('connection-type', RpcConsensusType.Single) - .choices('connection-type', [ - RpcConsensusType.Single, - RpcConsensusType.Quorum, - RpcConsensusType.Fallback, - ]) - .demandOption('connection-type') - .number('cycles-between-ethereum-messages') .describe( 'cycles-between-ethereum-messages', @@ -156,7 +145,6 @@ async function main(): Promise { fullCycleTime, messageSendTimeout, messageReceiptTimeout, - connectionType, cyclesBetweenEthereumMessages, } = await getKathyArgs(); @@ -173,7 +161,6 @@ async function main(): Promise { context, Role.Kathy, undefined, - connectionType, ); const appChains = app.chains(); diff --git a/typescript/infra/scripts/helloworld/utils.ts b/typescript/infra/scripts/helloworld/utils.ts index 38ab8969f..03cb408eb 100644 --- a/typescript/infra/scripts/helloworld/utils.ts +++ b/typescript/infra/scripts/helloworld/utils.ts @@ -8,7 +8,6 @@ import { MultiProtocolCore, MultiProtocolProvider, MultiProvider, - RpcConsensusType, attachContractsMap, attachContractsMapAndGetForeignDeployments, filterChainMapToProtocol, @@ -28,12 +27,10 @@ export async function getHelloWorldApp( context: Contexts, keyRole: Role, keyContext: Contexts = context, - connectionType: RpcConsensusType = RpcConsensusType.Single, ) { const multiProvider: MultiProvider = await coreConfig.getMultiProvider( keyContext, keyRole, - connectionType, ); const helloworldConfig = getHelloWorldConfig(coreConfig, context); @@ -61,12 +58,10 @@ export async function getHelloWorldMultiProtocolApp( context: Contexts, keyRole: Role, keyContext: Contexts = context, - connectionType: RpcConsensusType = RpcConsensusType.Single, ) { const multiProvider: MultiProvider = await coreConfig.getMultiProvider( keyContext, keyRole, - connectionType, ); const envAddresses = getEnvAddresses(coreConfig.environment); diff --git a/typescript/infra/src/config/chain.ts b/typescript/infra/src/config/chain.ts index 414ca34bd..2be5bc4ea 100644 --- a/typescript/infra/src/config/chain.ts +++ b/typescript/infra/src/config/chain.ts @@ -8,8 +8,6 @@ import { ChainName, HyperlaneSmartProvider, ProviderRetryOptions, - RpcConsensusType, - RpcUrl, } from '@hyperlane-xyz/sdk'; import { ProtocolType, objFilter, objMerge } from '@hyperlane-xyz/utils'; @@ -26,7 +24,6 @@ export const defaultRetry: ProviderRetryOptions = { export async function fetchProvider( chainName: ChainName, - connectionType: RpcConsensusType = RpcConsensusType.Single, ): Promise { const chainMetadata = getChain(chainName); if (!chainMetadata) { @@ -38,22 +35,12 @@ export async function fetchProvider( throw Error(`No RPC URLs found for chain: ${chainName}`); } - if (connectionType === RpcConsensusType.Single) { - return HyperlaneSmartProvider.fromRpcUrl(chainId, rpcData[0], defaultRetry); - } else if ( - connectionType === RpcConsensusType.Quorum || - connectionType === RpcConsensusType.Fallback - ) { - return new HyperlaneSmartProvider( - chainId, - rpcData.map((url) => ({ http: url })), - undefined, - // disable retry for quorum - connectionType === RpcConsensusType.Fallback ? defaultRetry : undefined, - ); - } else { - throw Error(`Unsupported connectionType: ${connectionType}`); - } + return new HyperlaneSmartProvider( + chainId, + rpcData.map((url) => ({ http: url })), + undefined, + defaultRetry, + ); } export function getChainMetadatas(chains: Array) { diff --git a/typescript/infra/src/config/environment.ts b/typescript/infra/src/config/environment.ts index 72e30f6d9..5b6fa0350 100644 --- a/typescript/infra/src/config/environment.ts +++ b/typescript/infra/src/config/environment.ts @@ -9,7 +9,6 @@ import { MultiProtocolProvider, MultiProvider, OwnableConfig, - RpcConsensusType, } from '@hyperlane-xyz/sdk'; import { objKeys } from '@hyperlane-xyz/utils'; @@ -54,7 +53,6 @@ export type EnvironmentConfig = { getMultiProvider: ( context?: Contexts, role?: Role, - connectionType?: RpcConsensusType, useSecrets?: boolean, ) => Promise; getKeys: ( diff --git a/typescript/infra/src/config/funding.ts b/typescript/infra/src/config/funding.ts index a55a6524f..f75d19cfd 100644 --- a/typescript/infra/src/config/funding.ts +++ b/typescript/infra/src/config/funding.ts @@ -1,4 +1,4 @@ -import { ChainMap, RpcConsensusType } from '@hyperlane-xyz/sdk'; +import { ChainMap } from '@hyperlane-xyz/sdk'; import { Contexts } from '../../config/contexts.js'; import { FundableRole, Role } from '../roles.js'; @@ -20,7 +20,6 @@ export interface KeyFunderConfig { contextsAndRolesToFund: ContextAndRolesMap; cyclesBetweenEthereumMessages?: number; prometheusPushGateway: string; - connectionType: RpcConsensusType; desiredBalancePerChain: ChainMap; desiredKathyBalancePerChain: ChainMap; } diff --git a/typescript/infra/src/config/helloworld/types.ts b/typescript/infra/src/config/helloworld/types.ts index 1345894d8..ba2be0750 100644 --- a/typescript/infra/src/config/helloworld/types.ts +++ b/typescript/infra/src/config/helloworld/types.ts @@ -1,4 +1,4 @@ -import { ChainMap, ChainName, RpcConsensusType } from '@hyperlane-xyz/sdk'; +import { ChainMap, ChainName } from '@hyperlane-xyz/sdk'; import { DockerConfig } from '../agent/agent.js'; @@ -29,7 +29,6 @@ export interface HelloWorldKathyConfig { messageReceiptTimeout: number; // Which type of provider to use - connectionType: RpcConsensusType; // How many cycles to skip between a cycles that send messages to/from Ethereum. Defaults to 0. cyclesBetweenEthereumMessages?: number; } diff --git a/typescript/infra/src/config/middleware.ts b/typescript/infra/src/config/middleware.ts index e6f25f92b..19fc3d848 100644 --- a/typescript/infra/src/config/middleware.ts +++ b/typescript/infra/src/config/middleware.ts @@ -1,10 +1,7 @@ -import { RpcConsensusType } from '@hyperlane-xyz/sdk'; - import { DockerConfig } from './agent/agent.js'; export interface LiquidityLayerRelayerConfig { docker: DockerConfig; namespace: string; - connectionType: RpcConsensusType.Single | RpcConsensusType.Quorum; prometheusPushGateway: string; } diff --git a/typescript/infra/src/funding/key-funder.ts b/typescript/infra/src/funding/key-funder.ts index b149b6a0b..ae29c7842 100644 --- a/typescript/infra/src/funding/key-funder.ts +++ b/typescript/infra/src/funding/key-funder.ts @@ -48,7 +48,6 @@ function getKeyFunderHelmValues( chains: agentConfig.environmentChainNames, contextFundingFrom: keyFunderConfig.contextFundingFrom, contextsAndRolesToFund: keyFunderConfig.contextsAndRolesToFund, - connectionType: keyFunderConfig.connectionType, desiredBalancePerChain: keyFunderConfig.desiredBalancePerChain, desiredKathyBalancePerChain: keyFunderConfig.desiredKathyBalancePerChain, }, diff --git a/typescript/infra/src/helloworld/kathy.ts b/typescript/infra/src/helloworld/kathy.ts index 44651380d..6366049fa 100644 --- a/typescript/infra/src/helloworld/kathy.ts +++ b/typescript/infra/src/helloworld/kathy.ts @@ -85,7 +85,6 @@ function getHelloworldKathyHelmValues( messageReceiptTimeout: kathyConfig.messageReceiptTimeout, cycleOnce, fullCycleTime, - connectionType: kathyConfig.connectionType, cyclesBetweenEthereumMessages: kathyConfig.cyclesBetweenEthereumMessages, }, image: { diff --git a/typescript/infra/src/middleware/liquidity-layer-relayer.ts b/typescript/infra/src/middleware/liquidity-layer-relayer.ts index e334c921e..4a1c3d7a1 100644 --- a/typescript/infra/src/middleware/liquidity-layer-relayer.ts +++ b/typescript/infra/src/middleware/liquidity-layer-relayer.ts @@ -44,7 +44,6 @@ function getLiquidityLayerRelayerHelmValues( runEnv: agentConfig.runEnv, // Only used for fetching RPC urls as env vars chains: agentConfig.contextChainNames, - connectionType: relayerConfig.connectionType, }, image: { repository: relayerConfig.docker.repo,