Skip to content

Update rpc client header#9276

Merged
samricotta merged 18 commits intomainfrom
rpcheader
Sep 1, 2022
Merged

Update rpc client header#9276
samricotta merged 18 commits intomainfrom
rpcheader

Conversation

@samricotta
Copy link
Contributor

Moving the changes from issue #7270 into main. This introduces header and header_by_hash queries to the RPC client. This is useful for Evmos JSON-RPC to avoid querying the block endpoint for the eth_header and eth_header_by_hash JSON-RPC endpoints

Note: This is part of the ABCI++ Prepare/Process Proposal Release Plan #9091

@samricotta samricotta requested a review from ebuchman as a code owner August 17, 2022 07:11
@samricotta samricotta requested a review from a team August 17, 2022 07:11
@samricotta samricotta changed the title Rpcheader Update rpc client header Aug 17, 2022

### IMPROVEMENTS

[abci/rpc] \#9276 `header` and `header_by_hash` queries to the RPC client
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
[abci/rpc] \#9276 `header` and `header_by_hash` queries to the RPC client
[rpc] \#9276 Add `header` and `header_by_hash` queries to the RPC layer

content:
application/json:
schema:
$ref: "#/components/schemas/HeaderResponse"
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
$ref: "#/components/schemas/HeaderResponse"
$ref: "#/components/schemas/BlockHeader"

content:
application/json:
schema:
$ref: "#/components/schemas/HeaderResponse"
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
$ref: "#/components/schemas/HeaderResponse"
$ref: "#/components/schemas/BlockHeader"


// LoadBlockMetaByHash returns the blockmeta who's header corresponds to the given
// hash. If none is found, returns nil.
func (bs *BlockStore) LoadBlockMetaByHash(hash []byte) *types.BlockMeta {
Copy link
Contributor

Choose a reason for hiding this comment

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

Want to add a test for this as well? (or add it in an existing test?)

Copy link
Contributor

@williambanfield williambanfield left a comment

Choose a reason for hiding this comment

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

Looks good, would echo Callum's request for a test of LoadBlockMetaByHash

@github-actions
Copy link

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the stale for use by stalebot label Aug 28, 2022
@thanethomson thanethomson removed the stale for use by stalebot label Aug 30, 2022
Comment on lines +42 to +43
[rpc] \#9276 `header` and `header_by_hash` queries to the RPC client

Copy link
Contributor

Choose a reason for hiding this comment

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

Is this supposed to be here?


### IMPROVEMENTS

- [rpc] \#9276 `header` and `header_by_hash` queries to the RPC client
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
- [rpc] \#9276 `header` and `header_by_hash` queries to the RPC client
- [rpc] \#9276 Added `header` and `header_by_hash` queries to the RPC client


// Header gets block header at a given height.
// If no height is provided, it will fetch the latest header.
// More: https://docs.tendermint.com/master/rpc/#/Info/header
Copy link
Contributor

Choose a reason for hiding this comment

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

The link contains master, should it be renamed to main?

baseBlock := bs.LoadBlockMetaByHash(block.Hash())
assert.EqualValues(t, block.Header.Height, baseBlock.Header.Height)
assert.EqualValues(t, block.Header.LastBlockID, baseBlock.Header.LastBlockID)
assert.EqualValues(t, block.Header.ChainID, baseBlock.Header.ChainID)
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you flip one bit of the hash, repeat the call, and check we now get nil?

Copy link
Contributor

@sergio-mena sergio-mena left a comment

Choose a reason for hiding this comment

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

LGTM

@samricotta samricotta self-assigned this Sep 1, 2022
@samricotta samricotta added the S:backport-to-v0.37.x Tell mergify to backport the PR to v0.37.x label Sep 1, 2022
@samricotta samricotta merged commit 2ff11e5 into main Sep 1, 2022
@samricotta samricotta deleted the rpcheader branch September 1, 2022 12:35
mergify bot pushed a commit that referenced this pull request Sep 1, 2022
* Update rpc client header

(cherry picked from commit 2ff11e5)
lbrown2007 pushed a commit that referenced this pull request Sep 2, 2022
* Update rpc client header

(cherry picked from commit 2ff11e5)
lbrown2007 pushed a commit that referenced this pull request Sep 3, 2022
* Update rpc client header

(cherry picked from commit 2ff11e5)
thanethomson pushed a commit that referenced this pull request Sep 3, 2022
* Update rpc client header

(cherry picked from commit 2ff11e5)

Co-authored-by: samricotta <37125168+samricotta@users.noreply.github.com>
james-chf added a commit to heliaxdev/tendermint that referenced this pull request Nov 25, 2022
…x-rc1

* release/v0.37.0-rc1:
  QA Process report for v0.37.x (and baseline for v0.34.x) (tendermint#9499) (tendermint#9577)
  Fix TX payload for DO testnets (tendermint#9540) (tendermint#9542)
  blocksync: retry requests after timeout (backport tendermint#9518) (tendermint#9533)
  Extend the load report tool to include transactions' hashes (tendermint#9509) (tendermint#9513)
  build(deps): Bump styfle/cancel-workflow-action from 0.10.0 to 0.10.1 (tendermint#9502)
  build(deps): Bump actions/stale from 5 to 6 (tendermint#9494)
  loadtime: add block time to the data point (tendermint#9484) (tendermint#9489)
  config: Add missing storage section when generating config (tendermint#9483) (tendermint#9487)
  Sync Vote.Verify() in spec with implementation (tendermint#9466) (tendermint#9476)
  fix spec (tendermint#9467) (tendermint#9469)
  metrics: fix panic because of absent prometheus label (tendermint#9455) (tendermint#9474)
  Ensure Dockerfile stages use consistent Go version (backport tendermint#9462) (tendermint#9472)
  build(deps): Bump slackapi/slack-github-action from 1.21.0 to 1.22.0 (tendermint#9432)
  build(deps): Bump bufbuild/buf-setup-action from 1.7.0 to 1.8.0 (tendermint#9453)
  state: restore previous error message (tendermint#9435) (tendermint#9440)
  build(deps): Bump gonum.org/v1/gonum from 0.11.0 to 0.12.0 (tendermint#9411)
  docs: Update ADRs for v0.37 (tendermint#9399) (tendermint#9418)
  build(deps): Bump github.com/spf13/viper from 1.12.0 to 1.13.0 (tendermint#9410)
  build(deps): Bump github.com/lib/pq from 1.10.6 to 1.10.7 (tendermint#9409)
  feat: support HTTPS inside websocket (tendermint#9416) (tendermint#9422)
  Removed unused param (tendermint#9394)
  test: generate uuid on startup for load tool (tendermint#9383) (tendermint#9392)
  add redirect links (tendermint#9385) (tendermint#9389)
  refactor: migrate to cosmos/gogoproto (backport tendermint#9356) (tendermint#9381)
  cmd: print all versions of tendermint and its sub protocols  (tendermint#9329) (tendermint#9386)
  Add missing changes changelog files (backport tendermint#9376) (tendermint#9382)
  add separated runs by UUID (backport tendermint#9367) (tendermint#9379)
  spec: abci++ cleanup for v0.37 (backport tendermint#9288) (tendermint#9374)
  ci: Remove "(WARNING: BETA SOFTWARE)" tagline from all upcoming releases (tendermint#9371) (tendermint#9372)
  Update rpc client header (tendermint#9276) (tendermint#9349)
  ci: Pre-release workflows (backport tendermint#9366) (tendermint#9368)
  test: add the loadtime report tool (tendermint#9351) (tendermint#9364)
  Update Tendermint version to v0.37.0 (tendermint#9354)
  test: add the loadtime tool (tendermint#9342) (tendermint#9357)

# Conflicts:
#	version/version.go
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S:backport-to-v0.37.x Tell mergify to backport the PR to v0.37.x

Projects

Status: Done/Merged

Development

Successfully merging this pull request may close these issues.

5 participants