Skip to content

Commit

Permalink
Move to reorg period of 1 for mantapacific (#3126)
Browse files Browse the repository at this point in the history
### Description

- Moves to a reorg period of 1 for mantapacific instead of 0 - this
should avoid the IGP indexing bugs we're seeing where we first get the
latest block, then make an eth_getLogs RPC, but the node servicing the
latter RPC doesn't yet know of the new latest block

### Drive-by changes

Remove some duplication of the reorg period

### Related issues

n/a

### Backward compatibility

backward compatible

### Testing

none yet, other than deploying
  • Loading branch information
tkporter authored Jan 19, 2024
1 parent 3339f78 commit ae4476a
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 34 deletions.
6 changes: 6 additions & 0 deletions .changeset/healthy-suits-punch.md
Original file line number Diff line number Diff line change
@@ -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.
2 changes: 1 addition & 1 deletion rust/config/mainnet3_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@
},
"blocks": {
"confirmations": 1,
"reorgPeriod": 0,
"reorgPeriod": 1,
"estimateBlockTime": 3
},
"rpcUrls": [
Expand Down
30 changes: 15 additions & 15 deletions typescript/infra/config/environments/mainnet3/validators.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -13,7 +13,7 @@ export const validatorChainConfig = (
return {
celo: {
interval: 5,
reorgPeriod: 0,
reorgPeriod: getReorgPeriod(chainMetadata.celo),
validators: validatorsConfig(
{
[Contexts.Hyperlane]: [
Expand All @@ -29,7 +29,7 @@ export const validatorChainConfig = (
},
ethereum: {
interval: 5,
reorgPeriod: 20,
reorgPeriod: getReorgPeriod(chainMetadata.ethereum),
validators: validatorsConfig(
{
[Contexts.Hyperlane]: [
Expand All @@ -45,7 +45,7 @@ export const validatorChainConfig = (
},
avalanche: {
interval: 5,
reorgPeriod: 3,
reorgPeriod: getReorgPeriod(chainMetadata.avalanche),
validators: validatorsConfig(
{
[Contexts.Hyperlane]: [
Expand All @@ -63,7 +63,7 @@ export const validatorChainConfig = (
},
polygon: {
interval: 5,
reorgPeriod: 256,
reorgPeriod: getReorgPeriod(chainMetadata.polygon),
validators: validatorsConfig(
{
[Contexts.Hyperlane]: [
Expand All @@ -79,7 +79,7 @@ export const validatorChainConfig = (
},
bsc: {
interval: 5,
reorgPeriod: 15,
reorgPeriod: getReorgPeriod(chainMetadata.bsc),
validators: validatorsConfig(
{
[Contexts.Hyperlane]: [
Expand All @@ -95,7 +95,7 @@ export const validatorChainConfig = (
},
arbitrum: {
interval: 5,
reorgPeriod: 0,
reorgPeriod: getReorgPeriod(chainMetadata.arbitrum),
validators: validatorsConfig(
{
[Contexts.Hyperlane]: [
Expand All @@ -111,7 +111,7 @@ export const validatorChainConfig = (
},
optimism: {
interval: 5,
reorgPeriod: 0,
reorgPeriod: getReorgPeriod(chainMetadata.optimism),
validators: validatorsConfig(
{
[Contexts.Hyperlane]: [
Expand All @@ -129,7 +129,7 @@ export const validatorChainConfig = (
},
moonbeam: {
interval: 5,
reorgPeriod: 2,
reorgPeriod: getReorgPeriod(chainMetadata.moonbeam),
validators: validatorsConfig(
{
[Contexts.Hyperlane]: [
Expand All @@ -145,7 +145,7 @@ export const validatorChainConfig = (
},
gnosis: {
interval: 5,
reorgPeriod: 14,
reorgPeriod: getReorgPeriod(chainMetadata.gnosis),
validators: validatorsConfig(
{
[Contexts.Hyperlane]: [
Expand All @@ -161,7 +161,7 @@ export const validatorChainConfig = (
},
base: {
interval: 5,
reorgPeriod: 0,
reorgPeriod: getReorgPeriod(chainMetadata.base),
validators: validatorsConfig(
{
[Contexts.Hyperlane]: [
Expand All @@ -177,7 +177,7 @@ export const validatorChainConfig = (
},
scroll: {
interval: 5,
reorgPeriod: 0,
reorgPeriod: getReorgPeriod(chainMetadata.scroll),
validators: validatorsConfig(
{
[Contexts.Hyperlane]: [
Expand All @@ -193,7 +193,7 @@ export const validatorChainConfig = (
},
polygonzkevm: {
interval: 5,
reorgPeriod: 0,
reorgPeriod: getReorgPeriod(chainMetadata.polygonzkevm),
validators: validatorsConfig(
{
[Contexts.Hyperlane]: [
Expand All @@ -209,7 +209,7 @@ export const validatorChainConfig = (
},
neutron: {
interval: 5,
reorgPeriod: 0,
reorgPeriod: getReorgPeriod(chainMetadata.neutron),
validators: validatorsConfig(
{
[Contexts.Hyperlane]: [
Expand All @@ -225,7 +225,7 @@ export const validatorChainConfig = (
},
mantapacific: {
interval: 5,
reorgPeriod: 0,
reorgPeriod: getReorgPeriod(chainMetadata.mantapacific),
validators: validatorsConfig(
{
[Contexts.Hyperlane]: [
Expand Down
34 changes: 17 additions & 17 deletions typescript/infra/config/environments/testnet4/validators.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -13,7 +13,7 @@ export const validatorChainConfig = (
return {
alfajores: {
interval: 5,
reorgPeriod: chainMetadata.alfajores.blocks!.reorgPeriod!,
reorgPeriod: getReorgPeriod(chainMetadata.alfajores),
validators: validatorsConfig(
{
[Contexts.Hyperlane]: [
Expand All @@ -33,7 +33,7 @@ export const validatorChainConfig = (
},
basegoerli: {
interval: 5,
reorgPeriod: chainMetadata.basegoerli.blocks!.reorgPeriod!,
reorgPeriod: getReorgPeriod(chainMetadata.alfajores),
validators: validatorsConfig(
{
[Contexts.Hyperlane]: [
Expand All @@ -53,7 +53,7 @@ export const validatorChainConfig = (
},
fuji: {
interval: 5,
reorgPeriod: chainMetadata.fuji.blocks!.reorgPeriod!,
reorgPeriod: getReorgPeriod(chainMetadata.alfajores),
validators: validatorsConfig(
{
[Contexts.Hyperlane]: [
Expand All @@ -73,7 +73,7 @@ export const validatorChainConfig = (
},
// chiado: {
// interval: 5,
// reorgPeriod: chainMetadata.chiado.blocks!.reorgPeriod!,
// reorgPeriod: getReorgPeriod(chainMetadata.chiado),
// validators: validatorsConfig(
// {
// [Contexts.Hyperlane]: [
Expand All @@ -92,7 +92,7 @@ export const validatorChainConfig = (
// },
// lineagoerli: {
// interval: 5,
// reorgPeriod: chainMetadata.lineagoerli.blocks!.reorgPeriod!,
// reorgPeriod: getReorgPeriod(chainMetadata.lineagoerli),
// validators: validatorsConfig(
// {
// [Contexts.Hyperlane]: [
Expand All @@ -111,7 +111,7 @@ export const validatorChainConfig = (
// },
mumbai: {
interval: 5,
reorgPeriod: chainMetadata.mumbai.blocks!.reorgPeriod!,
reorgPeriod: getReorgPeriod(chainMetadata.mumbai),
validators: validatorsConfig(
{
[Contexts.Hyperlane]: [
Expand All @@ -131,7 +131,7 @@ export const validatorChainConfig = (
},
bsctestnet: {
interval: 5,
reorgPeriod: chainMetadata.bsctestnet.blocks!.reorgPeriod!,
reorgPeriod: getReorgPeriod(chainMetadata.bsctestnet),
validators: validatorsConfig(
{
[Contexts.Hyperlane]: [
Expand All @@ -151,7 +151,7 @@ export const validatorChainConfig = (
},
goerli: {
interval: 5,
reorgPeriod: chainMetadata.goerli.blocks!.reorgPeriod!,
reorgPeriod: getReorgPeriod(chainMetadata.goerli),
validators: validatorsConfig(
{
[Contexts.Hyperlane]: [
Expand All @@ -171,7 +171,7 @@ export const validatorChainConfig = (
},
scrollsepolia: {
interval: 5,
reorgPeriod: chainMetadata.scrollsepolia.blocks!.reorgPeriod!,
reorgPeriod: getReorgPeriod(chainMetadata.scrollsepolia),
validators: validatorsConfig(
{
[Contexts.Hyperlane]: [
Expand All @@ -191,7 +191,7 @@ export const validatorChainConfig = (
},
sepolia: {
interval: 5,
reorgPeriod: chainMetadata.sepolia.blocks!.reorgPeriod!,
reorgPeriod: getReorgPeriod(chainMetadata.sepolia),
validators: validatorsConfig(
{
[Contexts.Hyperlane]: [
Expand All @@ -211,7 +211,7 @@ export const validatorChainConfig = (
},
moonbasealpha: {
interval: 5,
reorgPeriod: chainMetadata.moonbasealpha.blocks!.reorgPeriod!,
reorgPeriod: getReorgPeriod(chainMetadata.moonbasealpha),
validators: validatorsConfig(
{
[Contexts.Hyperlane]: [
Expand All @@ -231,7 +231,7 @@ export const validatorChainConfig = (
},
optimismgoerli: {
interval: 5,
reorgPeriod: chainMetadata.optimismgoerli.blocks!.reorgPeriod!,
reorgPeriod: getReorgPeriod(chainMetadata.optimismgoerli),
validators: validatorsConfig(
{
[Contexts.Hyperlane]: [
Expand All @@ -251,7 +251,7 @@ export const validatorChainConfig = (
},
arbitrumgoerli: {
interval: 5,
reorgPeriod: chainMetadata.arbitrumgoerli.blocks!.reorgPeriod!,
reorgPeriod: getReorgPeriod(chainMetadata.arbitrumgoerli),
validators: validatorsConfig(
{
[Contexts.Hyperlane]: [
Expand All @@ -271,7 +271,7 @@ export const validatorChainConfig = (
},
polygonzkevmtestnet: {
interval: 5,
reorgPeriod: chainMetadata.polygonzkevmtestnet.blocks!.reorgPeriod!,
reorgPeriod: getReorgPeriod(chainMetadata.polygonzkevmtestnet),
validators: validatorsConfig(
{
[Contexts.Hyperlane]: [
Expand All @@ -291,7 +291,7 @@ export const validatorChainConfig = (
},
// proteustestnet: {
// interval: 5,
// reorgPeriod: chainMetadata.proteustestnet.blocks!.reorgPeriod!,
// reorgPeriod: getReorgPeriod(chainMetadata.proteustestnet),
// validators: validatorsConfig(
// {
// [Contexts.Hyperlane]: [
Expand All @@ -308,7 +308,7 @@ export const validatorChainConfig = (
// },
// solanadevnet: {
// interval: 10,
// reorgPeriod: chainMetadata.solanadevnet.blocks!.reorgPeriod!,
// reorgPeriod: getReorgPeriod(chainMetadata.solanadevnet),
// validators: validatorsConfig(
// {
// [Contexts.Hyperlane]: [
Expand Down
2 changes: 1 addition & 1 deletion typescript/sdk/src/consts/chainMetadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@ export const mantapacific: ChainMetadata = {
blocks: {
confirmations: 1,
estimateBlockTime: 3,
reorgPeriod: 0,
reorgPeriod: 1,
},
chainId: 169,
displayName: 'Manta Pacific',
Expand Down
1 change: 1 addition & 0 deletions typescript/sdk/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ export {
getChainIdNumber,
getDomainId,
isValidChainMetadata,
getReorgPeriod,
} from './metadata/chainMetadataTypes';
export { ZHash } from './metadata/customZodTypes';
export {
Expand Down
6 changes: 6 additions & 0 deletions typescript/sdk/src/metadata/chainMetadataTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}

0 comments on commit ae4476a

Please sign in to comment.