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

refactor: remove gogoproto stringer annotations #14046

Merged
merged 14 commits into from
Nov 29, 2022

Conversation

julienrbrt
Copy link
Member

@julienrbrt julienrbrt commented Nov 28, 2022

Description

Follow-up of #13850
See #13850 (review), #13850 (comment)

These are left because I am not sure of the impact.

It seems like the Capability annotations needs to stay:

// String returns the string representation of a Capability. The string contains
// the Capability's memory reference as the string is to be used in a composite
// key and to authenticate capabilities.
func (ck *Capability) String() string {
	return fmt.Sprintf("Capability{%p, %d}", ck, ck.Index)
}

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)

@julienrbrt julienrbrt marked this pull request as ready for review November 28, 2022 15:24
@julienrbrt julienrbrt requested a review from a team as a code owner November 28, 2022 15:24
@facundomedica
Copy link
Member

LGTM, I think that the capability String() is safe to remove, the comment is a bit ambiguous and also wrong as of the latest version of FwdCapabilityKey.

The string contains the Capability's memory reference as the string is to be used in a composite key and to authenticate capabilities.

I think this is just saying "we return this memory reference because it's useful for debugging or whatever, given that we use it to create a key somewhere else". That key would be FwdCapabilityKey and the format used is outdated; FwdCapabilityKey now uses %#016p (since v0.46.0 iirc) instead of %p like here.

// FwdCapabilityKey returns a forward lookup key for a given module and capability
// reference.
func FwdCapabilityKey(module string, cap *Capability) []byte {
return []byte(fmt.Sprintf("%s/fwd/%#016p", module, cap))
}

btw most likely my bad that the format of String() and FwdCapabilityKey don't match 😅 (my first PR in the SDK lol)

@sonarcloud
Copy link

sonarcloud bot commented Nov 28, 2022

[Cosmos SDK] Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

93.3% 93.3% Coverage
0.0% 0.0% Duplication

@julienrbrt julienrbrt mentioned this pull request Nov 29, 2022
19 tasks
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, thanks

Copy link
Member

@facundomedica facundomedica left a comment

Choose a reason for hiding this comment

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

LGTM! 🚀

@julienrbrt julienrbrt enabled auto-merge (squash) November 29, 2022 13:04
@julienrbrt julienrbrt merged commit a1b09a0 into main Nov 29, 2022
@julienrbrt julienrbrt deleted the julien/gogoproto-stringer branch November 29, 2022 13:34
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.

4 participants