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

cluster: refactor base64 fields to base58 #851

Merged
merged 8 commits into from
Jul 26, 2022
Merged

Conversation

corverroos
Copy link
Contributor

Introduces draft cluster config version 1.2.0. EIP712 signatures are refactored to industry standard hex. Other base64 fields are refactored to base58 to be URL safe and easy for humans to work with.

v1.2.0 will contain more upgrades, so not "released" yet.

category: feature
ticket: #848

@codecov
Copy link

codecov bot commented Jul 25, 2022

Codecov Report

Merging #851 (ea973d3) into main (3b207e0) will decrease coverage by 0.03%.
The diff coverage is 56.40%.

❗ Current head ea973d3 differs from pull request most recent head c6a4f35. Consider uploading reports for the commit c6a4f35 to get more accurate results

@@            Coverage Diff             @@
##             main     #851      +/-   ##
==========================================
- Coverage   55.26%   55.22%   -0.04%     
==========================================
  Files         112      113       +1     
  Lines       11628    12008     +380     
==========================================
+ Hits         6426     6632     +206     
- Misses       4268     4425     +157     
- Partials      934      951      +17     
Impacted Files Coverage Δ
cluster/helpers.go 64.51% <33.33%> (-19.70%) ⬇️
cluster/definition.go 56.04% <50.76%> (-2.50%) ⬇️
cluster/lock.go 56.48% <53.76%> (-13.01%) ⬇️
cluster/distvalidator.go 71.60% <69.64%> (-4.40%) ⬇️
cluster/operator.go 69.56% <75.00%> (+5.92%) ⬆️
cluster/version.go 100.00% <100.00%> (ø)
p2p/peer.go 48.14% <0.00%> (-3.86%) ⬇️
core/tracker/tracker.go 70.55% <0.00%> (-3.82%) ⬇️
core/validatorapi/router.go 63.58% <0.00%> (-2.23%) ⬇️
... and 7 more

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 3b207e0...c6a4f35. Read the comment docs.

cluster/definition.go Outdated Show resolved Hide resolved
Copy link
Contributor

@dB2510 dB2510 left a comment

Choose a reason for hiding this comment

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

some small comments

Comment on lines 36 to 38
v1_2 = "v1.2.0" // WIP
v1_1 = "v1.1.0"
v1_0 = "v1.0.0"
Copy link
Contributor

@dB2510 dB2510 Jul 26, 2022

Choose a reason for hiding this comment

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

add enum for these versions, which would work as order of priority of versions at the time of comparison, which can be generated by go generate like we have in tracker as component enum

Copy link
Contributor

Choose a reason for hiding this comment

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

It will also make it easy to add versions in future with enum approach

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah, good idea

Copy link
Contributor Author

Choose a reason for hiding this comment

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

actually not sure this is going to work, since we need to do string comparison, which doesn't work nice with enums.

if err != nil {
return nil, errors.Wrap(err, "marshal lock")
}
if isJSONv1x1(d.Version) {
Copy link
Contributor

Choose a reason for hiding this comment

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

switch case would be more cleaner + readable imo

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fair

// distValidatorJSONv1x2 is the json formatter of DistValidator for versions v1.2.0 and later.
type distValidatorJSONv1x2 struct {
PubKey ethHex `json:"distributed_public_key"`
PubShares []base58 `json:"public_shares,omitempty"`
Copy link
Contributor

Choose a reason for hiding this comment

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

why are we changing format of PubShares?
Since PubShares are internal public keys of individual co-validator we won't be using it anyways anywhere. Seems like a premature change.

we can keep it the same

Copy link
Contributor Author

Choose a reason for hiding this comment

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

we are upgrading all base64 types to either base58 or hex. It is in the ticket.

@dB2510
Copy link
Contributor

dB2510 commented Jul 26, 2022

need to run go mod tidy for pre-commits to pass

corverroos and others added 3 commits July 26, 2022 10:45
Co-authored-by: Abhishek Kumar <43061995+xenowits@users.noreply.github.com>
@corverroos corverroos added the merge when ready Indicates bulldozer bot may merge when all checks pass label Jul 26, 2022
@obol-bulldozer obol-bulldozer bot merged commit 3f920df into main Jul 26, 2022
@obol-bulldozer obol-bulldozer bot deleted the corver/clusterformats branch July 26, 2022 09:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merge when ready Indicates bulldozer bot may merge when all checks pass
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants