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

fix: never store max uint topmost #2566

Merged
merged 1 commit into from
Oct 5, 2021
Merged

fix: never store max uint topmost #2566

merged 1 commit into from
Oct 5, 2021

Conversation

acud
Copy link
Member

@acud acud commented Oct 4, 2021

This change is Reviewable

@acud acud requested review from mrekucci, ldeffenb and istae October 4, 2021 17:22
@acud acud self-assigned this Oct 4, 2021
@sonarqubecloud
Copy link

sonarqubecloud bot commented Oct 4, 2021

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

Copy link
Collaborator

@ldeffenb ldeffenb left a comment

Choose a reason for hiding this comment

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

Looks like a good fix to me. Of course, it should only ever happen if someone (like me) does this experimental code in handling a pullsync request:

		o = new(pb.Offer)
		o.Topmost = rn.To
		o.Hashes = make([]byte, 0)
		s.metrics.OutboundOfferZeroCounter.Inc()
		return o, nil, nil

without first checking that rn.To is not a "live" request which ends at math.MaxUint64 by design.

But then, I guess it could also happen a few decades (centuries?) from now when some swarm node has gone through math.MaxUint64 chunks in a single localstore pullsync bin.

Copy link
Contributor

@mrekucci mrekucci left a comment

Choose a reason for hiding this comment

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

Reviewed 2 of 2 files at r1, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @acud)

@acud acud merged commit a14ebf5 into master Oct 5, 2021
@acud acud deleted the never-maxint branch October 5, 2021 07:45
mrekucci pushed a commit that referenced this pull request Oct 5, 2021
@acud acud added this to the v1.2.0 milestone Oct 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants