Skip to content

Commit

Permalink
feat: use maxBlockTime to calculate unbonding period
Browse files Browse the repository at this point in the history
  • Loading branch information
mateuszjasiuk committed Aug 22, 2024
1 parent 16133ab commit 72f462b
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions apps/namadillo/src/atoms/chain/services.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export const fetchChainParameters = async (
1,
minEpochDuration: Number(parameters.minDuration),
minNumOfBlocks: Number(parameters.minNumOfBlocks),
maxBlockTime: Number(parameters.maxBlockTime),
epochSwitchBlocksDelay: Number(parameters.epochSwitchBlocksDelay),
},
apr: BigNumber(parameters.apr),
Expand Down
3 changes: 1 addition & 2 deletions apps/namadillo/src/atoms/validators/functions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,9 @@ export const toValidator = (
const expectedApr = nominalApr.times(1 - commission.toNumber());

// Because epoch duration is in reality longer by epochSwitchBlocksDelay we have to account for that
const timePerBlock = epochInfo.minEpochDuration / epochInfo.minNumOfBlocks;
const realMinEpochDuration =
epochInfo.minEpochDuration +
timePerBlock * epochInfo.epochSwitchBlocksDelay;
epochInfo.maxBlockTime * epochInfo.epochSwitchBlocksDelay;

const unbondingPeriod = singleUnitDurationFromInterval(
0,
Expand Down
1 change: 1 addition & 0 deletions apps/namadillo/src/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export type EpochInfo = {
unbondingPeriodInEpochs: number;
minEpochDuration: number;
minNumOfBlocks: number;
maxBlockTime: number;
epochSwitchBlocksDelay: number;
};

Expand Down

0 comments on commit 72f462b

Please sign in to comment.