From 1592597d9309e2d8a145961f2c7e19d9f8061be6 Mon Sep 17 00:00:00 2001 From: Justin Starry Date: Fri, 14 Aug 2020 10:06:37 +0800 Subject: [PATCH] Explorer: Fix stake account validation (#11623) --- explorer/src/components/account/StakeAccountSection.tsx | 2 +- explorer/src/validators/accounts/stake.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/explorer/src/components/account/StakeAccountSection.tsx b/explorer/src/components/account/StakeAccountSection.tsx index cca16dd0cb..bebb36dfeb 100644 --- a/explorer/src/components/account/StakeAccountSection.tsx +++ b/explorer/src/components/account/StakeAccountSection.tsx @@ -12,7 +12,7 @@ import { } from "validators/accounts/stake"; import BN from "bn.js"; -const MAX_EPOCH = new BN(2).pow(new BN(64)); +const MAX_EPOCH = new BN(2).pow(new BN(64)).sub(new BN(1)); export function StakeAccountSection({ account, diff --git a/explorer/src/validators/accounts/stake.ts b/explorer/src/validators/accounts/stake.ts index 6dae5ab143..05174d08b7 100644 --- a/explorer/src/validators/accounts/stake.ts +++ b/explorer/src/validators/accounts/stake.ts @@ -1,4 +1,4 @@ -import { object, StructType, number, optional, enums } from "superstruct"; +import { object, StructType, number, nullable, enums } from "superstruct"; import { Pubkey } from "validators/pubkey"; import { BigNum } from "validators/bignum"; @@ -27,7 +27,7 @@ export const StakeMeta = object({ export type StakeAccountInfo = StructType; export const StakeAccountInfo = object({ meta: StakeMeta, - stake: optional( + stake: nullable( object({ delegation: object({ voter: Pubkey,