-
Notifications
You must be signed in to change notification settings - Fork 107
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
RFC: Contextual Difficulty #1246
RFC: Contextual Difficulty #1246
Conversation
Add a header, summary, and motivation
And update the state RFC definitions to match.
Outline the core calculations and checks.
@yaahc can you do a quick review to make sure that the definitions and guide-level explanation fit with the current state service design? In particular, the "relevant chain" for contextual validation needs to work with the non-finalised and finalised state. I'll also get others to have a look when they have some time. |
Co-authored-by: Jane Lusby <[email protected]>
Also split the difficulty adjustment and difficulty filter checks
Update the design based on the spec bugs in ZcashFoundation#1276, ZcashFoundation#1277, and zcash/zips#416. These changes make the difficulty filter into a context-free check, so we remove it from this contextual validation RFC.
Includes most of the implementation, modules for each function, and draft notes for some of the remaining parts of the RFC.
39632e8
to
ebc0fc2
Compare
This design is now complete enough for an additional review. The guide-level and reference-level explanations contain a substantially complete first draft. |
And finish off the first draft of the RFC.
We have to clone the data to pass a fixed-length array to a function, so we might as well sort that array to find the median, and avoid a copy.
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.
And fix the median_timespan_bounded comment
@yaahc I'm done with the implementation now, so there shouldn't be any more RFC changes. (Or if there are, I'll open a new pull request.) |
Do we need another review from @yaahc or are we good to merge this one now? |
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.
👍
Rendered
Status
First draft of reference-level design, focusing on the implementation.
Revised draft of summary, motivation, and guide-level explanation.
I haven't started the test plan yet.
There are some notes in the remaining sections.
Motivation
We need a design for contextual validation of the proof of work difficulty threshold.
Solution
The RFC should focus on Contextual Difficulty Validation, and summarise the Difficulty Validation Service Request in enough detail to justify the relevant design decisions.
Contextual Difficulty Validation - First Alpha
A synchronous contextual verifier that takes a block header (not a full block), and returns a Result that says if the difficulty threshold in the header matches the difficulty adjustment specified by the consensus rules.
Definitions
Consensus Rules
Guide-Level Explanation
Detailed Reference Design
Module Structure
zebra_chain::work::difficulty
(existing module)zebra_consensus::block::check
Follow Up
Difficulty Validation Service Request - see #1166
Related Work