Refactor call to update genesis state
All checks were successful
Integration Tests / test-integration (pull_request) Successful in 1m24s
Unit Tests / test-unit (pull_request) Successful in 1m37s
E2E Tests / test-e2e (pull_request) Successful in 2m29s
SDK Tests / sdk_tests_nameservice_expiry (pull_request) Successful in 5m35s
SDK Tests / sdk_tests_authority_auctions (pull_request) Successful in 11m8s
SDK Tests / sdk_tests (pull_request) Successful in 15m2s

This commit is contained in:
Prathamesh Musale 2025-05-19 15:17:08 +05:30
parent 62fb99ad54
commit af0a8b596b
4 changed files with 18 additions and 22 deletions

View File

@ -15,7 +15,6 @@ import (
clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli"
sdk "github.com/cosmos/cosmos-sdk/types"
"git.vdb.to/cerc-io/laconicd/tests/e2e"
laconictestcli "git.vdb.to/cerc-io/laconicd/testutil/cli"
"git.vdb.to/cerc-io/laconicd/testutil/network"
types "git.vdb.to/cerc-io/laconicd/x/auction"
@ -48,9 +47,6 @@ func (ets *E2ETestSuite) SetupSuite() { //nolint: all
var err error
ets.cfg.GenesisState, err = e2e.UpdateStakingGenesisBondDenom(ets.cfg.GenesisState, ets.cfg.Codec)
sr.NoError(err)
ets.network, err = network.New(ets.T(), ets.T().TempDir(), ets.cfg)
sr.NoError(err)

View File

@ -13,7 +13,6 @@ import (
clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli"
sdk "github.com/cosmos/cosmos-sdk/types"
"git.vdb.to/cerc-io/laconicd/tests/e2e"
laconictestcli "git.vdb.to/cerc-io/laconicd/testutil/cli"
"git.vdb.to/cerc-io/laconicd/testutil/network"
bondtypes "git.vdb.to/cerc-io/laconicd/x/bond"
@ -40,9 +39,6 @@ func (ets *E2ETestSuite) SetupSuite() { //nolint: all
var err error
ets.cfg.GenesisState, err = e2e.UpdateStakingGenesisBondDenom(ets.cfg.GenesisState, ets.cfg.Codec)
sr.NoError(err)
ets.network, err = network.New(ets.T(), ets.T().TempDir(), ets.cfg)
sr.NoError(err)

View File

@ -58,21 +58,29 @@ func NewTestNetworkFixture() network.TestFixture {
return app
}
encodingConfig := testutil.MakeTestEncodingConfig(
auth.AppModuleBasic{},
bank.AppModuleBasic{},
staking.AppModuleBasic{},
auctionmodule.AppModule{},
bondmodule.AppModule{},
registrymodule.AppModule{},
)
genesisState := app.DefaultGenesis()
genesisState, err = updateStakingGenesisBondDenom(genesisState, encodingConfig.Codec)
if err != nil {
panic(fmt.Sprintf("failed to update genesis state: %v", err))
}
return network.TestFixture{
AppConstructor: appCtr,
GenesisState: app.DefaultGenesis(),
EncodingConfig: testutil.MakeTestEncodingConfig(
auth.AppModuleBasic{},
bank.AppModuleBasic{},
staking.AppModuleBasic{},
auctionmodule.AppModule{},
bondmodule.AppModule{},
registrymodule.AppModule{},
),
GenesisState: genesisState,
EncodingConfig: encodingConfig,
}
}
func UpdateStakingGenesisBondDenom(genesisState map[string]json.RawMessage, codec codec.Codec) (map[string]json.RawMessage, error) {
func updateStakingGenesisBondDenom(genesisState map[string]json.RawMessage, codec codec.Codec) (map[string]json.RawMessage, error) {
var stakingGenesis stakingtypes.GenesisState
if err := codec.UnmarshalJSON(genesisState[stakingtypes.ModuleName], &stakingGenesis); err != nil {
return nil, nil

View File

@ -15,7 +15,6 @@ import (
clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli"
sdk "github.com/cosmos/cosmos-sdk/types"
"git.vdb.to/cerc-io/laconicd/tests/e2e"
laconictestcli "git.vdb.to/cerc-io/laconicd/testutil/cli"
"git.vdb.to/cerc-io/laconicd/testutil/network"
bondtypes "git.vdb.to/cerc-io/laconicd/x/bond"
@ -57,9 +56,6 @@ func (ets *E2ETestSuite) SetupSuite() {
genesisState[registrytypes.ModuleName] = registryGenesisBz
ets.cfg.GenesisState = genesisState
ets.cfg.GenesisState, err = e2e.UpdateStakingGenesisBondDenom(ets.cfg.GenesisState, ets.cfg.Codec)
sr.NoError(err)
ets.network, err = network.New(ets.T(), ets.T().TempDir(), ets.cfg)
sr.NoError(err)