Skip to content

Comments

feat(rpc): add getblockheader endpoint#603

Merged
dorianvp merged 23 commits intodevfrom
feat/rpc-getblockheader
Nov 4, 2025
Merged

feat(rpc): add getblockheader endpoint#603
dorianvp merged 23 commits intodevfrom
feat/rpc-getblockheader

Conversation

@dorianvp
Copy link
Member

@dorianvp dorianvp commented Oct 15, 2025

On top of #595, supersedes #473.

Motivation

#203.

Solution

Implement getblockheader.

PR Checklist

  • The PR name is suitable for the release notes.
  • The solution is tested.
  • The documentation is up to date.

@dorianvp dorianvp self-assigned this Oct 15, 2025
@dorianvp dorianvp linked an issue Oct 15, 2025 that may be closed by this pull request
@dorianvp dorianvp marked this pull request as ready for review October 17, 2025 21:04
@dorianvp dorianvp force-pushed the feat/rpc-getblockheader branch from 55548fa to ca4a280 Compare October 20, 2025 21:07
pacu
pacu previously approved these changes Oct 20, 2025
Copy link
Contributor

@pacu pacu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM (untested)

@zancas
Copy link
Member

zancas commented Oct 20, 2025

I see CI fails...

@dorianvp
Copy link
Member Author

I see CI fails...

Same flakes we're seeing on dev.

@dorianvp dorianvp marked this pull request as draft October 22, 2025 00:35
@dorianvp dorianvp marked this pull request as ready for review October 22, 2025 16:27
@ala-mode ala-mode self-requested a review October 28, 2025 21:11
Copy link
Contributor

@ala-mode ala-mode left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice job overall!

A couple things.

I didn't see any links to zcashd source code like ZL was doing for some previous rpcs (e.g. get_best_blockhash). If this is still something we want to do, someone should add links to the relevant source code, and make sure the logic follows that pattern, or any differences are understood and documented. If we're not following that anymore, please disregard.

Today I found myself fretting about the multiple fn get_block_header(...) in fetch and state backends, state indexer and jsonrpsee connector and service. This might be idiomatic to our project at this point, but I didn't love how this same name called itself on different levels, and then how there is also an inner function which is now 'legacy.'

I think we should at least understand but hopefully minimize this kind of name overloading.

Some other notes attached too.

I think I could probably pick up this PR and work with it in these ways, or I can leave these as requested changes and review again before long.

@ala-mode
Copy link
Contributor

All tests passing locally with a few flakes (which I believe is a current good-standard).

@dorianvp
Copy link
Member Author

All tests passing locally with a few flakes (which I believe is a current good-standard).

Extended the test to cover verbose responses & added a light reference to the zcashd implementation.

@dorianvp dorianvp requested a review from ala-mode October 31, 2025 01:23
Copy link
Contributor

@ala-mode ala-mode left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @dorianvp! Please see my attached comments.

I was not sure how things were really derived from the zcash source code versus what's present in your tests or in the struct.. If you think I might be onto something good with my concrete suggested changes, please do go ahead an merge them in and then make changes on top of them - or whatever is most fruitful.

@dorianvp dorianvp force-pushed the feat/rpc-getblockheader branch from d562c49 to 7a6de96 Compare November 2, 2025 04:07
@dorianvp
Copy link
Member Author

dorianvp commented Nov 2, 2025

Comments addressed! Looks like I was adding a field that was present in getblock but not getblockheader. Good catch @ala-mode!

@dorianvp dorianvp requested a review from ala-mode November 2, 2025 04:09
@zancas
Copy link
Member

zancas commented Nov 4, 2025

@ala-mode do you have any remaining concerns?

@ala-mode
Copy link
Contributor

ala-mode commented Nov 4, 2025

@ala-mode do you have any remaining concerns?

I didn't get to re-review, but I am sitting down to do it right now.

Copy link
Contributor

@ala-mode ala-mode left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I approve, but I couldn't pass all tests so didn't merge, see below. A couple notes:

I noticed the Unknown variant in pub enum GetBlockHeader stayed in - It's not worth blocking over, but I still don't love this.. even as a library, the call is going to query full nodes that have responses described in the variants and types you (nicely!) created. Are there other cases?

(Even if we query another zaino hypothetically, it will have ingested the same info in a VerboseBlockHeader or String.)

Other than this I attached a couple comments which are also not blocking, but could point toward a future issue.

Running tests now, I'll merge if they all pass for me locally (right now, allowing flakes)

@ala-mode
Copy link
Contributor

ala-mode commented Nov 4, 2025

I had one test locally that was very slow:
integration-tests::wallet_to_validator zebrad::fetch_service::monitor_unverified_mempool

because I didn't complete this test, I didn't merge.

@dorianvp dorianvp merged commit 3a7b70b into dev Nov 4, 2025
9 of 10 checks passed
@dorianvp dorianvp deleted the feat/rpc-getblockheader branch November 4, 2025 17:41
@ala-mode
Copy link
Contributor

ala-mode commented Nov 4, 2025

Just for referece that test passed for me (fairly quickly) on the 3rd try.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1.7: Add Zcash RPC getblockheader

4 participants