Skip to content

Commit

Permalink
fixed up most of app wiring
Browse files Browse the repository at this point in the history
  • Loading branch information
vexxvakan committed Jan 28, 2025
1 parent 55d91a7 commit 68e7875
Show file tree
Hide file tree
Showing 17 changed files with 463 additions and 886 deletions.
6 changes: 6 additions & 0 deletions app/app.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package app

import (
"encoding/json"
"fmt"
"io"
"os"
Expand Down Expand Up @@ -439,6 +440,11 @@ func (app *App) AutoCLIOpts(initClientCtx client.Context) autocli.AppOptions {
}
}

// DefaultGenesis returns a default genesis from the registered AppModuleBasic's.
func (a *App) DefaultGenesis() map[string]json.RawMessage {
return a.BasicModuleManager.DefaultGenesis(a.appCodec)
}

func (app *App) setPostHandler() {
postHandler, err := posthandler.NewPostHandler(
posthandler.HandlerOptions{},
Expand Down
18 changes: 0 additions & 18 deletions app/apptesting/events.go

This file was deleted.

323 changes: 0 additions & 323 deletions app/apptesting/test_suite.go

This file was deleted.

11 changes: 6 additions & 5 deletions app/decorators/change_rate_decorator.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package decorators
import (
"fmt"

sdkmath "cosmossdk.io/math"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/authz"
stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper"
Expand All @@ -17,12 +18,12 @@ const (
// that create validators and exceed the max change rate of 5%.
type MsgChangeRateDecorator struct {
sk *stakingkeeper.Keeper
maxCommissionChangeRate sdk.Dec
maxCommissionChangeRate sdkmath.LegacyDec
}

// Create new Change Rate Decorator
func NewChangeRateDecorator(sk *stakingkeeper.Keeper) MsgChangeRateDecorator {
rate, err := sdk.NewDecFromStr(MaxChangeRate)
rate, err := sdkmath.LegacyNewDecFromStr(MaxChangeRate)
if err != nil {
panic(err)
}
Expand Down Expand Up @@ -98,9 +99,9 @@ func (mcr MsgChangeRateDecorator) isInvalidEditMessage(ctx sdk.Context, msg *sta
}

// Get validator info, if exists
valInfo, found := mcr.sk.GetValidator(ctx, bech32Addr)
if !found {
return fmt.Errorf("validator not found")
valInfo, err := mcr.sk.GetValidator(ctx, bech32Addr)
if err != nil {
return err
}

// Check if new commission rate is out of bounds of the max change rate
Expand Down
Loading

0 comments on commit 68e7875

Please sign in to comment.