Skip to content

Commit

Permalink
A0-1847: Add support for disuniting aura and alephbft (#71)
Browse files Browse the repository at this point in the history
* A0-1847: Rename CurrentList to BlockProductionCommitteeList

* A0-1847: Add hook returning AlephBFT committee for session

* A0-1847: Add UI

* A0-1847: Add missing headers

* A0-1847: Fill in values when `nextFinalityCommittee` is not defined

* A0-1847: Fix linter errors

* A0-1847: Display finalizing committee size; improve styles

* A0-1847: Update translations
  • Loading branch information
youPickItUp authored Jul 11, 2023
1 parent fe7a3ce commit e934011
Show file tree
Hide file tree
Showing 17 changed files with 186 additions and 17 deletions.
1 change: 1 addition & 0 deletions packages/apps/public/locales/en/app-accounts.json
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@
"The recipient is associated with a known phishing site on {{url}}": "The recipient is associated with a known phishing site on {{url}}",
"The recoverable account is protected against the loss of seed/access by a social process.": "The recoverable account is protected against the loss of seed/access by a social process.",
"The secret seed value for this account. Ensure that you keep this in a safe place, with access to the seed you can re-create the account.": "The secret seed value for this account. Ensure that you keep this in a safe place, with access to the seed you can re-create the account.",
"The secret seed value for this account. Ensure that you keep this in a safe place, with access to the seed you can re-create the account. If you wish to retrieve your account now, paste your mnemonic seed in the input field on your left and proceed with on-screen instructions. Your account will be recovered.": "The secret seed value for this account. Ensure that you keep this in a safe place, with access to the seed you can re-create the account. If you wish to retrieve your account now, paste your mnemonic seed in the input field on your left and proceed with on-screen instructions. Your account will be recovered.",
"The signatories has the ability to create transactions using the multisig and approve transactions sent by others.Once the threshold is reached with approvals, the multisig transaction is enacted on-chain.": "The signatories has the ability to create transactions using the multisig and approve transactions sent by others.Once the threshold is reached with approvals, the multisig transaction is enacted on-chain.",
"The threshold for approval should be less or equal to the number of signatories for this multisig.": "The threshold for approval should be less or equal to the number of signatories for this multisig.",
"The threshold for approvals and the delay is the protection associated with the account. The delay should be such that any colluding recovery attempts does have a window to stop.": "The threshold for approvals and the delay is the protection associated with the account. The delay should be such that any colluding recovery attempts does have a window to stop.",
Expand Down
2 changes: 1 addition & 1 deletion packages/apps/public/locales/en/app-alliance.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@
"voter": "voter",
"websites": "websites",
"yes": "yes"
}
}
2 changes: 1 addition & 1 deletion packages/apps/public/locales/en/app-referenda.json
Original file line number Diff line number Diff line change
Expand Up @@ -107,4 +107,4 @@
"votes": "votes",
"{{blocks}} blocks": "{{blocks}} blocks",
"{{when}} (est.)": "{{when}} (est.)"
}
}
35 changes: 34 additions & 1 deletion packages/apps/public/locales/en/app-staking.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,12 @@
"Controller account": "Controller account",
"Create": "Create",
"Create nomination pool": "Create nomination pool",
"Current committee": "Current committee",
"Data isn't available that far back.": "Data isn't available that far back.",
"Data isn't available.": "Data isn't available.",
"Distinct stash and controller accounts are recommended to ensure fund security. You will be allowed to make the transaction, but take care to not tie up all funds, only use a portion of the available funds during this period.": "Distinct stash and controller accounts are recommended to ensure fund security. You will be allowed to make the transaction, but take care to not tie up all funds, only use a portion of the available funds during this period.",
"Era points": "Era points",
"Finality committee": "Finality committee",
"For fund security, your session key should not match your stash key.": "For fund security, your session key should not match your stash key.",
"Free balance": "Free balance",
"Grandpa": "Grandpa",
Expand All @@ -58,11 +62,13 @@
"No active validators to check": "No active validators to check",
"No available bags": "No available bags",
"No available nomination pools": "No available nomination pools",
"No entries found": "No entries found",
"No funds staked yet. Bond funds to validate or nominate a validator": "No funds staked yet. Bond funds to validate or nominate a validator",
"No members": "No members",
"No nominees": "No nominees",
"No pending payouts for your stashes": "No pending payouts for your stashes",
"No pending payouts for your validators": "No pending payouts for your validators",
"No suspensions events found in the past 84 eras": "No suspensions events found in the past 84 eras",
"No waiting validators found": "No waiting validators found",
"No, block all nominations": "No, block all nominations",
"Nominate": "Nominate",
Expand Down Expand Up @@ -95,12 +101,15 @@
"Payout all stakers": "Payout all stakers",
"Payouts": "Payouts",
"Payouts of rewards for a validator can be initiated by any account. This means that as soon as a validator or nominator requests a payout for an era, all the nominators for that validator will be rewarded. Each user does not need to claim individually and the suggestion is that validators should claim rewards for everybody as soon as an era ends.": "Payouts of rewards for a validator can be initiated by any account. This means that as soon as a validator or nominator requests a payout for an era, all the nominators for that validator will be rewarded. Each user does not need to claim individually and the suggestion is that validators should claim rewards for everybody as soon as an era ends.",
"Performance": "Performance",
"Pool rewards": "Pool rewards",
"Pooled": "Pooled",
"Pools": "Pools",
"Preparing target display": "Preparing target display",
"Preparing validator list": "Preparing validator list",
"Previous session": "Previous session",
"Produced blocks": "Produced blocks",
"Querying past performances": "Querying past performances",
"Rebag": "Rebag",
"Rebag dislocated entries": "Rebag dislocated entries",
"Rebag {{count}}": "Rebag {{count}}",
Expand All @@ -115,10 +124,12 @@
"Retrieving nomination pools": "Retrieving nomination pools",
"Retrieving nominators": "Retrieving nominators",
"Retrieving online status": "Retrieving online status",
"Retrieving suspensions events": "Retrieving suspensions events",
"Retrieving validator info": "Retrieving validator info",
"Retrieving validators": "Retrieving validators",
"Rewards (once paid) can be deposited to either the stash or controller, with different effects.": "Rewards (once paid) can be deposited to either the stash or controller, with different effects.",
"Session Key": "Session Key",
"Session number": "Session number",
"Set Session Key": "Set Session Key",
"Set controller": "Set controller",
"Set nominees": "Set nominees",
Expand All @@ -137,6 +148,7 @@
"Stashed": "Stashed",
"Stop": "Stop",
"Submit key": "Submit key",
"Suspensions": "Suspensions",
"Targets": "Targets",
"The All bags list is composed of bags that each describe a range of active bonded funds of the nominators. In each bag is a list of nodes that correspond to a nominator and their staked funds.": "The All bags list is composed of bags that each describe a range of active bonded funds of the nominators. In each bag is a list of nodes that correspond to a nominator and their staked funds.",
"The Threshold must be a positive number": "The Threshold must be a positive number",
Expand Down Expand Up @@ -187,7 +199,9 @@
"Unbond": "Unbond",
"Unbond funds": "Unbond funds",
"Unbond funds from pool": "Unbond funds from pool",
"Underperformed Session Count": "Underperformed Session Count",
"Use the account actions to create a new validator/nominator stash and bond it to participate in staking. Do not send funds directly via a transfer to a validator.": "Use the account actions to create a new validator/nominator stash and bond it to participate in staking. Do not send funds directly via a transfer to a validator.",
"Use the account actions to create a new validator/nominator stash and bond it to participate in staking. Do not send funds directly via a transfer to a validator. Learn more about the staking process ": "Use the account actions to create a new validator/nominator stash and bond it to participate in staking. Do not send funds directly via a transfer to a validator. Learn more about the staking process ",
"Validate": "Validate",
"Validator": "Validator",
"Validator stats": "Validator stats",
Expand All @@ -202,6 +216,7 @@
"You can either bond a specific amount from your free balance, or all of the accumulated rewards.": "You can either bond a specific amount from your free balance, or all of the accumulated rewards.",
"You should trust your nominations to act competently and honest; basing your decision purely on their current profitability could lead to reduced profits or even loss of funds.": "You should trust your nominations to act competently and honest; basing your decision purely on their current profitability could lead to reduced profits or even loss of funds.",
"Your bonded amount is below the on-chain minimum threshold of {{minBond}} and may be chilled. Bond extra funds to increase the bonded amount.": "Your bonded amount is below the on-chain minimum threshold of {{minBond}} and may be chilled. Bond extra funds to increase the bonded amount.",
"Your bonded amount is below the on-chain minimum threshold of {{minBond}} for direct validator nomination. If you would like to change the nominee, use nomination pools where that threshold is lower.": "Your bonded amount is below the on-chain minimum threshold of {{minBond}} for direct validator nomination. If you would like to change the nominee, use nomination pools where that threshold is lower.",
"account": "account",
"active / nominators": "active / nominators",
"additional free funds to bond": "additional free funds to bond",
Expand All @@ -213,6 +228,8 @@
"average": "average",
"bags": "bags",
"balance": "balance",
"block production committee size": "block production committee size",
"blocks created": "blocks created",
"bonded": "bonded",
"candidate accounts": "candidate accounts",
"capacity < {{maxCap}}%": "capacity < {{maxCap}}%",
Expand All @@ -231,15 +248,21 @@
"description": "description",
"ed25519, Edwards": "ed25519, Edwards",
"elected stake": "elected stake",
"end era": "end era",
"era": "era",
"era points": "era points",
"era validators": "era validators",
"era {{era}}": "era {{era}}",
"era {{era}}/unapplied": "era {{era}}/unapplied",
"eras": "eras",
"existing/active nominators": "existing/active nominators",
"expected block count": "expected block count",
"filter by name, address or index": "filter by name, address or index",
"finalizing committee size": "finalizing committee size",
"first": "first",
"generated public key": "generated public key",
"graphs": "graphs",
"here.": "here.",
"historic results": "historic results",
"ideal staked": "ideal staked",
"inflation": "inflation",
Expand All @@ -249,9 +272,11 @@
"key type to set": "key type to set",
"last": "last",
"last #": "last #",
"last era payout": "last era payout",
"last reward": "last reward",
"lowest / avg staked": "lowest / avg staked",
"max": "max",
"max % reward": "max % reward",
"max. members": "max. members",
"max. members / pool": "max. members / pool",
"member account": "member account",
Expand All @@ -265,6 +290,8 @@
"nominator": "nominator",
"nominators": "nominators",
"nominators to be removed": "nominators to be removed",
"not greater than": "not greater than",
"not smaller than": "not smaller than",
"on-chain bonding duration": "on-chain bonding duration",
"one validator per operator": "one validator per operator",
"other": "other",
Expand All @@ -282,6 +309,7 @@
"pool id": "pool id",
"pools": "pools",
"prev": "prev",
"reason": "reason",
"rebag from account": "rebag from account",
"rebonded amount": "rebonded amount",
"recent payouts": "recent payouts",
Expand All @@ -295,13 +323,18 @@
"rewards & slashes": "rewards & slashes",
"root": "root",
"selected validators": "selected validators",
"session": "session",
"session performance in last 4 eras": "session performance in last 4 eras",
"sr15519, Schnorrkel": "sr15519, Schnorrkel",
"staked": "staked",
"start era": "start era",
"stash": "stash",
"stash account": "stash account",
"stashes": "stashes",
"state": "state",
"stats": "stats",
"suri (seed & derivation)": "suri (seed & derivation)",
"suspensions": "suspensions",
"the associated controller": "the associated controller",
"the payment account": "the payment account",
"the stash account to nominate with": "the stash account to nominate with",
Expand Down Expand Up @@ -330,4 +363,4 @@
"{{currency}} slashed": "{{currency}} slashed",
"{{currency}} total": "{{currency}} total",
"{{days}} days": "{{days}} days"
}
}
1 change: 1 addition & 0 deletions packages/apps/public/locales/en/app-staking2.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"All pools": "All pools",
"Create": "Create",
"Create nomination pool": "Create nomination pool",
"Foundation pools": "Foundation pools",
"Join": "Join",
"Join nomination pool": "Join nomination pool",
"Members ({{count}})": "Members ({{count}})",
Expand Down
1 change: 1 addition & 0 deletions packages/apps/public/locales/en/app-storage.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"0x...": "0x...",
"Constants": "Constants",
"Decoded pallet name and call": "Decoded pallet name and call",
"Raw storage": "Raw storage",
"Storage": "Storage",
"blockhash to query at": "blockhash to query at",
Expand Down
3 changes: 2 additions & 1 deletion packages/apps/public/locales/en/apps-config.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"lightclient.experimental": "light client (experimental)",
"lng.detect": "Default browser language (auto-detect)",
"rpc.dev.azero.dev": "Aleph Zero Devnet",
"rpc.dev.custom": "Custom environment",
"rpc.dev.custom.entry": "Custom {{WS_URL}}",
"rpc.dev.custom.own": "Custom",
Expand All @@ -14,4 +15,4 @@
"rpc.header.westend.relay": "Test Westend & parachains",
"rpc.hosted.via": "via {{host}}",
"ss58.default": "Default for the connected node"
}
}
8 changes: 6 additions & 2 deletions packages/apps/public/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,10 @@
"Curator's deposit": "",
"Curator's deposit will be slashed and curator will be unassigned. Bounty will return to the Funded state.": "",
"Curator's fee": "",
"Dark theme (default)": "",
"DCF": "",
"Dark theme (default)": "",
"Data isn't available that far back.": "",
"Data isn't available.": "",
"Defender": "",
"Delegate": "",
"Delegate democracy votes": "",
Expand All @@ -68,9 +70,11 @@
"Extensions": "",
"File": "",
"Files": "",
"Finality committee": "",
"Folder": "",
"For approvals outstanding approvers will be shown, for hashes that should be cancelled the first approver is required.": "",
"Forget this account": "",
"Foundation pools": "",
"Frozen": "",
"Full Legal Name": "",
"Governance": "",
Expand Down Expand Up @@ -384,4 +388,4 @@
"{{percentage}}% turnout": "",
"{{when}} (est.)": "",
"⚡️ Thunder Gateway": ""
}
}
2 changes: 1 addition & 1 deletion packages/apps/public/locales/pl/add-accounts.json
Original file line number Diff line number Diff line change
Expand Up @@ -337,4 +337,4 @@
"website": "strona internetowa",
"your current password": "twoje obecne hasło",
"your new password": "twoje nowe hasło"
}
}
37 changes: 37 additions & 0 deletions packages/page-staking/src/Performance/AlephBFTCommitteeList.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// Copyright 2017-2023 @polkadot/react-components authors & contributors
// SPDX-License-Identifier: Apache-2.0

import React from 'react';

import { AddressSmall, Table } from '@polkadot/react-components';

import { useTranslation } from '../translate.js';

type Props = {
committeeAddresses: string[] | undefined;
};

const AlephBFTCommitteeList = ({ committeeAddresses }: Props) => {
const { t } = useTranslation();

const header: [string][] = [
[t('Finality committee')]
];

const messageOnEmpty = committeeAddresses && t("Data isn't available.");

return (
<Table
empty={messageOnEmpty}
header={header}
>
{committeeAddresses?.map((address) => (
<tr key={address}>
<td><AddressSmall value={address} /></td>
</tr>
))}
</Table>
);
};

export default AlephBFTCommitteeList;
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export function calculatePercentReward (blocksCreated: number | undefined, block
return rewardPercentage.toFixed(1);
}

function CurrentList ({ className, eraValidatorPerformances, expectedBlockCount, onlyCommittee }: Props): React.ReactElement<Props> {
function BlockProductionCommitteeList ({ className, eraValidatorPerformances, expectedBlockCount, onlyCommittee }: Props): React.ReactElement<Props> {
const { t } = useTranslation();

const [nameFilter, setNameFilter] = useState<string>('');
Expand Down Expand Up @@ -120,4 +120,4 @@ function CurrentList ({ className, eraValidatorPerformances, expectedBlockCount,
);
}

export default React.memo(CurrentList);
export default React.memo(BlockProductionCommitteeList);
16 changes: 14 additions & 2 deletions packages/page-staking/src/Performance/HistoricPerformance.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,12 @@

import React, { useMemo, useState } from 'react';

import { styled } from '@polkadot/react-components';
import { useAlephBFTCommittee } from '@polkadot/react-hooks';

import ActionsBanner from './ActionsBanner.js';
import CurrentList from './CurrentList.js';
import AlephBFTCommitteeList from './AlephBFTCommitteeList.js';
import BlockProductionCommitteeList from './BlockProductionCommitteeList.js';
import Summary from './Summary.js';
import useSessionCommitteePerformance, { ValidatorPerformance } from './useCommitteePerformance.js';

Expand All @@ -22,6 +26,8 @@ function HistoricPerformance ({ era, session }: Props): React.ReactElement<Props
const sessionCommitteePerformance = useSessionCommitteePerformance([session]);
const [expectedBlockCountInSessions, setExpectedBlockCountInSessions] = useState<number | undefined>(undefined);

const finalizingCommitteeAddresses = useAlephBFTCommittee(session);

const eraValidatorPerformances: EraValidatorPerformance[] = useMemo(() => {
if (sessionCommitteePerformance && sessionCommitteePerformance.length > 0) {
setExpectedBlockCountInSessions(sessionCommitteePerformance[0].expectedBlockCount);
Expand All @@ -48,16 +54,22 @@ function HistoricPerformance ({ era, session }: Props): React.ReactElement<Props
era={era}
eraValidatorPerformances={eraValidatorPerformances}
expectedBlockCount={expectedBlockCountInSessions}
finalizingCommitteeSize={finalizingCommitteeAddresses?.length}
session={session}
/>
<ActionsBanner />
<CurrentList
<StyledBlockProductionCommitteeList
eraValidatorPerformances={eraValidatorPerformances}
expectedBlockCount={expectedBlockCountInSessions}
onlyCommittee={true}
/>
<AlephBFTCommitteeList committeeAddresses={finalizingCommitteeAddresses} />
</div>
);
}

const StyledBlockProductionCommitteeList = styled(BlockProductionCommitteeList)`
margin-bottom: 64px;
`;

export default React.memo(HistoricPerformance);
Loading

0 comments on commit e934011

Please sign in to comment.