feat: simapp/v2 (#20412)
Co-authored-by: marbar3778 <marbar3778@yahoo.com> Co-authored-by: Marko <marko@baricevic.me> Co-authored-by: Likhita Polavarapu <78951027+likhita-809@users.noreply.github.com> Co-authored-by: unknown unknown <unknown@unknown>
This commit is contained in:
co-authored by
marbar3778
Marko
Likhita Polavarapu
unknown unknown
parent
ca195c1527
commit
2d014b26c2
@@ -3,6 +3,7 @@ package keeper
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
cmtproto "github.com/cometbft/cometbft/api/cometbft/types/v1"
|
||||
@@ -76,10 +77,17 @@ func (k Keeper) UpdateParams(ctx context.Context, msg *types.MsgUpdateParams) (*
|
||||
}
|
||||
|
||||
paramsProto, err := k.ParamsStore.Get(ctx)
|
||||
|
||||
var params cmttypes.ConsensusParams
|
||||
if err != nil {
|
||||
return nil, err
|
||||
if errors.Is(err, collections.ErrNotFound) {
|
||||
params = cmttypes.ConsensusParams{}
|
||||
} else {
|
||||
return nil, err
|
||||
}
|
||||
} else {
|
||||
params = cmttypes.ConsensusParamsFromProto(paramsProto)
|
||||
}
|
||||
params := cmttypes.ConsensusParamsFromProto(paramsProto)
|
||||
|
||||
nextParams := params.Update(&consensusParams)
|
||||
|
||||
|
||||
@@ -167,8 +167,7 @@ func (AppModule) ConsensusVersion() uint64 { return ConsensusVersion }
|
||||
|
||||
// BeginBlock returns the begin blocker for the distribution module.
|
||||
func (am AppModule) BeginBlock(ctx context.Context) error {
|
||||
c := sdk.UnwrapSDKContext(ctx) // TODO: remove and use context.Context after including the comet service
|
||||
return am.keeper.BeginBlocker(c)
|
||||
return am.keeper.BeginBlocker(ctx)
|
||||
}
|
||||
|
||||
// AppModuleSimulation functions
|
||||
|
||||
@@ -21,7 +21,6 @@ import (
|
||||
"github.com/cosmos/cosmos-sdk/client/flags"
|
||||
"github.com/cosmos/cosmos-sdk/client/input"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"github.com/cosmos/cosmos-sdk/types/module"
|
||||
"github.com/cosmos/cosmos-sdk/version"
|
||||
"github.com/cosmos/cosmos-sdk/x/genutil"
|
||||
"github.com/cosmos/cosmos-sdk/x/genutil/types"
|
||||
@@ -70,9 +69,13 @@ func displayInfo(dst io.Writer, info printInfo) error {
|
||||
return err
|
||||
}
|
||||
|
||||
type hasDefaultGenesis interface {
|
||||
DefaultGenesis() map[string]json.RawMessage
|
||||
}
|
||||
|
||||
// InitCmd returns a command that initializes all files needed for Tendermint
|
||||
// and the respective application.
|
||||
func InitCmd(mm *module.Manager) *cobra.Command {
|
||||
func InitCmd(mm hasDefaultGenesis) *cobra.Command {
|
||||
cmd := &cobra.Command{
|
||||
Use: "init [moniker]",
|
||||
Short: "Initialize private validator, p2p, genesis, and application configuration files",
|
||||
|
||||
Reference in New Issue
Block a user