diff --git a/packages/light-client/src/block.ts b/packages/light-client/src/block.ts index baab3cda67..4603047a5b 100644 --- a/packages/light-client/src/block.ts +++ b/packages/light-client/src/block.ts @@ -139,10 +139,7 @@ export function validateLightClientBlock({ function hashBlockProducers(bps: ValidatorStakeView[]): Buffer { const borshBps: BorshValidatorStakeView[] = bps.map((bp) => { if (bp.validator_stake_struct_version) { - const version = parseInt( - bp.validator_stake_struct_version.slice(1) - ); - if (version !== 1) { + if (bp.validator_stake_struct_version !== 'V1') { throw new Error( 'Only version 1 of the validator stake struct is supported' ); diff --git a/packages/light-client/src/borsh.ts b/packages/light-client/src/borsh.ts index a733856c43..2a6a53fdb3 100644 --- a/packages/light-client/src/borsh.ts +++ b/packages/light-client/src/borsh.ts @@ -170,4 +170,4 @@ export const SCHEMA = new Map([ ], }, ], -]); \ No newline at end of file +]); diff --git a/packages/types/src/assignable.ts b/packages/types/src/assignable.ts index 89fb5eb27f..fe0aaf9723 100644 --- a/packages/types/src/assignable.ts +++ b/packages/types/src/assignable.ts @@ -14,6 +14,9 @@ export abstract class Enum { throw new Error('Enum can only take single value'); } Object.keys(properties).map((key: string) => { + if (key === 'enum') { + throw new Error('Enum can not take key named enum'); + } (this as any)[key] = properties[key]; this.enum = key; });