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: fix CompactTextString panics with nested Anys and private fields #24

Merged
merged 7 commits into from
Nov 14, 2022

Conversation

julienrbrt
Copy link
Member

@julienrbrt julienrbrt commented Nov 11, 2022

Closes cosmos/cosmos-sdk#10965.
Looking at the tests now. Using a replace in the Cosmos SDK resolves cosmos/cosmos-sdk#10965 and cosmos/cosmos-sdk#13838 (using the codegen String method)

We'll need to tag 1.4.3 after.

@julienrbrt julienrbrt marked this pull request as ready for review November 11, 2022 16:35
@julienrbrt julienrbrt requested a review from a team as a code owner November 11, 2022 16:35
Copy link
Collaborator

@robert-zaremba robert-zaremba left a comment

Choose a reason for hiding this comment

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

Let's check if we need to handle bool type as well.

proto/text.go Outdated Show resolved Hide resolved
proto/text.go Outdated Show resolved Hide resolved
@julienrbrt julienrbrt changed the title fix: proposal.String() panics with nested Anys fix: generated string method panics with nested Anys Nov 12, 2022
@julienrbrt julienrbrt changed the title fix: generated string method panics with nested Anys fix: fix CompactTextString panics with nested Anys and private fields Nov 12, 2022
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.

utACK

proto/text.go Outdated Show resolved Hide resolved
@julienrbrt julienrbrt enabled auto-merge (squash) November 14, 2022 10:10
@julienrbrt julienrbrt merged commit 1c02725 into main Nov 14, 2022
@julienrbrt julienrbrt deleted the julien/fix-nested-any-string branch November 14, 2022 14:02
>`
got := proto.MarshalTextString(m)
if strings.EqualFold(expected, got) {
t.Errorf("got = %s, want %s", expected, got)

Choose a reason for hiding this comment

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

Invalid order of the error log; got should be first then expected :-) Also this test is saying that the values match with the same case then error out, did you mean if !strings.EqualFold?

Copy link
Member Author

@julienrbrt julienrbrt Nov 25, 2022

Choose a reason for hiding this comment

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

You are right, actually the test is not so useful either tbh (and wrong as you've noticed).
I have tested the fix using replace in the SDK directly, and quickly wrong this without paying too much attention :/ I can fix it or just remove it 🤷🏾‍♂️

Choose a reason for hiding this comment

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

Please fix it :-) I am up and will gladly review it.

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.

proposal.String() panics with nested Anys
6 participants