Skip to content

Commit

Permalink
Merge pull request #14 from tnasu/fix/issue578
Browse files Browse the repository at this point in the history
Fix to use sdk.AccAddressFromBech32 from sdk.AccAddress
  • Loading branch information
ulbqb authored Jul 20, 2022
2 parents 42d7f58 + 76b462f commit fccca83
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 9 deletions.
3 changes: 2 additions & 1 deletion x/feegrant/client/testutil/suite.go
Original file line number Diff line number Diff line change
Expand Up @@ -560,7 +560,8 @@ func (s *IntegrationTestSuite) TestNewCmdRevokeFeegrant() {
}

// Create new fee grant specifically to test amino.
aminoGrantee := sdk.AccAddress("link1zp4lzwuwzvhq7xhe8xj688vv00dxv2zyue4xuj")
aminoGrantee, err := sdk.AccAddressFromBech32("link1zp4lzwuwzvhq7xhe8xj688vv00dxv2zyue4xuj")
s.Require().NoError(err)
s.createGrant(granter, aminoGrantee)

testCases := []struct {
Expand Down
6 changes: 4 additions & 2 deletions x/feegrant/filtered_fee_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,10 +160,12 @@ func TestFilteredFeeValidAllow(t *testing.T) {
// however, the saved value was not.
// so we need this to catch the bug.

newGranter, _ := sdk.AccAddressFromBech32(grant.Granter)
newGrantee, _ := sdk.AccAddressFromBech32(grant.Grantee)
// create a new updated grant
newGrant, err := feegrant.NewGrant(
sdk.AccAddress(grant.Granter),
sdk.AccAddress(grant.Grantee),
newGranter,
newGrantee,
allowance)
require.NoError(t, err)

Expand Down
4 changes: 2 additions & 2 deletions x/wasm/client/cli/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -286,11 +286,11 @@ func parseStoreCodeAndInstantiateContractArgs(file string, initMsg string, sende
return types.MsgStoreCodeAndInstantiateContract{}, fmt.Errorf("instantiate by address: %s", err)
}
if onlyAddrStr != "" {
_, err = sdk.AccAddressFromBech32(onlyAddrStr)
addr, err := sdk.AccAddressFromBech32(onlyAddrStr)
if err != nil {
return types.MsgStoreCodeAndInstantiateContract{}, sdkerrors.Wrap(err, flagInstantiateByAddress)
}
x := types.AccessTypeOnlyAddress.With(sdk.AccAddress(onlyAddrStr))
x := types.AccessTypeOnlyAddress.With(addr)
perm = &x
} else {
everybodyStr, err := flags.GetString(flagInstantiateByEverybody)
Expand Down
8 changes: 4 additions & 4 deletions x/wasm/keeper/query_plugins_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -344,9 +344,9 @@ func TestBankQuerierBalance(t *testing.T) {
}

func TestContractInfoWasmQuerier(t *testing.T) {
var myValidContractAddr = RandomBech32AccountAddress(t)
var myCreatorAddr = RandomBech32AccountAddress(t)
var myAdminAddr = RandomBech32AccountAddress(t)
myValidContractAddr := RandomBech32AccountAddress(t)
myCreatorAddr := RandomBech32AccountAddress(t)
myAdminAddr := RandomBech32AccountAddress(t)
var ctx sdk.Context

specs := map[string]struct {
Expand Down Expand Up @@ -465,7 +465,7 @@ func TestQueryErrors(t *testing.T) {
return nil, spec.src
})
ctx := sdk.Context{}.WithGasMeter(sdk.NewInfiniteGasMeter()).WithMultiStore(store.NewCommitMultiStore(memdb.NewDB()))
q := NewQueryHandler(ctx, mock, sdk.AccAddress(""), NewGasMultiplier(types.DefaultGasMultiplier))
q := NewQueryHandler(ctx, mock, sdk.AccAddress{}, NewGasMultiplier(types.DefaultGasMultiplier))
_, gotErr := q.Query(wasmvmtypes.QueryRequest{}, 1)
assert.Equal(t, spec.expErr, gotErr)
})
Expand Down

0 comments on commit fccca83

Please sign in to comment.