-
Notifications
You must be signed in to change notification settings - Fork 111
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
Replace primitive_types
with bigint
#829
Comments
To calculate the block difficulty threshold from recent blocks, we need to perform the following operations on u256 values:
See #802 for details. Here are the alternative libraries I looked at:
Let me know which one you'd prefer, or if you know of another library that does u256 division. |
See #838 of one example where we use division. We also need to use division for calculating the average difficulty (median of recent blocks, scaled by the time range of those blocks). |
We currently depend on |
So Zebra could switch to |
Changed milestone since I think that if we have some working code, fixing it is lower-priority than getting the rest of our functionality done. |
I tried switching from But That's not a huge amount of work, but it's out of scope right now, so I left it for later. |
That can be implemented as subtraction from the all-ones u256. |
primitive_types
primitive_types
with bigint
Obsoleted by #2350 |
Motivation
We want to use
zcash_primitives
for non-malleable transaction IDs in PR #2129. But ourprimitive_types
dependency is incompatible withzcash_primitives
.Also,
primitive_types
has a fairly decent dependency footprint:This isn't a high priority compared to getting everything working, but it's one way we can prune the size of our dep tree.
Solution
We want to replace
primitive_types
with thebigint
crate, becauselibrustzcash
also uses that dependency .Required Code Changes
bigint::U256
inzebra_chain::work
To calculate the block difficulty threshold from recent blocks, we need to perform the following operations on u256 values:
Alternatives
Here are the alternative libraries I looked at:
The text was updated successfully, but these errors were encountered: