-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #422 from Kodylow/0.3.1
- Loading branch information
Showing
11 changed files
with
159 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import React from 'react'; | ||
import { Box, Text, Flex, theme } from '@chakra-ui/react'; | ||
import { useTranslation } from '@fedimint/utils'; | ||
import { bftHonest, bftFaulty } from '../utils'; | ||
|
||
interface BftInfoProps { | ||
numPeers: number; | ||
} | ||
|
||
export const BftInfo: React.FC<BftInfoProps> = ({ numPeers }) => { | ||
const { t } = useTranslation(); | ||
|
||
return ( | ||
<Box bg='blue.50' p={4} borderRadius='md' w={['100%', '50%']}> | ||
<Text | ||
mb='6px' | ||
fontSize='16px' | ||
fontWeight='500' | ||
color={theme.colors.gray[700]} | ||
> | ||
{t('set-config.bft-explanation-title', { total: numPeers })} | ||
</Text> | ||
<Flex direction='column' gap='6px'> | ||
<Text fontSize='sm'> | ||
{t('set-config.bft-explanation', { | ||
total: numPeers, | ||
honest: bftHonest(numPeers), | ||
faulty: bftFaulty(numPeers), | ||
})} | ||
</Text> | ||
<Text fontSize='sm'> | ||
{t('set-config.bft-faulty', { | ||
faulty: bftFaulty(numPeers), | ||
})} | ||
</Text> | ||
</Flex> | ||
</Box> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
export const randomNames = [ | ||
'Alice', | ||
'Andy', | ||
'Bob', | ||
'Bella', | ||
'Charlie', | ||
'Cara', | ||
'David', | ||
'Diana', | ||
'Eve', | ||
'Ethan', | ||
'Frank', | ||
'Fiona', | ||
'Grace', | ||
'George', | ||
'Harry', | ||
'Helen', | ||
'Iris', | ||
'Ian', | ||
'Jack', | ||
'Jill', | ||
'John', | ||
'Julia', | ||
'Kim', | ||
'Kyle', | ||
'Lisa', | ||
'Leo', | ||
'Maggie', | ||
'Max', | ||
'Mike', | ||
'Molly', | ||
'Naomi', | ||
'Nate', | ||
'Olivia', | ||
'Oscar', | ||
'Paul', | ||
'Penny', | ||
'Queen', | ||
'Quinn', | ||
'Robert', | ||
'Rachel', | ||
'Sarah', | ||
'Sam', | ||
'Taylor', | ||
'Thomas', | ||
'Victoria', | ||
'Vincent', | ||
'William', | ||
'Wendy', | ||
'Xavier', | ||
'Xena', | ||
'Yvonne', | ||
'Yuri', | ||
'Zoe', | ||
'Zack', | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
export function bftHonest(totalGuardians: number): number { | ||
return totalGuardians - bftFaulty(totalGuardians); | ||
} | ||
|
||
export function bftFaulty(totalGuardians: number): number { | ||
return Math.floor((totalGuardians - 1) / 3); | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters