From 49ea94ab29065c449989751663f157660d16a5bf Mon Sep 17 00:00:00 2001 From: Jaco Greeff Date: Wed, 29 Jul 2020 10:48:30 +0200 Subject: [PATCH] Adjust slash threshold for Polkadot (#3283) --- packages/page-council/src/Motions/Slashing.tsx | 4 ++-- packages/page-council/src/Motions/thresholds.ts | 17 +++++++++++------ 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/packages/page-council/src/Motions/Slashing.tsx b/packages/page-council/src/Motions/Slashing.tsx index 98267dd522..fe5deeb17f 100644 --- a/packages/page-council/src/Motions/Slashing.tsx +++ b/packages/page-council/src/Motions/Slashing.tsx @@ -9,7 +9,7 @@ import { Button, Dropdown, Input, InputAddress, Modal, TxButton } from '@polkado import { useApi, useToggle } from '@polkadot/react-hooks'; import { useTranslation } from '../translate'; -import { getThreshold } from './thresholds'; +import { getSlashThreshold } from './thresholds'; import useAvailableSlashes from './useAvailableSlashes'; interface Props { @@ -37,7 +37,7 @@ function Slashing ({ className = '', isMember, members }: Props): React.ReactEle const [{ proposal, proposalLength }, setProposal] = useState({ proposal: null, proposalLength: 0 }); const [eras, setEras] = useState([]); const [selectedEra, setSelectedEra] = useState(0); - const threshold = Math.ceil((members.length || 0) * getThreshold(api)); + const threshold = Math.ceil((members.length || 0) * getSlashThreshold(api)); useEffect((): void => { setEras( diff --git a/packages/page-council/src/Motions/thresholds.ts b/packages/page-council/src/Motions/thresholds.ts index 7af462caaf..c2cc6ef4f1 100644 --- a/packages/page-council/src/Motions/thresholds.ts +++ b/packages/page-council/src/Motions/thresholds.ts @@ -4,15 +4,20 @@ import { ApiPromise } from '@polkadot/api'; -const THRESHOLDS: Record = { +const PROPOSE_THRESHOLDS: Record = { // Polkadot - '0x91b171bb158e2d3848fa23a9f1c25182fb8e20313b2c1eb49219da7a70ce90c3': 0.6, - // Kusama - '0xb0a8d493285c2df73290dfb7e61f870f17b41801197a149ca93654499ea3dafe': 0.5 + '0x91b171bb158e2d3848fa23a9f1c25182fb8e20313b2c1eb49219da7a70ce90c3': 0.6 +}; + +const SLASH_THRESHOLDS: Record = { + // Polkadot + '0x91b171bb158e2d3848fa23a9f1c25182fb8e20313b2c1eb49219da7a70ce90c3': 0.75 }; export function getThreshold (api: ApiPromise): number { - return THRESHOLDS[api.genesisHash.toHex()] || 0.5; + return PROPOSE_THRESHOLDS[api.genesisHash.toHex()] || 0.5; } -export { THRESHOLDS }; +export function getSlashThreshold (api: ApiPromise): number { + return SLASH_THRESHOLDS[api.genesisHash.toHex()] || 0.5; +}