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

Change sdk.Msg.GetSigners() return type to []string #9239

Closed
aaronc opened this issue Apr 30, 2021 · 3 comments · Fixed by #9418
Closed

Change sdk.Msg.GetSigners() return type to []string #9239

aaronc opened this issue Apr 30, 2021 · 3 comments · Fixed by #9418
Assignees

Comments

@aaronc
Copy link
Member

aaronc commented Apr 30, 2021

sdk.Msg.GetSigners() currently returns []sdk.AccAddress which depends on global bech32 prefixes. Changing the return type to []string was already mentioned in #9011. This seems like low-hanging fruit and a pathway to #7448 (removing global bech32 prefixes).

@aaronc aaronc added this to the Post-Stargate Feature Backlog milestone Apr 30, 2021
@clevinson clevinson added S:needs architecture review To discuss on the next architecture review call to come to alignment Status: Ice Box and removed Status: Backlog labels Apr 30, 2021
@clevinson clevinson removed the S:needs architecture review To discuss on the next architecture review call to come to alignment label May 12, 2021
@aaronc
Copy link
Member Author

aaronc commented May 12, 2021

In the last architecture call we agreed to do this.

One note is that we want to make sure we are validating signers in CLI calls where we now call ValidateBasic to do that. I propose a ValidateMsg function to use in those places:

func ValidateMsg(msg sdk.Msg) error {
  err := msg.ValidateBasic()
  if err != nil {
   return err
  }
 
  signers := msg.GetSigners()
  for signer := range signers {
    _, err = sdk.AccAddressFromBech32(signer)
    if err != nil {
      return err
    }
  }
}

@amaury1093
Copy link
Contributor

amaury1093 commented Jun 28, 2021

One note is that we want to make sure we are validating signers in CLI calls where we now call ValidateBasic to do that. I propose a ValidateMsg function to use in those places:

Is ValidateMsg only for CLI? How about validation for grpc and rest calls? I would prefer an audit of all ValidateBasics to make sure they validate all their bech32 addresses.

Edit: proposing to put ValidateMsg in the antehandlers: #9418 (comment)

@robert-zaremba
Copy link
Collaborator

robert-zaremba commented Jun 28, 2021

Removing "DO NOT MERGE" flag - master is already in the v0.44 cycle.

@robert-zaremba robert-zaremba removed the S: DO NOT MERGE Status: DO NOT MERGE label Jun 28, 2021
@mergify mergify bot closed this as completed in #9418 Jul 7, 2021
mergify bot pushed a commit that referenced this issue Jul 7, 2021
<!-- < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < ☺
v                               ✰  Thanks for creating a PR! ✰
v    Before smashing the submit button please review the checkboxes.
v    If a checkbox is n/a - please still include it but + a little note why
☺ > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > >  -->

## Description

<!-- Add a description of the changes that this PR introduces and the files that
are the most critical to review.
-->

closes: #9239 

---

Before we can merge this PR, please make sure that all the following items have been
checked off. If any of the checklist items are not applicable, please leave them but
write a little note why.

- [ ] Targeted PR against correct branch (see [CONTRIBUTING.md](https://github.com/cosmos/cosmos-sdk/blob/master/CONTRIBUTING.md#pr-targeting))
- [ ] Linked to Github issue with discussion and accepted design OR link to spec that describes this work.
- [ ] Code follows the [module structure standards](https://github.com/cosmos/cosmos-sdk/blob/master/docs/building-modules/structure.md).
- [ ] Wrote unit and integration [tests](https://github.com/cosmos/cosmos-sdk/blob/master/CONTRIBUTING.md#testing)
- [ ] Updated relevant documentation (`docs/`) or specification (`x/<module>/spec/`)
- [ ] Added relevant `godoc` [comments](https://blog.golang.org/godoc-documenting-go-code).
- [ ] Added a relevant changelog entry to the `Unreleased` section in `CHANGELOG.md`
- [ ] Re-reviewed `Files changed` in the Github PR explorer
- [ ] Review `Codecov Report` in the comment section below once CI passes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants