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

API: New algod endpoint /v2/header/{round}/header omits transactions and cert from response #6163

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

nullun
Copy link
Contributor

@nullun nullun commented Nov 4, 2024

Retrieve just the block header information without the transactions and cert data. This reduces the response size and response time, but still includes block details such as the proposer and any incentive rewards.

With the introduction of consensus incentives, various people have asked how they can obtain this new data per block without also including all the transaction data in the response. This was considered a useful option, so thought I'd have a go at implementing it. Support for both json and msgpack is available, and a very simple test was included.

Copy link

codecov bot commented Nov 4, 2024

Codecov Report

Attention: Patch coverage is 0% with 20 lines in your changes missing coverage. Please review.

Project coverage is 56.24%. Comparing base (eff5fb4) to head (c84546f).

Files with missing lines Patch % Lines
daemon/algod/api/server/v2/handlers.go 0.00% 20 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #6163      +/-   ##
==========================================
+ Coverage   55.99%   56.24%   +0.24%     
==========================================
  Files         494      494              
  Lines       69958    69978      +20     
==========================================
+ Hits        39174    39360     +186     
+ Misses      28077    27939     -138     
+ Partials     2707     2679      -28     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@algorandskiy algorandskiy left a comment

Choose a reason for hiding this comment

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

Please fix the test, otherwise LGTM

daemon/algod/api/server/v2/test/handlers_test.go Outdated Show resolved Hide resolved
Copy link
Contributor

@algorandskiy algorandskiy left a comment

Choose a reason for hiding this comment

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

I guess it is better to round trip a header from a mock in the test but LGTM

}

// Encoding wasn't working well without embedding "real" objects.
response := struct {
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this be a defined type somewhere, or do we think single use-case/good enough?

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

Successfully merging this pull request may close these issues.

3 participants