Skip to content

x/bank/types: (Balance).GetAddress ignores error and returns zero value if invalid #8530

Closed
@odeke-em

Description

Summary of Bug

Noticed while auditing PR #8421 for the sake of Stargate release security, that this code

func (b Balance) GetAddress() sdk.AccAddress {
addr, _ := sdk.AccAddressFromBech32(b.Address)
return addr
}

Sure there is some different code path that actually checks the error when (Balance).Validate is invoked, but that's a code smell because many will forget to invoke (Balance).Validate() and even then those code paths re-do a bunch of work

Suggestion

We should always validate such a code path


For Admin Use

  • Not duplicate issue
  • Appropriate labels applied
  • Appropriate contributors tagged
  • Contributor assigned/self-assigned

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions