Skip to content
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

feat!: differentiate swarms based on network_id #575

Merged
merged 1 commit into from
Apr 28, 2024

Conversation

Ma233
Copy link
Member

@Ma233 Ma233 commented Apr 25, 2024

Please check if the PR fulfills these requirements

  • Tests for the changes have been added (for bug fixes/features)
  • Docs have been added / updated (for bug fixes / features)

🔵 What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)

This PR introduces a network_id field in ConnectNodeSend message. It's used to prevent nodes from different networks from connecting to each other.

🟤 What is the current behavior? (You can also link to an open issue here)

🟢 What is the new behavior (if this is a feature change)?

☢️ Does this PR introduce a breaking change? (What changes might users need to make in their application due to this PR?)

There is a breaking change in config file.
User must specify network_id in config file now.

ℹ️ Other information

Closes #issue

@@ -60,6 +60,10 @@ impl HandleMsg<QueryForTopoInfoReport> for MessageHandler {
#[cfg_attr(not(feature = "wasm"), async_trait)]
impl HandleMsg<ConnectNodeSend> for MessageHandler {
async fn handle(&self, ctx: &MessagePayload, msg: &ConnectNodeSend) -> Result<()> {
if msg.network_id != self.transport.network_id {
return Ok(());
Copy link
Member Author

Choose a reason for hiding this comment

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

Should the current node directly not respond when receiving a handshake request from a different network node?

Copy link
Member

Choose a reason for hiding this comment

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

Yes, response of denial of connection may be expensive in some case, especially the signature/verify phase.

@Ma233 Ma233 force-pushed the transport branch 3 times, most recently from 6c3c6f0 to 28134f8 Compare April 26, 2024 02:28
@Ma233
Copy link
Member Author

Ma233 commented Apr 27, 2024

@RyanKung Hi, it's a breaking change in config file. We may should upgrade the minor version number.

@Ma233 Ma233 requested a review from RyanKung April 27, 2024 04:50
@RyanKung
Copy link
Member

@RyanKung Hi, it's a breaking change in config file. We may should upgrade the minor version number.

Yep, version number will be upgrade on PR #578

@RyanKung RyanKung merged commit 318ac4a into RingsNetwork:master Apr 28, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants