diff --git a/apps/governance/src/routes/staking/home/validator-tables/consensus-validators-table.spec.tsx b/apps/governance/src/routes/staking/home/validator-tables/consensus-validators-table.spec.tsx index d11d729b7..bae509c58 100644 --- a/apps/governance/src/routes/staking/home/validator-tables/consensus-validators-table.spec.tsx +++ b/apps/governance/src/routes/staking/home/validator-tables/consensus-validators-table.spec.tsx @@ -288,7 +288,7 @@ describe('Consensus validators table', () => { expect( grid.querySelector('[role="gridcell"][col-id="totalPenalties"]') - ).toHaveTextContent('13.16%'); + ).toHaveTextContent('10.07%'); expect( grid.querySelector('[role="gridcell"][col-id="normalisedVotingPower"]') diff --git a/apps/governance/src/routes/staking/home/validator-tables/consensus-validators-table.tsx b/apps/governance/src/routes/staking/home/validator-tables/consensus-validators-table.tsx index 63272683f..915d7f394 100644 --- a/apps/governance/src/routes/staking/home/validator-tables/consensus-validators-table.tsx +++ b/apps/governance/src/routes/staking/home/validator-tables/consensus-validators-table.tsx @@ -185,15 +185,19 @@ export const ConsensusValidatorsTable = ({ const { rawValidatorScore: previousEpochValidatorScore } = getLastEpochScoreAndPerformance(previousEpochData, id); - const overstakingPenalty = calculateOverallPenalty( + const overstakingPenalty = calculateOverstakedPenalty( id, allNodesInPreviousEpoch ); - const totalPenalty = calculateOverstakedPenalty( + const totalPenalty = calculateOverallPenalty( id, allNodesInPreviousEpoch ); + const lastEpochDataForNode = allNodesInPreviousEpoch.find( + (node) => node.id === id + ); + return { id, [ValidatorFields.RANKING_INDEX]: stakedTotalRanking, @@ -239,6 +243,12 @@ export const ConsensusValidatorsTable = ({ : undefined, [ValidatorFields.MULTISIG_ERROR]: multisigStatus?.showMultisigStatusError, + [ValidatorFields.MULTISIG_PENALTY]: formatNumberPercentage( + new BigNumber(1) + .minus(lastEpochDataForNode?.rewardScore?.multisigScore ?? 1) + .times(100), + 2 + ), }; } ); @@ -378,7 +388,6 @@ export const ConsensusValidatorsTable = ({ headerTooltip: t('StakeDescription').toString(), cellRenderer: TotalStakeRenderer, width: 120, - sort: 'desc', }, { field: ValidatorFields.PENDING_STAKE, @@ -400,6 +409,7 @@ export const ConsensusValidatorsTable = ({ headerTooltip: t('NormalisedVotingPowerDescription').toString(), cellRenderer: VotingPowerRenderer, width: 120, + sort: 'desc', }, { field: ValidatorFields.TOTAL_PENALTIES, diff --git a/apps/governance/src/routes/staking/home/validator-tables/shared.tsx b/apps/governance/src/routes/staking/home/validator-tables/shared.tsx index 1abc3f8d3..fd804ce2e 100644 --- a/apps/governance/src/routes/staking/home/validator-tables/shared.tsx +++ b/apps/governance/src/routes/staking/home/validator-tables/shared.tsx @@ -40,6 +40,7 @@ export enum ValidatorFields { PENDING_USER_STAKE = 'pendingUserStake', USER_STAKE_SHARE = 'userStakeShare', MULTISIG_ERROR = 'multisigError', + MULTISIG_PENALTY = 'multisigPenalty', } export const addUserDataToValidator = ( @@ -327,7 +328,7 @@ interface TotalPenaltiesRendererProps { overstakedAmount: string; overstakingPenalty: string; totalPenalties: string; - multisigError?: boolean; + multisigPenalty: string; }; } @@ -346,11 +347,9 @@ export const TotalPenaltiesRenderer = ({