Skip to content

Commit

Permalink
chore!: var-naming linter errors (backport cosmos#12135) (cosmos#12401)
Browse files Browse the repository at this point in the history
  • Loading branch information
mergify[bot] authored and JeancarloBarrios committed Sep 28, 2024
1 parent 31e79b2 commit fe13c68
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 20 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ It is strongly recommended to upgrade to these releases as well.
* (x/mint) [#12384](https://github.com/cosmos/cosmos-sdk/pull/12384) Ensure `GoalBonded` must be positive when performing `x/mint` parameter validation.
* (x/auth) [#12261](https://github.com/cosmos/cosmos-sdk/pull/12261) Deprecate pagination in GetTxsEventRequest/Response in favor of page and limit to align with tendermint `SignClient.TxSearch`
* (vesting) [#12190](https://github.com/cosmos/cosmos-sdk/pull/12190) Replace https://github.com/cosmos/cosmos-sdk/pull/12190 to use `NewBaseAccountWithAddress` in all vesting account message handlers.
* (linting) [#12135](https://github.com/cosmos/cosmos-sdk/pull/12135/) Fix variable naming issues per enabled linters. Run gofumpt to ensure easy reviews of ongoing linting work.
* (linting) [#12132](https://github.com/cosmos/cosmos-sdk/pull/12132) Change sdk.Int to math.Int, run `gofumpt -w -l .`, and `golangci-lint run ./... --fix`
* (cli) [#12127](https://github.com/cosmos/cosmos-sdk/pull/12127) Fix the CLI not always taking into account `--fee-payer` and `--fee-granter` flags.
* (migrations) [#12028](https://github.com/cosmos/cosmos-sdk/pull/12028) Fix v0.45->v0.46 in-place store migrations.
* (baseapp) [#12089](https://github.com/cosmos/cosmos-sdk/pull/12089) Include antehandler and runMsgs events in SimulateTx.
Expand Down
4 changes: 2 additions & 2 deletions x/auth/tx/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ func (s txServer) GetBlockWithTxs(ctx context.Context, req *txtypes.GetBlockWith
"or greater than the current height %d", req.Height, currentHeight)
}

blockId, block, err := tmservice.GetProtoBlock(ctx, s.clientCtx, &req.Height)
blockID, block, err := tmservice.GetProtoBlock(ctx, s.clientCtx, &req.Height)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -223,7 +223,7 @@ func (s txServer) GetBlockWithTxs(ctx context.Context, req *txtypes.GetBlockWith

return &txtypes.GetBlockWithTxsResponse{
Txs: txs,
BlockId: &blockId,
BlockId: &blockID,
Block: block,
Pagination: &pagination.PageResponse{
Total: blockTxsLn,
Expand Down
27 changes: 20 additions & 7 deletions x/authz/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -404,9 +404,24 @@ func (k Keeper) getGrantQueueItem(ctx context.Context, expiration time.Time, gra
return &authz.GrantQueueItem{}, nil
}

var queueItems authz.GrantQueueItem
if err := k.cdc.Unmarshal(bz, &queueItems); err != nil {
return nil, err
_, _, msgType := parseGrantStoreKey(grantKey)
queueItems := queueItem.MsgTypeUrls

for index, typeURL := range queueItems {
ctx.GasMeter().ConsumeGas(gasCostPerIteration, "grant queue")

if typeURL == msgType {
end := len(queueItem.MsgTypeUrls) - 1
queueItems[index] = queueItems[end]
queueItems = queueItems[:end]

if err := keeper.setGrantQueueItem(ctx, expiration, granter, grantee, &authz.GrantQueueItem{
MsgTypeUrls: queueItems,
}); err != nil {
return err
}
break
}
}
return &queueItems, nil
}
Expand Down Expand Up @@ -437,10 +452,8 @@ func (k Keeper) InitGenesis(ctx sdk.Context, data *authz.GenesisState) {
}
}

// limit the amount of iterations to avoid taking too much time
count++
if count == limit {
return nil
for _, typeURL := range queueItem.MsgTypeUrls {
store.Delete(grantStoreKey(grantee, granter, typeURL))
}
}

Expand Down
3 changes: 2 additions & 1 deletion x/group/keeper/grpc_query.go
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,8 @@ func (k Keeper) getVotesByVoter(ctx context.Context, voter sdk.AccAddress, pageR
}

// TallyResult computes the live tally result of a proposal.
func (k Keeper) TallyResult(ctx context.Context, request *group.QueryTallyResultRequest) (*group.QueryTallyResultResponse, error) {
func (k Keeper) TallyResult(goCtx context.Context, request *group.QueryTallyResultRequest) (*group.QueryTallyResultResponse, error) {
ctx := sdk.UnwrapSDKContext(goCtx)
proposalID := request.ProposalId

proposal, err := k.getProposal(ctx, proposalID)
Expand Down
16 changes: 8 additions & 8 deletions x/group/keeper/msg_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -289,12 +289,12 @@ func (k Keeper) CreateGroupWithPolicy(ctx context.Context, msg *group.MsgCreateG
}
groupID := groupRes.GroupId

// NOTE: group policy message validation is performed in the CreateGroupPolicy method
groupPolicyRes, err := k.CreateGroupPolicy(ctx, &group.MsgCreateGroupPolicy{
Admin: msg.Admin,
var groupPolicyAddr sdk.AccAddress
groupPolicyRes, err := k.CreateGroupPolicy(goCtx, &group.MsgCreateGroupPolicy{
Admin: req.Admin,
GroupId: groupID,
Metadata: msg.GroupPolicyMetadata,
DecisionPolicy: msg.DecisionPolicy,
Metadata: req.GroupPolicyMetadata,
DecisionPolicy: req.DecisionPolicy,
})
if err != nil {
return nil, errorsmod.Wrap(err, "group policy response")
Expand All @@ -303,8 +303,8 @@ func (k Keeper) CreateGroupWithPolicy(ctx context.Context, msg *group.MsgCreateG
if msg.GroupPolicyAsAdmin {
updateAdminReq := &group.MsgUpdateGroupAdmin{
GroupId: groupID,
Admin: msg.Admin,
NewAdmin: groupPolicyRes.Address,
Admin: req.Admin,
NewAdmin: groupPolicyAddress,
}
_, err = k.UpdateGroupAdmin(ctx, updateAdminReq)
if err != nil {
Expand All @@ -322,7 +322,7 @@ func (k Keeper) CreateGroupWithPolicy(ctx context.Context, msg *group.MsgCreateG
}
}

return &group.MsgCreateGroupWithPolicyResponse{GroupId: groupID, GroupPolicyAddress: groupPolicyRes.Address}, nil
return &group.MsgCreateGroupWithPolicyResponse{GroupId: groupID, GroupPolicyAddress: groupPolicyAddress}, nil
}

func (k Keeper) CreateGroupPolicy(ctx context.Context, msg *group.MsgCreateGroupPolicy) (*group.MsgCreateGroupPolicyResponse, error) {
Expand Down
4 changes: 2 additions & 2 deletions x/group/keeper/tally.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (

// Tally is a function that tallies a proposal by iterating through its votes,
// and returns the tally result without modifying the proposal or any state.
func (k Keeper) Tally(ctx context.Context, p group.Proposal, groupID uint64) (group.TallyResult, error) {
func (k Keeper) Tally(ctx sdk.Context, p group.Proposal, groupID uint64) (group.TallyResult, error) {
// If proposal has already been tallied and updated, then its status is
// accepted/rejected, in which case we just return the previously stored result.
//
Expand Down Expand Up @@ -44,7 +44,7 @@ func (k Keeper) Tally(ctx context.Context, p group.Proposal, groupID uint64) (gr
}

var member group.GroupMember
err := k.groupMemberTable.GetOne(kvStore, orm.PrimaryKey(&group.GroupMember{
err := k.groupMemberTable.GetOne(ctx.KVStore(k.key), orm.PrimaryKey(&group.GroupMember{
GroupId: groupID,
Member: &group.Member{Address: vote.Voter},
}, k.accKeeper.AddressCodec()), &member)
Expand Down

0 comments on commit fe13c68

Please sign in to comment.