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

fix(consensus): Update median_timespan() method to align with zcashd implementation #8491

Merged
merged 3 commits into from
May 7, 2024

Conversation

arya2
Copy link
Contributor

@arya2 arya2 commented May 2, 2024

Motivation

This PR fixes a minor mistake in the median_timespan() method below block height 28. The bug does not affect checkpoint validation, and does not affect Mainnet or the default Testnet because Zebra requires checkpoint verification until well past block height 28 for those networks.

https://github.com/zcash/zcash/blob/master/src/pow.cpp#L47-L84

Depends-On: #8475.

PR Author Checklist

Check before marking the PR as ready for review:

  • Will the PR name make sense to users?
  • Does the PR have a priority label?
  • Have you added or updated tests?
  • Is the documentation up to date?
For significant changes:
  • Is there a summary in the CHANGELOG?
  • Can these changes be split into multiple PRs?

If a checkbox isn't relevant to the PR, mark it as done.

Specifications

Section 7.7.3, page 132 of the specification

Solution

Use the MedianTime of the genesis block as the older_median if there are fewer than PoWAveragingWindow blocks in the relevant chain.

Other changes:

  • Fixes a typo in dependabot in this PR so CI passes.

Review

Anyone can review, @upbqdn may be interested.

Reviewer Checklist

Check before approving the PR:

  • Does the PR scope match the ticket?
  • Are there enough tests to make sure it works? Do the tests cover the PR motivation?
  • Are all the PR blockers dealt with?
    PR blockers can be dealt with in new tickets or PRs.

And check the PR Author checklist is complete.

@arya2 arya2 added C-bug Category: This is a bug I-consensus Zebra breaks a Zcash consensus rule P-Medium ⚡ labels May 2, 2024
@arya2 arya2 self-assigned this May 2, 2024
@arya2 arya2 requested a review from a team as a code owner May 2, 2024 16:58
@arya2 arya2 requested review from oxarbitrage and removed request for a team May 2, 2024 16:58
@upbqdn upbqdn self-requested a review May 2, 2024 18:16
Base automatically changed from params-regtest to main May 2, 2024 19:43
@mergify mergify bot requested review from a team as code owners May 2, 2024 19:43
@upbqdn
Copy link
Member

upbqdn commented May 2, 2024

@arya, this PR needs a manual conflict resolution.

@arya2 arya2 force-pushed the fix-actual-timespan branch from 06ced2e to 783cf8c Compare May 3, 2024 16:16
@github-actions github-actions bot added the C-trivial Category: A trivial change that is not worth mentioning in the CHANGELOG label May 3, 2024
@oxarbitrage oxarbitrage added do-not-merge Tells Mergify not to merge this PR and removed P-Critical 🚑 labels May 3, 2024
@arya2 arya2 force-pushed the fix-actual-timespan branch from c609047 to bfa0837 Compare May 3, 2024 16:42
@oxarbitrage oxarbitrage removed the do-not-merge Tells Mergify not to merge this PR label May 7, 2024
mergify bot added a commit that referenced this pull request May 7, 2024
mergify bot added a commit that referenced this pull request May 7, 2024
@mergify mergify bot merged commit 0040c2b into main May 7, 2024
137 checks passed
@mergify mergify bot deleted the fix-actual-timespan branch May 7, 2024 20:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug C-trivial Category: A trivial change that is not worth mentioning in the CHANGELOG I-consensus Zebra breaks a Zcash consensus rule P-Medium ⚡
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants