File tree Expand file tree Collapse file tree 3 files changed +13
-7
lines changed
Expand file tree Collapse file tree 3 files changed +13
-7
lines changed Original file line number Diff line number Diff line change @@ -21,7 +21,6 @@ import {
2121 ValidatorsInfo ,
2222 showSpinner ,
2323 logResult ,
24- sleep ,
2524} from 'utils' ;
2625import { getVaultHubContract } from 'contracts' ;
2726import { waitForTransactionReceipt } from 'viem/actions' ;
@@ -274,8 +273,6 @@ export const checkValidators = async (
274273 }
275274 await checkSourceValidators ( sourceValidatorsInfo . data , finalizedEpoch ) ;
276275
277- await sleep ( 1000 ) ; // to fight with too many requests issue
278-
279276 const targetValidatorsInfo = await fetchValidatorsInfo ( targetPubkeys ) ;
280277 if ( targetValidatorsInfo . data == null ) {
281278 throw new Error ( 'targetValidatorsInfo.data is null' ) ;
Original file line number Diff line number Diff line change @@ -33,6 +33,9 @@ export const jsonToPermit = (value: string) => {
3333
3434export const jsonFileToPubkeys = ( value : string ) => {
3535 const content = readFileSync ( value , 'utf-8' ) ;
36+ if ( content . length === 0 ) {
37+ throw new Error ( 'File is empty' ) ;
38+ }
3639 return JSON . parse ( content ) as Pubkeys ;
3740} ;
3841
Original file line number Diff line number Diff line change @@ -14,13 +14,19 @@ export const checkSourceValidators = async (
1414 notActiveValidators . map ( ( v ) => v . validator . pubkey ) . join ( ', ' ) ,
1515 ) ;
1616
17- const wrongWCSourceValidators = sourceValidatorsInfoData . filter ( ( validator ) =>
18- validator . validator . withdrawal_credentials . startsWith ( '0x00' ) ,
17+ const correctWCSourceValidators = sourceValidatorsInfoData . filter (
18+ ( validator ) =>
19+ validator . validator . withdrawal_credentials . startsWith ( '0x01' ) ||
20+ validator . validator . withdrawal_credentials . startsWith ( '0x02' ) ,
1921 ) ;
22+
2023 assert (
21- wrongWCSourceValidators . length === 0 ,
24+ sourceValidatorsInfoData . length === correctWCSourceValidators . length ,
2225 'All source pubkeys must have a withdrawal credentials starting with 0x01 or 0x02. Wrong pubkeys:' +
23- wrongWCSourceValidators . map ( ( v ) => v . validator . pubkey ) . join ( ', ' ) ,
26+ sourceValidatorsInfoData
27+ . filter ( ( validator ) => ! correctWCSourceValidators . includes ( validator ) )
28+ . map ( ( v ) => v . validator . pubkey )
29+ . join ( ', ' ) ,
2430 ) ;
2531
2632 const sourceValidatorsWithLess256Epochs = sourceValidatorsInfoData . filter (
You can’t perform that action at this time.
0 commit comments