Adjust slash threshold for Polkadot (#3283)
This commit is contained in:
parent
2290e3f4d0
commit
49ea94ab29
@ -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<ProposalState>({ proposal: null, proposalLength: 0 });
|
||||
const [eras, setEras] = useState<Option[]>([]);
|
||||
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(
|
||||
|
||||
@ -4,15 +4,20 @@
|
||||
|
||||
import { ApiPromise } from '@polkadot/api';
|
||||
|
||||
const THRESHOLDS: Record<string, number> = {
|
||||
const PROPOSE_THRESHOLDS: Record<string, number> = {
|
||||
// Polkadot
|
||||
'0x91b171bb158e2d3848fa23a9f1c25182fb8e20313b2c1eb49219da7a70ce90c3': 0.6,
|
||||
// Kusama
|
||||
'0xb0a8d493285c2df73290dfb7e61f870f17b41801197a149ca93654499ea3dafe': 0.5
|
||||
'0x91b171bb158e2d3848fa23a9f1c25182fb8e20313b2c1eb49219da7a70ce90c3': 0.6
|
||||
};
|
||||
|
||||
const SLASH_THRESHOLDS: Record<string, number> = {
|
||||
// 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;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user