refactor: migrate to query Consensus Params (#19600)
Co-authored-by: Julien Robert <julien@rbrt.fr> Co-authored-by: Facundo <facundomedica@gmail.com> Co-authored-by: Facundo Medica <14063057+facundomedica@users.noreply.github.com> Co-authored-by: Matt Kocubinski <mkocubinski@gmail.com> Co-authored-by: Hieu Vu <72878483+hieuvubk@users.noreply.github.com>
This commit is contained in:
co-authored by
Julien Robert
Facundo
Facundo Medica
Matt Kocubinski
Hieu Vu
parent
c6890b3876
commit
b15732a594
@@ -50,6 +50,8 @@ func NewIntegrationApp(
|
||||
addressCodec address.Codec,
|
||||
validatorCodec address.Codec,
|
||||
modules map[string]appmodule.AppModule,
|
||||
msgRouter *baseapp.MsgServiceRouter,
|
||||
grpcRouter *baseapp.GRPCQueryRouter,
|
||||
) *App {
|
||||
db := dbm.NewMemDB()
|
||||
|
||||
@@ -80,14 +82,27 @@ func NewIntegrationApp(
|
||||
return moduleManager.EndBlock(sdkCtx)
|
||||
})
|
||||
|
||||
msgRouter := baseapp.NewMsgServiceRouter()
|
||||
msgRouter.SetInterfaceRegistry(interfaceRegistry)
|
||||
bApp.SetMsgServiceRouter(msgRouter)
|
||||
grpcRouter.SetInterfaceRegistry(interfaceRegistry)
|
||||
bApp.SetGRPCQueryRouter(grpcRouter)
|
||||
|
||||
if keys[consensusparamtypes.StoreKey] != nil {
|
||||
// set baseApp param store
|
||||
consensusParamsKeeper := consensusparamkeeper.NewKeeper(appCodec, runtime.NewEnvironment(runtime.NewKVStoreService(keys[consensusparamtypes.StoreKey]), log.NewNopLogger(), runtime.EnvWithRouterService(baseapp.NewGRPCQueryRouter(), msgRouter)), authtypes.NewModuleAddress("gov").String())
|
||||
consensusParamsKeeper := consensusparamkeeper.NewKeeper(appCodec, runtime.NewEnvironment(runtime.NewKVStoreService(keys[consensusparamtypes.StoreKey]), log.NewNopLogger(), runtime.EnvWithRouterService(grpcRouter, msgRouter)), authtypes.NewModuleAddress("gov").String())
|
||||
bApp.SetParamStore(consensusParamsKeeper.ParamsStore)
|
||||
consensusparamtypes.RegisterQueryServer(grpcRouter, consensusParamsKeeper)
|
||||
|
||||
_, err := consensusParamsKeeper.SetParams(sdkCtx, &consensusparamtypes.ConsensusMsgParams{
|
||||
Version: simtestutil.DefaultConsensusParams.Version,
|
||||
Block: simtestutil.DefaultConsensusParams.Block,
|
||||
Evidence: simtestutil.DefaultConsensusParams.Evidence,
|
||||
Validator: simtestutil.DefaultConsensusParams.Validator,
|
||||
Abci: simtestutil.DefaultConsensusParams.Abci,
|
||||
})
|
||||
if err != nil {
|
||||
panic(fmt.Errorf("failed to set consensus params: %w", err))
|
||||
}
|
||||
|
||||
if err := bApp.LoadLatestVersion(); err != nil {
|
||||
panic(fmt.Errorf("failed to load application version from store: %w", err))
|
||||
|
||||
Reference in New Issue
Block a user