-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement GRANDPA-GHOST #661
Conversation
@Log | ||
@Component | ||
public class GrandpaService { | ||
private final GrandpaState grandpaState; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
private final GrandpaState grandpaState; | |
private final GrandpaState grandpaState; |
* | ||
* @return GRANDPA GHOST block as a vote | ||
*/ | ||
public Vote getGrandpaGHOST() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
public Vote getGrandpaGHOST() { | |
public Vote getGrandpaGhost() { |
Just a personal pref, but I'd rather stick to the naming conventions unless absolutely necessary.
Map<Hash256, BigInteger> blocks = getPossibleSelectedBlocks(threshold, Subround.PRE_VOTE); | ||
|
||
if (blocks.isEmpty() || threshold.equals(BigInteger.ZERO)) { | ||
throw new ExecutionFailedException("GHOST not found"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be a good idea to have a custom exception for grandpa/ghost related manners. GrandpaGenericException
GhostExecutionException
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest we reuse the existing Subround
and move it to the grandpa package in the future.
Quality Gate passedIssues Measures |
Description
GHOST method identifies the "heaviest" block -> the block with the most cumulative votes, from the current voting round. The implementation ensures that the block selection adheres to the threshold of valid votes, recursively including ancestor blocks when direct votes are insufficient.
Fixes #395