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

Ibft transmitted packets are logged by gossiper #652

Merged
merged 36 commits into from
Jan 29, 2019

Conversation

rain-on
Copy link
Contributor

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

Messages which originate with the current node are logged in the
gossiper such that if a remote peer sends a packet which originated
from the local back to the local node, it should not go back out
again.

@rain-on rain-on requested review from jframe and CjHare January 24, 2019 10:47
Messages which originate with the current node are logged in the
gossiper such that if a remote peer sends a packet which originated
from the local back to the local node, it should not go back out
again.
}

@Override
public boolean send(final MessageData messageData, final List<Address> excludeAddressesList) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this method should have gossip in the name as it is doing gossiping

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would rather not have the word gossip littered through the code... or else you end up with:
gossiper.gossip(msg) ...

@@ -36,12 +39,11 @@
public class IbftMessageTransmitter {

private final MessageFactory messageFactory;
private final ValidatorMulticaster multicaster;
private final Gossiper network;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps gossiper? It's not really the network

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.


boolean gossipMessage(Message message);

boolean send(MessageData messageData, List<Address> excludeAddressesList);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This form of gossip where we haven't got the original message is never going to have excluded addresses so perhaps just remove that argument?

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.


@Override
public boolean send(final MessageData messageData, final List<Address> excludeAddressesList) {
Hash uniqueID = Hash.hash(messageData.getData());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we just use the hashCode from the messageData instead to uniquely identify the message?

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.

Errorific and others added 22 commits January 29, 2019 12:52
* Refactoring for more readable IBFT IT

* Renaming Roles to peers

* Moving the assert behaviour into the RoundChangePeers

* Renmaing prefix of assert to verify, grammar

* Reducing usage of getAllPeers()

* Dropping the getter for the peer list

* Dropping peer from method names, as it's now in the class name

* Spotless
fixes NC-2026 adds a `--network` option instead of separated options

Networks are now defined using a `--network` option that takes the case insensitive
name of an enum values as input :   MAINNET, RINKEBY, ROPSTEN, GOERLI, DEV

These presets are a set of network-id, genesis file and boonodes list.

If the `--genesis-file` is provided with a valid JSON genesis file,
Pantheon uses it instead of the default network. An empty bootnodes list is then
the default value and network id is the chain id found in the genesis file.

`--network-id` and `--bootnodes` options can override these defaults.

You can of course also override the `--network-id` and `--bootnodes` for a
predefined known network (using `--network`).

User have no reason to set `--network` and `--genesis-file` options at the same
time that would lead to misunderstandings so we raise an error to prevent both
options to be defined at the same time on the command line.

Also fixes NC-2189 renaming --private-genesis-file to --genesis-file

Updates a lot of doc according to the options changes
fixes NC-2120 --discovery-enabled option refactoring

now able to have --discovery-enabled option with true as default
and --discovery-enabled=true or --discovery-enabled=false on CLI
and discovery-enabled=true or discovery-enabled=false in YAML config file.

updates doc
Separate the management of sync target and actual import from the rest of the Downloader logic in preparation for introducing a fast sync chain downloader.

@Override
public void send(final MessageData message, final Collection<Address> blackList) {
final Object uniqueID = message.hashCode();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

be nicer to use Integer instead of Object here

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.

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.

I like the separation of the multicaster into single responsibility objects 👍


public interface Gossiper {

void gossipMessage(Message message);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit; gossipMessage -> send().

From the context (an interface called gossiper), a reader can infer that all the behaviour will be gossiping related. As the method input parameter is a Message does additional value really come from repeating those same details in the method name?

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.

@rain-on rain-on merged commit 04dd9df into PegaSysEng:master Jan 29, 2019
vinistevam pushed a commit to vinistevam/pantheon that referenced this pull request Jan 29, 2019
Messages which originate with the current node are logged in the
gossiper such that if a remote peer sends a packet which originated
from the local back to the local node, it should not go back out
again.
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.

10 participants