Skip to content

[p2p] support network separation#3817

Closed
envestcc wants to merge 4 commits into
iotexproject:masterfrom
envestcc:network_separation_v2
Closed

[p2p] support network separation#3817
envestcc wants to merge 4 commits into
iotexproject:masterfrom
envestcc:network_separation_v2

Conversation

@envestcc

@envestcc envestcc commented Feb 27, 2023

Copy link
Copy Markdown
Member

Description

P2P support block, action, consensus three networks, main changes including:

  • add option to choose networks to join
  • add broadcast, unicast, connectedPeers by network method for Agent
  • add AgentProxy to maintain compatibility

Fixes #(issue)

Type of change

Please delete options that are not relevant.

  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • make test

Test Configuration:

  • Firmware version:
  • Hardware:
  • Toolchain:
  • SDK:

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

Comment thread go.mod Outdated

replace golang.org/x/xerrors => golang.org/x/xerrors v0.0.0-20190212162355-a5947ffaace3

replace github.com/iotexproject/go-p2p => /Users/chenchen/dev/go-p2p

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

create a PR for go-p2p changes

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

sure, it's here: iotexproject/go-p2p#36

Comment thread p2p/agent.go Outdated
Comment thread p2p/agent.go Outdated
Comment thread p2p/agent.go Outdated
Comment thread p2p/agent.go
return
}

func (p *agent) broadcastTopicName(network string) string {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

topic string

Comment thread p2p/agent.go Outdated
status,
).Inc()
}()
network, err := p.getMessageNetwork(msg)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

topic, err := p.getMessageTopic(msg)

Comment thread p2p/agent.go Outdated
Comment thread p2p/agent.go Outdated
Comment thread p2p/agent_test.go Outdated
Comment thread p2p/agent.go Outdated
Comment thread p2p/agent.go
a.networks[BlockNetwork] = struct{}{}
for _, opt := range opts {
opt(a)
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

if len(a.networks) == 0 { error out }

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

node can not join any subnets in p2p level

Comment thread p2p/agent.go Outdated
// ErrAgentNotStarted is the error returned when p2p agent has not been started
ErrAgentNotStarted = errors.New("p2p agent has not been started")
// ErrNoConnectedPeers is a broadcast error when have no connected peers
ErrNoConnectedPeers = p2p.ErrNoConnectedPeers

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

delete

Comment thread p2p/agent.go Outdated
@sonarqubecloud

Copy link
Copy Markdown

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 4 Code Smells

No Coverage information No Coverage information
1.5% 1.5% Duplication

Comment thread p2p/agent.go Outdated
@sonarqubecloud

sonarqubecloud Bot commented Aug 7, 2023

Copy link
Copy Markdown

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 4 Code Smells

No Coverage information No Coverage information
1.4% 1.4% Duplication

@envestcc

Copy link
Copy Markdown
Member Author

IIP-16 paused

@envestcc envestcc closed this Aug 28, 2023
@envestcc envestcc reopened this Jul 29, 2024
@envestcc envestcc force-pushed the network_separation_v2 branch from da2da0a to a45755e Compare August 2, 2024 00:46
@envestcc envestcc marked this pull request as ready for review August 2, 2024 03:20
@envestcc envestcc requested review from a team and Liuhaai as code owners August 2, 2024 03:20
@sonarqubecloud

sonarqubecloud Bot commented Aug 2, 2024

Copy link
Copy Markdown

CoderZhi
CoderZhi previously approved these changes Aug 7, 2024
Comment thread p2p/agent.go Outdated
status := _successStr
if err != nil {
status = _failureStr
// Skip the broadcast message if it's from the node itself

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

move to line 291 or delete

@envestcc envestcc force-pushed the network_separation_v2 branch from bbeabb4 to bdd9b61 Compare December 24, 2024 17:10
Comment thread action/receipt.go
l := &iotextypes.Log{}
l.ContractAddress = log.Address
l.Topics = [][]byte{}
var shareTopic hash.Hash256

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

same with #4532

@sonarqubecloud

Copy link
Copy Markdown

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.

4 participants