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

feat(rpc); Add blockcommitments field to getblock output #9217

Merged
merged 5 commits into from
Feb 11, 2025

Conversation

Metalcape
Copy link
Contributor

@Metalcape Metalcape commented Feb 9, 2025

Motivation

This PR adds the blockcommitments field to the getblock command output which is returned by zcashd and is required for FlyClient functionality.

Partially implements #9022 .

Solution

  • Added a new commitment method to Header which returns the content of the commitment_bytes field in presentation byte order
  • Added a block_commitments field to the response objects for both getblock and getblockheader
  • Modified the get_block_header method of the RPC implementation to parse the value of the commitment_bytes field depending on the block's network and height

Tests

  • Snapshots and tests were updated to take the new field into account.
  • The value of the blockcommitments field was compared manually to the one returned by zcashd, before and after each network update.

Follow-up Work

To resolve #9022 we have to consider if the chainhistoryroot and authdataroot fields should also be added. The content of blockcommitments is equal to finalsaplingroot before Heartwood, and is equal to chainhistoryroot after Heartwood activation and before NU5.

PR Author's Checklist

  • The PR name will make sense to users.
  • The PR provides a CHANGELOG summary.
  • The solution is tested.
  • The documentation is up to date.
  • The PR has a priority label.

PR Reviewer's Checklist

  • The PR Author's checklist is complete.
  • The PR resolves the issue.

@Metalcape Metalcape requested a review from a team as a code owner February 9, 2025 11:44
@Metalcape Metalcape requested review from upbqdn and removed request for a team February 9, 2025 11:44
@github-actions github-actions bot added the C-feature Category: New features label Feb 9, 2025
@upbqdn upbqdn added the A-rpc Area: Remote Procedure Call interfaces label Feb 11, 2025
mergify bot added a commit that referenced this pull request Feb 11, 2025
@mergify mergify bot merged commit 3a0269d into ZcashFoundation:main Feb 11, 2025
109 checks passed
@Metalcape Metalcape deleted the blockcommitments branch February 11, 2025 18:42
gustavovalverde pushed a commit that referenced this pull request Feb 13, 2025
* Add blockcommitments field to getblock output

* Parse commitment_bytes from block header

* Update tests

* Rustfmt

---------

Co-authored-by: Marek <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-rpc Area: Remote Procedure Call interfaces C-feature Category: New features P-Medium ⚡
Projects
None yet
Development

Successfully merging this pull request may close these issues.

getblock: return the authdataroot, chainhistoryroot fields
2 participants