From d66454563fe89c818511645247be9e4d26094a75 Mon Sep 17 00:00:00 2001 From: Nam Chu Hoai Date: Mon, 26 Sep 2022 15:22:26 -0400 Subject: [PATCH] Add script to list validator indices (#1107) * Add script to list validator indices * Remove file * Update typescript/infra/config/environments/test/validators.ts Co-authored-by: Yorke Rhodes * Update typescript/infra/config/environments/test/validators.ts Co-authored-by: Yorke Rhodes * Update typescript/infra/config/environments/test/validators.ts Co-authored-by: Yorke Rhodes * PR review Co-authored-by: Yorke Rhodes --- .../config/environments/mainnet/validators.ts | 35 ++++++++++++++ .../config/environments/test/validators.ts | 3 ++ .../environments/testnet2/validators.ts | 34 +++++++++++++ .../list-validator-checkpoint-indices.ts | 48 +++++++++++++++++++ typescript/infra/scripts/utils.ts | 10 ++-- typescript/infra/src/agents/aws/validator.ts | 10 ++++ typescript/infra/src/config/agent.ts | 1 + 7 files changed, 138 insertions(+), 3 deletions(-) create mode 100644 typescript/infra/scripts/list-validator-checkpoint-indices.ts diff --git a/typescript/infra/config/environments/mainnet/validators.ts b/typescript/infra/config/environments/mainnet/validators.ts index 26d308131..b8436720c 100644 --- a/typescript/infra/config/environments/mainnet/validators.ts +++ b/typescript/infra/config/environments/mainnet/validators.ts @@ -20,6 +20,7 @@ export const validators: ChainValidatorSets = { validators: [ { address: '0x8784f09c2cfb70329b936a3b75eb61c41b467b65', + name: s3BucketName('celo', 0), checkpointSyncer: { type: CheckpointSyncerType.S3, bucket: s3BucketName('celo', 0), @@ -28,6 +29,7 @@ export const validators: ChainValidatorSets = { }, { address: '0x36daf0ac1f4feb22440ea0834308e0d3ae409139', + name: s3BucketName('celo', 1), checkpointSyncer: { type: CheckpointSyncerType.S3, bucket: s3BucketName('celo', 1), @@ -36,6 +38,7 @@ export const validators: ChainValidatorSets = { }, { address: '0x3fc9689d60e3fe78a624eeb5d9d3452b272cb1a4', + name: s3BucketName('celo', 2), checkpointSyncer: { type: CheckpointSyncerType.S3, bucket: s3BucketName('celo', 2), @@ -45,6 +48,7 @@ export const validators: ChainValidatorSets = { { address: '0xd8B404ad70A1682aaF457d4918F7b506035262D3', readonly: true, + name: 'ZKV-celo', checkpointSyncer: { type: CheckpointSyncerType.S3, bucket: 'abacus-mainnet-zkv-celo-signatures', @@ -54,6 +58,7 @@ export const validators: ChainValidatorSets = { { address: '0x1ba04e4df7DF9D736543cC9A8D6f61278EA140ec', readonly: true, + name: 'ZPLabs-celo', checkpointSyncer: { type: CheckpointSyncerType.S3, bucket: 'abacus-validator-signatures-zplabs-celo', @@ -67,6 +72,7 @@ export const validators: ChainValidatorSets = { validators: [ { address: '0x7c1d96c9e72c41b84d74095dc2e72b979e933904', + name: s3BucketName('ethereum', 0), checkpointSyncer: { type: CheckpointSyncerType.S3, bucket: s3BucketName('ethereum', 0), @@ -75,6 +81,7 @@ export const validators: ChainValidatorSets = { }, { address: '0xd82ebbd1ef3d75b21f33a36a5c250865d97b9ca1', + name: s3BucketName('ethereum', 1), checkpointSyncer: { type: CheckpointSyncerType.S3, bucket: s3BucketName('ethereum', 1), @@ -83,6 +90,7 @@ export const validators: ChainValidatorSets = { }, { address: '0x333f37f29c6bca607084a75abbe66fd268f585cb', + name: s3BucketName('ethereum', 2), checkpointSyncer: { type: CheckpointSyncerType.S3, bucket: s3BucketName('ethereum', 2), @@ -92,6 +100,7 @@ export const validators: ChainValidatorSets = { { address: '0x1946782598328C6D5e1CD1076d37Feab680ad9D2', readonly: true, + name: 'ZKV-ethereum', checkpointSyncer: { type: CheckpointSyncerType.S3, bucket: 'abacus-mainnet-zkv-ethereum-signatures', @@ -101,6 +110,7 @@ export const validators: ChainValidatorSets = { { address: '0xaDF418C044e857C174e70B3a1df7454B55ee258F', readonly: true, + name: 'ZPLabs-eth', checkpointSyncer: { type: CheckpointSyncerType.S3, bucket: 'abacus-validator-signatures-zplabs-eth', @@ -114,6 +124,7 @@ export const validators: ChainValidatorSets = { validators: [ { address: '0x1353b91e2b256ca0a283504b02ae3c69374fb105', + name: s3BucketName('avalanche', 0), checkpointSyncer: { type: CheckpointSyncerType.S3, bucket: s3BucketName('avalanche', 0), @@ -122,6 +133,7 @@ export const validators: ChainValidatorSets = { }, { address: '0x9c6028433b8a0af8530399e57433d2b3b5379b55', + name: s3BucketName('avalanche', 1), checkpointSyncer: { type: CheckpointSyncerType.S3, bucket: s3BucketName('avalanche', 1), @@ -130,6 +142,7 @@ export const validators: ChainValidatorSets = { }, { address: '0x5344d1cccaa4cb189ec7c2d30bdd9eb202aeb738', + name: s3BucketName('avalanche', 2), checkpointSyncer: { type: CheckpointSyncerType.S3, bucket: s3BucketName('avalanche', 2), @@ -139,6 +152,7 @@ export const validators: ChainValidatorSets = { { address: '0x1E1086F3E6F2F5762AF54B8167cdE934186cbAf9', readonly: true, + name: 'ZKV-avalanche', checkpointSyncer: { type: CheckpointSyncerType.S3, bucket: 'abacus-mainnet-zkv-avalanche-signatures', @@ -148,6 +162,7 @@ export const validators: ChainValidatorSets = { { address: '0xd0b24bb03d2c244c3B1cA78c21A793c9e6ff4d87', readonly: true, + name: 'ZPLabs-avax', checkpointSyncer: { type: CheckpointSyncerType.S3, bucket: 'abacus-validator-signatures-zplabs-avax', @@ -161,6 +176,7 @@ export const validators: ChainValidatorSets = { validators: [ { address: '0xff198cae21069d865b142f2b9e798d3b299b8df6', + name: s3BucketName('polygon', 0), checkpointSyncer: { type: CheckpointSyncerType.S3, bucket: s3BucketName('polygon', 0), @@ -169,6 +185,7 @@ export const validators: ChainValidatorSets = { }, { address: '0x577ae23f23a4b81c5c7e26ddd1ffa8c317937629', + name: s3BucketName('polygon', 1), checkpointSyncer: { type: CheckpointSyncerType.S3, bucket: s3BucketName('polygon', 1), @@ -177,6 +194,7 @@ export const validators: ChainValidatorSets = { }, { address: '0xc79c2e64c5051ac1c8df4a18df4f9ceb5a2ec767', + name: s3BucketName('polygon', 2), checkpointSyncer: { type: CheckpointSyncerType.S3, bucket: s3BucketName('polygon', 2), @@ -186,6 +204,7 @@ export const validators: ChainValidatorSets = { { address: '0x5201867Fc19c7104cA18B37d07C60bBfe8164197', readonly: true, + name: 'ZKV-avalanche', checkpointSyncer: { type: CheckpointSyncerType.S3, bucket: 'abacus-mainnet-zkv-polygon-signatures', @@ -195,6 +214,7 @@ export const validators: ChainValidatorSets = { { address: '0x4c055065DdD22DC874B3494Eb81FcDC1cDe9F57e', readonly: true, + name: 'ZPLabs-pgon', checkpointSyncer: { type: CheckpointSyncerType.S3, bucket: 'abacus-validator-signatures-zplabs-pgon', @@ -208,6 +228,7 @@ export const validators: ChainValidatorSets = { validators: [ { address: '0x013d01a570b5cfa19032c5176488b5824e225a6b', + name: s3BucketName('bsc', 0), checkpointSyncer: { type: CheckpointSyncerType.S3, bucket: s3BucketName('bsc', 0), @@ -216,6 +237,7 @@ export const validators: ChainValidatorSets = { }, { address: '0x507ee81c640daeed081ba013324e4e26bc893446', + name: s3BucketName('bsc', 1), checkpointSyncer: { type: CheckpointSyncerType.S3, bucket: s3BucketName('bsc', 1), @@ -224,6 +246,7 @@ export const validators: ChainValidatorSets = { }, { address: '0x27d47d7d5f14f76b5f800481499f4c1cb1eb54d9', + name: s3BucketName('bsc', 2), checkpointSyncer: { type: CheckpointSyncerType.S3, bucket: s3BucketName('bsc', 2), @@ -233,6 +256,7 @@ export const validators: ChainValidatorSets = { { address: '0x24f9004c3e02C8c354881685B221cAd8FaF4d9B0', readonly: true, + name: 'ZKV-bsc', checkpointSyncer: { type: CheckpointSyncerType.S3, bucket: 'abacus-mainnet-zkv-bsc-signatures', @@ -242,6 +266,7 @@ export const validators: ChainValidatorSets = { { address: '0x7e303daC8b6b24cac10b6f032e0eF373A1D80299', readonly: true, + name: 'ZPLabs-bsc', checkpointSyncer: { type: CheckpointSyncerType.S3, bucket: 'abacus-validator-signatures-zplabs-bsc', @@ -255,6 +280,7 @@ export const validators: ChainValidatorSets = { validators: [ { address: '0x6289f913acc64c2e6baaa2b5175c7db35f98f62d', + name: s3BucketName('arbitrum', 0), checkpointSyncer: { type: CheckpointSyncerType.S3, bucket: s3BucketName('arbitrum', 0), @@ -263,6 +289,7 @@ export const validators: ChainValidatorSets = { }, { address: '0x3b989d35931f39d6c7b5bdd41eac3cad5c903af9', + name: s3BucketName('arbitrum', 1), checkpointSyncer: { type: CheckpointSyncerType.S3, bucket: s3BucketName('arbitrum', 1), @@ -271,6 +298,7 @@ export const validators: ChainValidatorSets = { }, { address: '0x38566cc4ceb264dfcb0022d9857ffe6c9da33881', + name: s3BucketName('arbitrum', 2), checkpointSyncer: { type: CheckpointSyncerType.S3, bucket: s3BucketName('arbitrum', 2), @@ -280,6 +308,7 @@ export const validators: ChainValidatorSets = { { address: '0xFF20DFeEE355Ef5a6d3C6dEe25AAB697ad3915a4', readonly: true, + name: 'ZKV-arbitrum', checkpointSyncer: { type: CheckpointSyncerType.S3, bucket: 'abacus-mainnet-zkv-arbitrum-signatures', @@ -289,6 +318,7 @@ export const validators: ChainValidatorSets = { { address: '0xb2e9B58B63c8676E583c2C0050bD46cecd8Ac8F3', readonly: true, + name: 'ZPLabs-arbitrum', checkpointSyncer: { type: CheckpointSyncerType.S3, bucket: 'abacus-validator-signatures-zplabs-arbitrum', @@ -302,6 +332,7 @@ export const validators: ChainValidatorSets = { validators: [ { address: '0xcf2dcc3462c84420965501c1dda3d62dde08941d', + name: s3BucketName('optimism', 0), checkpointSyncer: { type: CheckpointSyncerType.S3, bucket: s3BucketName('optimism', 0), @@ -310,6 +341,7 @@ export const validators: ChainValidatorSets = { }, { address: '0x6dc8296b04206521afc57b868653203fa5585037', + name: s3BucketName('optimism', 1), checkpointSyncer: { type: CheckpointSyncerType.S3, bucket: s3BucketName('optimism', 1), @@ -318,6 +350,7 @@ export const validators: ChainValidatorSets = { }, { address: '0x95c27b4d029b11f7581f3f36b6575a14daba83d1', + name: s3BucketName('optimism', 2), checkpointSyncer: { type: CheckpointSyncerType.S3, bucket: s3BucketName('optimism', 2), @@ -327,6 +360,7 @@ export const validators: ChainValidatorSets = { { address: '0x8669a883652DBf8c47DECbC4ec8b137E54A5bEAF', readonly: true, + name: 'ZKV-optimism', checkpointSyncer: { type: CheckpointSyncerType.S3, bucket: 'abacus-mainnet-zkv-optimism-signatures', @@ -336,6 +370,7 @@ export const validators: ChainValidatorSets = { { address: '0x9D8a7F26B62fC4e481Be0F0736683d2822A8c354', readonly: true, + name: 'ZPLabs-optimism', checkpointSyncer: { type: CheckpointSyncerType.S3, bucket: 'abacus-validator-signatures-zplabs-optimism', diff --git a/typescript/infra/config/environments/test/validators.ts b/typescript/infra/config/environments/test/validators.ts index b954b5e52..684bf9321 100644 --- a/typescript/infra/config/environments/test/validators.ts +++ b/typescript/infra/config/environments/test/validators.ts @@ -16,6 +16,7 @@ export const validators: ChainValidatorSets = { validators: [ { address: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', + name: 'local-validator-test1', checkpointSyncer: { type: CheckpointSyncerType.LocalStorage, path: localStoragePath('test1'), @@ -28,6 +29,7 @@ export const validators: ChainValidatorSets = { validators: [ { address: '0x3c44cdddb6a900fa2b585dd299e03d12fa4293bc', + name: 'local-validator-test2', checkpointSyncer: { type: CheckpointSyncerType.LocalStorage, path: localStoragePath('test2'), @@ -40,6 +42,7 @@ export const validators: ChainValidatorSets = { validators: [ { address: '0x90f79bf6eb2c4f870365e785982e1f101e93b906', + name: 'local-validator-test3', checkpointSyncer: { type: CheckpointSyncerType.LocalStorage, path: localStoragePath('test3'), diff --git a/typescript/infra/config/environments/testnet2/validators.ts b/typescript/infra/config/environments/testnet2/validators.ts index 8bd739351..c37ec1b5d 100644 --- a/typescript/infra/config/environments/testnet2/validators.ts +++ b/typescript/infra/config/environments/testnet2/validators.ts @@ -20,6 +20,7 @@ export const validators: ChainValidatorSets = { validators: [ { address: '0x7716860b2be4079137dc21533ac6d26a99d76e83', + name: s3BucketName('alfajores', 0), checkpointSyncer: { type: CheckpointSyncerType.S3, bucket: s3BucketName('alfajores', 0), @@ -28,6 +29,7 @@ export const validators: ChainValidatorSets = { }, { address: '0xb476f4d55d640e9a9a43b9bdf471dc06e4508bbd', + name: s3BucketName('alfajores', 1), checkpointSyncer: { type: CheckpointSyncerType.S3, bucket: s3BucketName('alfajores', 1), @@ -36,6 +38,7 @@ export const validators: ChainValidatorSets = { }, { address: '0xda63918dd964c0d7c59a04062bffe0fba8edaf1c', + name: s3BucketName('alfajores', 2), checkpointSyncer: { type: CheckpointSyncerType.S3, bucket: s3BucketName('alfajores', 2), @@ -44,6 +47,7 @@ export const validators: ChainValidatorSets = { }, { address: '0xebb97602f6acd259ecec9f9fa811aed5b35981ab', + name: s3BucketName('alfajores', 3), checkpointSyncer: { type: CheckpointSyncerType.S3, bucket: s3BucketName('alfajores', 3), @@ -57,6 +61,7 @@ export const validators: ChainValidatorSets = { validators: [ { address: '0x1ee94e776cbe4bf74d2f80dae551758efbc21887', + name: s3BucketName('kovan', 0), checkpointSyncer: { type: CheckpointSyncerType.S3, bucket: s3BucketName('kovan', 0), @@ -65,6 +70,7 @@ export const validators: ChainValidatorSets = { }, { address: '0xf2af10d9fd08eead8c6724a7feb679b5c900a38c', + name: s3BucketName('kovan', 1), checkpointSyncer: { type: CheckpointSyncerType.S3, bucket: s3BucketName('kovan', 1), @@ -73,6 +79,7 @@ export const validators: ChainValidatorSets = { }, { address: '0xf3b7d58acfbff1fd64f173607101f611034e4f5f', + name: s3BucketName('kovan', 2), checkpointSyncer: { type: CheckpointSyncerType.S3, bucket: s3BucketName('kovan', 2), @@ -81,6 +88,7 @@ export const validators: ChainValidatorSets = { }, { address: '0xff94c7660e857ba3f35ee248ae461feea266a504', + name: s3BucketName('kovan', 3), checkpointSyncer: { type: CheckpointSyncerType.S3, bucket: s3BucketName('kovan', 3), @@ -94,6 +102,7 @@ export const validators: ChainValidatorSets = { validators: [ { address: '0xc0ab1f3e3317521a92462927849b8844cf408b09', + name: s3BucketName('fuji', 0), checkpointSyncer: { type: CheckpointSyncerType.S3, bucket: s3BucketName('fuji', 0), @@ -102,6 +111,7 @@ export const validators: ChainValidatorSets = { }, { address: '0xefde1812fea378c645d8e7984ce985b228cd1beb', + name: s3BucketName('fuji', 1), checkpointSyncer: { type: CheckpointSyncerType.S3, bucket: s3BucketName('fuji', 1), @@ -110,6 +120,7 @@ export const validators: ChainValidatorSets = { }, { address: '0xb17f4f63e09c0a9207e2f008977e3f5b5584875d', + name: s3BucketName('fuji', 2), checkpointSyncer: { type: CheckpointSyncerType.S3, bucket: s3BucketName('fuji', 2), @@ -118,6 +129,7 @@ export const validators: ChainValidatorSets = { }, { address: '0x6f6a95ad0348454a5d4c3029cd3243acecd1cf8b', + name: s3BucketName('fuji', 3), checkpointSyncer: { type: CheckpointSyncerType.S3, bucket: s3BucketName('fuji', 3), @@ -131,6 +143,7 @@ export const validators: ChainValidatorSets = { validators: [ { address: '0x0f1a231cb2ecc5f26696c433d76fe59521a227e0', + name: s3BucketName('mumbai', 0), checkpointSyncer: { type: CheckpointSyncerType.S3, bucket: s3BucketName('mumbai', 0), @@ -139,6 +152,7 @@ export const validators: ChainValidatorSets = { }, { address: '0x3e527087fc60752695d9a4f77a6324bbae3940b1', + name: s3BucketName('mumbai', 1), checkpointSyncer: { type: CheckpointSyncerType.S3, bucket: s3BucketName('mumbai', 1), @@ -147,6 +161,7 @@ export const validators: ChainValidatorSets = { }, { address: '0x62afdaed75bdfd94e0d6103eb0333669d4f5d232', + name: s3BucketName('mumbai', 2), checkpointSyncer: { type: CheckpointSyncerType.S3, bucket: s3BucketName('mumbai', 2), @@ -155,6 +170,7 @@ export const validators: ChainValidatorSets = { }, { address: '0xa12b4612d00f682276c994040a3f37d0d6f343c4', + name: s3BucketName('mumbai', 3), checkpointSyncer: { type: CheckpointSyncerType.S3, bucket: s3BucketName('mumbai', 3), @@ -168,6 +184,7 @@ export const validators: ChainValidatorSets = { validators: [ { address: '0xa7959b2f03f6fc77c9592547bd0ca12fe2c7bf8f', + name: s3BucketName('bsctestnet', 0), checkpointSyncer: { type: CheckpointSyncerType.S3, bucket: s3BucketName('bsctestnet', 0), @@ -176,6 +193,7 @@ export const validators: ChainValidatorSets = { }, { address: '0xc78c1198d4224103dbb0e365286c3403c54fbbf6', + name: s3BucketName('bsctestnet', 1), checkpointSyncer: { type: CheckpointSyncerType.S3, bucket: s3BucketName('bsctestnet', 1), @@ -184,6 +202,7 @@ export const validators: ChainValidatorSets = { }, { address: '0x453da5c773e829aa4f61be9bad64aa5eaaef000a', + name: s3BucketName('bsctestnet', 2), checkpointSyncer: { type: CheckpointSyncerType.S3, bucket: s3BucketName('bsctestnet', 2), @@ -192,6 +211,7 @@ export const validators: ChainValidatorSets = { }, { address: '0x625027ffb9b9b9ba083d267e5b7756af33e636a0', + name: s3BucketName('bsctestnet', 3), checkpointSyncer: { type: CheckpointSyncerType.S3, bucket: s3BucketName('bsctestnet', 3), @@ -205,6 +225,7 @@ export const validators: ChainValidatorSets = { validators: [ { address: '0xf5a871bcb9d6dfa2d3519caf396e7ab3c5a7a2ee', + name: s3BucketName('arbitrumrinkeby', 0), checkpointSyncer: { type: CheckpointSyncerType.S3, bucket: s3BucketName('arbitrumrinkeby', 0), @@ -213,6 +234,7 @@ export const validators: ChainValidatorSets = { }, { address: '0xa6773fc38b023a512106e104a4f2cad2e68d802d', + name: s3BucketName('arbitrumrinkeby', 1), checkpointSyncer: { type: CheckpointSyncerType.S3, bucket: s3BucketName('arbitrumrinkeby', 1), @@ -221,6 +243,7 @@ export const validators: ChainValidatorSets = { }, { address: '0x42f7b994720463eff351186f83d683efa5e2ed49', + name: s3BucketName('arbitrumrinkeby', 2), checkpointSyncer: { type: CheckpointSyncerType.S3, bucket: s3BucketName('arbitrumrinkeby', 2), @@ -229,6 +252,7 @@ export const validators: ChainValidatorSets = { }, { address: '0x49649a8708f45171f5439ec71dc83baafd98b01c', + name: s3BucketName('arbitrumrinkeby', 3), checkpointSyncer: { type: CheckpointSyncerType.S3, bucket: s3BucketName('arbitrumrinkeby', 3), @@ -242,6 +266,7 @@ export const validators: ChainValidatorSets = { validators: [ { address: '0xef0d7bbb9c71fef7dc148722060afd78d0ff09d8', + name: s3BucketName('optimismkovan', 0), checkpointSyncer: { type: CheckpointSyncerType.S3, bucket: s3BucketName('optimismkovan', 0), @@ -250,6 +275,7 @@ export const validators: ChainValidatorSets = { }, { address: '0x8e64ff3936aeadacc23a76cf2c96466927ed758f', + name: s3BucketName('optimismkovan', 1), checkpointSyncer: { type: CheckpointSyncerType.S3, bucket: s3BucketName('optimismkovan', 1), @@ -258,6 +284,7 @@ export const validators: ChainValidatorSets = { }, { address: '0x13a3cd962ce99d6a6509f8d5b63a4498db329323', + name: s3BucketName('optimismkovan', 2), checkpointSyncer: { type: CheckpointSyncerType.S3, bucket: s3BucketName('optimismkovan', 2), @@ -266,6 +293,7 @@ export const validators: ChainValidatorSets = { }, { address: '0x85f8286a8ee13aecc227e99b75375826cdb512dd', + name: s3BucketName('optimismkovan', 3), checkpointSyncer: { type: CheckpointSyncerType.S3, bucket: s3BucketName('optimismkovan', 3), @@ -279,6 +307,7 @@ export const validators: ChainValidatorSets = { validators: [ { address: '0x89687c99ffb56f329915f80a858a45fccc2b7402', + name: s3BucketName('goerli', 0), checkpointSyncer: { type: CheckpointSyncerType.S3, bucket: s3BucketName('goerli', 0), @@ -287,6 +316,7 @@ export const validators: ChainValidatorSets = { }, { address: '0xca25781e7c0067a71d09b991bd7b37ab1168c76c', + name: s3BucketName('goerli', 1), checkpointSyncer: { type: CheckpointSyncerType.S3, bucket: s3BucketName('goerli', 1), @@ -295,6 +325,7 @@ export const validators: ChainValidatorSets = { }, { address: '0xcbf6cde516f43a7b5346f48319b016b0e05cb7af', + name: s3BucketName('goerli', 2), checkpointSyncer: { type: CheckpointSyncerType.S3, bucket: s3BucketName('goerli', 2), @@ -308,6 +339,7 @@ export const validators: ChainValidatorSets = { validators: [ { address: '0x0cc08084a0a7cc61102e800204851627732f8aa4', + name: s3BucketName('moonbasealpha', 0), checkpointSyncer: { type: CheckpointSyncerType.S3, bucket: s3BucketName('moonbasealpha', 0), @@ -316,6 +348,7 @@ export const validators: ChainValidatorSets = { }, { address: '0xd151f6ca08e632eb7abd5afcb49c47d6a9b67a54', + name: s3BucketName('moonbasealpha', 1), checkpointSyncer: { type: CheckpointSyncerType.S3, bucket: s3BucketName('moonbasealpha', 1), @@ -324,6 +357,7 @@ export const validators: ChainValidatorSets = { }, { address: '0x8d41c4cb699a408f9b5c69156eaa12ce76346b16', + name: s3BucketName('moonbasealpha', 2), checkpointSyncer: { type: CheckpointSyncerType.S3, bucket: s3BucketName('moonbasealpha', 2), diff --git a/typescript/infra/scripts/list-validator-checkpoint-indices.ts b/typescript/infra/scripts/list-validator-checkpoint-indices.ts new file mode 100644 index 000000000..1b4055f16 --- /dev/null +++ b/typescript/infra/scripts/list-validator-checkpoint-indices.ts @@ -0,0 +1,48 @@ +import { ChainNameToDomainId } from '@hyperlane-xyz/sdk'; + +import { S3Validator } from '../src/agents/aws/validator'; +import { concurrentMap } from '../src/utils/utils'; + +import { + getContextAgentConfig, + getCoreEnvironmentConfig, + getEnvironment, +} from './utils'; + +async function main() { + const environment = await getEnvironment(); + const config = getCoreEnvironmentConfig(environment); + + const agentConfig = await getContextAgentConfig(config, 'abacus'); + + const validators = Object.entries(agentConfig.validatorSets).flatMap( + ([chain, set]) => set.validators.map((validator) => ({ chain, validator })), + ); + const indices = await concurrentMap( + 4, + validators, + async ({ chain, validator }) => { + const s3Validator = new S3Validator( + validator.address, + // @ts-ignore + ChainNameToDomainId[chain], + // @ts-ignore + `https://${validator.checkpointSyncer.bucket!}.s3.${ + // @ts-ignore + validator.checkpointSyncer.region + }.amazonaws.com`, + ); + + return { + chain, + name: validator.name, + address: validator.address, + index: await s3Validator.getLatestCheckpointIndex(), + }; + }, + ); + + console.table(indices, ['chain', 'index', 'name', 'address']); +} + +main().catch(console.error); diff --git a/typescript/infra/scripts/utils.ts b/typescript/infra/scripts/utils.ts index b4ce96a74..ca2ca7714 100644 --- a/typescript/infra/scripts/utils.ts +++ b/typescript/infra/scripts/utils.ts @@ -62,16 +62,20 @@ export async function getEnvironmentConfig() { return getCoreEnvironmentConfig(await getEnvironment()); } -export async function getContext(): Promise { +export async function getContext(defaultContext?: string): Promise { const argv = await getArgs().argv; - return assertContext(argv.context!); + return assertContext(argv.context! || defaultContext!); } // Gets the agent config for the context that has been specified via yargs. export async function getContextAgentConfig( coreEnvironmentConfig?: CoreEnvironmentConfig, + defaultContext?: string, ) { - return getAgentConfig(await getContext(), coreEnvironmentConfig); + return getAgentConfig( + await getContext(defaultContext), + coreEnvironmentConfig, + ); } // Gets the agent config of a specific context. diff --git a/typescript/infra/src/agents/aws/validator.ts b/typescript/infra/src/agents/aws/validator.ts index 4497757e5..cbdb0fa7c 100644 --- a/typescript/infra/src/agents/aws/validator.ts +++ b/typescript/infra/src/agents/aws/validator.ts @@ -50,6 +50,16 @@ export class S3Validator extends BaseValidator { this.s3Bucket = new S3Wrapper(s3Bucket); } + async getLatestCheckpointIndex() { + const latestCheckpointIndex = await this.s3Bucket.getS3Obj( + LATEST_KEY, + ); + + if (!latestCheckpointIndex) return -1; + + return latestCheckpointIndex.data; + } + async compare(other: S3Validator, count = 20): Promise { const latestCheckpointIndex = await this.s3Bucket.getS3Obj( LATEST_KEY, diff --git a/typescript/infra/src/config/agent.ts b/typescript/infra/src/config/agent.ts index e16783eb1..2fc5a0e02 100644 --- a/typescript/infra/src/config/agent.ts +++ b/typescript/infra/src/config/agent.ts @@ -73,6 +73,7 @@ interface ValidatorSet { // A validator. This isn't agent-specific configuration, just information // on the validator that is enrolled in a validator set. interface Validator { + name: string; address: string; checkpointSyncer: CheckpointSyncerConfig; readonly?: boolean;