-
Notifications
You must be signed in to change notification settings - Fork 130
IBFT ensure non-validator does not partake in consensus #627
Conversation
Nodes which are not validators in a network should not inject IBFT messages to the consensus round, and should not gossip received messages. I.e. all events should ensure that they are only handled if the node is a validator at the current height.
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.
Looks like a workable solution, a few suggestions on the naming, but otherwise 👍
import tech.pegasys.pantheon.consensus.ibft.payload.SignedData; | ||
import tech.pegasys.pantheon.ethereum.core.BlockHeader; | ||
|
||
public interface AbstractBlockHeightManager { |
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'm never super keen on having Abstract
as part of a class name, any chance it can something else? BlockHeightManager
?
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.
done.
@@ -87,6 +87,10 @@ public boolean isLocalNodeProposerForRound(final ConsensusRoundIdentifier roundI | |||
return getProposerForRound(roundIdentifier).equals(localAddress); | |||
} | |||
|
|||
public boolean localNodeIsValidator() { |
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.
Idiomatic Java naming: s/localNodeIsValidator/isLocalNodeValidator
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.
done. (I dislike it, but one man's opinion counts for little).
import tech.pegasys.pantheon.consensus.ibft.payload.SignedData; | ||
import tech.pegasys.pantheon.ethereum.core.BlockHeader; | ||
|
||
public class NullBlockHeightManager implements AbstractBlockHeightManager { |
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.
Perhaps NoBlockHeightManager
would suit better? ...being a height manager that does nothing and if something exists it's not really null.
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.
Went with NoOpBlockHeightManager.
finalState.getClock(), | ||
messageValidatorFactory); | ||
} else { | ||
return new NoOpBlockHeightManager(parentHeader); |
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.
think it would be better to have a seperate method for creating the NoOpBlockHeightManager then all the logic for non-validator nodes can be moved/stay in the IbftController
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.
yeah, that'd be nicer.
Nodes which are not validators in a network should not inject
IBFT messages to the consensus round, and should not gossip
received messages.
I.e. all events should ensure that they are only handled if
the node is a validator at the current height.