-
Notifications
You must be signed in to change notification settings - Fork 27
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(consensus): Change meta.score and meta.accumulated_weight to int type #572
Conversation
265afc8
to
65ccfdd
Compare
65ccfdd
to
21acfdb
Compare
69098cf
to
fd2bf10
Compare
1b625ad
to
12084a4
Compare
0bf14d9
to
86ce84c
Compare
a48df48
to
83760be
Compare
289dc7f
to
b0d8f5c
Compare
b0d8f5c
to
81b60c9
Compare
8e4ecfe
to
464fb5b
Compare
fcbcac1
to
701b787
Compare
93d9f89
to
da4ac0d
Compare
Bencher Report
Click to view all benchmark results
|
da4ac0d
to
b74fa0d
Compare
b74fa0d
to
45884e3
Compare
45884e3
to
b21d67c
Compare
b21d67c
to
2f2d7a8
Compare
2f2d7a8
to
1a3e1d0
Compare
4a182f4
to
d870605
Compare
fb35bfb
to
17eac7c
Compare
… type Co-authored-by: Jan Segre <jan@hathor.network>
17eac7c
to
26a36c0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approved!
Just as a report, last night I synced a node from scratch using this branch, it synced correctly up to the same block as the network, and this is a comparison of the score of the best block (which accumulates tiny errors in the current release):
Even after the tiny accumulated errors the difference is currently minimal. I'm going forward with the merge. |
Motivation
The metadata
accumulated_weight
andscore
are calculated summing up the vertices' weight. Even though both metadata can be integer numbers, they are calculated as the logarithm of their integer value. This might lead to minor issues caused by precision error. We currently use thecalculate_min_significant_weight()
to prevent precision error on mining activity.This PR converts both metadata to integer values, simplifying parts of the code that had to take float precision into consideration.
Acceptance criteria
meta.score
andmeta.accumulated_weight
to typeint
.meta.score
to useweight_to_work()
.meta.accumulated_weight
to useweight_to_work()
.WEIGHT_TOL
).sum_weights(a, b)
toweight_to_work(a) + weight_to_work(b)
.sum_weights(score, a)
toscore + weight_to_work(a)
.sum_weights(accumulated_weight, a)
toaccumulated_weight + weight_to_work(a)
.sum_weights()
.meta.score
andmeta.accumulated_weight
as strings to prevent precision issues with JSON parsers.