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: kademlia oversaturation based on an exponential decay formula #2530

Closed
wants to merge 3 commits into from

Conversation

istae
Copy link
Member

@istae istae commented Sep 21, 2021

Bin oversaturation count is calculated using an exponential decay formula.
The goal is to give more weight to shallower bins (relative to how they are now) as they make up the majority of known peers.
This should improve connectivity and decrease hops in syncing protocols.


This change is Reviewable

@istae istae changed the title feat: kademlia bin curve feat: kademlia oversaturation based on an an exponential decay formula Sep 21, 2021
@istae istae added the in progress ongoing development , hold out with review label Sep 21, 2021
@istae istae changed the title feat: kademlia oversaturation based on an an exponential decay formula feat: kademlia oversaturation based on an exponential decay formula Sep 21, 2021
if o.BitSuffixLength == 0 {
o.BitSuffixLength = defaultBitSuffixLength
}

for i := 0; i < int(swarm.MaxBins); i++ {
}

Copy link
Collaborator

Choose a reason for hiding this comment

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

An empty loop? To what purpose?

Copy link
Member Author

Choose a reason for hiding this comment

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

hence the 'in progress' label :) thank you!

func defaultOverSaturationCalc(bin uint8) int {
return int(math.Round(50 * math.Exp(-float64(bin)/8.0)))
}

Copy link
Collaborator

Choose a reason for hiding this comment

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

Should the 50 and the 8.0 be constants declared above? Otherwise this completely hides the actual bin limits inside this function.

@sonarqubecloud
Copy link

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 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@istae istae added RFC and removed RFC in progress ongoing development , hold out with review labels Sep 22, 2021
@github-actions
Copy link

github-actions bot commented Nov 7, 2021

This PR is stale because it has been open 45 days with no activity. Remove stale label or comment or this will be closed in 5 days.

@github-actions
Copy link

This PR was closed because it has been stalled for 5 days with no activity.

@github-actions github-actions bot closed this Nov 13, 2021
@istae istae reopened this Nov 24, 2021
@sonarqubecloud
Copy link

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 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@codecov-commenter
Copy link

Codecov Report

Merging #2530 (ef98984) into master (c30ba68) will decrease coverage by 0.04%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2530      +/-   ##
==========================================
- Coverage   63.57%   63.53%   -0.05%     
==========================================
  Files         236      236              
  Lines       26557    26561       +4     
==========================================
- Hits        16884    16875       -9     
- Misses       8154     8168      +14     
+ Partials     1519     1518       -1     
Impacted Files Coverage Δ
pkg/topology/kademlia/kademlia.go 75.88% <100.00%> (+0.34%) ⬆️
pkg/p2p/libp2p/stream.go 70.58% <0.00%> (-11.77%) ⬇️
pkg/localstore/subscription_pull.go 84.24% <0.00%> (-6.85%) ⬇️
pkg/localstore/subscription_push.go 73.68% <0.00%> (-3.51%) ⬇️
pkg/chainsyncer/chainsyncer.go 79.71% <0.00%> (-1.45%) ⬇️
pkg/p2p/libp2p/internal/reacher/reacher.go 90.90% <0.00%> (-1.30%) ⬇️
pkg/retrieval/retrieval.go 62.04% <0.00%> (-0.31%) ⬇️
pkg/p2p/libp2p/libp2p.go 61.60% <0.00%> (+0.58%) ⬆️
pkg/p2p/libp2p/headers.go 83.33% <0.00%> (+5.55%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c30ba68...ef98984. Read the comment docs.

@istae istae added the ready for review The PR is ready to be reviewed label Dec 2, 2021
@github-actions
Copy link

This PR is stale because it has been open 45 days with no activity. Remove stale label or comment or this will be closed in 5 days.

@github-actions
Copy link

This PR was closed because it has been stalled for 5 days with no activity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pull-request ready for review The PR is ready to be reviewed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants