Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@ func (app *InitiaApp) Simulate(txBytes []byte) (sdk.GasInfo, *sdk.Result, error)

// RegisterTxService implements the Application.RegisterTxService method.
func (app *InitiaApp) RegisterTxService(clientCtx client.Context) {
authtx.RegisterTxService(app.BaseApp.GRPCQueryRouter(), clientCtx, app.Simulate, app.interfaceRegistry)
authtx.RegisterTxService(app.GRPCQueryRouter(), clientCtx, app.Simulate, app.interfaceRegistry)
initiatx.RegisterTxQuery(app.GRPCQueryRouter(), app.DynamicFeeKeeper)

// Register the Block SDK mempool transaction service.
Expand All @@ -488,7 +488,7 @@ func (app *InitiaApp) RegisterTxService(clientCtx client.Context) {
// RegisterTendermintService implements the Application.RegisterTendermintService method.
func (app *InitiaApp) RegisterTendermintService(clientCtx client.Context) {
cmtservice.RegisterTendermintService(
clientCtx, app.BaseApp.GRPCQueryRouter(),
clientCtx, app.GRPCQueryRouter(),
app.interfaceRegistry, app.Query,
)
}
Expand Down
7 changes: 2 additions & 5 deletions app/export.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func (app *InitiaApp) ExportAppStateAndValidators(
AppState: appState,
Validators: validators,
Height: height,
ConsensusParams: app.BaseApp.GetConsensusParams(ctx),
ConsensusParams: app.GetConsensusParams(ctx),
}, nil
}

Expand All @@ -58,12 +58,9 @@ func (app *InitiaApp) ExportAppStateAndValidators(
//
// in favour of export at a block height
func (app *InitiaApp) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs []string) error {
applyAllowedAddrs := false
applyAllowedAddrs := len(jailAllowedAddrs) > 0

// check if there is a allowed address list
if len(jailAllowedAddrs) > 0 {
applyAllowedAddrs = true
}

allowedAddrsMap := make(map[string]bool)

Expand Down
2 changes: 1 addition & 1 deletion crypto/ledger/usbwallet/wallet.go
Original file line number Diff line number Diff line change
Expand Up @@ -588,7 +588,7 @@ func (w *wallet) signPersonalMessage(account accounts.Account, data []byte) ([]b
// SignData signs keccak256(data). The mimetype parameter describes the type of data being signed
func (w *wallet) SignData(account accounts.Account, mimeType string, data []byte) ([]byte, error) {
// Unless we are doing 712 signing, simply dispatch to signHash
if !(mimeType == accounts.MimetypeTypedData && len(data) == 66 && data[0] == 0x19 && data[1] == 0x01) {
if mimeType != accounts.MimetypeTypedData || len(data) != 66 || data[0] != 0x19 || data[1] != 0x01 {
return w.signHash(account, crypto.Keccak256(data))
}

Expand Down
2 changes: 1 addition & 1 deletion x/bank/keeper/custom_msg_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func (ms customMsgServer) SetDenomMetadata(ctx context.Context, req *customtypes
return nil, err
}

ms.Keeper.SetDenomMetaData(ctx, req.Metadata)
ms.SetDenomMetaData(ctx, req.Metadata)

return &customtypes.MsgSetDenomMetadataResponse{}, nil
}
6 changes: 3 additions & 3 deletions x/distribution/keeper/custom_grpc_query.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func (q CustomQueryServer) ValidatorOutstandingRewards(ctx context.Context, req
return nil, err
}

rewards, err := q.Keeper.GetValidatorOutstandingRewards(ctx, valAdr)
rewards, err := q.GetValidatorOutstandingRewards(ctx, valAdr)
if err != nil {
return nil, err
}
Expand All @@ -74,7 +74,7 @@ func (q CustomQueryServer) ValidatorCommission(ctx context.Context, req *customt
return nil, err
}

commission, err := q.Keeper.GetValidatorAccumulatedCommission(ctx, valAdr)
commission, err := q.GetValidatorAccumulatedCommission(ctx, valAdr)
if err != nil {
return nil, err
}
Expand All @@ -100,7 +100,7 @@ func (q CustomQueryServer) ValidatorSlashes(ctx context.Context, req *customtype
if err != nil {
return nil, status.Errorf(codes.InvalidArgument, "invalid validator address")
}
events, pageRes, err := query.CollectionFilteredPaginate(ctx, q.Keeper.ValidatorSlashEvents, req.Pagination,
events, pageRes, err := query.CollectionFilteredPaginate(ctx, q.ValidatorSlashEvents, req.Pagination,
func(key collections.Triple[[]byte, uint64, uint64], result customtypes.ValidatorSlashEvent) (bool, error) {
if result.ValidatorPeriod < req.StartingHeight || result.ValidatorPeriod > req.EndingHeight {
return false, nil
Expand Down
6 changes: 3 additions & 3 deletions x/distribution/keeper/grpc_query.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ func (q QueryServer) ValidatorOutstandingRewards(ctx context.Context, req *types
if err != nil {
return nil, err
}
rewards, err := q.Keeper.GetValidatorOutstandingRewards(ctx, valAddr)
rewards, err := q.GetValidatorOutstandingRewards(ctx, valAddr)
if err != nil {
return nil, err
}
Expand All @@ -134,7 +134,7 @@ func (q QueryServer) ValidatorCommission(ctx context.Context, req *types.QueryVa
if err != nil {
return nil, err
}
commission, err := q.Keeper.GetValidatorAccumulatedCommission(ctx, valAddr)
commission, err := q.GetValidatorAccumulatedCommission(ctx, valAddr)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -162,7 +162,7 @@ func (q QueryServer) ValidatorSlashes(ctx context.Context, req *types.QueryValid
if err != nil {
return nil, status.Errorf(codes.InvalidArgument, "invalid validator address")
}
events, pageRes, err := query.CollectionFilteredPaginate(ctx, q.Keeper.ValidatorSlashEvents, req.Pagination,
events, pageRes, err := query.CollectionFilteredPaginate(ctx, q.ValidatorSlashEvents, req.Pagination,
func(key collections.Triple[[]byte, uint64, uint64], result customtypes.ValidatorSlashEvent) (bool, error) {
if result.ValidatorPeriod < req.StartingHeight || result.ValidatorPeriod > req.EndingHeight {
return false, nil
Expand Down
4 changes: 2 additions & 2 deletions x/dynamic-fee/keeper/ante.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ func NewAnteKeeper(k *Keeper) AnteKeeper {
}

func (k AnteKeeper) BaseDenom(ctx context.Context) (string, error) {
return k.Keeper.baseDenomKeeper.BaseDenom(ctx)
return k.baseDenomKeeper.BaseDenom(ctx)
}

func (k AnteKeeper) GetBaseSpotPrice(ctx context.Context, denom string) (math.LegacyDec, error) {
Expand All @@ -28,5 +28,5 @@ func (k AnteKeeper) GetBaseSpotPrice(ctx context.Context, denom string) (math.Le
} else if baseDenom == denom {
return math.LegacyOneDec(), nil
}
return k.Keeper.tokenPriceKeeper.GetBaseSpotPrice(ctx, denom)
return k.tokenPriceKeeper.GetBaseSpotPrice(ctx, denom)
}
2 changes: 1 addition & 1 deletion x/gov/abci.go
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ func handleTallyResult(
// the deposit at this point since the proposal is converted to regular.
// As a result, the deposits are either deleted or refunded in all cases
// EXCEPT when an expedited proposal fails.
if !(proposal.Expedited && !passed) {
if !proposal.Expedited || passed {
if burnDeposits {
err = k.DeleteAndBurnDeposits(ctx, proposal.Id)
} else {
Expand Down
12 changes: 6 additions & 6 deletions x/gov/keeper/custom_grpc_query.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ func (q CustomQueryServer) Proposals(ctx context.Context, req *customtypes.Query
return false, err
}

has, err := q.Keeper.Votes.Has(ctx, collections.Join(p.Id, sdk.AccAddress(voter)))
has, err := q.Votes.Has(ctx, collections.Join(p.Id, sdk.AccAddress(voter)))
// if no error, vote found, matchVoter = true
matchVoter = err == nil && has
}
Expand All @@ -97,7 +97,7 @@ func (q CustomQueryServer) Proposals(ctx context.Context, req *customtypes.Query
if err != nil {
return false, err
}
has, err := q.Keeper.Deposits.Has(ctx, collections.Join(p.Id, sdk.AccAddress(depositor)))
has, err := q.Deposits.Has(ctx, collections.Join(p.Id, sdk.AccAddress(depositor)))
// if no error, deposit found, matchDepositor = true
matchDepositor = err == nil && has
}
Expand Down Expand Up @@ -139,11 +139,11 @@ func (q CustomQueryServer) TallyResult(ctx context.Context, req *customtypes.Que

var tallyResult customtypes.TallyResult

switch {
case proposal.Status == v1.StatusDepositPeriod:
switch proposal.Status {
case v1.StatusDepositPeriod:
tallyResult = customtypes.EmptyTallyResult()

case proposal.Status == v1.StatusPassed || proposal.Status == v1.StatusRejected:
case v1.StatusPassed, v1.StatusRejected:
tallyResult = proposal.FinalTallyResult

default:
Expand All @@ -153,7 +153,7 @@ func (q CustomQueryServer) TallyResult(ctx context.Context, req *customtypes.Que
return nil, err
}

_, _, _, tallyResult, err = q.Keeper.Tally(ctx, params, proposal)
_, _, _, tallyResult, err = q.Tally(ctx, params, proposal)
if err != nil {
return nil, err
}
Expand Down
12 changes: 6 additions & 6 deletions x/gov/keeper/msg_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ func (k msgServer) SubmitProposal(goCtx context.Context, msg *v1.MsgSubmitPropos
"submit proposal",
)

votingStarted, err := k.Keeper.AddDeposit(ctx, proposal.Id, proposer, msg.GetInitialDeposit())
votingStarted, err := k.AddDeposit(ctx, proposal.Id, proposer, msg.GetInitialDeposit())
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -162,11 +162,11 @@ func (k msgServer) ExecLegacyContent(goCtx context.Context, msg *v1.MsgExecLegac
}

// Ensure that the content has a respective handler
if !k.Keeper.legacyRouter.HasRoute(content.ProposalRoute()) {
if !k.legacyRouter.HasRoute(content.ProposalRoute()) {
return nil, errors.Wrap(types.ErrNoProposalHandlerExists, content.ProposalRoute())
}

handler := k.Keeper.legacyRouter.GetRoute(content.ProposalRoute())
handler := k.legacyRouter.GetRoute(content.ProposalRoute())
if err := handler(ctx, content); err != nil {
return nil, errors.Wrapf(types.ErrInvalidProposalContent, "failed to run legacy handler %s, %+v", content.ProposalRoute(), err)
}
Expand All @@ -186,7 +186,7 @@ func (k msgServer) Vote(goCtx context.Context, msg *v1.MsgVote) (*v1.MsgVoteResp
}

ctx := sdk.UnwrapSDKContext(goCtx)
err = k.Keeper.AddVote(ctx, msg.ProposalId, accAddr, v1.NewNonSplitVoteOption(msg.Option), msg.Metadata)
err = k.AddVote(ctx, msg.ProposalId, accAddr, v1.NewNonSplitVoteOption(msg.Option), msg.Metadata)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -231,7 +231,7 @@ func (k msgServer) VoteWeighted(goCtx context.Context, msg *v1.MsgVoteWeighted)
}

ctx := sdk.UnwrapSDKContext(goCtx)
err := k.Keeper.AddVote(ctx, msg.ProposalId, accAddr, msg.Options, msg.Metadata)
err := k.AddVote(ctx, msg.ProposalId, accAddr, msg.Options, msg.Metadata)
if err != nil {
return nil, err
}
Expand All @@ -251,7 +251,7 @@ func (k msgServer) Deposit(goCtx context.Context, msg *v1.MsgDeposit) (*v1.MsgDe
}

ctx := sdk.UnwrapSDKContext(goCtx)
votingStarted, err := k.Keeper.AddDeposit(ctx, msg.ProposalId, accAddr, msg.Amount)
votingStarted, err := k.AddDeposit(ctx, msg.ProposalId, accAddr, msg.Amount)
if err != nil {
return nil, err
}
Expand Down
2 changes: 1 addition & 1 deletion x/ibc/perm/keeper/grpc_query.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func (q QueryServerImpl) ChannelStates(ctx context.Context, req *types.QueryChan
func (q QueryServerImpl) ChannelState(ctx context.Context, req *types.QueryChannelStateRequest) (*types.QueryChannelStateResponse, error) {
ctx = sdk.UnwrapSDKContext(ctx)

channelState, err := q.Keeper.GetChannelState(ctx, req.PortId, req.ChannelId)
channelState, err := q.GetChannelState(ctx, req.PortId, req.ChannelId)
if err != nil {
return nil, err
}
Expand Down
12 changes: 6 additions & 6 deletions x/ibc/perm/keeper/msg_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ func NewMsgServerImpl(k *Keeper) MsgServer {

// UpdateAdmin update channel relayer to restrict relaying operation of a channel to specific relayer.
func (ms MsgServer) UpdateAdmin(ctx context.Context, req *types.MsgUpdateAdmin) (*types.MsgUpdateAdminResponse, error) {
if err := req.Validate(ms.Keeper.ac); err != nil {
if err := req.Validate(ms.ac); err != nil {
return nil, err
}

cs, err := ms.Keeper.GetChannelState(ctx, req.PortId, req.ChannelId)
cs, err := ms.GetChannelState(ctx, req.PortId, req.ChannelId)
if err != nil {
return nil, err
}
Expand All @@ -40,7 +40,7 @@ func (ms MsgServer) UpdateAdmin(ctx context.Context, req *types.MsgUpdateAdmin)
}

cs.Admin = req.Admin
err = ms.Keeper.SetChannelState(ctx, cs)
err = ms.SetChannelState(ctx, cs)
if err != nil {
return nil, err
}
Expand All @@ -67,11 +67,11 @@ func (ms MsgServer) UpdateAdmin(ctx context.Context, req *types.MsgUpdateAdmin)

// UpdatePermissionedRelayers update channel relayer to restrict relaying operation of a channel to specific relayer.
func (ms MsgServer) UpdatePermissionedRelayers(ctx context.Context, req *types.MsgUpdatePermissionedRelayers) (*types.MsgUpdatePermissionedRelayersResponse, error) {
if err := req.Validate(ms.Keeper.ac); err != nil {
if err := req.Validate(ms.ac); err != nil {
return nil, err
}

cs, err := ms.Keeper.GetChannelState(ctx, req.PortId, req.ChannelId)
cs, err := ms.GetChannelState(ctx, req.PortId, req.ChannelId)
if err != nil {
return nil, err
}
Expand All @@ -82,7 +82,7 @@ func (ms MsgServer) UpdatePermissionedRelayers(ctx context.Context, req *types.M
}

cs.Relayers = req.Relayers
err = ms.Keeper.SetChannelState(ctx, cs)
err = ms.SetChannelState(ctx, cs)
if err != nil {
return nil, err
}
Expand Down
7 changes: 4 additions & 3 deletions x/move/client/cli/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,13 +135,14 @@ func bcsSerializeArg(argType string, arg string, s serde.Serializer, ac address.
return s.GetBytes(), err

case "bool":
if arg == "true" || arg == "True" {
switch arg {
case "true", "True":
err := s.SerializeBool(true)
return s.GetBytes(), err
} else if arg == "false" || arg == "False" {
case "false", "False":
err := s.SerializeBool(false)
return s.GetBytes(), err
} else {
default:
return nil, errors.New("unsupported bool value")
}

Expand Down
6 changes: 3 additions & 3 deletions x/move/keeper/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func (api GoApi) AmountToShare(valBz []byte, metadata vmtypes.AccountAddress, am
return "0", err
}

denom, err := types.DenomFromMetadataAddress(api.ctx, api.Keeper.MoveBankKeeper(), metadata)
denom, err := types.DenomFromMetadataAddress(api.ctx, api.MoveBankKeeper(), metadata)
if err != nil {
return "0", err
}
Expand All @@ -78,7 +78,7 @@ func (api GoApi) ShareToAmount(valBz []byte, metadata vmtypes.AccountAddress, sh
return 0, err
}

denom, err := types.DenomFromMetadataAddress(api.ctx, api.Keeper.MoveBankKeeper(), metadata)
denom, err := types.DenomFromMetadataAddress(api.ctx, api.MoveBankKeeper(), metadata)
if err != nil {
return 0, err
}
Expand Down Expand Up @@ -134,7 +134,7 @@ func (api GoApi) Query(req vmtypes.QueryRequest, gasBalance uint64) ([]byte, uin
// use normal gas meter to meter gas consumption during query with max gas limit
sdkCtx := sdk.UnwrapSDKContext(api.ctx).WithGasMeter(storetypes.NewGasMeter(gasBalance))

res, err := api.Keeper.HandleVMQuery(sdkCtx, &req)
res, err := api.HandleVMQuery(sdkCtx, &req)
if err != nil {
return nil, sdkCtx.GasMeter().GasConsumed(), err
}
Expand Down
12 changes: 7 additions & 5 deletions x/move/keeper/balancer.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,12 @@ func (k BalancerKeeper) Whitelist(ctx context.Context, metadataLP vmtypes.Accoun
}

var metadataQuote vmtypes.AccountAddress
if metadataBase == metadata[0] {
switch metadataBase {
case metadata[0]:
metadataQuote = metadata[1]
} else if metadataBase == metadata[1] {
case metadata[1]:
metadataQuote = metadata[0]
} else {
default:
return false, moderrors.Wrapf(
types.ErrInvalidDexConfig,
"To be whitelisted, a dex should contain `%s` in its pair", denomBase,
Expand Down Expand Up @@ -311,9 +312,10 @@ func (k BalancerKeeper) isReverse(
return false, err
}

if metadataBase == metadata[0] {
switch metadataBase {
case metadata[0]:
return false, nil
} else if metadataBase == metadata[1] {
case metadata[1]:
return true, nil
}

Expand Down
Loading