From 91eb02df6a78b4fffc0141feacfdd5c1c73cea0e Mon Sep 17 00:00:00 2001 From: marbar3778 Date: Sun, 11 Aug 2024 10:50:48 +0200 Subject: [PATCH 01/13] remove consensus message --- core/app/app.go | 26 ++++----- core/context/context.go | 2 + server/v2/cometbft/abci.go | 19 ++++--- server/v2/cometbft/config.go | 4 +- x/consensus/keeper/keeper.go | 55 +++++++++++++++---- x/consensus/module.go | 7 +++ .../proto/cosmos/consensus/v1/query.proto | 1 - 7 files changed, 76 insertions(+), 38 deletions(-) diff --git a/core/app/app.go b/core/app/app.go index 2295b0300835..b377d42cef38 100644 --- a/core/app/app.go +++ b/core/app/app.go @@ -21,26 +21,24 @@ type QueryResponse struct { } type BlockRequest[T transaction.Tx] struct { - Height uint64 - Time time.Time - Hash []byte - ChainId string - AppHash []byte - Txs []T - ConsensusMessages []transaction.Msg + Height uint64 + Time time.Time + Hash []byte + ChainId string + AppHash []byte + Txs []T // IsGenesis indicates if this block is the first block of the chain. IsGenesis bool } type BlockResponse struct { - Apphash []byte - ConsensusMessagesResponse []transaction.Msg - ValidatorUpdates []appmodulev2.ValidatorUpdate - PreBlockEvents []event.Event - BeginBlockEvents []event.Event - TxResults []TxResult - EndBlockEvents []event.Event + Apphash []byte + ValidatorUpdates []appmodulev2.ValidatorUpdate + PreBlockEvents []event.Event + BeginBlockEvents []event.Event + TxResults []TxResult + EndBlockEvents []event.Event } type RequestInitChain struct { diff --git a/core/context/context.go b/core/context/context.go index 6803bd7eb44b..5bff705a686c 100644 --- a/core/context/context.go +++ b/core/context/context.go @@ -3,12 +3,14 @@ package context type ( execModeKey struct{} cometInfoKey struct{} + initInfoKey struct{} environmentKey struct{} ) var ( ExecModeKey = execModeKey{} CometInfoKey = cometInfoKey{} + InitInfoKey = initInfoKey{} // EnvironmentContextKey is the context key for the environment. // A caller should not assume the environment is available in each context. diff --git a/server/v2/cometbft/abci.go b/server/v2/cometbft/abci.go index 54f1c153cc96..d05945f03315 100644 --- a/server/v2/cometbft/abci.go +++ b/server/v2/cometbft/abci.go @@ -13,6 +13,7 @@ import ( coreappmgr "cosmossdk.io/core/app" "cosmossdk.io/core/comet" + corecontext "cosmossdk.io/core/context" "cosmossdk.io/core/event" "cosmossdk.io/core/store" "cosmossdk.io/core/transaction" @@ -234,14 +235,15 @@ func (c *Consensus[T]) InitChain(ctx context.Context, req *abciproto.InitChainRe c.initialHeight = 1 } - var consMessages []transaction.Msg if req.ConsensusParams != nil { - consMessages = append(consMessages, &consensustypes.MsgUpdateParams{ + ctx = context.WithValue(ctx, corecontext.InitInfoKey, &consensustypes.MsgUpdateParams{ Authority: c.consensusAuthority, Block: req.ConsensusParams.Block, Evidence: req.ConsensusParams.Evidence, Validator: req.ConsensusParams.Validator, Abci: req.ConsensusParams.Abci, + Synchrony: req.ConsensusParams.Synchrony, + Feature: req.ConsensusParams.Feature, }) } @@ -254,13 +256,12 @@ func (c *Consensus[T]) InitChain(ctx context.Context, req *abciproto.InitChainRe bz := sha256.Sum256([]byte{}) br := &coreappmgr.BlockRequest[T]{ - Height: uint64(req.InitialHeight - 1), - Time: req.Time, - Hash: bz[:], - AppHash: ci.Hash, - ChainId: req.ChainId, - ConsensusMessages: consMessages, - IsGenesis: true, + Height: uint64(req.InitialHeight - 1), + Time: req.Time, + Hash: bz[:], + AppHash: ci.Hash, + ChainId: req.ChainId, + IsGenesis: true, } blockresponse, genesisState, err := c.app.InitGenesis( diff --git a/server/v2/cometbft/config.go b/server/v2/cometbft/config.go index 3f03e383c601..56860a78ddaf 100644 --- a/server/v2/cometbft/config.go +++ b/server/v2/cometbft/config.go @@ -43,14 +43,14 @@ type CfgOption func(*Config) // OverwriteDefaultConfigTomlConfig overwrites the default comet config with the new config. func OverwriteDefaultConfigTomlConfig(newCfg *cmtcfg.Config) CfgOption { return func(cfg *Config) { - cfg.ConfigTomlConfig = newCfg // nolint:ineffassign,staticcheck // We want to overwrite everything + cfg.ConfigTomlConfig = newCfg } } // OverwriteDefaultAppTomlConfig overwrites the default comet config with the new config. func OverwriteDefaultAppTomlConfig(newCfg *AppTomlConfig) CfgOption { return func(cfg *Config) { - cfg.AppTomlConfig = newCfg // nolint:ineffassign,staticcheck // We want to overwrite everything + cfg.AppTomlConfig = newCfg } } diff --git a/x/consensus/keeper/keeper.go b/x/consensus/keeper/keeper.go index 9236f76f8ddb..ee79e794f596 100644 --- a/x/consensus/keeper/keeper.go +++ b/x/consensus/keeper/keeper.go @@ -12,6 +12,7 @@ import ( "cosmossdk.io/collections" "cosmossdk.io/core/appmodule" + corecontext "cosmossdk.io/core/context" "cosmossdk.io/core/event" "cosmossdk.io/x/consensus/exported" "cosmossdk.io/x/consensus/types" @@ -41,6 +42,26 @@ func (k *Keeper) GetAuthority() string { return k.authority } +// InitGenesis initializes the initial state of the module +func (k *Keeper) InitGenesis(ctx context.Context) error { + value := ctx.Value(corecontext.InitInfoKey).(*types.MsgUpdateParams) + if value == nil { + return nil + } + + consensusParams, err := value.ToProtoConsensusParams() + if err != nil { + return err + } + + nextParams, err := k.paramCheck(ctx, consensusParams) + if err != nil { + return err + } + + return k.ParamsStore.Set(ctx, nextParams.ToProto()) +} + // Querier var _ types.QueryServer = Keeper{} @@ -69,6 +90,27 @@ func (k Keeper) UpdateParams(ctx context.Context, msg *types.MsgUpdateParams) (* return nil, err } + nextParams, err := k.paramCheck(ctx, consensusParams) + if err != nil { + return nil, err + } + + if err := k.ParamsStore.Set(ctx, nextParams.ToProto()); err != nil { + return nil, err + } + + if err := k.EventService.EventManager(ctx).EmitKV( + "update_consensus_params", + event.NewAttribute("authority", msg.Authority), + event.NewAttribute("parameters", consensusParams.String())); err != nil { + return nil, err + } + + return &types.MsgUpdateParamsResponse{}, nil +} + +// paramCheck validates the consensus params +func (k Keeper) paramCheck(ctx context.Context, consensusParams cmtproto.ConsensusParams) (*cmttypes.ConsensusParams, error) { paramsProto, err := k.ParamsStore.Get(ctx) var params cmttypes.ConsensusParams @@ -92,16 +134,5 @@ func (k Keeper) UpdateParams(ctx context.Context, msg *types.MsgUpdateParams) (* return nil, err } - if err := k.ParamsStore.Set(ctx, nextParams.ToProto()); err != nil { - return nil, err - } - - if err := k.EventService.EventManager(ctx).EmitKV( - "update_consensus_params", - event.NewAttribute("authority", msg.Authority), - event.NewAttribute("parameters", consensusParams.String())); err != nil { - return nil, err - } - - return &types.MsgUpdateParamsResponse{}, nil + return &nextParams, nil } diff --git a/x/consensus/module.go b/x/consensus/module.go index 02504cfcff19..4720d962d18a 100644 --- a/x/consensus/module.go +++ b/x/consensus/module.go @@ -2,6 +2,7 @@ package consensus import ( "context" + "encoding/json" gwruntime "github.com/grpc-ecosystem/grpc-gateway/runtime" "google.golang.org/grpc" @@ -42,6 +43,12 @@ func NewAppModule(cdc codec.Codec, keeper keeper.Keeper) AppModule { } } +// InitGenesis performs genesis initialization for the bank module. +func (am AppModule) InitGenesis(ctx context.Context, data json.RawMessage) error { + + return am.keeper.InitGenesis(ctx) +} + // IsAppModule implements the appmodule.AppModule interface. func (AppModule) IsAppModule() {} diff --git a/x/consensus/proto/cosmos/consensus/v1/query.proto b/x/consensus/proto/cosmos/consensus/v1/query.proto index 4841c5aed367..9a84c1909766 100644 --- a/x/consensus/proto/cosmos/consensus/v1/query.proto +++ b/x/consensus/proto/cosmos/consensus/v1/query.proto @@ -4,7 +4,6 @@ package cosmos.consensus.v1; import "google/api/annotations.proto"; import "cometbft/types/v1/params.proto"; -import "cosmos/consensus/v1/consensus.proto"; option go_package = "cosmossdk.io/x/consensus/types"; From b13c09b2d9c8443054ed475882eff42e98eaed8b Mon Sep 17 00:00:00 2001 From: marbar3778 Date: Sun, 11 Aug 2024 10:52:29 +0200 Subject: [PATCH 02/13] add godoc --- core/context/context.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/core/context/context.go b/core/context/context.go index 5bff705a686c..54ed6b46236f 100644 --- a/core/context/context.go +++ b/core/context/context.go @@ -8,9 +8,12 @@ type ( ) var ( - ExecModeKey = execModeKey{} + // ExecModeKey is the context key for setting the execution mode. + ExecModeKey = execModeKey{} + // CometInfoKey is the context key for allowing modules to get CometInfo. CometInfoKey = cometInfoKey{} - InitInfoKey = initInfoKey{} + // InitInfoKey is the context key for setting consensus params from genesis in the consensus module. + InitInfoKey = initInfoKey{} // EnvironmentContextKey is the context key for the environment. // A caller should not assume the environment is available in each context. From a9a818e8c66d4c4bc626b40db2e79243efd03679 Mon Sep 17 00:00:00 2001 From: marbar3778 Date: Mon, 12 Aug 2024 12:03:20 +0200 Subject: [PATCH 03/13] remove consensus message design --- server/v2/stf/stf.go | 36 +++++++++--------------------------- x/consensus/module.go | 5 ----- 2 files changed, 9 insertions(+), 32 deletions(-) diff --git a/server/v2/stf/stf.go b/server/v2/stf/stf.go index 2231f893b55b..d3cd2405b23b 100644 --- a/server/v2/stf/stf.go +++ b/server/v2/stf/stf.go @@ -106,10 +106,6 @@ func (s STF[T]) DeliverBlock( exCtx := s.makeContext(ctx, appmanager.ConsensusIdentity, newState, internal.ExecModeFinalize) exCtx.setHeaderInfo(hi) - consMessagesResponses, err := s.runConsensusMessages(exCtx, block.ConsensusMessages) - if err != nil { - return nil, nil, fmt.Errorf("failed to execute consensus messages: %w", err) - } // reset events exCtx.events = make([]event.Event, 0) @@ -160,13 +156,12 @@ func (s STF[T]) DeliverBlock( } return &appmanager.BlockResponse{ - Apphash: nil, - ConsensusMessagesResponse: consMessagesResponses, - ValidatorUpdates: valset, - PreBlockEvents: preBlockEvents, - BeginBlockEvents: beginBlockEvents, - TxResults: txResults, - EndBlockEvents: endBlockEvents, + Apphash: nil, + ValidatorUpdates: valset, + PreBlockEvents: preBlockEvents, + BeginBlockEvents: beginBlockEvents, + TxResults: txResults, + EndBlockEvents: endBlockEvents, }, newState, nil } @@ -333,6 +328,7 @@ func (s STF[T]) runTxMsgs( return msgResps, consumed, execCtx.events, nil } +// preBlock executes the pre block logic. func (s STF[T]) preBlock( ctx *executionContext, txs []T, @@ -352,22 +348,7 @@ func (s STF[T]) preBlock( return ctx.events, nil } -func (s STF[T]) runConsensusMessages( - ctx *executionContext, - messages []transaction.Msg, -) ([]transaction.Msg, error) { - responses := make([]transaction.Msg, len(messages)) - for i := range messages { - resp, err := s.msgRouter.InvokeUntyped(ctx, messages[i]) - if err != nil { - return nil, err - } - responses[i] = resp - } - - return responses, nil -} - +// beginBlock executes the begin block logic. func (s STF[T]) beginBlock( ctx *executionContext, ) (beginBlockEvents []event.Event, err error) { @@ -386,6 +367,7 @@ func (s STF[T]) beginBlock( return ctx.events, nil } +// endBlock executes the end block logic. func (s STF[T]) endBlock( ctx *executionContext, ) ([]event.Event, []appmodulev2.ValidatorUpdate, error) { diff --git a/x/consensus/module.go b/x/consensus/module.go index 4720d962d18a..d19d72ede5e1 100644 --- a/x/consensus/module.go +++ b/x/consensus/module.go @@ -82,8 +82,3 @@ func (am AppModule) RegisterServices(registrar grpc.ServiceRegistrar) error { // ConsensusVersion implements HasConsensusVersion. func (AppModule) ConsensusVersion() uint64 { return ConsensusVersion } - -// RegisterConsensusMessages registers the consensus module's messages. -func (am AppModule) RegisterConsensusMessages(builder any) { - // std.RegisterConsensusHandler(builder ,am.keeper.SetParams) // TODO uncomment when api is available -} From df962b6fa1784804db357f2178a8bb2e004d94e5 Mon Sep 17 00:00:00 2001 From: marbar3778 Date: Mon, 12 Aug 2024 13:04:59 +0200 Subject: [PATCH 04/13] solve issue with appversion --- server/v2/appmanager/appmanager.go | 8 +++----- server/v2/cometbft/abci.go | 15 ++++++++++----- server/v2/cometbft/utils.go | 1 + simapp/v2/app_config.go | 1 + x/consensus/keeper/keeper.go | 2 ++ 5 files changed, 17 insertions(+), 10 deletions(-) diff --git a/server/v2/appmanager/appmanager.go b/server/v2/appmanager/appmanager.go index cef0fc57cce7..66e38a762a18 100644 --- a/server/v2/appmanager/appmanager.go +++ b/server/v2/appmanager/appmanager.go @@ -36,6 +36,7 @@ type AppManager[T transaction.Tx] struct { stf StateTransitionFunction[T] } +// InitGenesis initializes the genesis state of the application. func (a AppManager[T]) InitGenesis( ctx context.Context, blockRequest *appmanager.BlockRequest[T], @@ -65,8 +66,6 @@ func (a AppManager[T]) InitGenesis( return nil, nil, fmt.Errorf("failed to import genesis state: %w", err) } // run block - // TODO: in an ideal world, genesis state is simply an initial state being applied - // unaware of what that state means in relation to every other blockRequest.Txs = genTxs blockResponse, blockZeroState, err := a.stf.DeliverBlock(ctx, blockRequest, genesisState) @@ -75,18 +74,17 @@ func (a AppManager[T]) InitGenesis( } // after executing block 0, we extract the changes and apply them to the genesis state. - blockZeroStateChanges, err := blockZeroState.GetStateChanges() + stateChanges, err := blockZeroState.GetStateChanges() if err != nil { return nil, nil, fmt.Errorf("failed to get block zero state changes: %w", err) } - err = genesisState.ApplyStateChanges(blockZeroStateChanges) + err = genesisState.ApplyStateChanges(stateChanges) if err != nil { return nil, nil, fmt.Errorf("failed to apply block zero state changes to genesis state: %w", err) } return blockResponse, genesisState, err - // consensus server will need to set the version of the store } // ExportGenesis exports the genesis state of the application. diff --git a/server/v2/cometbft/abci.go b/server/v2/cometbft/abci.go index d05945f03315..e0ce3eff08f8 100644 --- a/server/v2/cometbft/abci.go +++ b/server/v2/cometbft/abci.go @@ -153,10 +153,15 @@ func (c *Consensus[T]) Info(ctx context.Context, _ *abciproto.InfoRequest) (*abc return nil, err } - // cp, err := c.GetConsensusParams(ctx) - // if err != nil { - // return nil, err - // } + // if height is 0, we dont know the consensus params + var appVersion uint64 = 0 + if version > 0 { + cp, err := c.GetConsensusParams(ctx) + if err != nil { + return nil, err + } + appVersion = cp.Version.GetApp() + } cid, err := c.store.LastCommitID() if err != nil { @@ -166,7 +171,7 @@ func (c *Consensus[T]) Info(ctx context.Context, _ *abciproto.InfoRequest) (*abc return &abciproto.InfoResponse{ Data: c.appName, Version: c.version, - AppVersion: 0, // TODO fetch consensus params? + AppVersion: appVersion, LastBlockHeight: int64(version), LastBlockAppHash: cid.Hash, }, nil diff --git a/server/v2/cometbft/utils.go b/server/v2/cometbft/utils.go index 594e046ad173..f76a2c0d484b 100644 --- a/server/v2/cometbft/utils.go +++ b/server/v2/cometbft/utils.go @@ -303,6 +303,7 @@ func (c *Consensus[T]) GetConsensusParams(ctx context.Context) (*cmtproto.Consen } if r, ok := res.(*consensus.QueryParamsResponse); !ok { + fmt.Println("err2") return nil, errors.New("failed to query consensus params") } else { // convert our params to cometbft params diff --git a/simapp/v2/app_config.go b/simapp/v2/app_config.go index c3e5e0492935..ab54100a3f09 100644 --- a/simapp/v2/app_config.go +++ b/simapp/v2/app_config.go @@ -139,6 +139,7 @@ var ( // properly initialized with tokens from genesis accounts. // NOTE: The genutils module must also occur after auth so that it can access the params from auth. InitGenesis: []string{ + consensustypes.ModuleName, accounts.ModuleName, authtypes.ModuleName, banktypes.ModuleName, diff --git a/x/consensus/keeper/keeper.go b/x/consensus/keeper/keeper.go index ee79e794f596..42359d742796 100644 --- a/x/consensus/keeper/keeper.go +++ b/x/consensus/keeper/keeper.go @@ -59,6 +59,8 @@ func (k *Keeper) InitGenesis(ctx context.Context) error { return err } + fmt.Println(nextParams, "nextParams") + return k.ParamsStore.Set(ctx, nextParams.ToProto()) } From 7c850603aa6f435468100230d456c1e7778f3a5d Mon Sep 17 00:00:00 2001 From: marbar3778 Date: Mon, 12 Aug 2024 13:28:20 +0200 Subject: [PATCH 05/13] fully implement interface --- server/v2/appmanager/go.mod | 18 +++++++++++++++--- server/v2/appmanager/go.sum | 4 ++-- server/v2/go.mod | 16 ++++++++++------ server/v2/go.sum | 29 ++++++++++++++++++----------- x/consensus/keeper/keeper.go | 3 +-- x/consensus/module.go | 17 ++++++++++++++++- 6 files changed, 62 insertions(+), 25 deletions(-) diff --git a/server/v2/appmanager/go.mod b/server/v2/appmanager/go.mod index a27239eca333..1b331c54447a 100644 --- a/server/v2/appmanager/go.mod +++ b/server/v2/appmanager/go.mod @@ -1,14 +1,26 @@ module cosmossdk.io/server/v2/appmanager -go 1.21 +go 1.22.2 replace cosmossdk.io/core => ../../../core -require cosmossdk.io/core v0.12.0 +replace cosmossdk.io/api => ../../../api + +replace cosmossdk.io/x/consensus => ../../../x/consensus + +replace cosmossdk.io/x/auth => ../../../x/auth + +replace cosmossdk.io/x/bank => ../../../x/bank + +replace cosmossdk.io/x/staking => ../../../x/staking + +replace github.com/cosmos/cosmos-sdk => ../../../. + +require cosmossdk.io/core v0.12.1-0.20231114100755-569e3ff6a0d7 require ( github.com/cosmos/gogoproto v1.6.0 // indirect github.com/google/go-cmp v0.6.0 // indirect - golang.org/x/exp v0.0.0-20240314144324-c7f7c6466f7f // indirect + golang.org/x/exp v0.0.0-20240531132922-fd00a4e0eefc // indirect google.golang.org/protobuf v1.34.2 // indirect ) diff --git a/server/v2/appmanager/go.sum b/server/v2/appmanager/go.sum index 7efdd5257f76..48dfc1aefbb9 100644 --- a/server/v2/appmanager/go.sum +++ b/server/v2/appmanager/go.sum @@ -4,7 +4,7 @@ github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -golang.org/x/exp v0.0.0-20240314144324-c7f7c6466f7f h1:3CW0unweImhOzd5FmYuRsD4Y4oQFKZIjAnKbjV4WIrw= -golang.org/x/exp v0.0.0-20240314144324-c7f7c6466f7f/go.mod h1:CxmFvTBINI24O/j8iY7H1xHzx2i4OsyguNBmN/uPtqc= +golang.org/x/exp v0.0.0-20240531132922-fd00a4e0eefc h1:O9NuF4s+E/PvMIy+9IUZB9znFwUIXEWSstNjek6VpVg= +golang.org/x/exp v0.0.0-20240531132922-fd00a4e0eefc/go.mod h1:XtvwrStGgqGPLc4cjQfWqZHG1YFdYs6swckp8vpsjnc= google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= diff --git a/server/v2/go.mod b/server/v2/go.mod index 93376d3c4297..2c68f3af3418 100644 --- a/server/v2/go.mod +++ b/server/v2/go.mod @@ -1,6 +1,6 @@ module cosmossdk.io/server/v2 -go 1.21 +go 1.22.2 replace ( cosmossdk.io/api => ../../api @@ -26,9 +26,9 @@ require ( github.com/golang/protobuf v1.5.4 github.com/gorilla/mux v1.8.1 github.com/grpc-ecosystem/grpc-gateway v1.16.0 - github.com/hashicorp/go-hclog v1.6.2 + github.com/hashicorp/go-hclog v1.6.3 github.com/hashicorp/go-metrics v0.5.3 - github.com/hashicorp/go-plugin v1.6.0 + github.com/hashicorp/go-plugin v1.6.1 github.com/mitchellh/mapstructure v1.5.0 github.com/pelletier/go-toml/v2 v2.2.2 github.com/prometheus/client_golang v1.19.1 @@ -46,8 +46,9 @@ require ( require ( cosmossdk.io/errors/v2 v2.0.0-20240731132947-df72853b3ca5 // indirect - github.com/DataDog/datadog-go v3.2.0+incompatible // indirect + github.com/DataDog/datadog-go v4.8.3+incompatible // indirect github.com/DataDog/zstd v1.5.5 // indirect + github.com/Microsoft/go-winio v0.6.1 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect github.com/cockroachdb/errors v1.11.1 // indirect @@ -60,7 +61,7 @@ require ( github.com/cosmos/ics23/go v0.10.0 // indirect github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/emicklei/dot v1.6.2 // indirect - github.com/fatih/color v1.15.0 // indirect + github.com/fatih/color v1.17.0 // indirect github.com/fsnotify/fsnotify v1.7.0 // indirect github.com/getsentry/sentry-go v0.27.0 // indirect github.com/gogo/googleapis v1.4.1 // indirect @@ -74,7 +75,7 @@ require ( github.com/hashicorp/yamux v0.1.1 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/jhump/protoreflect v1.15.3 // indirect - github.com/klauspost/compress v1.17.7 // indirect + github.com/klauspost/compress v1.17.8 // indirect github.com/kr/pretty v0.3.1 // indirect github.com/kr/text v0.2.0 // indirect github.com/linxGnu/grocksdb v1.8.14 // indirect @@ -85,6 +86,7 @@ require ( github.com/mitchellh/go-testing-interface v1.14.1 // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/oklog/run v1.1.0 // indirect + github.com/onsi/gomega v1.28.1 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/prometheus/client_model v0.6.1 // indirect @@ -100,9 +102,11 @@ require ( github.com/tidwall/btree v1.7.0 // indirect go.uber.org/multierr v1.11.0 // indirect golang.org/x/crypto v0.26.0 // indirect + golang.org/x/mod v0.17.0 // indirect golang.org/x/net v0.28.0 // indirect golang.org/x/sys v0.24.0 // indirect golang.org/x/text v0.17.0 // indirect + golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de // indirect google.golang.org/genproto/googleapis/api v0.0.0-20240528184218-531527333157 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240808171019-573a1156607a // indirect diff --git a/server/v2/go.sum b/server/v2/go.sum index 5904ce7de94c..929b5b5cff5d 100644 --- a/server/v2/go.sum +++ b/server/v2/go.sum @@ -5,10 +5,13 @@ cosmossdk.io/errors/v2 v2.0.0-20240731132947-df72853b3ca5/go.mod h1:0CuYKkFHxc1v cosmossdk.io/log v1.4.0 h1:Ttt9d6fQ0GlktwhcysOeNiIjixW7l0rYBocmoXOb11k= cosmossdk.io/log v1.4.0/go.mod h1:k08v0Pyq+gCP6phvdI6RCGhLf/r425UT6Rk/m+o74rU= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/DataDog/datadog-go v3.2.0+incompatible h1:qSG2N4FghB1He/r2mFrWKCaL7dXCilEuNEeAn20fdD4= github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= +github.com/DataDog/datadog-go v4.8.3+incompatible h1:fNGaYSuObuQb5nzeTQqowRAd9bpDIRRV4/gUtIBjh8Q= +github.com/DataDog/datadog-go v4.8.3+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= github.com/DataDog/zstd v1.5.5 h1:oWf5W7GtOLgp6bciQYDmhHHjdhYkALu6S/5Ni9ZgSvQ= github.com/DataDog/zstd v1.5.5/go.mod h1:g4AWEaM3yOg3HYfnJ3YIawPnVdXJh9QME85blwSAmyw= +github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migciow= +github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= @@ -79,8 +82,8 @@ github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go. github.com/envoyproxy/go-control-plane v0.10.2-0.20220325020618-49ff273808a1/go.mod h1:KJwIaB5Mv44NWtYuAOFCVOjcI94vtpEz2JU/D2v6IjE= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk= -github.com/fatih/color v1.15.0 h1:kOqh6YHBtK8aywxGerMG2Eq3H6Qgoqeo13Bk2Mv/nBs= -github.com/fatih/color v1.15.0/go.mod h1:0h5ZqXfHYED7Bhv2ZJamyIOUej9KtShiJESRwBDUSsw= +github.com/fatih/color v1.17.0 h1:GlRw1BRJxkpqUCBKzKOw098ed57fEsKeNjpTe3cSjK4= +github.com/fatih/color v1.17.0/go.mod h1:YZ7TlrGPkiz6ku9fK3TLD/pl3CpsiFyu8N92HLgmosI= github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8= github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= @@ -148,15 +151,15 @@ github.com/gorilla/mux v1.8.1/go.mod h1:AKf9I4AEqPTmMytcMc0KkNouC66V3BtZ4qD5fmWS github.com/grpc-ecosystem/grpc-gateway v1.16.0 h1:gmcG1KaJ57LophUzW0Hy8NmPhnMZb4M0+kPpLofRdBo= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= -github.com/hashicorp/go-hclog v1.6.2 h1:NOtoftovWkDheyUM/8JW3QMiXyxJK3uHRK7wV04nD2I= -github.com/hashicorp/go-hclog v1.6.2/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M= +github.com/hashicorp/go-hclog v1.6.3 h1:Qr2kF+eVWjTiYmU7Y31tYlP1h0q/X3Nl3tPGdaB11/k= +github.com/hashicorp/go-hclog v1.6.3/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M= github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= github.com/hashicorp/go-immutable-radix v1.3.1 h1:DKHmCUm2hRBK510BaiZlwvpD40f8bJFeZnpfm2KLowc= github.com/hashicorp/go-immutable-radix v1.3.1/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= github.com/hashicorp/go-metrics v0.5.3 h1:M5uADWMOGCTUNU1YuC4hfknOeHNaX54LDm4oYSucoNE= github.com/hashicorp/go-metrics v0.5.3/go.mod h1:KEjodfebIOuBYSAe/bHTm+HChmKSxAOXPBieMLYozDE= -github.com/hashicorp/go-plugin v1.6.0 h1:wgd4KxHJTVGGqWBq4QPB1i5BZNEx9BR8+OFmHDmTk8A= -github.com/hashicorp/go-plugin v1.6.0/go.mod h1:lBS5MtSSBZk0SHc66KACcjjlU6WzEVP/8pwz68aMkCI= +github.com/hashicorp/go-plugin v1.6.1 h1:P7MR2UP6gNKGPp+y7EZw2kOiq4IR9WiqLvp0XOsVdwI= +github.com/hashicorp/go-plugin v1.6.1/go.mod h1:XPHFku2tFo3o3QKFgSYo+cghcUhw1NA1hZyMK0PWAw0= github.com/hashicorp/go-retryablehttp v0.5.3/go.mod h1:9B5zBasrRhHXnJnui7y6sL7es7NDiJgTc6Er0maI1Xs= github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= github.com/hashicorp/go-uuid v1.0.1 h1:fv1ep09latC32wFoVwnqcnKJGnMSdBanPczbHAYm1BE= @@ -180,8 +183,8 @@ github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7V github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/klauspost/compress v1.17.7 h1:ehO88t2UGzQK66LMdE8tibEd1ErmzZjNEqWkjLAKQQg= -github.com/klauspost/compress v1.17.7/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= +github.com/klauspost/compress v1.17.8 h1:YcnTYrq7MikUT7k0Yb5eceMmALQPYBW/Xltxn0NAMnU= +github.com/klauspost/compress v1.17.8/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= @@ -234,8 +237,8 @@ github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7J github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= github.com/onsi/gomega v1.17.0/go.mod h1:HnhC7FXeEQY45zxNK3PPoIUhzk/80Xly9PcubAlGdZY= github.com/onsi/gomega v1.19.0/go.mod h1:LY+I3pBVzYsTBU1AnDwOSxaYi9WoWiqgwooUqq9yPro= -github.com/onsi/gomega v1.26.0 h1:03cDLK28U6hWvCAns6NeydX3zIm4SF3ci69ulidS32Q= -github.com/onsi/gomega v1.26.0/go.mod h1:r+zV744Re+DiYCIPRlYOTxn0YkOLcAnW8k1xXdMPGhM= +github.com/onsi/gomega v1.28.1 h1:MijcGUbfYuznzK/5R4CPNoUP/9Xvuo20sXfEm6XxoTA= +github.com/onsi/gomega v1.28.1/go.mod h1:9sxs+SwGrKI0+PWe4Fxa9tFQQBG5xSsSbMXOI8PPpoQ= github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0MwY= github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= github.com/pelletier/go-toml/v2 v2.2.2 h1:aYUidT7k73Pcl9nb2gScu7NSrKCSHIDE89b3+6Wq+LM= @@ -341,6 +344,8 @@ golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvx golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.17.0 h1:zY54UmvipHiNd+pm+m0x9KhZ9hl1/7QNMyxXbc6ICqA= +golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -425,6 +430,8 @@ golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtn golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d h1:vU5i/LfpvrRCpgM/VPfJLg5KjxD3E+hfT1SH+d9zLwg= +golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/x/consensus/keeper/keeper.go b/x/consensus/keeper/keeper.go index 42359d742796..08b2172409b5 100644 --- a/x/consensus/keeper/keeper.go +++ b/x/consensus/keeper/keeper.go @@ -44,6 +44,7 @@ func (k *Keeper) GetAuthority() string { // InitGenesis initializes the initial state of the module func (k *Keeper) InitGenesis(ctx context.Context) error { + fmt.Println("InitGenesis consensus") value := ctx.Value(corecontext.InitInfoKey).(*types.MsgUpdateParams) if value == nil { return nil @@ -59,8 +60,6 @@ func (k *Keeper) InitGenesis(ctx context.Context) error { return err } - fmt.Println(nextParams, "nextParams") - return k.ParamsStore.Set(ctx, nextParams.ToProto()) } diff --git a/x/consensus/module.go b/x/consensus/module.go index d19d72ede5e1..72c04496addc 100644 --- a/x/consensus/module.go +++ b/x/consensus/module.go @@ -26,6 +26,7 @@ var ( _ module.HasGRPCGateway = AppModule{} _ appmodule.AppModule = AppModule{} + _ appmodule.HasGenesis = AppModule{} _ appmodule.HasRegisterInterfaces = AppModule{} ) @@ -45,10 +46,24 @@ func NewAppModule(cdc codec.Codec, keeper keeper.Keeper) AppModule { // InitGenesis performs genesis initialization for the bank module. func (am AppModule) InitGenesis(ctx context.Context, data json.RawMessage) error { - return am.keeper.InitGenesis(ctx) } +// DefaultGenesis returns the default genesis state. (Noop) +func (am AppModule) DefaultGenesis() json.RawMessage { + return nil +} + +// ValidateGenesis validates the genesis state. (Noop) +func (am AppModule) ValidateGenesis(data json.RawMessage) error { + return nil +} + +// ExportGenesis returns the exported genesis state. (Noop) +func (am AppModule) ExportGenesis(ctx context.Context) (json.RawMessage, error) { + return nil, nil +} + // IsAppModule implements the appmodule.AppModule interface. func (AppModule) IsAppModule() {} From 293fc32a020da709d85d973f5f27fe483969bc72 Mon Sep 17 00:00:00 2001 From: marbar3778 Date: Mon, 12 Aug 2024 13:29:45 +0200 Subject: [PATCH 06/13] remove replaces --- server/v2/appmanager/go.mod | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/server/v2/appmanager/go.mod b/server/v2/appmanager/go.mod index 1b331c54447a..dc6f88fbe50a 100644 --- a/server/v2/appmanager/go.mod +++ b/server/v2/appmanager/go.mod @@ -4,18 +4,6 @@ go 1.22.2 replace cosmossdk.io/core => ../../../core -replace cosmossdk.io/api => ../../../api - -replace cosmossdk.io/x/consensus => ../../../x/consensus - -replace cosmossdk.io/x/auth => ../../../x/auth - -replace cosmossdk.io/x/bank => ../../../x/bank - -replace cosmossdk.io/x/staking => ../../../x/staking - -replace github.com/cosmos/cosmos-sdk => ../../../. - require cosmossdk.io/core v0.12.1-0.20231114100755-569e3ff6a0d7 require ( From f2fa48cc832a1c110ce3e8edd943fe77a089dfe2 Mon Sep 17 00:00:00 2001 From: marbar3778 Date: Mon, 12 Aug 2024 13:46:24 +0200 Subject: [PATCH 07/13] set consensus --- simapp/app.go | 26 +++++++++++++++++++++----- simapp/app_config.go | 1 + x/consensus/keeper/keeper.go | 1 - 3 files changed, 22 insertions(+), 6 deletions(-) diff --git a/simapp/app.go b/simapp/app.go index 6c2424e29c60..a03a9e69f518 100644 --- a/simapp/app.go +++ b/simapp/app.go @@ -51,6 +51,7 @@ import ( "cosmossdk.io/x/consensus" consensusparamkeeper "cosmossdk.io/x/consensus/keeper" consensusparamtypes "cosmossdk.io/x/consensus/types" + consensustypes "cosmossdk.io/x/consensus/types" distr "cosmossdk.io/x/distribution" distrkeeper "cosmossdk.io/x/distribution/keeper" distrtypes "cosmossdk.io/x/distribution/types" @@ -501,11 +502,26 @@ func NewSimApp( // properly initialized with tokens from genesis accounts. // NOTE: The genutils module must also occur after auth so that it can access the params from auth. genesisModuleOrder := []string{ - accounts.ModuleName, authtypes.ModuleName, banktypes.ModuleName, - distrtypes.ModuleName, stakingtypes.ModuleName, slashingtypes.ModuleName, govtypes.ModuleName, - minttypes.ModuleName, genutiltypes.ModuleName, evidencetypes.ModuleName, authz.ModuleName, - feegrant.ModuleName, nft.ModuleName, group.ModuleName, upgradetypes.ModuleName, - vestingtypes.ModuleName, consensusparamtypes.ModuleName, circuittypes.ModuleName, pooltypes.ModuleName, + consensustypes.ModuleName, + accounts.ModuleName, + authtypes.ModuleName, + banktypes.ModuleName, + distrtypes.ModuleName, + stakingtypes.ModuleName, + slashingtypes.ModuleName, + govtypes.ModuleName, + minttypes.ModuleName, + genutiltypes.ModuleName, + evidencetypes.ModuleName, + authz.ModuleName, + feegrant.ModuleName, + nft.ModuleName, + group.ModuleName, + upgradetypes.ModuleName, + vestingtypes.ModuleName, + consensusparamtypes.ModuleName, + circuittypes.ModuleName, + pooltypes.ModuleName, epochstypes.ModuleName, } app.ModuleManager.SetOrderInitGenesis(genesisModuleOrder...) diff --git a/simapp/app_config.go b/simapp/app_config.go index e92ac2ce03fe..8918475184e1 100644 --- a/simapp/app_config.go +++ b/simapp/app_config.go @@ -149,6 +149,7 @@ var ( // properly initialized with tokens from genesis accounts. // NOTE: The genutils module must also occur after auth so that it can access the params from auth. InitGenesis: []string{ + consensustypes.ModuleName, accounts.ModuleName, authtypes.ModuleName, banktypes.ModuleName, diff --git a/x/consensus/keeper/keeper.go b/x/consensus/keeper/keeper.go index 08b2172409b5..ee79e794f596 100644 --- a/x/consensus/keeper/keeper.go +++ b/x/consensus/keeper/keeper.go @@ -44,7 +44,6 @@ func (k *Keeper) GetAuthority() string { // InitGenesis initializes the initial state of the module func (k *Keeper) InitGenesis(ctx context.Context) error { - fmt.Println("InitGenesis consensus") value := ctx.Value(corecontext.InitInfoKey).(*types.MsgUpdateParams) if value == nil { return nil From f2a4ed15fd6c97ee597f6fb55f25097c0f2d9181 Mon Sep 17 00:00:00 2001 From: marbar3778 Date: Mon, 12 Aug 2024 13:46:45 +0200 Subject: [PATCH 08/13] comment --- x/consensus/keeper/keeper.go | 1 + 1 file changed, 1 insertion(+) diff --git a/x/consensus/keeper/keeper.go b/x/consensus/keeper/keeper.go index ee79e794f596..e36cb4e2ac12 100644 --- a/x/consensus/keeper/keeper.go +++ b/x/consensus/keeper/keeper.go @@ -46,6 +46,7 @@ func (k *Keeper) GetAuthority() string { func (k *Keeper) InitGenesis(ctx context.Context) error { value := ctx.Value(corecontext.InitInfoKey).(*types.MsgUpdateParams) if value == nil { + // no error for appv1 return nil } From cd4a3244624d26532410f649a264f581b6176856 Mon Sep 17 00:00:00 2001 From: marbar3778 Date: Mon, 12 Aug 2024 13:52:36 +0200 Subject: [PATCH 09/13] comments --- server/v2/appmanager/go.mod | 2 +- server/v2/cometbft/utils.go | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/server/v2/appmanager/go.mod b/server/v2/appmanager/go.mod index dc6f88fbe50a..5c0c367db208 100644 --- a/server/v2/appmanager/go.mod +++ b/server/v2/appmanager/go.mod @@ -1,6 +1,6 @@ module cosmossdk.io/server/v2/appmanager -go 1.22.2 +go 1.21 replace cosmossdk.io/core => ../../../core diff --git a/server/v2/cometbft/utils.go b/server/v2/cometbft/utils.go index f76a2c0d484b..594e046ad173 100644 --- a/server/v2/cometbft/utils.go +++ b/server/v2/cometbft/utils.go @@ -303,7 +303,6 @@ func (c *Consensus[T]) GetConsensusParams(ctx context.Context) (*cmtproto.Consen } if r, ok := res.(*consensus.QueryParamsResponse); !ok { - fmt.Println("err2") return nil, errors.New("failed to query consensus params") } else { // convert our params to cometbft params From 62ddfe0576fb33051a01854e324c0d4aab15811f Mon Sep 17 00:00:00 2001 From: marbar3778 Date: Mon, 12 Aug 2024 13:53:09 +0200 Subject: [PATCH 10/13] remove unused --- x/consensus/proto/cosmos/consensus/v1/tx.proto | 1 - 1 file changed, 1 deletion(-) diff --git a/x/consensus/proto/cosmos/consensus/v1/tx.proto b/x/consensus/proto/cosmos/consensus/v1/tx.proto index afecf31d97b8..d0cdde493a9c 100644 --- a/x/consensus/proto/cosmos/consensus/v1/tx.proto +++ b/x/consensus/proto/cosmos/consensus/v1/tx.proto @@ -6,7 +6,6 @@ import "amino/amino.proto"; import "cosmos_proto/cosmos.proto"; import "cosmos/msg/v1/msg.proto"; import "cometbft/types/v1/params.proto"; -import "cometbft/abci/v1/types.proto"; option go_package = "cosmossdk.io/x/consensus/types"; From 208c8250eb35fb5edc4439185597ce637b362b82 Mon Sep 17 00:00:00 2001 From: marbar3778 Date: Mon, 12 Aug 2024 13:59:06 +0200 Subject: [PATCH 11/13] revert change --- server/v2/go.mod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/v2/go.mod b/server/v2/go.mod index 2c68f3af3418..abc18ad3aabd 100644 --- a/server/v2/go.mod +++ b/server/v2/go.mod @@ -1,6 +1,6 @@ module cosmossdk.io/server/v2 -go 1.22.2 +go 1.21 replace ( cosmossdk.io/api => ../../api From f304637a0cb3ed8dea9254ca6330383483371683 Mon Sep 17 00:00:00 2001 From: marbar3778 Date: Mon, 12 Aug 2024 15:34:10 +0200 Subject: [PATCH 12/13] check if interface is available --- x/consensus/keeper/keeper.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/x/consensus/keeper/keeper.go b/x/consensus/keeper/keeper.go index e36cb4e2ac12..548bf61d9337 100644 --- a/x/consensus/keeper/keeper.go +++ b/x/consensus/keeper/keeper.go @@ -44,7 +44,11 @@ func (k *Keeper) GetAuthority() string { // InitGenesis initializes the initial state of the module func (k *Keeper) InitGenesis(ctx context.Context) error { - value := ctx.Value(corecontext.InitInfoKey).(*types.MsgUpdateParams) + value, ok := ctx.Value(corecontext.InitInfoKey).(*types.MsgUpdateParams) + if !ok { + // no error for appv1 and appv2 + return nil + } if value == nil { // no error for appv1 return nil From 82ef194d8f716f25f805aaabf5b9e5f9681d8575 Mon Sep 17 00:00:00 2001 From: marbar3778 Date: Mon, 12 Aug 2024 16:03:38 +0200 Subject: [PATCH 13/13] account for nil and non 0 version --- server/v2/cometbft/abci.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/server/v2/cometbft/abci.go b/server/v2/cometbft/abci.go index 3d67d166b259..b7a300b05f5e 100644 --- a/server/v2/cometbft/abci.go +++ b/server/v2/cometbft/abci.go @@ -157,10 +157,18 @@ func (c *Consensus[T]) Info(ctx context.Context, _ *abciproto.InfoRequest) (*abc var appVersion uint64 = 0 if version > 0 { cp, err := c.GetConsensusParams(ctx) + // if the consensus params are not found, we set the app version to 0 + // in the case that the start version is > 0 + if cp == nil || errors.Is(err, errors.New("collections: not found")) { + appVersion = 0 + } else if err != nil { + return nil, err + } else { + appVersion = cp.Version.GetApp() + } if err != nil { return nil, err } - appVersion = cp.Version.GetApp() } cid, err := c.store.LastCommitID()