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: populate oldest_block_identifier and wrap jsonrpc errors #13832

Merged
merged 10 commits into from
Nov 12, 2022

Conversation

JulianToledano
Copy link
Contributor

@JulianToledano JulianToledano commented Nov 10, 2022

Description

Closes:
#13830
#13827

  • Rosetta /network/status response:
    • populates oldest_block_identifier with EarliestBlockHeight from rpc syncInfo
    • tries to populate genesis_block_identifier with block of height 1
      • if block is not queryable, sets value of InitialHeight from genesis doc
        • if not queryable sets same value as oldest_block_identifier
  • Wrap github.com/tendermint/tendermint/rpc/jsonrpc/types errors to rosetta errors
  • Split services into its own go files (account, block, mempool, network)

Author Checklist

All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.

I have...

  • included the correct type prefix in the PR title
  • added ! to the type prefix if API or client breaking change
  • targeted the correct branch (see PR Targeting)
  • provided a link to the relevant issue or specification
  • followed the guidelines for building modules
  • included the necessary unit and integration tests
  • added a changelog entry to CHANGELOG.md
  • included comments for documenting Go code
  • updated the relevant documentation or specification
  • reviewed "Files changed" and left comments if necessary
  • confirmed all CI checks have passed

Reviewers Checklist

All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.

I have...

  • confirmed the correct type prefix in the PR title
  • confirmed ! in the type prefix if API or client breaking change
  • confirmed all author checklist items have been addressed
  • reviewed state machine logic
  • reviewed API design and naming
  • reviewed documentation is accurate
  • reviewed tests and test coverage
  • manually tested (if applicable)

@github-actions github-actions bot added the C:Rosetta Issues and PR related to Rosetta label Nov 10, 2022
// fromTendermintToRosettaError converts a tendermint jsonrpc error to rosetta error
func fromTendermintToRosettaError(err *tmtypes.RPCError) *Error {
return &Error{rosErr: &types.Error{
Code: int32(err.Code),

Check failure

Code scanning / gosec

Potential integer overflow by integer type conversion

Potential integer overflow by integer type conversion
@codecov
Copy link

codecov bot commented Nov 10, 2022

Codecov Report

Merging #13832 (3a8349f) into main (d66b7fa) will decrease coverage by 0.35%.
The diff coverage is 38.70%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main   #13832      +/-   ##
==========================================
- Coverage   56.62%   56.27%   -0.36%     
==========================================
  Files         647      650       +3     
  Lines       56100    56231     +131     
==========================================
- Hits        31766    31642     -124     
- Misses      21772    22024     +252     
- Partials     2562     2565       +3     
Impacted Files Coverage Δ
tools/rosetta/client_online.go 1.31% <0.00%> (ø)
tools/rosetta/lib/errors/errors.go 74.32% <100.00%> (ø)
simapp/test_helpers.go
simapp/simd/cmd/root.go
simapp/simd/cmd/genaccounts.go
simapp/export.go
simapp/app.go
simapp/state.go
simapp/genesis_account.go
simapp/simd/cmd/testnet.go
... and 15 more

@JulianToledano JulianToledano marked this pull request as ready for review November 11, 2022 13:23
@JulianToledano JulianToledano requested a review from a team as a code owner November 11, 2022 13:23
Copy link
Member

@tac0turtle tac0turtle left a comment

Choose a reason for hiding this comment

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

could we get a changelog for this change.

@JulianToledano
Copy link
Contributor Author

changelog updated. :)
Could we link the pr to:

@julienrbrt
Copy link
Member

julienrbrt commented Nov 11, 2022

Because Rosetta have its own go mod the changelog is at tools/rosetta/CHANGELOG.md. Could you update this one instead :)

CHANGELOG.md Outdated Show resolved Hide resolved
CHANGELOG.md Outdated Show resolved Hide resolved
@JulianToledano
Copy link
Contributor Author

Because Rosetta have its own go mod the changelog is at tools/rosetta/CHANGELOG.md. Could you update this one instead :)

My bad. Already updated :)

Copy link
Member

@julienrbrt julienrbrt left a comment

Choose a reason for hiding this comment

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

utACK! If you rebase, we can merge.

tools/rosetta/CHANGELOG.md Outdated Show resolved Hide resolved
@JulianToledano JulianToledano force-pushed the misc/rosetta-genesis-and-rpcErrors branch 2 times, most recently from 52b7bc7 to 991fd4a Compare November 11, 2022 18:30
@julienrbrt julienrbrt added the A:automerge Automatically merge PR once all prerequisites pass. label Nov 11, 2022
@JulianToledano JulianToledano force-pushed the misc/rosetta-genesis-and-rpcErrors branch from 991fd4a to 3a8349f Compare November 11, 2022 22:58
@julienrbrt
Copy link
Member

@JulianToledano Shall we tag a 0.2.0 with your fixes or have you more fixes coming?

@JulianToledano
Copy link
Contributor Author

@JulianToledano Shall we tag a 0.2.0 with your fixes or have you more fixes coming?

more fixes coming probably next week

@mergify mergify bot merged commit b00cc29 into cosmos:main Nov 12, 2022
@JulianToledano JulianToledano deleted the misc/rosetta-genesis-and-rpcErrors branch November 17, 2022 16:05
@ainhoa-a ainhoa-a mentioned this pull request Nov 24, 2022
23 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A:automerge Automatically merge PR once all prerequisites pass. C:Rosetta Issues and PR related to Rosetta
Projects
None yet
3 participants