From 01019e43f7ba4a63d8b3bd1a5c304fd795a8fcb9 Mon Sep 17 00:00:00 2001 From: Sai Kumar Date: Thu, 4 Jul 2024 13:32:16 +0530 Subject: [PATCH] fix: fix the e2e tests setup --- app/app.go | 7 +++---- app/encoding.go | 10 +++++----- tests/e2e/setup/setup.go | 6 ++++-- tests/e2e/setup/validator.go | 1 + 4 files changed, 13 insertions(+), 11 deletions(-) diff --git a/app/app.go b/app/app.go index ba1a5bf89f..af4c4a5fae 100644 --- a/app/app.go +++ b/app/app.go @@ -296,8 +296,7 @@ type UmeeApp struct { ScopedWasmKeeper capabilitykeeper.ScopedKeeper // the module manager - mm *module.Manager - bmm module.BasicManager + mm *module.Manager // simulation manager sm *module.SimulationManager @@ -1074,7 +1073,7 @@ func (app *UmeeApp) InterfaceRegistry() types.InterfaceRegistry { // DefaultGenesis returns a default genesis from the registered AppModuleBasic's. func (app *UmeeApp) DefaultGenesis() map[string]json.RawMessage { - return app.bmm.DefaultGenesis(app.appCodec) + return ModuleBasics.DefaultGenesis(app.appCodec) } // GetKey returns the KVStoreKey for the provided store key. @@ -1125,7 +1124,7 @@ func (app *UmeeApp) RegisterAPIRoutes(apiSvr *api.Server, apiConfig config.APICo nodeservice.RegisterGRPCGatewayRoutes(clientCtx, apiSvr.GRPCGatewayRouter) // Register grpc-gateway routes for all modules. - app.bmm.RegisterGRPCGatewayRoutes(clientCtx, apiSvr.GRPCGatewayRouter) + ModuleBasics.RegisterGRPCGatewayRoutes(clientCtx, apiSvr.GRPCGatewayRouter) // register swagger API from root so that other applications can override easily if apiConfig.Swagger { diff --git a/app/encoding.go b/app/encoding.go index faa1f0e852..f6e4de2de9 100644 --- a/app/encoding.go +++ b/app/encoding.go @@ -16,21 +16,21 @@ func MakeEncodingConfig() mtestuti.TestEncodingConfig { interfaceRegistry := testutil.CodecOptions{ AccAddressPrefix: params.AccountAddressPrefix, ValAddressPrefix: params.ValidatorAddressPrefix, - }.NewInterfaceRegistry() + } - appCodec := codec.NewProtoCodec(interfaceRegistry) + appCodec := interfaceRegistry.NewCodec() aminoCodec := codec.NewLegacyAmino() // cosmos-sdk module std.RegisterLegacyAminoCodec(aminoCodec) - std.RegisterInterfaces(interfaceRegistry) + std.RegisterInterfaces(appCodec.InterfaceRegistry()) // umee app modules ModuleBasics.RegisterLegacyAminoCodec(aminoCodec) - ModuleBasics.RegisterInterfaces(interfaceRegistry) + ModuleBasics.RegisterInterfaces(appCodec.InterfaceRegistry()) encCfg := mtestuti.TestEncodingConfig{ - InterfaceRegistry: interfaceRegistry, + InterfaceRegistry: appCodec.InterfaceRegistry(), Codec: appCodec, TxConfig: tx.NewTxConfig(appCodec, tx.DefaultSignModes), Amino: aminoCodec, diff --git a/tests/e2e/setup/setup.go b/tests/e2e/setup/setup.go index 29b886527e..fd182e76de 100644 --- a/tests/e2e/setup/setup.go +++ b/tests/e2e/setup/setup.go @@ -10,6 +10,7 @@ import ( "strings" "time" + "cosmossdk.io/log" sdkmath "cosmossdk.io/math" tmconfig "github.com/cometbft/cometbft/config" tmjson "github.com/cometbft/cometbft/libs/json" @@ -79,7 +80,7 @@ func (s *E2ETestSuite) SetupSuite() { db := dbm.NewMemDB() app := app.New( - nil, + log.NewNopLogger(), db, nil, true, @@ -332,7 +333,8 @@ func (s *E2ETestSuite) initGenesis() { // write the updated genesis file to each validator s.T().Log("writing updated genesis file to each validator") for _, val := range s.Chain.Validators { - writeFile(filepath.Join(val.configDir(), "config", "genesis.json"), bz) + err = writeFile(filepath.Join(val.configDir(), "config", "genesis.json"), bz) + s.Require().NoError(err) } } diff --git a/tests/e2e/setup/validator.go b/tests/e2e/setup/validator.go index 5f19171c92..be9e814a33 100644 --- a/tests/e2e/setup/validator.go +++ b/tests/e2e/setup/validator.go @@ -247,6 +247,7 @@ func (v *validator) signMsg(cdc codec.Codec, msgs ...sdk.Msg) (*sdktx.Tx, error) if err != nil { return nil, err } + signerData.PubKey = pubKey sig := signing.SignatureV2{ PubKey: pubKey, Data: &signing.SingleSignatureData{