-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
chore: fix textual tests #18849
chore: fix textual tests #18849
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In theory it should be able to support the previous string as well in the tx 🤔. This is why we had a proto enum alias.
Makes sense for the display however.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this was failing locally for me. I think its specific to sign mode textual, being that this will be our main signing protocol we should probably better understand if changing field names breaks signing as well. @facundomedica do you know if this is true?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't reproduce, and if I apply the changes from this PR it fails with:
proto: (line 19:17): invalid value for enum type: "VOTE_OPTION_ONE"
Test: TestTxJSONTestcases/a_bit_of_everything
I'm still digging into this to see what's going on, but yes if the string representation of a value changes, the CBOR representation will change
So, I have checked-out main, and I am unable to reproduce the failing test on main. cd x/tx
go test ./...
? cosmossdk.io/x/tx/internal/testpb [no test files]
? cosmossdk.io/x/tx/signing/aminojson/internal/aminojsonpb [no test files]
? cosmossdk.io/x/tx/signing/aminojson/internal/testpb [no test files]
? cosmossdk.io/x/tx/signing/std [no test files]
? cosmossdk.io/x/tx/signing/testutil [no test files]
? cosmossdk.io/x/tx/signing/textual/internal/textualpb [no test files]
ok cosmossdk.io/x/tx/decode 1.110s
ok cosmossdk.io/x/tx/signing 0.012s
ok cosmossdk.io/x/tx/signing/aminojson 0.624s
ok cosmossdk.io/x/tx/signing/direct 0.012s
ok cosmossdk.io/x/tx/signing/directaux 0.012s
ok cosmossdk.io/x/tx/signing/textual 0.044s
ok cosmossdk.io/x/tx/signing/textual/internal/cbor 0.005s |
It could be due to the go.work file i have, all with the same error
|
Right, then it is using the latest api module with the latest gov proto changes. |
The issue is that textual uses the enum's name in the sign bytes, and this enum name is get using protoreflect's The proto representation doesn't include the name of the value, only the enum itself which is not enough for textual to know which string it should use for display and sign. Alternatives:
IMO, option 2 would be fine but from a user perspective it will be very confusing. It will only take a gov proposal that uses option one for NO instead of YES. And maybe even exploitable? |
We actually only want to display it as option when it's a multiple choice proposal. So 1. We could swap back the alias to have the default be like it was and the aliases the option instead. |
@julienrbrt yes, having a custom message renderer is another option: cosmos-sdk/x/tx/signing/textual/handler.go Lines 186 to 190 in 19e66a9
I think it would be the first time this gets used :D EDIT: we'd need to include the proposal type in the message, but it's doable |
Description
this pr fixes tests around sign mode textual and recent governance changes. Mainly sign mode textual signing for the same message is different now due to cbor encoding
cc @julienrbrt
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...
!
in the type prefix if API or client breaking changeCHANGELOG.md
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...