diff --git a/.changeset/healthy-suits-punch.md b/.changeset/healthy-suits-punch.md new file mode 100644 index 000000000..57c3cf537 --- /dev/null +++ b/.changeset/healthy-suits-punch.md @@ -0,0 +1,6 @@ +--- +'@hyperlane-xyz/infra': patch +'@hyperlane-xyz/sdk': patch +--- + +Bumped mantapacific reorgPeriod to 1, a reorg period in chain metadata is now required by infra. diff --git a/rust/config/mainnet3_config.json b/rust/config/mainnet3_config.json index c144174d6..361e59d0a 100644 --- a/rust/config/mainnet3_config.json +++ b/rust/config/mainnet3_config.json @@ -387,7 +387,7 @@ }, "blocks": { "confirmations": 1, - "reorgPeriod": 0, + "reorgPeriod": 1, "estimateBlockTime": 3 }, "rpcUrls": [ diff --git a/typescript/infra/config/environments/mainnet3/validators.ts b/typescript/infra/config/environments/mainnet3/validators.ts index 61cf6f3f1..3f5e60e16 100644 --- a/typescript/infra/config/environments/mainnet3/validators.ts +++ b/typescript/infra/config/environments/mainnet3/validators.ts @@ -1,4 +1,4 @@ -import { chainMetadata } from '@hyperlane-xyz/sdk'; +import { chainMetadata, getReorgPeriod } from '@hyperlane-xyz/sdk'; import { ValidatorBaseChainConfigMap } from '../../../src/config/agent'; import { Contexts } from '../../contexts'; @@ -13,7 +13,7 @@ export const validatorChainConfig = ( return { celo: { interval: 5, - reorgPeriod: 0, + reorgPeriod: getReorgPeriod(chainMetadata.celo), validators: validatorsConfig( { [Contexts.Hyperlane]: [ @@ -29,7 +29,7 @@ export const validatorChainConfig = ( }, ethereum: { interval: 5, - reorgPeriod: 20, + reorgPeriod: getReorgPeriod(chainMetadata.ethereum), validators: validatorsConfig( { [Contexts.Hyperlane]: [ @@ -45,7 +45,7 @@ export const validatorChainConfig = ( }, avalanche: { interval: 5, - reorgPeriod: 3, + reorgPeriod: getReorgPeriod(chainMetadata.avalanche), validators: validatorsConfig( { [Contexts.Hyperlane]: [ @@ -63,7 +63,7 @@ export const validatorChainConfig = ( }, polygon: { interval: 5, - reorgPeriod: 256, + reorgPeriod: getReorgPeriod(chainMetadata.polygon), validators: validatorsConfig( { [Contexts.Hyperlane]: [ @@ -79,7 +79,7 @@ export const validatorChainConfig = ( }, bsc: { interval: 5, - reorgPeriod: 15, + reorgPeriod: getReorgPeriod(chainMetadata.bsc), validators: validatorsConfig( { [Contexts.Hyperlane]: [ @@ -95,7 +95,7 @@ export const validatorChainConfig = ( }, arbitrum: { interval: 5, - reorgPeriod: 0, + reorgPeriod: getReorgPeriod(chainMetadata.arbitrum), validators: validatorsConfig( { [Contexts.Hyperlane]: [ @@ -111,7 +111,7 @@ export const validatorChainConfig = ( }, optimism: { interval: 5, - reorgPeriod: 0, + reorgPeriod: getReorgPeriod(chainMetadata.optimism), validators: validatorsConfig( { [Contexts.Hyperlane]: [ @@ -129,7 +129,7 @@ export const validatorChainConfig = ( }, moonbeam: { interval: 5, - reorgPeriod: 2, + reorgPeriod: getReorgPeriod(chainMetadata.moonbeam), validators: validatorsConfig( { [Contexts.Hyperlane]: [ @@ -145,7 +145,7 @@ export const validatorChainConfig = ( }, gnosis: { interval: 5, - reorgPeriod: 14, + reorgPeriod: getReorgPeriod(chainMetadata.gnosis), validators: validatorsConfig( { [Contexts.Hyperlane]: [ @@ -161,7 +161,7 @@ export const validatorChainConfig = ( }, base: { interval: 5, - reorgPeriod: 0, + reorgPeriod: getReorgPeriod(chainMetadata.base), validators: validatorsConfig( { [Contexts.Hyperlane]: [ @@ -177,7 +177,7 @@ export const validatorChainConfig = ( }, scroll: { interval: 5, - reorgPeriod: 0, + reorgPeriod: getReorgPeriod(chainMetadata.scroll), validators: validatorsConfig( { [Contexts.Hyperlane]: [ @@ -193,7 +193,7 @@ export const validatorChainConfig = ( }, polygonzkevm: { interval: 5, - reorgPeriod: 0, + reorgPeriod: getReorgPeriod(chainMetadata.polygonzkevm), validators: validatorsConfig( { [Contexts.Hyperlane]: [ @@ -209,7 +209,7 @@ export const validatorChainConfig = ( }, neutron: { interval: 5, - reorgPeriod: 0, + reorgPeriod: getReorgPeriod(chainMetadata.neutron), validators: validatorsConfig( { [Contexts.Hyperlane]: [ @@ -225,7 +225,7 @@ export const validatorChainConfig = ( }, mantapacific: { interval: 5, - reorgPeriod: 0, + reorgPeriod: getReorgPeriod(chainMetadata.mantapacific), validators: validatorsConfig( { [Contexts.Hyperlane]: [ diff --git a/typescript/infra/config/environments/testnet4/validators.ts b/typescript/infra/config/environments/testnet4/validators.ts index 44ddc2005..23fb1a6f9 100644 --- a/typescript/infra/config/environments/testnet4/validators.ts +++ b/typescript/infra/config/environments/testnet4/validators.ts @@ -1,4 +1,4 @@ -import { chainMetadata } from '@hyperlane-xyz/sdk'; +import { chainMetadata, getReorgPeriod } from '@hyperlane-xyz/sdk'; import { ValidatorBaseChainConfigMap } from '../../../src/config/agent'; import { Contexts } from '../../contexts'; @@ -13,7 +13,7 @@ export const validatorChainConfig = ( return { alfajores: { interval: 5, - reorgPeriod: chainMetadata.alfajores.blocks!.reorgPeriod!, + reorgPeriod: getReorgPeriod(chainMetadata.alfajores), validators: validatorsConfig( { [Contexts.Hyperlane]: [ @@ -33,7 +33,7 @@ export const validatorChainConfig = ( }, basegoerli: { interval: 5, - reorgPeriod: chainMetadata.basegoerli.blocks!.reorgPeriod!, + reorgPeriod: getReorgPeriod(chainMetadata.alfajores), validators: validatorsConfig( { [Contexts.Hyperlane]: [ @@ -53,7 +53,7 @@ export const validatorChainConfig = ( }, fuji: { interval: 5, - reorgPeriod: chainMetadata.fuji.blocks!.reorgPeriod!, + reorgPeriod: getReorgPeriod(chainMetadata.alfajores), validators: validatorsConfig( { [Contexts.Hyperlane]: [ @@ -73,7 +73,7 @@ export const validatorChainConfig = ( }, // chiado: { // interval: 5, - // reorgPeriod: chainMetadata.chiado.blocks!.reorgPeriod!, + // reorgPeriod: getReorgPeriod(chainMetadata.chiado), // validators: validatorsConfig( // { // [Contexts.Hyperlane]: [ @@ -92,7 +92,7 @@ export const validatorChainConfig = ( // }, // lineagoerli: { // interval: 5, - // reorgPeriod: chainMetadata.lineagoerli.blocks!.reorgPeriod!, + // reorgPeriod: getReorgPeriod(chainMetadata.lineagoerli), // validators: validatorsConfig( // { // [Contexts.Hyperlane]: [ @@ -111,7 +111,7 @@ export const validatorChainConfig = ( // }, mumbai: { interval: 5, - reorgPeriod: chainMetadata.mumbai.blocks!.reorgPeriod!, + reorgPeriod: getReorgPeriod(chainMetadata.mumbai), validators: validatorsConfig( { [Contexts.Hyperlane]: [ @@ -131,7 +131,7 @@ export const validatorChainConfig = ( }, bsctestnet: { interval: 5, - reorgPeriod: chainMetadata.bsctestnet.blocks!.reorgPeriod!, + reorgPeriod: getReorgPeriod(chainMetadata.bsctestnet), validators: validatorsConfig( { [Contexts.Hyperlane]: [ @@ -151,7 +151,7 @@ export const validatorChainConfig = ( }, goerli: { interval: 5, - reorgPeriod: chainMetadata.goerli.blocks!.reorgPeriod!, + reorgPeriod: getReorgPeriod(chainMetadata.goerli), validators: validatorsConfig( { [Contexts.Hyperlane]: [ @@ -171,7 +171,7 @@ export const validatorChainConfig = ( }, scrollsepolia: { interval: 5, - reorgPeriod: chainMetadata.scrollsepolia.blocks!.reorgPeriod!, + reorgPeriod: getReorgPeriod(chainMetadata.scrollsepolia), validators: validatorsConfig( { [Contexts.Hyperlane]: [ @@ -191,7 +191,7 @@ export const validatorChainConfig = ( }, sepolia: { interval: 5, - reorgPeriod: chainMetadata.sepolia.blocks!.reorgPeriod!, + reorgPeriod: getReorgPeriod(chainMetadata.sepolia), validators: validatorsConfig( { [Contexts.Hyperlane]: [ @@ -211,7 +211,7 @@ export const validatorChainConfig = ( }, moonbasealpha: { interval: 5, - reorgPeriod: chainMetadata.moonbasealpha.blocks!.reorgPeriod!, + reorgPeriod: getReorgPeriod(chainMetadata.moonbasealpha), validators: validatorsConfig( { [Contexts.Hyperlane]: [ @@ -231,7 +231,7 @@ export const validatorChainConfig = ( }, optimismgoerli: { interval: 5, - reorgPeriod: chainMetadata.optimismgoerli.blocks!.reorgPeriod!, + reorgPeriod: getReorgPeriod(chainMetadata.optimismgoerli), validators: validatorsConfig( { [Contexts.Hyperlane]: [ @@ -251,7 +251,7 @@ export const validatorChainConfig = ( }, arbitrumgoerli: { interval: 5, - reorgPeriod: chainMetadata.arbitrumgoerli.blocks!.reorgPeriod!, + reorgPeriod: getReorgPeriod(chainMetadata.arbitrumgoerli), validators: validatorsConfig( { [Contexts.Hyperlane]: [ @@ -271,7 +271,7 @@ export const validatorChainConfig = ( }, polygonzkevmtestnet: { interval: 5, - reorgPeriod: chainMetadata.polygonzkevmtestnet.blocks!.reorgPeriod!, + reorgPeriod: getReorgPeriod(chainMetadata.polygonzkevmtestnet), validators: validatorsConfig( { [Contexts.Hyperlane]: [ @@ -291,7 +291,7 @@ export const validatorChainConfig = ( }, // proteustestnet: { // interval: 5, - // reorgPeriod: chainMetadata.proteustestnet.blocks!.reorgPeriod!, + // reorgPeriod: getReorgPeriod(chainMetadata.proteustestnet), // validators: validatorsConfig( // { // [Contexts.Hyperlane]: [ @@ -308,7 +308,7 @@ export const validatorChainConfig = ( // }, // solanadevnet: { // interval: 10, - // reorgPeriod: chainMetadata.solanadevnet.blocks!.reorgPeriod!, + // reorgPeriod: getReorgPeriod(chainMetadata.solanadevnet), // validators: validatorsConfig( // { // [Contexts.Hyperlane]: [ diff --git a/typescript/sdk/src/consts/chainMetadata.ts b/typescript/sdk/src/consts/chainMetadata.ts index 253a67ce9..b76a673a5 100644 --- a/typescript/sdk/src/consts/chainMetadata.ts +++ b/typescript/sdk/src/consts/chainMetadata.ts @@ -451,7 +451,7 @@ export const mantapacific: ChainMetadata = { blocks: { confirmations: 1, estimateBlockTime: 3, - reorgPeriod: 0, + reorgPeriod: 1, }, chainId: 169, displayName: 'Manta Pacific', diff --git a/typescript/sdk/src/index.ts b/typescript/sdk/src/index.ts index 4013fa9a9..d9dc0501e 100644 --- a/typescript/sdk/src/index.ts +++ b/typescript/sdk/src/index.ts @@ -186,6 +186,7 @@ export { getChainIdNumber, getDomainId, isValidChainMetadata, + getReorgPeriod, } from './metadata/chainMetadataTypes'; export { ZHash } from './metadata/customZodTypes'; export { diff --git a/typescript/sdk/src/metadata/chainMetadataTypes.ts b/typescript/sdk/src/metadata/chainMetadataTypes.ts index 1ed7ecdb2..240174fb0 100644 --- a/typescript/sdk/src/metadata/chainMetadataTypes.ts +++ b/typescript/sdk/src/metadata/chainMetadataTypes.ts @@ -241,3 +241,9 @@ export function getChainIdNumber(chainMetadata: ChainMetadata): number { if (typeof chainMetadata.chainId === 'number') return chainMetadata.chainId; else throw new Error('ChainId is not a number, chain may be of Cosmos type'); } + +export function getReorgPeriod(chainMetadata: ChainMetadata): number { + if (chainMetadata.blocks?.reorgPeriod !== undefined) + return chainMetadata.blocks.reorgPeriod; + else throw new Error('Chain has no reorg period'); +}