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

util/s3: improve patch number capacity in version comparison #5224

Merged
merged 4 commits into from
Mar 22, 2023

Conversation

algorandskiy
Copy link
Contributor

Summary

Local builds could produce packages with higher than build number than the comparator in updater can handle.
This affects both updater and nodecfg.

Test Plan

Added unit test

algobarb
algobarb previously approved these changes Mar 22, 2023
Copy link
Contributor

@algobarb algobarb left a comment

Choose a reason for hiding this comment

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

Thank you!

testValidVersion(t, "algonode_update_0.1.0.log", uint64(0x01000000))
testValidVersion(t, "algo_update_0.1.0", uint64(0x01000000))
testValidVersion(t, "algo_update_65535.1.0", uint64(0x00FFFF000001000000))
testValidVersion(t, "algo_update_65535.65535.65535", uint64(0x00FFFF00FFFF00FFFF))
Copy link
Contributor

@winder winder Mar 22, 2023

Choose a reason for hiding this comment

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

May as well add the test

Suggested change
testValidVersion(t, "algo_update_65535.65535.65535", uint64(0x00FFFF00FFFF00FFFF))
testValidVersion(t, "algo_update_65535.65535.65535", uint64(0x00FFFF00FFFF00FFFF))
testValidVersion(t, "algo_update_16777215.16777215.16777215", uint64(0xFFFFFFFFFFFFFFFFFF))

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this number exceeds max uint64
maybe allocate 24bits for the patch and 16+16 for major/minor?

Copy link
Contributor

Choose a reason for hiding this comment

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

16/16/24 seems like a good option.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

added

util/s3/s3Helper.go Outdated Show resolved Hide resolved
winder
winder previously approved these changes Mar 22, 2023
Copy link
Contributor

@winder winder left a comment

Choose a reason for hiding this comment

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

LGTM (assuming these numbers are never written down)

@codecov
Copy link

codecov bot commented Mar 22, 2023

Codecov Report

Merging #5224 (87d41d5) into master (f4fa3cb) will increase coverage by 0.62%.
The diff coverage is 80.00%.

@@            Coverage Diff             @@
##           master    #5224      +/-   ##
==========================================
+ Coverage   52.94%   53.56%   +0.62%     
==========================================
  Files         441      441              
  Lines       55098    55099       +1     
==========================================
+ Hits        29171    29514     +343     
+ Misses      23576    23298     -278     
+ Partials     2351     2287      -64     
Impacted Files Coverage Δ
util/s3/s3Helper.go 45.83% <80.00%> (+0.45%) ⬆️

... and 48 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@algorandskiy algorandskiy merged commit e31b978 into algorand:master Mar 22, 2023
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.

3 participants