Skip to content
This repository has been archived by the owner on Jun 11, 2024. It is now read-only.

Use encoded communication in p2p using lisk-codec - Closes #5269 #5423

Merged
merged 18 commits into from
Jun 12, 2020

Conversation

ishantiw
Copy link
Contributor

What was the problem?

This PR resolves #5269

How was it solved?

  • Created nodeInfo, peerInfo, and peerListResponse schema
  • Use encoding and decoding when sending and receiving the above data from the network
  • Update tests

How was it tested?

Run npm t under elements/lisk-p2p

@ishantiw ishantiw self-assigned this Jun 10, 2020
@ishantiw ishantiw requested a review from shuse2 June 10, 2020 19:50
@ishantiw ishantiw requested a review from shuse2 June 11, 2020 11:30
Copy link
Contributor

@mitsuaki-u mitsuaki-u left a comment

Choose a reason for hiding this comment

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

Few minor comments but other than @shuse2 review, LGTM

success: true,
peers: [],
Copy link
Contributor

Choose a reason for hiding this comment

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

Does the order of object property matter 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.

no, it doesn't

Copy link
Contributor

Choose a reason for hiding this comment

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

Ok, I saw that you changed it so I wondered if there was a reason.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ah yeah, I changed it because I thought it was the reason for failing test :(

sharedState: {
version: '1.1.1',
},
sharedState: {},
Copy link
Contributor

Choose a reason for hiding this comment

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

No longer including version?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

now we only have protocolVersion, version was to support older nodes. We can remove version and other fields in another PR. Issue related to it #5419

// import { P2P } from '../../src/index';
// import { createNetwork, destroyNetwork } from '../utils/network_setup';

// TODO: Skipping as strict schema doesn't allow custom fields. Enable this test when users will be allowed to pass custom schema.
Copy link
Contributor

Choose a reason for hiding this comment

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

Instead of commenting out, you can simply .skip the test

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If I skip eslint throws an error and even with eslint-disable it's not working. It works on Mocha


// Skipping as schema validation doesn't allow custom fields and supported properties are validated before applying nodeInfo.
Copy link
Contributor

Choose a reason for hiding this comment

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

Instead of commenting out, you can simply .skip the test

Copy link
Contributor Author

Choose a reason for hiding this comment

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

same for this

ishantiw added 2 commits June 12, 2020 11:55
…/LiskHQ/lisk-sdk into 5269_update_liskp2p_encoded_data

* '5269_update_liskp2p_encoded_data' of https://github.com/LiskHQ/lisk-sdk:
  ♻️ Update variable name
  🐛 Fix decoding with nested array with same field numbers
  ♻️ Refactor chain transaction handler to be first degree function and remove unnecessary functions and behavior
@shuse2 shuse2 merged commit bd48d70 into development Jun 12, 2020
@shuse2 shuse2 deleted the 5269_update_liskp2p_encoded_data branch June 12, 2020 10:29
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.

Update lisk-p2p to communicate with encoded data
3 participants