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: enhance rosetta support #11590

Closed
wants to merge 19 commits into from

Conversation

Vritra4
Copy link
Contributor

@Vritra4 Vritra4 commented Apr 11, 2022

feat/fix to enhance rosetta support

Description

followup of #10766
Closes: #10618

we did integration test with coinbase so this PR includes all of our fixes and features requested from coinbase.

features:

  • add fee_suggetion feature for /construction/metadata
    • adding suggested_fee in result
    • added realted configurations
  • enable offline mode
    • offline-moded cosmo-sdk will return error for sequence-related APIs like /construction/metadata
  • bump rosetta-sdk-go to v0.7.7

fixes:

  • fix bugs: /block returns with nil pointer address when a request has both of index and hash
  • increase timeout to prevent timeout when genesis is huge
  • force set events about fees to success
    • to pass reconcilition, fee have to be presented as success.
    • it is available because failed transaction have no events other than fee

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)

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.

LGTM, could you add a changlog entry pleas

server/rosetta/client_online.go Outdated Show resolved Hide resolved
@@ -69,8 +70,24 @@ func (on OnlineNetwork) ConstructionMetadata(ctx context.Context, request *types
return nil, errors.ToRosetta(err)
}

price, err := sdk.ParseDecCoin(metadata["gas_price"].(string))
Copy link
Contributor

Choose a reason for hiding this comment

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

we should be safe and have explicit type assertions on these metadata fields and return an error when the type is invalid. Otherwise, this could could panic of metadata structure changes.

server/rosetta/lib/internal/service/construction.go Outdated Show resolved Hide resolved
server/rosetta/lib/internal/service/construction.go Outdated Show resolved Hide resolved
server/config/config.go Outdated Show resolved Hide resolved
server/config/config.go Outdated Show resolved Hide resolved
server/rosetta/client_online.go Outdated Show resolved Hide resolved
@@ -6,12 +6,14 @@ import (
"time"

"github.com/coinbase/rosetta-sdk-go/types"
clientflags "github.com/cosmos/cosmos-sdk/client/flags"
Copy link
Collaborator

Choose a reason for hiding this comment

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

gofmt

@@ -30,17 +32,24 @@ const (
DefaultNetwork = "network"
// DefaultOffline defines the default offline value
DefaultOffline = false
// DefaultEnableDefaultFeeSuggest indicates to use fee suggestion
DefaultEnableDefaultFeeSuggest = false
Copy link
Collaborator

Choose a reason for hiding this comment

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

odd to read, we can remove Default prefix and address the changes that @alexanderbez suggested for naming

Co-authored-by: Aleksandr Bezobchuk <alexanderbez@users.noreply.github.com>
Co-authored-by: Anil Kumar Kammari <anil@vitwit.com>
@Vritra4
Copy link
Contributor Author

Vritra4 commented Apr 12, 2022

My apologies.. miscreated pr with outdated and invalid test branch. I'll create again with right branch after applying your suggestions.

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.

Events for failed transactions
5 participants