chore: set up release/v0.53.x branch (#23660)
Co-authored-by: Zygimantas <5236121+Zygimantass@users.noreply.github.com> Co-authored-by: Zygimantas <zygis@skip.build>
This commit is contained in:
co-authored by
Zygimantas
Zygimantas
parent
ec78863c60
commit
f5e8e517ab
@@ -32,12 +32,13 @@ import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"maps"
|
||||
"slices"
|
||||
"sort"
|
||||
|
||||
abci "github.com/cometbft/cometbft/abci/types"
|
||||
"github.com/grpc-ecosystem/grpc-gateway/runtime"
|
||||
"github.com/spf13/cobra"
|
||||
"golang.org/x/exp/maps"
|
||||
|
||||
"cosmossdk.io/core/appmodule"
|
||||
"cosmossdk.io/core/genesis"
|
||||
@@ -205,6 +206,8 @@ type AppModule interface {
|
||||
}
|
||||
|
||||
// HasInvariants is the interface for registering invariants.
|
||||
//
|
||||
// Deprecated: this will be removed in the next Cosmos SDK release.
|
||||
type HasInvariants interface {
|
||||
// RegisterInvariants registers module invariants.
|
||||
RegisterInvariants(sdk.InvariantRegistry)
|
||||
@@ -445,13 +448,9 @@ func (m *Manager) SetOrderMigrations(moduleNames ...string) {
|
||||
}
|
||||
|
||||
// RegisterInvariants registers all module invariants
|
||||
func (m *Manager) RegisterInvariants(ir sdk.InvariantRegistry) {
|
||||
for _, module := range m.Modules {
|
||||
if module, ok := module.(HasInvariants); ok {
|
||||
module.RegisterInvariants(ir)
|
||||
}
|
||||
}
|
||||
}
|
||||
//
|
||||
// Deprecated: this function is a no-op and will be removed in the next release of the Cosmos SDK.
|
||||
func (m *Manager) RegisterInvariants(_ sdk.InvariantRegistry) {}
|
||||
|
||||
// RegisterServices registers all module services
|
||||
func (m *Manager) RegisterServices(cfg Configurator) error {
|
||||
@@ -871,7 +870,7 @@ func (m *Manager) GetVersionMap() VersionMap {
|
||||
|
||||
// ModuleNames returns list of all module names, without any particular order.
|
||||
func (m *Manager) ModuleNames() []string {
|
||||
return maps.Keys(m.Modules)
|
||||
return slices.Collect(maps.Keys(m.Modules))
|
||||
}
|
||||
|
||||
// DefaultMigrationsOrder returns a default migrations order: ascending alphabetical by module name,
|
||||
|
||||
@@ -9,9 +9,9 @@ import (
|
||||
|
||||
abci "github.com/cometbft/cometbft/abci/types"
|
||||
cmtproto "github.com/cometbft/cometbft/proto/tendermint/types"
|
||||
"github.com/golang/mock/gomock"
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/stretchr/testify/require"
|
||||
"go.uber.org/mock/gomock"
|
||||
"google.golang.org/grpc"
|
||||
|
||||
"cosmossdk.io/core/appmodule"
|
||||
@@ -165,27 +165,6 @@ func TestManagerOrderSetters(t *testing.T) {
|
||||
require.Equal(t, []string{"module3", "module2", "module1"}, mm.OrderPrecommiters)
|
||||
}
|
||||
|
||||
func TestManager_RegisterInvariants(t *testing.T) {
|
||||
mockCtrl := gomock.NewController(t)
|
||||
t.Cleanup(mockCtrl.Finish)
|
||||
|
||||
mockAppModule1 := mock.NewMockAppModuleWithAllExtensions(mockCtrl)
|
||||
mockAppModule2 := mock.NewMockAppModuleWithAllExtensions(mockCtrl)
|
||||
mockAppModule3 := mock.NewMockCoreAppModule(mockCtrl)
|
||||
mockAppModule1.EXPECT().Name().Times(2).Return("module1")
|
||||
mockAppModule2.EXPECT().Name().Times(2).Return("module2")
|
||||
// TODO: This is not working for Core API modules yet
|
||||
mm := module.NewManager(mockAppModule1, mockAppModule2, module.CoreAppModuleBasicAdaptor("mockAppModule3", mockAppModule3))
|
||||
require.NotNil(t, mm)
|
||||
require.Equal(t, 3, len(mm.Modules))
|
||||
|
||||
// test RegisterInvariants
|
||||
mockInvariantRegistry := mock.NewMockInvariantRegistry(mockCtrl)
|
||||
mockAppModule1.EXPECT().RegisterInvariants(gomock.Eq(mockInvariantRegistry)).Times(1)
|
||||
mockAppModule2.EXPECT().RegisterInvariants(gomock.Eq(mockInvariantRegistry)).Times(1)
|
||||
mm.RegisterInvariants(mockInvariantRegistry)
|
||||
}
|
||||
|
||||
func TestManager_RegisterQueryServices(t *testing.T) {
|
||||
mockCtrl := gomock.NewController(t)
|
||||
t.Cleanup(mockCtrl.Finish)
|
||||
|
||||
Reference in New Issue
Block a user