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: duration renderer for SIGN_MODE_TEXTUAL #13312

Merged

Conversation

JimLarson
Copy link
Contributor

@JimLarson JimLarson commented Sep 16, 2022

Description

Closes: #12710

Adds SIGN_MODE_TEXTUAL value renderer for google.protobuf.Duration messages.


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

(CHANGELOG intentionally unmodified - will be updated with the whole epic)

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
Contributor

@amaury1093 amaury1093 left a comment

Choose a reason for hiding this comment

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

LGTM overall, thanks @JimLarson. One comment is whether we need to normalize Durations, or simply check that the input durations are valid.

tx/textual/internal/testdata/duration.json Outdated Show resolved Hide resolved
tx/textual/valuerenderer/duration.go Outdated Show resolved Hide resolved
tx/textual/valuerenderer/duration.go Outdated Show resolved Hide resolved
tx/textual/valuerenderer/duration.go Outdated Show resolved Hide resolved
tx/textual/valuerenderer/duration.go Outdated Show resolved Hide resolved
dur.Seconds *= -1
dur.Nanos *= -1
}

Copy link
Contributor

Choose a reason for hiding this comment

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

What about calling dur.CheckValid just to be sure our algo was correct?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Outside the scope of Parse(). It doesn't need to handle anything outside of data formatted from a valid proto.

Copy link

@github-advanced-security github-advanced-security bot left a comment

Choose a reason for hiding this comment

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

gosec found more than 10 potential problems in the proposed changes. Check the Files changed tab for more details.

Copy link
Contributor

@amaury1093 amaury1093 left a comment

Choose a reason for hiding this comment

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

Some final small nits. I'll get a 2nd approval from the SDK team, and we can merge this.

tx/textual/valuerenderer/duration.go Outdated Show resolved Hide resolved
tx/textual/valuerenderer/duration.go Outdated Show resolved Hide resolved
tx/textual/valuerenderer/duration.go Outdated Show resolved Hide resolved
Copy link
Contributor

@amaury1093 amaury1093 left a comment

Choose a reason for hiding this comment

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

LGTM

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.

lgtm

@amaury1093
Copy link
Contributor

This branch is out-of-date with the base branch

@JimLarson Could you rebase/merge main, or give maintainers write access to your branch so that we can do it for you?

@amaury1093 amaury1093 enabled auto-merge (squash) October 6, 2022 10:51
auto-merge was automatically disabled October 7, 2022 00:05

Head branch was pushed to by a user without write access

@JimLarson JimLarson force-pushed the jimlarson/12710-duration-renderer branch from 75f1184 to 837b72e Compare October 7, 2022 00:05
@JimLarson JimLarson force-pushed the jimlarson/12710-duration-renderer branch from 837b72e to 08731fe Compare October 7, 2022 00:07
@JimLarson
Copy link
Contributor Author

@AmauryM or @julienrbrt please reenable the automerge. Thanks!

@codecov
Copy link

codecov bot commented Oct 7, 2022

Codecov Report

Merging #13312 (08731fe) into main (6d03dde) will decrease coverage by 0.08%.
The diff coverage is 78.57%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main   #13312      +/-   ##
==========================================
- Coverage   54.05%   53.97%   -0.09%     
==========================================
  Files         653      648       -5     
  Lines       55899    55425     -474     
==========================================
- Hits        30216    29915     -301     
+ Misses      23269    23111     -158     
+ Partials     2414     2399      -15     
Impacted Files Coverage Δ
tx/textual/valuerenderer/duration.go 78.40% <78.40%> (ø)
tx/textual/valuerenderer/valuerenderer.go 79.59% <100.00%> (ø)
x/staking/simulation/operations.go 74.54% <0.00%> (-1.38%) ⬇️
x/group/keeper/keeper.go 56.25% <0.00%> (-0.40%) ⬇️
cosmovisor/cmd/cosmovisor/help.go
cosmovisor/cmd/cosmovisor/run.go
cosmovisor/logger.go
cosmovisor/errors/multi.go
cosmovisor/cmd/cosmovisor/version.go
cosmovisor/cmd/cosmovisor/main.go
... and 12 more

@julienrbrt julienrbrt merged commit 5f01f6f into cosmos:main Oct 7, 2022
@JimLarson JimLarson deleted the jimlarson/12710-duration-renderer branch October 7, 2022 00:33
Wryhder pushed a commit to Wryhder/cosmos-sdk that referenced this pull request Oct 26, 2022
* feat: value renderer for durations

* feat: dispatch for duration ValueRenderer

* docs: update duration rendering spec

* feat: error on malformed proto, review feedback, more tests

* fix: silence spurious int overflow warnings

* fix: supress spurious gosec warning on safe operation
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.

TEXTUAL Value Renderers for google.protobuf.Duration
4 participants