Skip to content

fix: fix CompactTextString panics with nested Anys and private fields#24

Merged
julienrbrt merged 7 commits into
mainfrom
julien/fix-nested-any-string
Nov 14, 2022
Merged

fix: fix CompactTextString panics with nested Anys and private fields#24
julienrbrt merged 7 commits into
mainfrom
julien/fix-nested-any-string

Conversation

@julienrbrt

@julienrbrt julienrbrt commented Nov 11, 2022

Copy link
Copy Markdown
Contributor

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 review from a team, aaronc and amaury1093 November 11, 2022 16:35

@robert-zaremba robert-zaremba left a comment

Copy link
Copy Markdown
Contributor

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.

Comment thread proto/text.go Outdated
Comment thread proto/text.go Outdated
@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

@amaury1093 amaury1093 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

utACK

Comment thread proto/text.go Outdated
@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
Comment thread proto/text_test.go
>`
got := proto.MarshalTextString(m)
if strings.EqualFold(expected, got) {
t.Errorf("got = %s, want %s", expected, got)

Copy link
Copy Markdown

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?

@julienrbrt julienrbrt Nov 25, 2022

Copy link
Copy Markdown
Contributor Author

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 🤷🏾‍♂️

Copy link
Copy Markdown

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

Development

Successfully merging this pull request may close these issues.

proposal.String() panics with nested Anys

6 participants