-
Notifications
You must be signed in to change notification settings - Fork 41
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
[6.0.0] Conversion from Long-encoded nBits representation to BigInt and back #962
Conversation
@kushti, I suggest to add these operations as methods of SGlobal (i.e. in SGlobalMethods) |
moved, also, the PR is finalized now, please review. If you think anything is not tested, please specify what exactly, and so I will be able to add tests. |
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.
IMO, the most important tests are those in LanguageSpecification, more specifically using verifyCases method.
When they are done, not only full coverage is ensured, but also cost profiling can be done.
I suggest to test these new operations as two separate property()
Done, two new |
@aslesarenko comments addresses, please make another pass! |
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.
LGTM, please see one new comment.
|
||
private lazy val EncodeNBitsCost = FixedCost(JitCost(25)) // the same cost for nbits encoding and decoding | ||
|
||
private lazy val DecodeNBitsCost = FixedCost(JitCost(50)) // the same cost for nbits encoding and decoding |
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.
The comment looks like obsolete.
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.
thanks, fixed
In this PR, two new methods, Global.encodeNbits() and Global.decodeNbits() are introduced, to support conversion from NBits-encoded numbers to big integers and back
Among new tests Bitcoin PoW check example can be found.
close #675