Skip to content
This repository has been archived by the owner on Sep 26, 2019. It is now read-only.

IBFT ensure non-validator does not partake in consensus #627

Merged
merged 4 commits into from
Jan 22, 2019

Conversation

rain-on
Copy link
Contributor

@rain-on rain-on commented Jan 22, 2019

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.

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.
@rain-on rain-on requested review from jframe and CjHare January 22, 2019 02:44
Copy link
Contributor

@CjHare CjHare left a 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 {
Copy link
Contributor

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?

Copy link
Contributor Author

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() {
Copy link
Contributor

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

Copy link
Contributor Author

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 {
Copy link
Contributor

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.

Copy link
Contributor Author

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);
Copy link
Contributor

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

Copy link
Contributor Author

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.

@rain-on rain-on merged commit 41170d6 into PegaSysEng:master Jan 22, 2019
@rain-on rain-on deleted the nonValNode branch January 24, 2019 10:14
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants