Skip to content

Commit

Permalink
fix: changes based on review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
austinabell committed Jun 2, 2023
1 parent 8731572 commit f766671
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
5 changes: 1 addition & 4 deletions packages/light-client/src/block.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
);
Expand Down
2 changes: 1 addition & 1 deletion packages/light-client/src/borsh.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,4 +170,4 @@ export const SCHEMA = new Map<Class, any>([
],
},
],
]);
]);
3 changes: 3 additions & 0 deletions packages/types/src/assignable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
});
Expand Down

0 comments on commit f766671

Please sign in to comment.