diff --git a/app/upgrade.go b/app/upgrade.go index eec456885..92cbbcbb9 100644 --- a/app/upgrade.go +++ b/app/upgrade.go @@ -11,6 +11,8 @@ import ( paymentmodule "github.com/bnb-chain/greenfield/x/payment" paymenttypes "github.com/bnb-chain/greenfield/x/payment/types" storagemoduletypes "github.com/bnb-chain/greenfield/x/storage/types" + virtualgroupmodule "github.com/bnb-chain/greenfield/x/virtualgroup" + virtualgrouptypes "github.com/bnb-chain/greenfield/x/virtualgroup/types" ) func (app *App) RegisterUpgradeHandlers(chainID string, serverCfg *serverconfig.Config) error { @@ -24,6 +26,8 @@ func (app *App) RegisterUpgradeHandlers(chainID string, serverCfg *serverconfig. app.registerNagquUpgradeHandler() app.registerPampasUpgradeHandler() app.registerManchurianUpgradeHandler() + app.registerHulunbeierUpgradeHandler() + // app.register...() // ... return nil @@ -124,7 +128,36 @@ func (app *App) registerManchurianUpgradeHandler() { app.UpgradeKeeper.SetUpgradeInitializer(upgradetypes.Manchurian, func() error { app.Logger().Info("Init Manchurian upgrade") + return nil + }) +} + +func (app *App) registerHulunbeierUpgradeHandler() { + // Register the upgrade handler + app.UpgradeKeeper.SetUpgradeHandler(upgradetypes.Hulunbeier, + func(ctx sdk.Context, plan upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) { + app.Logger().Info("upgrade to ", plan.Name) + + // enable SP exit + app.GashubKeeper.SetMsgGasParams(ctx, *gashubtypes.NewMsgGasParamsWithFixedGas(sdk.MsgTypeURL(&virtualgrouptypes.MsgReserveSwapIn{}), 1.2e3)) + app.GashubKeeper.SetMsgGasParams(ctx, *gashubtypes.NewMsgGasParamsWithFixedGas(sdk.MsgTypeURL(&virtualgrouptypes.MsgCancelSwapIn{}), 1.2e3)) + app.GashubKeeper.SetMsgGasParams(ctx, *gashubtypes.NewMsgGasParamsWithFixedGas(sdk.MsgTypeURL(&virtualgrouptypes.MsgCompleteSwapIn{}), 1.2e3)) + app.GashubKeeper.SetMsgGasParams(ctx, *gashubtypes.NewMsgGasParamsWithFixedGas(sdk.MsgTypeURL(&virtualgrouptypes.MsgStorageProviderForcedExit{}), 1.2e3)) + app.GashubKeeper.SetMsgGasParams(ctx, *gashubtypes.NewMsgGasParamsWithFixedGas(sdk.MsgTypeURL(&virtualgrouptypes.MsgStorageProviderExit{}), 1.2e3)) + app.GashubKeeper.SetMsgGasParams(ctx, *gashubtypes.NewMsgGasParamsWithFixedGas(sdk.MsgTypeURL(&virtualgrouptypes.MsgCompleteStorageProviderExit{}), 1.2e3)) + return app.mm.RunMigrations(ctx, app.configurator, fromVM) + }) + + // Register the upgrade initializer + app.UpgradeKeeper.SetUpgradeInitializer(upgradetypes.Hulunbeier, + func() error { + app.Logger().Info("Init Hulunbeier upgrade") + mm, ok := app.mm.Modules[virtualgrouptypes.ModuleName].(*virtualgroupmodule.AppModule) + if !ok { + panic("*virtualgroupmodule.AppModule not found") + } + mm.SetConsensusVersion(2) return nil }) } diff --git a/deployment/localup/localup.sh b/deployment/localup/localup.sh index 80b82686d..7cfad3ed1 100644 --- a/deployment/localup/localup.sh +++ b/deployment/localup/localup.sh @@ -174,6 +174,7 @@ function generate_genesis() { echo -e '[[upgrade]]\nname = "Nagqu"\nheight = 20\ninfo = ""' >> ${workspace}/.local/validator${i}/config/app.toml echo -e '[[upgrade]]\nname = "Pampas"\nheight = 20\ninfo = ""' >> ${workspace}/.local/validator${i}/config/app.toml echo -e '[[upgrade]]\nname = "Manchurian"\nheight = 20\ninfo = ""' >> ${workspace}/.local/validator${i}/config/app.toml + echo -e '[[upgrade]]\nname = "Hulunbeier"\nheight = 21\ninfo = ""' >> ${workspace}/.local/validator${i}/config/app.toml done # enable swagger API for validator0 diff --git a/e2e/core/basesuite.go b/e2e/core/basesuite.go index 50fa8d1f4..bde8bab85 100644 --- a/e2e/core/basesuite.go +++ b/e2e/core/basesuite.go @@ -28,6 +28,7 @@ import ( "github.com/prysmaticlabs/prysm/crypto/bls" "github.com/spf13/cobra" "github.com/stretchr/testify/suite" + "golang.org/x/exp/slices" "github.com/bnb-chain/greenfield/cmd/gnfd/cmd" "github.com/bnb-chain/greenfield/sdk/client" @@ -682,6 +683,17 @@ func (s *BaseSuite) CreateObject(user keys.KeyManager, primarySP *StorageProvide } func (s *BaseSuite) CreateGlobalVirtualGroup(sp *StorageProvider, familyID uint32, secondarySPIDs []uint32, depositAmount int64) (uint32, uint32) { + + // check if the GVG already exits + if familyID != 0 { + resp, _ := s.Client.GlobalVirtualGroupByFamilyID(context.Background(), &virtualgroupmoduletypes.QueryGlobalVirtualGroupByFamilyIDRequest{GlobalVirtualGroupFamilyId: familyID}) + for _, gvg := range resp.GlobalVirtualGroups { + if slices.Equal(secondarySPIDs, gvg.SecondarySpIds) { + return gvg.Id, familyID + } + } + } + // Create a GVG for each sp by default deposit := sdk.Coin{ Denom: s.Config.Denom, @@ -733,6 +745,15 @@ func (s *BaseSuite) PickStorageProvider() *StorageProvider { return nil } +func (s *BaseSuite) PickStorageProviderByID(id uint32) *StorageProvider { + for _, sp := range s.StorageProviders { + if sp.Info.Id == id { + return sp + } + } + return nil +} + func (s *BaseSuite) PickDifferentStorageProvider(spId uint32) *StorageProvider { for _, sp := range s.StorageProviders { if sp.Info.Id != spId { diff --git a/e2e/tests/sp_test.go b/e2e/tests/sp_test.go index 9d2cca354..84233e5ef 100644 --- a/e2e/tests/sp_test.go +++ b/e2e/tests/sp_test.go @@ -22,6 +22,7 @@ import ( "github.com/bnb-chain/greenfield/sdk/types" "github.com/bnb-chain/greenfield/testutil/sample" sptypes "github.com/bnb-chain/greenfield/x/sp/types" + virtualgroupmoduletypes "github.com/bnb-chain/greenfield/x/virtualgroup/types" ) type StorageProviderTestSuite struct { @@ -37,39 +38,40 @@ func (s *StorageProviderTestSuite) SetupSuite() { func (s *StorageProviderTestSuite) SetupTest() { } -//func (s *StorageProviderTestSuite) TestCreateStorageProvider() { -// // Create a New SP -// sp := s.BaseSuite.CreateNewStorageProvider() -// -// // query sp by id -// querySPResp, err := s.Client.StorageProvider(context.Background(), &sptypes.QueryStorageProviderRequest{ -// Id: sp.Info.Id, -// }) -// s.Require().NoError(err) -// s.Require().Equal(querySPResp.StorageProvider, querySPResp.StorageProvider) -// -// // sp exit -// msgSPExit := virtualgroupmoduletypes.MsgStorageProviderExit{ -// StorageProvider: sp.OperatorKey.GetAddr().String(), -// } -// s.SendTxBlock(sp.OperatorKey, &msgSPExit) -// -// // 9 query sp status -// querySPResp2, err := s.Client.StorageProvider(context.Background(), &sptypes.QueryStorageProviderRequest{Id: sp.Info.Id}) -// s.Require().NoError(err) -// s.Require().Equal(querySPResp2.StorageProvider.Status, sptypes.STATUS_GRACEFUL_EXITING) -// -// // 10 complete sp exit -// msgCompleteSPExit := virtualgroupmoduletypes.MsgCompleteStorageProviderExit{ -// StorageProvider: sp.OperatorKey.GetAddr().String(), -// } -// -// s.SendTxBlock(sp.OperatorKey, &msgCompleteSPExit) -// -// // 10 query sp -// _, err = s.Client.StorageProvider(context.Background(), &sptypes.QueryStorageProviderRequest{Id: sp.Info.Id}) -// s.Require().Error(err) -//} +func (s *StorageProviderTestSuite) TestCreateStorageProvider() { + // Create a New SP + sp := s.BaseSuite.CreateNewStorageProvider() + + // query sp by id + querySPResp, err := s.Client.StorageProvider(context.Background(), &sptypes.QueryStorageProviderRequest{ + Id: sp.Info.Id, + }) + s.Require().NoError(err) + s.Require().Equal(querySPResp.StorageProvider, querySPResp.StorageProvider) + + // sp exit + msgSPExit := virtualgroupmoduletypes.MsgStorageProviderExit{ + StorageProvider: sp.OperatorKey.GetAddr().String(), + } + s.SendTxBlock(sp.OperatorKey, &msgSPExit) + + // 9 query sp status + querySPResp2, err := s.Client.StorageProvider(context.Background(), &sptypes.QueryStorageProviderRequest{Id: sp.Info.Id}) + s.Require().NoError(err) + s.Require().Equal(querySPResp2.StorageProvider.Status, sptypes.STATUS_GRACEFUL_EXITING) + + // 10 complete sp exit + msgCompleteSPExit := virtualgroupmoduletypes.MsgCompleteStorageProviderExit{ + StorageProvider: sp.OperatorKey.GetAddr().String(), + Operator: sp.OperatorKey.GetAddr().String(), + } + + s.SendTxBlock(sp.OperatorKey, &msgCompleteSPExit) + + // 10 query sp + _, err = s.Client.StorageProvider(context.Background(), &sptypes.QueryStorageProviderRequest{Id: sp.Info.Id}) + s.Require().Error(err) +} func (s *StorageProviderTestSuite) TestEditStorageProvider() { ctx := context.Background() diff --git a/e2e/tests/virtualgroup_test.go b/e2e/tests/virtualgroup_test.go index 9e6bba771..3647bbe7b 100644 --- a/e2e/tests/virtualgroup_test.go +++ b/e2e/tests/virtualgroup_test.go @@ -23,6 +23,8 @@ import ( "github.com/bnb-chain/greenfield/e2e/core" "github.com/bnb-chain/greenfield/sdk/types" storagetestutil "github.com/bnb-chain/greenfield/testutil/storage" + types3 "github.com/bnb-chain/greenfield/x/payment/types" + sptypes "github.com/bnb-chain/greenfield/x/sp/types" storagetypes "github.com/bnb-chain/greenfield/x/storage/types" virtualgroupmoduletypes "github.com/bnb-chain/greenfield/x/virtualgroup/types" ) @@ -112,7 +114,6 @@ func (s *VirtualGroupTestSuite) TestBasic() { s.BaseSuite.CreateGlobalVirtualGroup(primarySP, gvg.FamilyId, secondarySPIDs, 1) gvgs = s.queryGlobalVirtualGroupsByFamily(gvg.FamilyId) - s.Require().Equal(len(gvgs), len(srcGVGs)+1) oldGVGIDs := make(map[uint32]bool) for _, gvg := range srcGVGs { @@ -762,3 +763,556 @@ func (s *VirtualGroupTestSuite) TestEmptyGlobalVirtualGroupFamily() { s.Require().Equal(1, len(gvgs)) s.Require().Equal(gvgs[0].Id, newGVGID) } + +func (s *VirtualGroupTestSuite) TestSPExit() { + user := s.GenAndChargeAccounts(1, 1000000)[0] + + // 1. create an SP-x that wants to exit + spx := s.BaseSuite.CreateNewStorageProvider() + s.T().Logf("new SP(successor) Info: %s", spx.Info.String()) + + // 2. create a successor SP-y + spy := s.BaseSuite.CreateNewStorageProvider() + s.T().Logf("new SP(successor) Info: %s", spy.Info.String()) + + // 3, SP-x create a new family with a GVG. Family {GVG: [x|2, 3, 4, 5, 6, 7]} + gvgID, familyID := s.BaseSuite.CreateGlobalVirtualGroup(spx, 0, []uint32{2, 3, 4, 5, 6, 7}, 1) + + // 4. create object + s.BaseSuite.CreateObject(user, spx, gvgID, storagetestutil.GenRandomBucketName(), storagetestutil.GenRandomObjectName()) + + // 5. SP-2 creates gvg contains SP-x [2|x,3,4,5,6,7] + sp2 := s.BaseSuite.PickStorageProviderByID(2) + s.T().Logf("SP 2 Info: %s", spx.Info.String()) + gvgID2, familyID2 := s.BaseSuite.CreateGlobalVirtualGroup(sp2, 0, []uint32{spx.Info.Id, 3, 4, 5, 6, 7}, 1) + + // 6. SP-x declare to exit + s.SendTxBlock(spx.OperatorKey, &virtualgroupmoduletypes.MsgStorageProviderExit{ + StorageProvider: spx.OperatorKey.GetAddr().String(), + }) + resp, err := s.Client.StorageProvider(context.Background(), &sptypes.QueryStorageProviderRequest{Id: spx.Info.Id}) + s.Require().NoError(err) + s.Require().Equal(resp.StorageProvider.Status, sptypes.STATUS_GRACEFUL_EXITING) + + // 7. SP-x complete exit, it would fail due to there are family and GVG binded to it. + s.SendTxBlockWithExpectErrorString( + &virtualgroupmoduletypes.MsgCompleteStorageProviderExit{ + StorageProvider: spx.OperatorKey.GetAddr().String(), + Operator: spx.OperatorKey.GetAddr().String()}, + spx.OperatorKey, + "not swap out from all the family") + + // 8.The SP-y will reserve the swapIn as primary sp for the SP-x's family + msgReserveSwapIn := virtualgroupmoduletypes.NewMsgReserveSwapIn(spy.OperatorKey.GetAddr(), spx.Info.Id, familyID, 0) + s.SendTxBlock(spy.OperatorKey, msgReserveSwapIn) + + // 9 query the swapInInfo onchain, show reservation is recorded onchain + swapInInfo, err := s.Client.SwapInInfo(context.Background(), &virtualgroupmoduletypes.QuerySwapInInfoRequest{ + GlobalVirtualGroupFamilyId: familyID, + }) + s.Require().NoError(err) + s.Require().Equal(swapInInfo.SwapInInfo.SuccessorSpId, spy.Info.Id) + s.Require().Equal(swapInInfo.SwapInInfo.TargetSpId, spx.Info.Id) + + // 10. SP-y cancel the swapIn + msgCancelSwapIn := virtualgroupmoduletypes.NewMsgCancelSwapIn(spy.OperatorKey.GetAddr(), familyID, 0) + s.Require().NoError(err) + s.SendTxBlock(spy.OperatorKey, msgCancelSwapIn) + + // 11. SP-y wants to complete swap in, as primary sp, failure is expected. + msgCompleteSwapIn := virtualgroupmoduletypes.NewMsgCompleteSwapIn(spy.OperatorKey.GetAddr(), familyID, 0) + s.Require().NoError(err) + s.SendTxBlockWithExpectErrorString(msgCompleteSwapIn, spy.OperatorKey, "The swap info not found in blockchain") + + // 12 SP-y reserves swapIn again, and complete swapIn + s.SendTxBlock(spy.OperatorKey, msgReserveSwapIn) + + swapInInfo, err = s.Client.SwapInInfo(context.Background(), &virtualgroupmoduletypes.QuerySwapInInfoRequest{ + GlobalVirtualGroupFamilyId: familyID, + }) + s.Require().NoError(err) + s.Require().Equal(swapInInfo.SwapInInfo.SuccessorSpId, spy.Info.Id) + s.Require().Equal(swapInInfo.SwapInInfo.TargetSpId, spx.Info.Id) + + s.SendTxBlock(spy.OperatorKey, msgCompleteSwapIn) + + // 13. query the swapInInfo should be not found onChain. + _, err = s.Client.SwapInInfo(context.Background(), &virtualgroupmoduletypes.QuerySwapInInfoRequest{ + GlobalVirtualGroupFamilyId: familyID, + }) + s.Require().Error(err) + + // 14. The SP-y has replaced Sp-x in the family successfully, and it becomes the primary SP. Family {GVG: [y|2, 3, 4, 5, 6, 7]} + familyAfterSwapIn, err := s.Client.GlobalVirtualGroupFamily(context.Background(), &virtualgroupmoduletypes.QueryGlobalVirtualGroupFamilyRequest{FamilyId: familyID}) + s.Require().NoError(err) + s.Require().Equal(spy.Info.Id, familyAfterSwapIn.GlobalVirtualGroupFamily.PrimarySpId) + s.Require().Equal(gvgID, familyAfterSwapIn.GlobalVirtualGroupFamily.GlobalVirtualGroupIds[0]) + + gvgAfterSwapIn, err := s.Client.GlobalVirtualGroup(context.Background(), &virtualgroupmoduletypes.QueryGlobalVirtualGroupRequest{GlobalVirtualGroupId: gvgID}) + s.Require().NoError(err) + s.Require().Equal(spy.Info.Id, gvgAfterSwapIn.GlobalVirtualGroup.PrimarySpId) + s.Require().Equal(familyID, gvgAfterSwapIn.GlobalVirtualGroup.FamilyId) + s.Require().Equal([]uint32{2, 3, 4, 5, 6, 7}, gvgAfterSwapIn.GlobalVirtualGroup.SecondarySpIds) + + // 15. SP-x tries to complete exit, but would fail, since SP-2 has a GVG that includes SP-x [2|x,3,4,5,6,7] + s.SendTxBlockWithExpectErrorString( + &virtualgroupmoduletypes.MsgCompleteStorageProviderExit{ + StorageProvider: spx.OperatorKey.GetAddr().String(), + Operator: spx.OperatorKey.GetAddr().String()}, + spx.OperatorKey, + "not swap out from all the gvgs") + + // 16. SP-y reserves the swapIn, as secondary sp + msgReserveSwapIn = virtualgroupmoduletypes.NewMsgReserveSwapIn(spy.OperatorKey.GetAddr(), spx.Info.Id, 0, gvgID2) + s.Require().NoError(err) + s.SendTxBlock(spy.OperatorKey, msgReserveSwapIn) + + // query the swapInInfo + swapInInfo, err = s.Client.SwapInInfo(context.Background(), &virtualgroupmoduletypes.QuerySwapInInfoRequest{ + GlobalVirtualGroupId: gvgID2, + }) + s.Require().NoError(err) + s.Require().Equal(spy.Info.Id, swapInInfo.SwapInInfo.SuccessorSpId) + s.Require().Equal(spx.Info.Id, swapInInfo.SwapInInfo.TargetSpId) + + // 17 SP-y cancels swap in as secondary sp + msgCancelSwapIn = virtualgroupmoduletypes.NewMsgCancelSwapIn(spy.OperatorKey.GetAddr(), 0, gvgID2) + s.Require().NoError(err) + s.SendTxBlock(spy.OperatorKey, msgCancelSwapIn) + + // 18 query the swapInInfo not found + _, err = s.Client.SwapInInfo(context.Background(), &virtualgroupmoduletypes.QuerySwapInInfoRequest{ + GlobalVirtualGroupId: gvgID2, + }) + s.Require().Error(err) + + // 19. SP-y tries to complete swapIn, failure expected. + msgCompleteSwapIn = virtualgroupmoduletypes.NewMsgCompleteSwapIn(spy.OperatorKey.GetAddr(), 0, gvgID2) + s.SendTxBlockWithExpectErrorString(msgCompleteSwapIn, spy.OperatorKey, "The swap info not found in blockchain") + + // 20. SP-y reserves swapIn again, as secondary sp + msgReserveSwapIn = virtualgroupmoduletypes.NewMsgReserveSwapIn(spy.OperatorKey.GetAddr(), spx.Info.Id, 0, gvgID2) + s.SendTxBlock(spy.OperatorKey, msgReserveSwapIn) + + // 21 SP-y complete the swap in + msgCompleteSwapIn = virtualgroupmoduletypes.NewMsgCompleteSwapIn(spy.OperatorKey.GetAddr(), 0, gvgID2) + s.SendTxBlock(spy.OperatorKey, msgCompleteSwapIn) + + // 22 SP-y has replaced Sp-x in Sp-2's GVG, the GVG becomes [2|y, 3, 4, 5, 6, 7]} + gvgAfterSwapIn, err = s.Client.GlobalVirtualGroup(context.Background(), &virtualgroupmoduletypes.QueryGlobalVirtualGroupRequest{GlobalVirtualGroupId: gvgID2}) + s.Require().NoError(err) + s.Require().Equal(sp2.Info.Id, gvgAfterSwapIn.GlobalVirtualGroup.PrimarySpId) + s.Require().Equal(familyID2, gvgAfterSwapIn.GlobalVirtualGroup.FamilyId) + s.Require().Equal([]uint32{spy.Info.Id, 3, 4, 5, 6, 7}, gvgAfterSwapIn.GlobalVirtualGroup.SecondarySpIds) + + // 23. SP-x complete exit success + s.SendTxBlock( + spx.OperatorKey, + &virtualgroupmoduletypes.MsgCompleteStorageProviderExit{StorageProvider: spx.OperatorKey.GetAddr().String(), Operator: spx.OperatorKey.GetAddr().String()}, + ) + + // 24 SP-x no longer found on chain + _, err = s.Client.StorageProvider(context.Background(), &sptypes.QueryStorageProviderRequest{Id: spx.Info.Id}) + s.Require().Error(err) +} + +func (s *VirtualGroupTestSuite) TestSPExit2() { + // 1. Create SP-x, y, z, SP-x wants to exit, SP-y, SP-z will SwapIn SP-x family and GVG + spx := s.BaseSuite.CreateNewStorageProvider() + spy := s.BaseSuite.CreateNewStorageProvider() + spz := s.BaseSuite.CreateNewStorageProvider() + + // 2 SP-x creates a new family with a GVG. Family: {GVG: [x|y, 3, 4, 5, 6, 7]}, SP-y is a secondary on this GVG. + gvgID, familyID := s.BaseSuite.CreateGlobalVirtualGroup(spx, 0, []uint32{spy.Info.Id, 3, 4, 5, 6, 7}, 1) + + // 3. SP-x announces to exit + s.SendTxBlock(spx.OperatorKey, &virtualgroupmoduletypes.MsgStorageProviderExit{ + StorageProvider: spx.OperatorKey.GetAddr().String(), + }) + resp, err := s.Client.StorageProvider(context.Background(), &sptypes.QueryStorageProviderRequest{Id: spx.Info.Id}) + s.Require().NoError(err) + s.Require().Equal(resp.StorageProvider.Status, sptypes.STATUS_GRACEFUL_EXITING) + + // 4. SP-y also announces to exit, multiple SP exit concurrently not allowed. + s.SendTxBlockWithExpectErrorString(&virtualgroupmoduletypes.MsgStorageProviderExit{ + StorageProvider: spy.OperatorKey.GetAddr().String()}, spy.OperatorKey, "") + resp, err = s.Client.StorageProvider(context.Background(), &sptypes.QueryStorageProviderRequest{Id: spy.Info.Id}) + s.Require().NoError(err) + s.Require().Equal(resp.StorageProvider.Status, sptypes.STATUS_IN_SERVICE) + + // 5. SP-y reserves the swapIn and complete it for SP-x family {GVG: [x|y, 3, 4, 5, 6, 7]}, then have {[y|y,3,4,5,6,7]} + // Sp-y will act both role in this GVG, primary and one of the secondary. + msgReserveSwapIn := virtualgroupmoduletypes.NewMsgReserveSwapIn(spy.OperatorKey.GetAddr(), spx.Info.Id, familyID, 0) + s.SendTxBlock(spy.OperatorKey, msgReserveSwapIn) + msgCompleteSwapIn := virtualgroupmoduletypes.NewMsgCompleteSwapIn(spy.OperatorKey.GetAddr(), familyID, 0) + s.SendTxBlock(spy.OperatorKey, msgCompleteSwapIn) + + gvgAfterSwapIn, err := s.Client.GlobalVirtualGroup(context.Background(), &virtualgroupmoduletypes.QueryGlobalVirtualGroupRequest{GlobalVirtualGroupId: gvgID}) + s.Require().NoError(err) + s.Require().Equal(spy.Info.Id, gvgAfterSwapIn.GlobalVirtualGroup.PrimarySpId) + s.Require().Equal(familyID, gvgAfterSwapIn.GlobalVirtualGroup.FamilyId) + s.Require().Equal([]uint32{spy.Info.Id, 3, 4, 5, 6, 7}, gvgAfterSwapIn.GlobalVirtualGroup.SecondarySpIds) + + // 6. SP-x now can complete the exit, since it has only 1 family and it has been taken by SP-y + s.SendTxBlock( + spx.OperatorKey, + &virtualgroupmoduletypes.MsgCompleteStorageProviderExit{ + StorageProvider: spx.OperatorKey.GetAddr().String(), + Operator: spx.OperatorKey.GetAddr().String()}, + ) + _, err = s.Client.StorageProvider(context.Background(), &sptypes.QueryStorageProviderRequest{Id: spx.Info.Id}) + s.Require().Error(err) + + // 7. SP-y try to exit as well, not allowed and rejected by chain due to it has GVG [y|y,3,4,5,6,7] that break the redundancy requirement + s.SendTxBlockWithExpectErrorString(&virtualgroupmoduletypes.MsgStorageProviderExit{ + StorageProvider: spy.OperatorKey.GetAddr().String()}, spy.OperatorKey, "break the redundancy requirement") + resp, err = s.Client.StorageProvider(context.Background(), &sptypes.QueryStorageProviderRequest{Id: spy.Info.Id}) + s.Require().NoError(err) + s.Require().Equal(resp.StorageProvider.Status, sptypes.STATUS_IN_SERVICE) + + // 8 SP-z reserves and completes the swap, GVG becomes [y|z,3,4,5,6,7], + msgReserveSwapIn = virtualgroupmoduletypes.NewMsgReserveSwapIn(spz.OperatorKey.GetAddr(), spy.Info.Id, 0, gvgID) + s.SendTxBlock(spz.OperatorKey, msgReserveSwapIn) + msgCompleteSwapIn = virtualgroupmoduletypes.NewMsgCompleteSwapIn(spz.OperatorKey.GetAddr(), 0, gvgID) + s.SendTxBlock(spz.OperatorKey, msgCompleteSwapIn) + + gvgAfterSwapIn, err = s.Client.GlobalVirtualGroup(context.Background(), &virtualgroupmoduletypes.QueryGlobalVirtualGroupRequest{GlobalVirtualGroupId: gvgID}) + s.Require().NoError(err) + s.Require().Equal(spy.Info.Id, gvgAfterSwapIn.GlobalVirtualGroup.PrimarySpId) + s.Require().Equal(familyID, gvgAfterSwapIn.GlobalVirtualGroup.FamilyId) + s.Require().Equal([]uint32{spz.Info.Id, 3, 4, 5, 6, 7}, gvgAfterSwapIn.GlobalVirtualGroup.SecondarySpIds) + + // 9 SP-y can declare to exit + s.SendTxBlock(spy.OperatorKey, &virtualgroupmoduletypes.MsgStorageProviderExit{ + StorageProvider: spy.OperatorKey.GetAddr().String()}) + resp, err = s.Client.StorageProvider(context.Background(), &sptypes.QueryStorageProviderRequest{Id: spy.Info.Id}) + s.Require().NoError(err) + s.Require().Equal(resp.StorageProvider.Status, sptypes.STATUS_GRACEFUL_EXITING) + + // 10 SP-z reserves and complete swapIn for family {[y|z,3,4,5,6,7]} and becomes {[z|z,3,4,5,6,7]} + msgReserveSwapIn = virtualgroupmoduletypes.NewMsgReserveSwapIn(spz.OperatorKey.GetAddr(), spy.Info.Id, familyID, 0) + s.SendTxBlock(spz.OperatorKey, msgReserveSwapIn) + msgCompleteSwapIn = virtualgroupmoduletypes.NewMsgCompleteSwapIn(spz.OperatorKey.GetAddr(), familyID, 0) + s.SendTxBlock(spz.OperatorKey, msgCompleteSwapIn) + + gvgAfterSwapIn, err = s.Client.GlobalVirtualGroup(context.Background(), &virtualgroupmoduletypes.QueryGlobalVirtualGroupRequest{GlobalVirtualGroupId: gvgID}) + s.Require().NoError(err) + s.Require().Equal(spz.Info.Id, gvgAfterSwapIn.GlobalVirtualGroup.PrimarySpId) + s.Require().Equal(familyID, gvgAfterSwapIn.GlobalVirtualGroup.FamilyId) + s.Require().Equal([]uint32{spz.Info.Id, 3, 4, 5, 6, 7}, gvgAfterSwapIn.GlobalVirtualGroup.SecondarySpIds) + + // 11 complete SPy's exit by sp-z + s.SendTxBlock( + spz.OperatorKey, + &virtualgroupmoduletypes.MsgCompleteStorageProviderExit{ + StorageProvider: spy.OperatorKey.GetAddr().String(), + Operator: spz.OperatorKey.GetAddr().String()}, + ) + _, err = s.Client.StorageProvider(context.Background(), &sptypes.QueryStorageProviderRequest{Id: spy.Info.Id}) + s.Require().Error(err) +} + +func (s *VirtualGroupTestSuite) TestSPForcedExit() { + + ctx := context.Background() + user := s.GenAndChargeAccounts(1, 1000000)[0] + + // 1. create SPs + spx := s.BaseSuite.CreateNewStorageProvider() + spy := s.BaseSuite.CreateNewStorageProvider() + + // get the dynamic balance of gov address account i payment module + govAddrInPaymentBalance, err := s.Client.DynamicBalance(context.Background(), &types3.QueryDynamicBalanceRequest{ + Account: types3.GovernanceAddress.String(), + }) + s.Require().NoError(err) + s.T().Logf("payment module gov stream record balance is %s", core.YamlString(govAddrInPaymentBalance)) + + // 2. SP-x creates a new family with a gvg: {[x|2,3,4,5,6,7]} + gvgID, familyID := s.BaseSuite.CreateGlobalVirtualGroup(spx, 0, []uint32{2, 3, 4, 5, 6, 7}, 1) + + // User creates an object and sealed by the SP-x's GVG + bucketName := storagetestutil.GenRandomBucketName() + objectName := storagetestutil.GenRandomBucketName() + s.BaseSuite.CreateObject(user, spx, gvgID, bucketName, objectName) + objectResp, err := s.Client.HeadObject(context.Background(), &storagetypes.QueryHeadObjectRequest{ + BucketName: bucketName, ObjectName: objectName, + }) + s.Require().NoError(err) + + // 3. create a proposal that puts SP-x to FORCE_EXIT + govAddr := authtypes.NewModuleAddress(govtypes.ModuleName).String() + msgForcedExit := virtualgroupmoduletypes.NewMsgStorageProviderForcedExit(govAddr, spx.OperatorKey.GetAddr()) + + proposal, err := v1.NewMsgSubmitProposal([]sdk.Msg{msgForcedExit}, sdk.NewCoins(sdk.NewCoin("BNB", sdk.NewInt(1000000000000000000))), + s.Validator.GetAddr().String(), "", "put SP to force exit status", "put SP to force exit status") + s.Require().NoError(err) + txBroadCastResp, err := s.SendTxBlockWithoutCheck(proposal, s.Validator) + s.Require().NoError(err) + s.T().Log("create proposal tx hash: ", txBroadCastResp.TxResponse.TxHash) + + // get proposal id + proposalID := 0 + txResp, err := s.WaitForTx(txBroadCastResp.TxResponse.TxHash) + s.Require().NoError(err) + if txResp.Code == 0 && txResp.Height > 0 { + for _, event := range txResp.Events { + if event.Type == "submit_proposal" { + proposalID, err = strconv.Atoi(event.GetAttributes()[0].Value) + s.Require().NoError(err) + } + } + } + s.Require().True(proposalID != 0) + queryProposal := &v1.QueryProposalRequest{ProposalId: uint64(proposalID)} + _, err = s.Client.GovQueryClientV1.Proposal(ctx, queryProposal) + s.Require().NoError(err) + + // 4. submit MsgVote and wait the proposal exec + msgVote := v1.NewMsgVote(s.Validator.GetAddr(), uint64(proposalID), v1.OptionYes, "test") + txRes := s.SendTxBlock(s.Validator, msgVote) + s.Require().Equal(txRes.Code, uint32(0)) + + queryVoteParamsReq := v1.QueryParamsRequest{ParamsType: "voting"} + queryVoteParamsResp, err := s.Client.GovQueryClientV1.Params(ctx, &queryVoteParamsReq) + s.Require().NoError(err) + + // 5. wait a voting period and confirm that the proposal success. + s.T().Logf("voting period %s", *queryVoteParamsResp.Params.VotingPeriod) + time.Sleep(*queryVoteParamsResp.Params.VotingPeriod + time.Second) + proposalRes, err := s.Client.GovQueryClientV1.Proposal(ctx, queryProposal) + s.Require().NoError(err) + s.Require().Equal(v1.ProposalStatus_PROPOSAL_STATUS_PASSED, proposalRes.Proposal.Status) + + // 6. SP-x status will be FORCE_EXITING + resp, err := s.Client.StorageProvider(context.Background(), &sptypes.QueryStorageProviderRequest{Id: spx.Info.Id}) + s.Require().NoError(err) + s.Require().Equal(sptypes.STATUS_FORCED_EXITING, resp.StorageProvider.Status) + + // 7. SP-x successor SP try swapIn family + msgReserveSwapIn := virtualgroupmoduletypes.NewMsgReserveSwapIn(spy.OperatorKey.GetAddr(), spx.Info.Id, familyID, 0) + s.Require().NoError(err) + s.SendTxBlock(spy.OperatorKey, msgReserveSwapIn) + + // query the swapInInfo + swapInInfo, err := s.Client.SwapInInfo(context.Background(), &virtualgroupmoduletypes.QuerySwapInInfoRequest{ + GlobalVirtualGroupFamilyId: familyID, + }) + s.Require().NoError(err) + s.Require().Equal(swapInInfo.SwapInInfo.SuccessorSpId, spy.Info.Id) + s.Require().Equal(swapInInfo.SwapInInfo.TargetSpId, spx.Info.Id) + + // swapin info not found + _, err = s.Client.SwapInInfo(context.Background(), &virtualgroupmoduletypes.QuerySwapInInfoRequest{ + GlobalVirtualGroupId: gvgID, + }) + s.Require().Error(err) + + // SP-y is able to discontinue the object as a successor Primary SP + msgDiscontinueObject := &storagetypes.MsgDiscontinueObject{ + Operator: spy.GcKey.GetAddr().String(), + BucketName: bucketName, + ObjectIds: []sdkmath.Uint{objectResp.ObjectInfo.Id}, + } + s.SendTxBlock(spy.GcKey, msgDiscontinueObject) + time.Sleep(5 * time.Second) + _, err = s.Client.HeadObject(context.Background(), &storagetypes.QueryHeadObjectRequest{ + BucketName: bucketName, ObjectName: objectName, + }) + s.Require().Error(err) + + // 8. SP-y complete SwapIn + msgCompleteSwapIn := virtualgroupmoduletypes.NewMsgCompleteSwapIn(spy.OperatorKey.GetAddr(), familyID, 0) + s.SendTxBlock(spy.OperatorKey, msgCompleteSwapIn) + + // 9. query the swapInInfo should be not found + _, err = s.Client.SwapInInfo(context.Background(), &virtualgroupmoduletypes.QuerySwapInInfoRequest{ + GlobalVirtualGroupFamilyId: familyID, + }) + s.Require().Error(err) + + gvgAfterSwapIn, err := s.Client.GlobalVirtualGroup(context.Background(), &virtualgroupmoduletypes.QueryGlobalVirtualGroupRequest{GlobalVirtualGroupId: gvgID}) + s.Require().NoError(err) + s.Require().Equal(spy.Info.Id, gvgAfterSwapIn.GlobalVirtualGroup.PrimarySpId) + s.Require().Equal(familyID, gvgAfterSwapIn.GlobalVirtualGroup.FamilyId) + s.Require().Equal([]uint32{2, 3, 4, 5, 6, 7}, gvgAfterSwapIn.GlobalVirtualGroup.SecondarySpIds) + + // 11 User help complete the exit + s.SendTxBlock( + user, + &virtualgroupmoduletypes.MsgCompleteStorageProviderExit{StorageProvider: spx.OperatorKey.GetAddr().String(), + Operator: user.GetAddr().String()}, + ) + _, err = s.Client.StorageProvider(context.Background(), &sptypes.QueryStorageProviderRequest{Id: spx.Info.Id}) + s.Require().Error(err) + + govAddrInPaymentBalanceAfter, err := s.Client.DynamicBalance(context.Background(), &types3.QueryDynamicBalanceRequest{ + Account: types3.GovernanceAddress.String(), + }) + s.Require().NoError(err) + s.T().Logf("payment module gov stream record balance is %s", core.YamlString(govAddrInPaymentBalanceAfter)) + s.Require().Equal(govAddrInPaymentBalance.BankBalance.Add(resp.StorageProvider.TotalDeposit), govAddrInPaymentBalanceAfter.BankBalance) +} + +func (s *VirtualGroupTestSuite) updateParams(params virtualgroupmoduletypes.Params) { + govAddr := authtypes.NewModuleAddress(govtypes.ModuleName).String() + msgUpdateParams := &virtualgroupmoduletypes.MsgUpdateParams{ + Authority: govAddr, + Params: params, + } + proposal, err := v1.NewMsgSubmitProposal([]sdk.Msg{msgUpdateParams}, sdk.NewCoins(sdk.NewCoin("BNB", sdk.NewInt(1000000000000000000))), + s.Validator.GetAddr().String(), "", "update virtual group params", "update virtual group params") + s.Require().NoError(err) + txBroadCastResp, err := s.SendTxBlockWithoutCheck(proposal, s.Validator) + s.Require().NoError(err) + s.T().Log("create proposal tx hash: ", txBroadCastResp.TxResponse.TxHash) + + // get proposal id + proposalID := 0 + txResp, err := s.WaitForTx(txBroadCastResp.TxResponse.TxHash) + s.Require().NoError(err) + if txResp.Code == 0 && txResp.Height > 0 { + for _, event := range txResp.Events { + if event.Type == "submit_proposal" { + proposalID, err = strconv.Atoi(event.GetAttributes()[0].Value) + s.Require().NoError(err) + } + } + } + s.Require().True(proposalID != 0) + queryProposal := &v1.QueryProposalRequest{ProposalId: uint64(proposalID)} + _, err = s.Client.GovQueryClientV1.Proposal(context.Background(), queryProposal) + s.Require().NoError(err) + + // 4. submit MsgVote and wait the proposal exec + msgVote := v1.NewMsgVote(s.Validator.GetAddr(), uint64(proposalID), v1.OptionYes, "test") + txRes := s.SendTxBlock(s.Validator, msgVote) + s.Require().Equal(txRes.Code, uint32(0)) + + queryVoteParamsReq := v1.QueryParamsRequest{ParamsType: "voting"} + queryVoteParamsResp, err := s.Client.GovQueryClientV1.Params(context.Background(), &queryVoteParamsReq) + s.Require().NoError(err) + + // 5. wait a voting period and confirm that the proposal success. + s.T().Logf("voting period %s", *queryVoteParamsResp.Params.VotingPeriod) + time.Sleep(*queryVoteParamsResp.Params.VotingPeriod + time.Second) + proposalRes, err := s.Client.GovQueryClientV1.Proposal(context.Background(), queryProposal) + s.Require().NoError(err) + s.Require().Equal(proposalRes.Proposal.Status, v1.ProposalStatus_PROPOSAL_STATUS_PASSED) +} + +func (s *VirtualGroupTestSuite) TestSPExit_SwapInfo_Expired() { + + // update the param, swapInInfo validity period is 10s + queryParamsResp, err := s.Client.VirtualGroupQueryClient.Params(context.Background(), &virtualgroupmoduletypes.QueryParamsRequest{}) + s.Require().NoError(err) + updatedParams := queryParamsResp.Params + + swapInValidityPeriod := sdk.NewInt(10) + updatedParams.SwapInValidityPeriod = &swapInValidityPeriod // the swapInInfo will expire in 10 seconds + s.updateParams(updatedParams) + + queryParamsResp, err = s.Client.VirtualGroupQueryClient.Params(context.Background(), &virtualgroupmoduletypes.QueryParamsRequest{}) + s.Require().NoError(err) + s.Require().Equal(uint64(10), queryParamsResp.Params.SwapInValidityPeriod.Uint64()) + + // 1. create an SP-x that wants to exit + spx := s.BaseSuite.CreateNewStorageProvider() + s.T().Logf("new SPx(successor) Info: %s", spx.Info.String()) + + // 2. create a successor SP-y, successor SP-z + spy := s.BaseSuite.CreateNewStorageProvider() + s.T().Logf("new SPy(successor) Info: %s", spy.Info.String()) + spz := s.BaseSuite.CreateNewStorageProvider() + s.T().Logf("new SPz(successor) Info: %s", spz.Info.String()) + + // 3 SP-x create a new family with a GVG. Family {GVG: [x|2, 3, 4, 5, 6, 7]} + _, familyID := s.BaseSuite.CreateGlobalVirtualGroup(spx, 0, []uint32{2, 3, 4, 5, 6, 7}, 1) + + // 4. SP-x declare to exit + s.SendTxBlock(spx.OperatorKey, &virtualgroupmoduletypes.MsgStorageProviderExit{ + StorageProvider: spx.OperatorKey.GetAddr().String(), + }) + resp, err := s.Client.StorageProvider(context.Background(), &sptypes.QueryStorageProviderRequest{Id: spx.Info.Id}) + s.Require().NoError(err) + s.Require().Equal(resp.StorageProvider.Status, sptypes.STATUS_GRACEFUL_EXITING) + + // 5 SP-y reserves the swapIn family + msgReserveSwapIn := virtualgroupmoduletypes.NewMsgReserveSwapIn(spy.OperatorKey.GetAddr(), spx.Info.Id, familyID, 0) + s.SendTxBlock(spy.OperatorKey, msgReserveSwapIn) + + // 6 query the swapInInfo onchain, show reservation is recorded onchain + swapInInfo, err := s.Client.SwapInInfo(context.Background(), &virtualgroupmoduletypes.QuerySwapInInfoRequest{ + GlobalVirtualGroupFamilyId: familyID, + }) + s.Require().NoError(err) + s.Require().Equal(swapInInfo.SwapInInfo.SuccessorSpId, spy.Info.Id) + s.Require().Equal(swapInInfo.SwapInInfo.TargetSpId, spx.Info.Id) + + // 7. SP-z try to swapIn family, it would fail + msgReserveSwapIn = virtualgroupmoduletypes.NewMsgReserveSwapIn(spz.OperatorKey.GetAddr(), spx.Info.Id, familyID, 0) + s.SendTxBlockWithExpectErrorString(msgReserveSwapIn, spz.OperatorKey, "already exist SP") + + // 8 waits for swapIno is expired, it can still be queried but with expired info + time.Sleep(11 * time.Second) + _, err = s.Client.SwapInInfo(context.Background(), &virtualgroupmoduletypes.QuerySwapInInfoRequest{ + GlobalVirtualGroupFamilyId: familyID, + }) + s.Require().NoError(err) + s.Require().True(swapInInfo.SwapInInfo.ExpirationTime < uint64(time.Now().Unix())) + + // 9 SP-y try to complete swapIn family, it is allowed, since no other SP apply swapIn, and swapIn info will be gone after completion + msgCompleteSwapIn := virtualgroupmoduletypes.NewMsgCompleteSwapIn(spy.OperatorKey.GetAddr(), familyID, 0) + s.SendTxBlock(spy.OperatorKey, msgCompleteSwapIn) + + _, err = s.Client.SwapInInfo(context.Background(), &virtualgroupmoduletypes.QuerySwapInInfoRequest{ + GlobalVirtualGroupFamilyId: familyID, + }) + s.Require().Error(err) + + // 10 sp-x completes the exit + s.SendTxBlock( + spx.OperatorKey, + &virtualgroupmoduletypes.MsgCompleteStorageProviderExit{StorageProvider: spx.OperatorKey.GetAddr().String(), + Operator: spx.OperatorKey.GetAddr().String()}, + ) + _, err = s.Client.StorageProvider(context.Background(), &sptypes.QueryStorageProviderRequest{Id: spx.Info.Id}) + s.Require().Error(err) + + // 11. SP-y declare to exit + s.SendTxBlock(spy.OperatorKey, &virtualgroupmoduletypes.MsgStorageProviderExit{ + StorageProvider: spy.OperatorKey.GetAddr().String(), + }) + resp, err = s.Client.StorageProvider(context.Background(), &sptypes.QueryStorageProviderRequest{Id: spy.Info.Id}) + s.Require().NoError(err) + s.Require().Equal(resp.StorageProvider.Status, sptypes.STATUS_GRACEFUL_EXITING) + + // 12 SP-z reserves the swapIn family but not complete it + msgReserveSwapIn = virtualgroupmoduletypes.NewMsgReserveSwapIn(spz.OperatorKey.GetAddr(), spy.Info.Id, familyID, 0) + s.SendTxBlock(spz.OperatorKey, msgReserveSwapIn) + + // 13 query the swapInInfo onchain, show reservation is recorded onchain + _, err = s.Client.SwapInInfo(context.Background(), &virtualgroupmoduletypes.QuerySwapInInfoRequest{ + GlobalVirtualGroupFamilyId: familyID, + }) + s.Require().NoError(err) + // 14. wait for swapIn info expired + time.Sleep(11 * time.Second) + + // 15 a new SP can reserve since the prev one is expired + spn := s.BaseSuite.CreateNewStorageProvider() + msgReserveSwapIn = virtualgroupmoduletypes.NewMsgReserveSwapIn(spn.OperatorKey.GetAddr(), spy.Info.Id, familyID, 0) + s.SendTxBlock(spn.OperatorKey, msgReserveSwapIn) + + msgCompleteSwapIn = virtualgroupmoduletypes.NewMsgCompleteSwapIn(spn.OperatorKey.GetAddr(), familyID, 0) + s.SendTxBlock(spn.OperatorKey, msgCompleteSwapIn) + + // 16 spy complete exit + s.SendTxBlock( + spy.OperatorKey, + &virtualgroupmoduletypes.MsgCompleteStorageProviderExit{StorageProvider: spy.OperatorKey.GetAddr().String(), + Operator: spy.OperatorKey.GetAddr().String()}, + ) + _, err = s.Client.StorageProvider(context.Background(), &sptypes.QueryStorageProviderRequest{Id: spy.Info.Id}) + s.Require().Error(err) +} diff --git a/go.mod b/go.mod index 04aa1cbb4..bed9cbb5b 100644 --- a/go.mod +++ b/go.mod @@ -27,6 +27,7 @@ require ( github.com/spf13/pflag v1.0.5 github.com/spf13/viper v1.15.0 github.com/stretchr/testify v1.8.4 + golang.org/x/exp v0.0.0-20230515195305-f3d0a9c9a5cc google.golang.org/genproto/googleapis/api v0.0.0-20230711160842-782d3b101e98 google.golang.org/grpc v1.58.3 google.golang.org/protobuf v1.31.0 @@ -159,7 +160,6 @@ require ( github.com/zondax/ledger-go v0.14.1 // indirect go.etcd.io/bbolt v1.3.7 // indirect golang.org/x/crypto v0.14.0 // indirect - golang.org/x/exp v0.0.0-20230515195305-f3d0a9c9a5cc // indirect golang.org/x/net v0.17.0 // indirect golang.org/x/sys v0.13.0 // indirect golang.org/x/term v0.13.0 // indirect @@ -180,7 +180,7 @@ replace ( github.com/cometbft/cometbft => github.com/bnb-chain/greenfield-cometbft v1.1.0 github.com/cometbft/cometbft-db => github.com/bnb-chain/greenfield-cometbft-db v0.8.1-alpha.1 github.com/confio/ics23/go => github.com/cosmos/cosmos-sdk/ics23/go v0.8.0 - github.com/cosmos/cosmos-sdk => github.com/bnb-chain/greenfield-cosmos-sdk v1.2.0 + github.com/cosmos/cosmos-sdk => github.com/bnb-chain/greenfield-cosmos-sdk v1.0.2-0.20231214052136-c20e9a5452b6 github.com/cosmos/iavl => github.com/bnb-chain/greenfield-iavl v0.20.1 github.com/syndtr/goleveldb => github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 github.com/wercker/journalhook => github.com/wercker/journalhook v0.0.0-20230927020745-64542ffa4117 diff --git a/go.sum b/go.sum index 687b15ca5..4c0fde9f9 100644 --- a/go.sum +++ b/go.sum @@ -163,8 +163,8 @@ github.com/bnb-chain/greenfield-cometbft v1.1.0 h1:jqnkDWIZW6f/rUn5/pE26YZMT9xzp github.com/bnb-chain/greenfield-cometbft v1.1.0/go.mod h1:NZ2/ZJK2HYe3++0CsPiw4LTG6UrC6pH7fQ3VOz6pqJw= github.com/bnb-chain/greenfield-cometbft-db v0.8.1-alpha.1 h1:XcWulGacHVRiSCx90Q8Y//ajOrLNBQWR/KDB89dy3cU= github.com/bnb-chain/greenfield-cometbft-db v0.8.1-alpha.1/go.mod h1:ey1CiK4bYo1RBNJLRiVbYr5CMdSxci9S/AZRINLtppI= -github.com/bnb-chain/greenfield-cosmos-sdk v1.2.0 h1:oxwxEiwF+Dani7vr9//nybjrTNLfk2rnO7PjpWSNrNI= -github.com/bnb-chain/greenfield-cosmos-sdk v1.2.0/go.mod h1:Yrvq+J1Lsm7OHFX+M/AZWBTGt1TRHUTC4VYOMlvW3fs= +github.com/bnb-chain/greenfield-cosmos-sdk v1.0.2-0.20231214052136-c20e9a5452b6 h1:XO3cnv1E2vCSPfKw9467y3/8FL4r2XOI/h0C9NrFKTA= +github.com/bnb-chain/greenfield-cosmos-sdk v1.0.2-0.20231214052136-c20e9a5452b6/go.mod h1:Yrvq+J1Lsm7OHFX+M/AZWBTGt1TRHUTC4VYOMlvW3fs= github.com/bnb-chain/greenfield-cosmos-sdk/api v0.0.0-20230816082903-b48770f5e210 h1:GHPbV2bC+gmuO6/sG0Tm8oGal3KKSRlyE+zPscDjlA8= github.com/bnb-chain/greenfield-cosmos-sdk/api v0.0.0-20230816082903-b48770f5e210/go.mod h1:vhsZxXE9tYJeYB5JR4hPhd6Pc/uPf7j1T8IJ7p9FdeM= github.com/bnb-chain/greenfield-cosmos-sdk/math v0.0.0-20230816082903-b48770f5e210 h1:FLVOn4+OVbsKi2+YJX5kmD27/4dRu4FW7xCXFhzDO5s= diff --git a/internal/sequence/sequence_test.go b/internal/sequence/sequence_test.go index ea59bf579..1f806f6f5 100644 --- a/internal/sequence/sequence_test.go +++ b/internal/sequence/sequence_test.go @@ -61,8 +61,6 @@ func TestSequenceIncrementsUint256(t *testing.T) { i = i.Incr() assert.True(t, i.Equal(id)) assert.True(t, i.Equal(curId)) - fmt.Printf("bytes len %d\n", len(id.Bytes())) - fmt.Print("i= ", i.Uint64(), "id=", id.Uint64(), "curID", curId.Uint64()) } } diff --git a/proto/greenfield/sp/types.proto b/proto/greenfield/sp/types.proto index 3d83286b6..62d8ad7f0 100644 --- a/proto/greenfield/sp/types.proto +++ b/proto/greenfield/sp/types.proto @@ -29,6 +29,7 @@ enum Status { STATUS_IN_JAILED = 1; STATUS_GRACEFUL_EXITING = 2; STATUS_IN_MAINTENANCE = 3; + STATUS_FORCED_EXITING = 4; } // StorageProvider defines the meta info of storage provider diff --git a/proto/greenfield/virtualgroup/events.proto b/proto/greenfield/virtualgroup/events.proto index 47e25debe..5c3068d31 100644 --- a/proto/greenfield/virtualgroup/events.proto +++ b/proto/greenfield/virtualgroup/events.proto @@ -165,12 +165,56 @@ message EventStorageProviderExit { message EventCompleteStorageProviderExit { // The id of the storage provider who complete exit uint32 storage_provider_id = 1; - // The operator address which initial the complete exit transaction + // The operator address which initials the complete exit transaction. string operator_address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + // The storage provider address which completes the exit + string storage_provider_address = 3 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // total_deposit defines the number of tokens deposited by this storage provider for staking. - string total_deposit = 3 [ + string total_deposit = 4 [ (cosmos_proto.scalar) = "cosmos.Int", (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", (gogoproto.nullable) = false ]; + // forced_exit whether the exit is a forced exit + bool forced_exit = 5; +} + +message EventReserveSwapIn { + // The id of the storage provider who wants to swap in + uint32 storage_provider_id = 1; + // The id of the gvg family which the storage provider wants to swap in as primary sp + uint32 global_virtual_group_family_id = 2; + // The id of the gvg which the storage provider wants to swap in as secondary sp + uint32 global_virtual_group_id = 3; + // The id of the target sp who will be swapped + uint32 target_sp_id = 4; + // the expiration time of this reserved swapIn + uint64 expiration_time = 5; +} + +message EventCompleteSwapIn { + // The id of the storage provider who complete swap in. + uint32 storage_provider_id = 1; + // The id of the storage provider who swap in the family or gvgs + uint32 target_storage_provider_id = 2; + // The id of the gvg family + uint32 global_virtual_group_family_id = 3; + // The id of the gvg + uint32 global_virtual_group_id = 4; +} + +message EventCancelSwapIn { + // The id of the storage provider who cancel swap in. + uint32 storage_provider_id = 1; + // The id of the gvg family + uint32 global_virtual_group_family_id = 2; + // The id of the gvg + uint32 global_virtual_group_id = 3; + // The id of the target sp who was swapped from family or gvgs + uint32 target_sp_id = 4; +} + +message EventStorageProviderForcedExit { + // The id of the storage provider who wants to exit + uint32 storage_provider_id = 1; } diff --git a/proto/greenfield/virtualgroup/params.proto b/proto/greenfield/virtualgroup/params.proto index ea37f8004..5551902e4 100644 --- a/proto/greenfield/virtualgroup/params.proto +++ b/proto/greenfield/virtualgroup/params.proto @@ -25,4 +25,14 @@ message Params { uint32 max_global_virtual_group_num_per_family = 4; // if the store size reach the exceed, the family is not allowed to sever more buckets uint64 max_store_size_per_family = 5; + // the validity period that a successor SP can reserve to complete the swap for Global virtual group/family + string swap_in_validity_period = 6 [ + (cosmos_proto.scalar) = "cosmos.Int", + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int" + ]; + // the the number of sp allowed to exit concurrently. + string sp_concurrent_exit_num = 7 [ + (cosmos_proto.scalar) = "cosmos.Int", + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int" + ]; } diff --git a/proto/greenfield/virtualgroup/query.proto b/proto/greenfield/virtualgroup/query.proto index 0b71cc417..9a0f289b0 100644 --- a/proto/greenfield/virtualgroup/query.proto +++ b/proto/greenfield/virtualgroup/query.proto @@ -41,6 +41,16 @@ service Query { rpc AvailableGlobalVirtualGroupFamilies(AvailableGlobalVirtualGroupFamiliesRequest) returns (AvailableGlobalVirtualGroupFamiliesResponse) { option (google.api.http).get = "/greenfield/virtualgroup/available_global_virtual_group_families"; } + + // SwapInInfo gets reserved swapIn info for a specific global virtual group family or global virtual group + rpc SwapInInfo(QuerySwapInInfoRequest) returns (QuerySwapInInfoResponse) { + option (google.api.http).get = "/greenfield/virtualgroup/swap_in_info"; + } + + // GVGStatistics gets gvg statistics for a SP + rpc GVGStatistics(QuerySPGVGStatisticsRequest) returns (QuerySPGVGStatisticsResponse) { + option (google.api.http).get = "/greenfield/virtualgroup/sp_gvg_statistics"; + } } // QueryParamsRequest is request type for the Query/Params RPC method. @@ -92,3 +102,20 @@ message AvailableGlobalVirtualGroupFamiliesRequest { message AvailableGlobalVirtualGroupFamiliesResponse { repeated uint32 global_virtual_group_family_ids = 1; } + +message QuerySwapInInfoRequest { + uint32 global_virtual_group_family_id = 1; + uint32 global_virtual_group_id = 2; +} + +message QuerySwapInInfoResponse { + SwapInInfo swap_in_info = 1; +} + +message QuerySPGVGStatisticsRequest { + uint32 sp_id = 1; +} + +message QuerySPGVGStatisticsResponse { + GVGStatisticsWithinSP gvg_stats = 1; +} diff --git a/proto/greenfield/virtualgroup/tx.proto b/proto/greenfield/virtualgroup/tx.proto index 42c8eb3a2..63e045c49 100644 --- a/proto/greenfield/virtualgroup/tx.proto +++ b/proto/greenfield/virtualgroup/tx.proto @@ -29,6 +29,13 @@ service Msg { rpc CompleteStorageProviderExit(MsgCompleteStorageProviderExit) returns (MsgCompleteStorageProviderExitResponse); rpc CompleteSwapOut(MsgCompleteSwapOut) returns (MsgCompleteSwapOutResponse); rpc CancelSwapOut(MsgCancelSwapOut) returns (MsgCancelSwapOutResponse); + rpc ReserveSwapIn(MsgReserveSwapIn) returns (MsgReserveSwapInResponse); + rpc CancelSwapIn(MsgCancelSwapIn) returns (MsgCancelSwapInResponse); + rpc CompleteSwapIn(MsgCompleteSwapIn) returns (MsgCompleteSwapInResponse); + + // StorageProviderForcedExit defines a governance operation for a SP to be forced to exit + // The authority is defined in the keeper. + rpc StorageProviderForcedExit(MsgStorageProviderForcedExit) returns (MsgStorageProviderForcedExitResponse); } // MsgUpdateParams is the Msg/UpdateParams request type. @@ -182,8 +189,74 @@ message MsgStorageProviderExitResponse {} message MsgCompleteStorageProviderExit { option (cosmos.msg.v1.signer) = "storage_provider"; - // storage_provider defines the operator account address of the storage provider who want to exit from the greenfield storage network. + // storage_provider defines the operator account address of the storage provider who will exit string storage_provider = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + + // operator defines the operator account address who initials this transaction. + string operator = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; } message MsgCompleteStorageProviderExitResponse {} + +message MsgReserveSwapIn { + option (cosmos.msg.v1.signer) = "storage_provider"; + + // storage_provider defines the operator account address of the storage provider who want to swap into the virtual group family or global virtual group. + string storage_provider = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + // target_sp_id defines the storage provider id to be replaced by the successor sp. + uint32 target_sp_id = 2; + // virtual_group_family_id is the identifier of the virtual group family. + // if it set to non-zero, it represents that the operator swap in as the primary storage provider + // it it set to zero, it represents that the operator swap in as the secondary storage provider. + uint32 global_virtual_group_family_id = 3; + // global_virtual_group_id is a global virtual group ID associated with the swap in. + // It allows to be empty only when the operator wants to be the successor primary storage provider in a family. + uint32 global_virtual_group_id = 4; +} + +message MsgReserveSwapInResponse {} + +message MsgCompleteSwapIn { + option (cosmos.msg.v1.signer) = "storage_provider"; + + // storage_provider defines the operator account address of the storage provider who wants to swap into the virtual group family or global virtual group. + string storage_provider = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + // virtual_group_family_id is the identifier of the virtual group family. + // if it set to non-zero, it represents that the operator swap in as the primary storage provider + // it it set to zero, it represents that the operator swap in as the secondary storage provider. + uint32 global_virtual_group_family_id = 2; + // global_virtual_group_id is a global virtual group ID associated with the swap in. + // It allows to be empty only when the operator wants to be the successor primary storage provider in a family. + uint32 global_virtual_group_id = 3; +} + +message MsgCompleteSwapInResponse {} + +message MsgCancelSwapIn { + option (cosmos.msg.v1.signer) = "storage_provider"; + + // storage_provider defines the operator account address of the storage provider who want to swap into the virtual group family or global virtual group. + string storage_provider = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + // virtual_group_family_id is the identifier of the virtual group family. + // if it set to non-zero, it represents that the operator swap in as the primary storage provider + // it it set to zero, it represents that the operator swap in as the secondary storage provider. + uint32 global_virtual_group_family_id = 2; + // global_virtual_group_id is a global virtual group IDs associated with the swap in. + // It allows to be empty only when the operator wants to be the successor primary storage provider in a family. + uint32 global_virtual_group_id = 3; +} + +message MsgCancelSwapInResponse {} + +// this line is used by starport scaffolding # proto/tx/message +message MsgStorageProviderForcedExit { + option (cosmos.msg.v1.signer) = "authority"; + + // authority is the address that controls the module (defaults to x/gov unless overwritten). + string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + + // storage_provider defines the account address of the storage provider forced to exit + string storage_provider = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; +} + +message MsgStorageProviderForcedExitResponse {} diff --git a/proto/greenfield/virtualgroup/types.proto b/proto/greenfield/virtualgroup/types.proto index 2a1e40865..0104d1890 100644 --- a/proto/greenfield/virtualgroup/types.proto +++ b/proto/greenfield/virtualgroup/types.proto @@ -59,11 +59,18 @@ message GlobalVirtualGroupsBindingOnBucket { message GVGStatisticsWithinSP { // storage_provider_id defines the id of the sp which the statistics associated to uint32 storage_provider_id = 1; - // primary_sp_family_count defines the number of the family which this sp serves as primary sp + // primary_count defines the number of global virtual groups (GVGs) which this sp serves as primary sp uint32 primary_count = 2; // secondary_count defines the number of global virtual groups (GVGs) in // which this storage provider serves as a secondary storage provider. uint32 secondary_count = 3; + // Redundancy defines the number of gvg that sp serves as sp and secondary sp, which breaks the data redundancy requirement. + // In most case, this should not happen, + // during sp exit, a successor sp might need to swapIn GVG(s) that it is already a secondary and become the primary SP + // of whole family. + // a successor sp which need to swapIn a GVG as secondary must be unique to all other SP. So this will not be used for + // swapIn individual GVG as secondary + uint32 break_redundancy_reqmt_gvg_count = 4; } message SwapOutInfo { @@ -72,3 +79,12 @@ message SwapOutInfo { // successor_sp_id is the id of the successor storage provider. uint32 successor_sp_id = 2; } + +message SwapInInfo { + // successor_sp_id defines the id of SP who wants to join the family or GVG + uint32 successor_sp_id = 1; + // target_sp_id is the id of SP in the family or GVG to be swapped. + uint32 target_sp_id = 2; + // expiration_time is the expiration of epoch time for the swapInInfo + uint64 expiration_time = 3; +} diff --git a/swagger/static/swagger.yaml b/swagger/static/swagger.yaml index 7139239f6..a694c0dc5 100644 --- a/swagger/static/swagger.yaml +++ b/swagger/static/swagger.yaml @@ -1896,6 +1896,7 @@ paths: - STATUS_IN_JAILED - STATUS_GRACEFUL_EXITING - STATUS_IN_MAINTENANCE + - STATUS_FORCED_EXITING default: STATUS_IN_SERVICE description: Status is the status of a storage provider. endpoint: @@ -2096,6 +2097,7 @@ paths: - STATUS_IN_JAILED - STATUS_GRACEFUL_EXITING - STATUS_IN_MAINTENANCE + - STATUS_FORCED_EXITING default: STATUS_IN_SERVICE description: Status is the status of a storage provider. endpoint: @@ -2236,6 +2238,7 @@ paths: - STATUS_IN_JAILED - STATUS_GRACEFUL_EXITING - STATUS_IN_MAINTENANCE + - STATUS_FORCED_EXITING default: STATUS_IN_SERVICE description: Status is the status of a storage provider. endpoint: @@ -6110,6 +6113,14 @@ paths: title: >- if the store size reach the exceed, the family is not allowed to sever more buckets + swap_in_validity_period: + type: string + title: >- + the validity period that a successor SP can reserve to + complete the swap for Global virtual group/family + sp_concurrent_exit_num: + type: string + description: the the number of sp allowed to exit concurrently. description: >- QueryParamsResponse is response type for the Query/Params RPC method. @@ -6137,6 +6148,158 @@ paths: format: byte tags: - Query + /greenfield/virtualgroup/sp_gvg_statistics: + get: + summary: GVGStatistics gets gvg statistics for a SP + operationId: GVGStatistics + responses: + '200': + description: A successful response. + schema: + type: object + properties: + gvg_stats: + type: object + properties: + storage_provider_id: + type: integer + format: int64 + title: >- + storage_provider_id defines the id of the sp which the + statistics associated to + primary_count: + type: integer + format: int64 + title: >- + primary_count defines the number of global virtual groups + (GVGs) which this sp serves as primary sp + secondary_count: + type: integer + format: int64 + description: >- + secondary_count defines the number of global virtual + groups (GVGs) in + + which this storage provider serves as a secondary storage + provider. + break_redundancy_reqmt_gvg_count: + type: integer + format: int64 + title: >- + Redundancy defines the number of gvg that sp serves as sp + and secondary sp, which breaks the data redundancy + requirement. + + In most case, this should not happen, + + during sp exit, a successor sp might need to swapIn GVG(s) + that it is already a secondary and become the primary SP + + of whole family. + + a successor sp which need to swapIn a GVG as secondary + must be unique to all other SP. So this will not be used + for + + swapIn individual GVG as secondary + default: + description: An unexpected error response. + schema: + type: object + properties: + error: + type: string + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + type_url: + type: string + value: + type: string + format: byte + parameters: + - name: sp_id + in: query + required: false + type: integer + format: int64 + tags: + - Query + /greenfield/virtualgroup/swap_in_info: + get: + summary: >- + SwapInInfo gets reserved swapIn info for a specific global virtual group + family or global virtual group + operationId: SwapInInfo + responses: + '200': + description: A successful response. + schema: + type: object + properties: + swap_in_info: + type: object + properties: + successor_sp_id: + type: integer + format: int64 + title: >- + successor_sp_id defines the id of SP who wants to join the + family or GVG + target_sp_id: + type: integer + format: int64 + description: >- + target_sp_id is the id of SP in the family or GVG to be + swapped. + expiration_time: + type: string + format: uint64 + title: >- + expiration_time is the expiration of epoch time for the + swapInInfo + default: + description: An unexpected error response. + schema: + type: object + properties: + error: + type: string + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + type_url: + type: string + value: + type: string + format: byte + parameters: + - name: global_virtual_group_family_id + in: query + required: false + type: integer + format: int64 + - name: global_virtual_group_id + in: query + required: false + type: integer + format: int64 + tags: + - Query /cosmos/auth/v1beta1/account_info/{address}: get: summary: AccountInfo queries account info which is common to all account types. @@ -33648,6 +33811,7 @@ definitions: - STATUS_IN_JAILED - STATUS_GRACEFUL_EXITING - STATUS_IN_MAINTENANCE + - STATUS_FORCED_EXITING default: STATUS_IN_SERVICE description: Status is the status of a storage provider. endpoint: @@ -33767,6 +33931,7 @@ definitions: - STATUS_IN_JAILED - STATUS_GRACEFUL_EXITING - STATUS_IN_MAINTENANCE + - STATUS_FORCED_EXITING default: STATUS_IN_SERVICE description: Status is the status of a storage provider. endpoint: @@ -33863,6 +34028,7 @@ definitions: - STATUS_IN_JAILED - STATUS_GRACEFUL_EXITING - STATUS_IN_MAINTENANCE + - STATUS_FORCED_EXITING default: STATUS_IN_SERVICE description: Status is the status of a storage provider. endpoint: @@ -33950,6 +34116,7 @@ definitions: - STATUS_IN_JAILED - STATUS_GRACEFUL_EXITING - STATUS_IN_MAINTENANCE + - STATUS_FORCED_EXITING default: STATUS_IN_SERVICE description: Status is the status of a storage provider. greenfield.sp.StorageProvider: @@ -34002,6 +34169,7 @@ definitions: - STATUS_IN_JAILED - STATUS_GRACEFUL_EXITING - STATUS_IN_MAINTENANCE + - STATUS_FORCED_EXITING default: STATUS_IN_SERVICE description: Status is the status of a storage provider. endpoint: @@ -36572,6 +36740,45 @@ definitions: items: type: integer format: int64 + greenfield.virtualgroup.GVGStatisticsWithinSP: + type: object + properties: + storage_provider_id: + type: integer + format: int64 + title: >- + storage_provider_id defines the id of the sp which the statistics + associated to + primary_count: + type: integer + format: int64 + title: >- + primary_count defines the number of global virtual groups (GVGs) which + this sp serves as primary sp + secondary_count: + type: integer + format: int64 + description: |- + secondary_count defines the number of global virtual groups (GVGs) in + which this storage provider serves as a secondary storage provider. + break_redundancy_reqmt_gvg_count: + type: integer + format: int64 + title: >- + Redundancy defines the number of gvg that sp serves as sp and + secondary sp, which breaks the data redundancy requirement. + + In most case, this should not happen, + + during sp exit, a successor sp might need to swapIn GVG(s) that it is + already a secondary and become the primary SP + + of whole family. + + a successor sp which need to swapIn a GVG as secondary must be unique + to all other SP. So this will not be used for + + swapIn individual GVG as secondary greenfield.virtualgroup.GlobalVirtualGroupFamily: type: object properties: @@ -36625,6 +36832,14 @@ definitions: title: >- if the store size reach the exceed, the family is not allowed to sever more buckets + swap_in_validity_period: + type: string + title: >- + the validity period that a successor SP can reserve to complete the + swap for Global virtual group/family + sp_concurrent_exit_num: + type: string + description: the the number of sp allowed to exit concurrently. description: Params defines the parameters for the module. greenfield.virtualgroup.QueryGlobalVirtualGroupByFamilyIDResponse: type: object @@ -36857,7 +37072,97 @@ definitions: title: >- if the store size reach the exceed, the family is not allowed to sever more buckets + swap_in_validity_period: + type: string + title: >- + the validity period that a successor SP can reserve to complete + the swap for Global virtual group/family + sp_concurrent_exit_num: + type: string + description: the the number of sp allowed to exit concurrently. description: QueryParamsResponse is response type for the Query/Params RPC method. + greenfield.virtualgroup.QuerySPGVGStatisticsResponse: + type: object + properties: + gvg_stats: + type: object + properties: + storage_provider_id: + type: integer + format: int64 + title: >- + storage_provider_id defines the id of the sp which the statistics + associated to + primary_count: + type: integer + format: int64 + title: >- + primary_count defines the number of global virtual groups (GVGs) + which this sp serves as primary sp + secondary_count: + type: integer + format: int64 + description: >- + secondary_count defines the number of global virtual groups (GVGs) + in + + which this storage provider serves as a secondary storage + provider. + break_redundancy_reqmt_gvg_count: + type: integer + format: int64 + title: >- + Redundancy defines the number of gvg that sp serves as sp and + secondary sp, which breaks the data redundancy requirement. + + In most case, this should not happen, + + during sp exit, a successor sp might need to swapIn GVG(s) that it + is already a secondary and become the primary SP + + of whole family. + + a successor sp which need to swapIn a GVG as secondary must be + unique to all other SP. So this will not be used for + + swapIn individual GVG as secondary + greenfield.virtualgroup.QuerySwapInInfoResponse: + type: object + properties: + swap_in_info: + type: object + properties: + successor_sp_id: + type: integer + format: int64 + title: >- + successor_sp_id defines the id of SP who wants to join the family + or GVG + target_sp_id: + type: integer + format: int64 + description: target_sp_id is the id of SP in the family or GVG to be swapped. + expiration_time: + type: string + format: uint64 + title: expiration_time is the expiration of epoch time for the swapInInfo + greenfield.virtualgroup.SwapInInfo: + type: object + properties: + successor_sp_id: + type: integer + format: int64 + title: >- + successor_sp_id defines the id of SP who wants to join the family or + GVG + target_sp_id: + type: integer + format: int64 + description: target_sp_id is the id of SP in the family or GVG to be swapped. + expiration_time: + type: string + format: uint64 + title: expiration_time is the expiration of epoch time for the swapInInfo cosmos.auth.v1beta1.BaseAccount: type: object properties: diff --git a/x/challenge/abci.go b/x/challenge/abci.go index 9f85939c5..240234e6d 100644 --- a/x/challenge/abci.go +++ b/x/challenge/abci.go @@ -88,7 +88,7 @@ func EndBlocker(ctx sdk.Context, keeper k.Keeper) { if !found { continue } - if sp.Status != sptypes.STATUS_IN_SERVICE && sp.Status != sptypes.STATUS_GRACEFUL_EXITING { + if sp.Status != sptypes.STATUS_IN_SERVICE && sp.Status != sptypes.STATUS_GRACEFUL_EXITING && sp.Status != sptypes.STATUS_FORCED_EXITING { continue } diff --git a/x/challenge/keeper/msg_server_submit.go b/x/challenge/keeper/msg_server_submit.go index cd0849d21..549794adc 100644 --- a/x/challenge/keeper/msg_server_submit.go +++ b/x/challenge/keeper/msg_server_submit.go @@ -24,7 +24,8 @@ func (k msgServer) Submit(goCtx context.Context, msg *types.MsgSubmit) (*types.M return nil, types.ErrUnknownBucketObject } sp := k.StorageKeeper.MustGetPrimarySPForBucket(ctx, bucketInfo) - if sp.Status != sptypes.STATUS_IN_SERVICE && sp.Status != sptypes.STATUS_GRACEFUL_EXITING { + + if sp.Status != sptypes.STATUS_IN_SERVICE && sp.Status != sptypes.STATUS_GRACEFUL_EXITING && sp.Status != sptypes.STATUS_FORCED_EXITING { return nil, types.ErrInvalidSpStatus } diff --git a/x/payment/types/expected_keepers_mocks.go b/x/payment/types/expected_keepers_mocks.go index 9450c3ce7..35cb18582 100644 --- a/x/payment/types/expected_keepers_mocks.go +++ b/x/payment/types/expected_keepers_mocks.go @@ -182,6 +182,20 @@ func (mr *MockBankKeeperMockRecorder) SendCoinsFromModuleToAccount(ctx, senderMo return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendCoinsFromModuleToAccount", reflect.TypeOf((*MockBankKeeper)(nil).SendCoinsFromModuleToAccount), ctx, senderModule, recipientAddr, amt) } +// SendCoinsFromModuleToModule mocks base method. +func (m *MockBankKeeper) SendCoinsFromModuleToModule(ctx types.Context, senderModule string, recipientModule string, amt types.Coins) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "SendCoinsFromModuleToModule", ctx, senderModule, recipientModule, amt) + ret0, _ := ret[0].(error) + return ret0 +} + +// SendCoinsFromModuleToModule indicates an expected call of SendCoinsFromModuleToAccount. +func (mr *MockBankKeeperMockRecorder) SendCoinsFromModuleToModule(ctx, senderModule, recipientModule, amt interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendCoinsFromModuleToAccount", reflect.TypeOf((*MockBankKeeper)(nil).SendCoinsFromModuleToModule), ctx, senderModule, recipientModule, amt) +} + // SpendableCoins mocks base method. func (m *MockBankKeeper) SpendableCoins(ctx types.Context, addr types.AccAddress) types.Coins { m.ctrl.T.Helper() diff --git a/x/sp/keeper/msg_server.go b/x/sp/keeper/msg_server.go index f96b9310a..00194df1a 100644 --- a/x/sp/keeper/msg_server.go +++ b/x/sp/keeper/msg_server.go @@ -424,7 +424,7 @@ func (k msgServer) UpdateSpStatus(goCtx context.Context, msg *types.MsgUpdateSto return nil, types.ErrStorageProviderStatusUpdateNotAllow } k.UpdateToInService(ctx, sp) - case types.STATUS_IN_JAILED, types.STATUS_GRACEFUL_EXITING: + case types.STATUS_IN_JAILED, types.STATUS_GRACEFUL_EXITING, types.STATUS_FORCED_EXITING: return nil, types.ErrStorageProviderStatusUpdateNotAllow } k.SetStorageProvider(ctx, sp) diff --git a/x/sp/types/errors.go b/x/sp/types/errors.go index 3b6594550..d740dc64f 100644 --- a/x/sp/types/errors.go +++ b/x/sp/types/errors.go @@ -24,6 +24,7 @@ var ( ErrStorageProviderStatusUpdateNotAllow = errors.Register(ModuleName, 16, "StorageProvider status is not allow to change") ErrStorageProviderMaintenanceAddrExists = errors.Register(ModuleName, 17, "StorageProvider already exist for this maintenance address; must use new StorageProvider maintenance address.") ErrStorageProviderPriceUpdateNotAllow = errors.Register(ModuleName, 18, "StorageProvider update price is disallowed") + ErrStorageProviderWrongStatus = errors.Register(ModuleName, 19, "StorageProvider is in wrong status") ErrSignerNotGovModule = errors.Register(ModuleName, 40, "signer is not gov module account") ErrSignerEmpty = errors.Register(ModuleName, 41, "signer is empty") diff --git a/x/sp/types/types.pb.go b/x/sp/types/types.pb.go index 36d19af42..0d9d909af 100644 --- a/x/sp/types/types.pb.go +++ b/x/sp/types/types.pb.go @@ -34,6 +34,7 @@ const ( STATUS_IN_JAILED Status = 1 STATUS_GRACEFUL_EXITING Status = 2 STATUS_IN_MAINTENANCE Status = 3 + STATUS_FORCED_EXITING Status = 4 ) var Status_name = map[int32]string{ @@ -41,6 +42,7 @@ var Status_name = map[int32]string{ 1: "STATUS_IN_JAILED", 2: "STATUS_GRACEFUL_EXITING", 3: "STATUS_IN_MAINTENANCE", + 4: "STATUS_FORCED_EXITING", } var Status_value = map[string]int32{ @@ -48,6 +50,7 @@ var Status_value = map[string]int32{ "STATUS_IN_JAILED": 1, "STATUS_GRACEFUL_EXITING": 2, "STATUS_IN_MAINTENANCE": 3, + "STATUS_FORCED_EXITING": 4, } func (x Status) String() string { @@ -581,70 +584,71 @@ func init() { func init() { proto.RegisterFile("greenfield/sp/types.proto", fileDescriptor_7a9af9b5be8c2eeb) } var fileDescriptor_7a9af9b5be8c2eeb = []byte{ - // 999 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x56, 0xc1, 0x6e, 0x23, 0x45, - 0x10, 0xf5, 0xd8, 0x8e, 0xb3, 0x29, 0x27, 0xb1, 0xd3, 0x49, 0xd8, 0x49, 0x10, 0xde, 0xc8, 0x87, - 0x10, 0x56, 0x8a, 0xad, 0x0d, 0x87, 0x95, 0x80, 0x8b, 0x63, 0x9b, 0xc8, 0xb0, 0x1b, 0x2d, 0xe3, - 0x2c, 0x42, 0x20, 0x34, 0x6a, 0x4f, 0x57, 0x9c, 0x56, 0xec, 0xee, 0xd9, 0xee, 0x76, 0x16, 0xff, - 0x01, 0x47, 0xbe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, 0xc1, 0x5b, 0x4b, 0xe0, 0x33, 0x3e, 0xc6, 0x3e, 0x06, 0xe4, 0x3b, - 0x00, 0x85, 0x94, 0xf9, 0x61, 0x24, 0x65, 0x27, 0xe3, 0xff, 0x5c, 0x69, 0x07, 0x83, 0xb9, 0x2b, - 0xed, 0x60, 0xe0, 0xad, 0x44, 0x7a, 0x49, 0x66, 0xfb, 0x50, 0x39, 0x57, 0x88, 0x7e, 0x7c, 0xc2, - 0x8b, 0x89, 0x34, 0x34, 0x9e, 0x9d, 0xa2, 0xb7, 0x16, 0xc1, 0x1e, 0x52, 0xf6, 0x55, 0x04, 0x92, - 0xef, 0xa1, 0xac, 0x8d, 0x54, 0x68, 0xb3, 0x58, 0xba, 0x83, 0x2c, 0x20, 0x16, 0x8c, 0xd3, 0xa8, - 0xff, 0x9d, 0x07, 0x72, 0x32, 0x92, 0x03, 0x3a, 0x4a, 0x2a, 0x87, 0x59, 0x76, 0xb7, 0x4b, 0xe4, - 0x2c, 0x2e, 0x51, 0xfe, 0x6e, 0x4b, 0x34, 0x82, 0xcd, 0x50, 0xf1, 0x31, 0x55, 0x53, 0x7f, 0xbe, - 0x04, 0x77, 0x71, 0x11, 0x1b, 0x56, 0x78, 0xee, 0x91, 0x43, 0xd8, 0xd6, 0x18, 0x48, 0xc1, 0x6e, - 0x9f, 0x57, 0xbc, 0x83, 0xf3, 0x36, 0x33, 0xe9, 0xd9, 0x89, 0xf5, 0x67, 0x40, 0xfa, 0xe1, 0xd3, - 0xd9, 0x36, 0x89, 0x46, 0x58, 0x93, 0x4f, 0x60, 0x59, 0x61, 0x20, 0x15, 0x8b, 0x46, 0xa6, 0x70, - 0x50, 0x3e, 0xda, 0xbb, 0x35, 0x99, 0x73, 0x0c, 0x2f, 0x0e, 0xf4, 0x52, 0x42, 0xfd, 0x67, 0x07, - 0x36, 0xfe, 0xe3, 0x26, 0xef, 0x41, 0xe9, 0x02, 0xf9, 0xf0, 0xc2, 0xd8, 0x3b, 0xb4, 0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xca, 0xa0, 0x14, 0x7f, 0x41, 0x7c, 0xfc, 0x4f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xc4, - 0xb8, 0x2c, 0x5d, 0xbe, 0x08, 0x00, 0x00, + // 1013 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x56, 0xc1, 0x6e, 0xdb, 0x46, + 0x13, 0x16, 0x25, 0x59, 0x8e, 0x47, 0xb6, 0xa5, 0xac, 0xed, 0x3f, 0xb4, 0x7f, 0x54, 0x31, 0x74, + 0x70, 0xdd, 0x00, 0x96, 0x10, 0xf7, 0x10, 0xa0, 0xed, 0x45, 0x96, 0x14, 0x83, 0x6d, 0xe2, 0xa6, + 0x94, 0x53, 0x14, 0x2d, 0x0a, 0x62, 0x45, 0x8e, 0xe5, 0x85, 0xa5, 0x5d, 0x66, 0x77, 0xe5, 0x54, + 0x6f, 0xd0, 0x53, 0xd1, 0x27, 0xe8, 0xa1, 0x7d, 0x82, 0x02, 0x39, 0xf5, 0x09, 0x72, 0x0c, 0x72, + 0x2a, 0x7a, 0x08, 0x0a, 0xfb, 0x29, 0x7a, 0x2b, 0x48, 0x2e, 0x29, 0xd6, 0x3d, 0x08, 0x05, 0x7c, + 0x92, 0xe6, 0x9b, 0xf9, 0xbe, 0x1d, 0xce, 0xce, 0x0c, 0x09, 0xdb, 0x23, 0x89, 0xc8, 0xcf, 0x18, + 0x8e, 0x83, 0xb6, 0x0a, 0xdb, 0x7a, 0x16, 0xa2, 0x6a, 0x85, 0x52, 0x68, 0x41, 0xd6, 0xe6, 0xae, + 0x96, 0x0a, 0x77, 0x1a, 0xbe, 0x50, 0x13, 0xa1, 0xda, 0x43, 0xaa, 0xb0, 0x7d, 0xf9, 0x70, 0x88, + 0x9a, 0x3e, 0x6c, 0xfb, 0x82, 0xf1, 0x24, 0x7c, 0x67, 0x3b, 0xf1, 0x7b, 0xb1, 0xd5, 0x4e, 0x0c, + 0xe3, 0xda, 0x1c, 0x89, 0x91, 0x48, 0xf0, 0xe8, 0x5f, 0x82, 0x36, 0x7f, 0xb6, 0xa0, 0xda, 0x43, + 0xe5, 0x4b, 0x16, 0x6a, 0x26, 0x38, 0xb1, 0x61, 0x79, 0x22, 0x38, 0xbb, 0x40, 0x69, 0x5b, 0xbb, + 0xd6, 0xfe, 0x8a, 0x9b, 0x9a, 0x64, 0x07, 0xee, 0xb0, 0x00, 0xb9, 0x66, 0x7a, 0x66, 0x17, 0x63, + 0x57, 0x66, 0x47, 0xac, 0x97, 0x38, 0x54, 0x4c, 0xa3, 0x5d, 0x4a, 0x58, 0xc6, 0x24, 0x1f, 0x40, + 0x5d, 0xa1, 0x3f, 0x95, 0x4c, 0xcf, 0x3c, 0x5f, 0x70, 0x4d, 0x7d, 0x6d, 0x97, 0xe3, 0x90, 0x5a, + 0x8a, 0x77, 0x13, 0x38, 0x12, 0x09, 0x50, 0x53, 0x36, 0x56, 0xf6, 0x52, 0x22, 0x62, 0xcc, 0xe6, + 0x6f, 0x4b, 0x50, 0x1b, 0x68, 0x21, 0xe9, 0x08, 0x9f, 0x49, 0x71, 0xc9, 0x02, 0x94, 0x64, 0x1d, + 0x8a, 0x2c, 0x88, 0x73, 0x5c, 0x73, 0x8b, 0x2c, 0x20, 0x5d, 0xa8, 0x8b, 0x10, 0x25, 0xd5, 0x42, + 0x7a, 0x34, 0x08, 0x24, 0x2a, 0x95, 0xa4, 0x79, 0x64, 0xbf, 0x7d, 0x75, 0xb0, 0x69, 0x4a, 0xd1, + 0x49, 0x3c, 0x03, 0x2d, 0x19, 0x1f, 0xb9, 0xb5, 0x94, 0x61, 0x60, 0xd2, 0x81, 0xda, 0xd9, 0x94, + 0x07, 0x8c, 0x8f, 0x32, 0x8d, 0xd2, 0x02, 0x8d, 0x75, 0x43, 0x48, 0x25, 0x3e, 0x86, 0x55, 0x85, + 0x74, 0x9c, 0xf1, 0xcb, 0x0b, 0xf8, 0xd5, 0x28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0x4f, 0x3b, 0xce, 0x93, 0x7e, 0xaf, 0x6e, 0x91, 0xff, 0xc3, + 0x3d, 0x83, 0x1e, 0xbb, 0x9d, 0x6e, 0xff, 0xf1, 0xf3, 0x27, 0x5e, 0xff, 0x2b, 0xe7, 0xd4, 0x39, + 0x39, 0xae, 0x17, 0xc9, 0x36, 0x6c, 0xcd, 0x29, 0x4f, 0x3b, 0xce, 0xc9, 0x69, 0xff, 0xa4, 0x73, + 0xd2, 0xed, 0xd7, 0x4b, 0x39, 0xd7, 0xe3, 0xcf, 0xdd, 0x6e, 0xbf, 0x97, 0xb1, 0xca, 0x3b, 0xe5, + 0xef, 0x7f, 0x69, 0x14, 0x8e, 0x7a, 0xaf, 0xaf, 0x1a, 0xd6, 0x9b, 0xab, 0x86, 0xf5, 0xe7, 0x55, + 0xc3, 0xfa, 0xf1, 0xba, 0x51, 0x78, 0x73, 0xdd, 0x28, 0xfc, 0x7e, 0xdd, 0x28, 0x7c, 0xfd, 0x20, + 0x77, 0xd1, 0x43, 0x3e, 0x3c, 0xf0, 0xcf, 0x29, 0xe3, 0xed, 0xdc, 0xa7, 0xcb, 0x77, 0xd9, 0xc7, + 0xcb, 0xb0, 0x12, 0x7f, 0x5d, 0x7c, 0xf8, 0x77, 0x00, 0x00, 0x00, 0xff, 0xff, 0xf2, 0xc1, 0x3c, + 0xf4, 0xda, 0x08, 0x00, 0x00, } func (m *Description) Marshal() (dAtA []byte, err error) { diff --git a/x/storage/keeper/cross_app_bucket.go b/x/storage/keeper/cross_app_bucket.go index b2f510924..3b9b84870 100644 --- a/x/storage/keeper/cross_app_bucket.go +++ b/x/storage/keeper/cross_app_bucket.go @@ -4,12 +4,11 @@ import ( "encoding/hex" "cosmossdk.io/math" - sdk "github.com/cosmos/cosmos-sdk/types" + upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" "github.com/bnb-chain/greenfield/types/common" "github.com/bnb-chain/greenfield/x/storage/types" - upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" ) var _ sdk.CrossChainApplication = &BucketApp{} diff --git a/x/storage/keeper/keeper.go b/x/storage/keeper/keeper.go index ecb081f0c..d3f0cc228 100644 --- a/x/storage/keeper/keeper.go +++ b/x/storage/keeper/keeper.go @@ -11,6 +11,7 @@ import ( "github.com/cosmos/cosmos-sdk/store/prefix" storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" + upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" "github.com/cosmos/gogoproto/proto" "github.com/bnb-chain/greenfield/internal/sequence" @@ -375,6 +376,13 @@ func (k Keeper) UpdateBucketInfo(ctx sdk.Context, operator sdk.AccAddress, bucke return types.ErrSourceTypeMismatch } + if ctx.IsUpgraded(upgradetypes.Hulunbeier) { + sp := k.MustGetPrimarySPForBucket(ctx, bucketInfo) + if sp.Status == sptypes.STATUS_GRACEFUL_EXITING || sp.Status == sptypes.STATUS_FORCED_EXITING { + return types.ErrUpdateQuotaFailed.Wrapf("The SP is in %s, bucket can not be updated", sp.Status) + } + } + // check permission effect := k.VerifyBucketPermission(ctx, bucketInfo, operator, permtypes.ACTION_UPDATE_BUCKET_INFO, nil) if effect != permtypes.EFFECT_ALLOW { @@ -1157,7 +1165,13 @@ func (k Keeper) DiscontinueObject(ctx sdk.Context, operator sdk.AccAddress, buck spInState := k.MustGetPrimarySPForBucket(ctx, bucketInfo) if sp.Id != spInState.Id { - return errors.Wrapf(types.ErrAccessDenied, "only primary sp is allowed to do discontinue objects") + if !ctx.IsUpgraded(upgradetypes.Hulunbeier) { + return errors.Wrapf(types.ErrAccessDenied, "only primary sp is allowed to do discontinue objects") + } + swapInInfo, found := k.virtualGroupKeeper.GetSwapInInfo(ctx, bucketInfo.GlobalVirtualGroupFamilyId, virtualgroupmoduletypes.NoSpecifiedGVGId) + if !found || swapInInfo.TargetSpId != spInState.Id || swapInInfo.SuccessorSpId != sp.Id { + return errors.Wrapf(types.ErrAccessDenied, "the sp is not allowed to do discontinue objects") + } } count := k.GetDiscontinueObjectCount(ctx, operator) diff --git a/x/storage/types/expected_keepers.go b/x/storage/types/expected_keepers.go index 9e9342752..8f2dd357d 100644 --- a/x/storage/types/expected_keepers.go +++ b/x/storage/types/expected_keepers.go @@ -95,6 +95,7 @@ type VirtualGroupKeeper interface { SettleAndDistributeGVG(ctx sdk.Context, gvg *types.GlobalVirtualGroup) error GetAndCheckGVGFamilyAvailableForNewBucket(ctx sdk.Context, familyID uint32) (*types.GlobalVirtualGroupFamily, error) GetGlobalVirtualGroupIfAvailable(ctx sdk.Context, gvgID uint32, expectedStoreSize uint64) (*types.GlobalVirtualGroup, error) + GetSwapInInfo(ctx sdk.Context, familyID, gvgID uint32) (*types.SwapInInfo, bool) } // StorageKeeper used by the cross-chain applications diff --git a/x/storage/types/expected_keepers_mocks.go b/x/storage/types/expected_keepers_mocks.go index ebfffd9fb..ba7bf24cc 100644 --- a/x/storage/types/expected_keepers_mocks.go +++ b/x/storage/types/expected_keepers_mocks.go @@ -876,6 +876,21 @@ func (mr *MockVirtualGroupKeeperMockRecorder) SettleAndDistributeGVGFamily(ctx, return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SettleAndDistributeGVGFamily", reflect.TypeOf((*MockVirtualGroupKeeper)(nil).SettleAndDistributeGVGFamily), ctx, sp, family) } +// GetSwapInInfo mocks base method. +func (m *MockVirtualGroupKeeper) GetSwapInInfo(ctx types3.Context, familyID, gvgID uint32) (*types2.SwapInInfo, bool) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetSwapInInfo", ctx, familyID, gvgID) + ret0, _ := ret[0].(*types2.SwapInInfo) + ret1, _ := ret[1].(bool) + return ret0, ret1 +} + +// GetSwapInInfo indicates an expected call of GetSwapInInfo. +func (mr *MockVirtualGroupKeeperMockRecorder) GetSwapInInfo(ctx, familyID, gvgID interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetSwapInInfo", reflect.TypeOf((*MockVirtualGroupKeeper)(nil).GetSwapInInfo), ctx, familyID, gvgID) +} + // MockStorageKeeper is a mock of StorageKeeper interface. type MockStorageKeeper struct { ctrl *gomock.Controller diff --git a/x/virtualgroup/keeper/grpc_query.go b/x/virtualgroup/keeper/grpc_query.go index 2fe684529..fe8c994d9 100644 --- a/x/virtualgroup/keeper/grpc_query.go +++ b/x/virtualgroup/keeper/grpc_query.go @@ -119,3 +119,49 @@ func (k Keeper) AvailableGlobalVirtualGroupFamilies(goCtx context.Context, req * } return &types.AvailableGlobalVirtualGroupFamiliesResponse{GlobalVirtualGroupFamilyIds: availableFamilyIds}, nil } + +func (k Keeper) SwapInInfo(goCtx context.Context, req *types.QuerySwapInInfoRequest) (*types.QuerySwapInInfoResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + ctx := sdk.UnwrapSDKContext(goCtx) + swapInInfo, found := k.GetSwapInInfo(ctx, req.GetGlobalVirtualGroupFamilyId(), req.GetGlobalVirtualGroupId()) + if !found { + return nil, types.ErrSwapInInfoNotExist + } + return &types.QuerySwapInInfoResponse{ + SwapInInfo: swapInInfo, + }, nil +} + +func (k Keeper) GetSwapInInfo(ctx sdk.Context, globalVirtualGroupFamilyId, globalVirtualGroupId uint32) (*types.SwapInInfo, bool) { + store := ctx.KVStore(k.storeKey) + var key []byte + if globalVirtualGroupFamilyId != types.NoSpecifiedFamilyId { + key = types.GetSwapInFamilyKey(globalVirtualGroupFamilyId) + } else { + key = types.GetSwapInGVGKey(globalVirtualGroupId) + } + bz := store.Get(key) + if bz == nil { + return nil, false + } + swapInInfo := &types.SwapInInfo{} + k.cdc.MustUnmarshal(bz, swapInInfo) + return swapInInfo, true +} + +func (k Keeper) GVGStatistics(goCtx context.Context, req *types.QuerySPGVGStatisticsRequest) (*types.QuerySPGVGStatisticsResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + ctx := sdk.UnwrapSDKContext(goCtx) + + stats, found := k.GetGVGStatisticsWithinSP(ctx, req.GetSpId()) + if !found { + return nil, types.ErrGVGStatisticsNotExist + } + return &types.QuerySPGVGStatisticsResponse{ + GvgStats: stats, + }, nil +} diff --git a/x/virtualgroup/keeper/keeper.go b/x/virtualgroup/keeper/keeper.go index 2d96fbf41..a3c9d6dfc 100644 --- a/x/virtualgroup/keeper/keeper.go +++ b/x/virtualgroup/keeper/keeper.go @@ -278,8 +278,7 @@ func (k Keeper) GetAvailableStakingTokens(ctx sdk.Context, gvg *types.GlobalVirt return gvg.TotalDeposit.Sub(mustStakingTokens) } -func (k Keeper) SwapOutAsPrimarySP(ctx sdk.Context, primarySP, successorSP *sptypes.StorageProvider, familyID uint32) error { - +func (k Keeper) SwapAsPrimarySP(ctx sdk.Context, primarySP, successorSP *sptypes.StorageProvider, familyID uint32, swapIn bool) error { family, found := k.GetGVGFamily(ctx, familyID) if !found { return types.ErrGVGFamilyNotExist @@ -298,11 +297,20 @@ func (k Keeper) SwapOutAsPrimarySP(ctx sdk.Context, primarySP, successorSP *spty return types.ErrGVGNotExist } if gvg.PrimarySpId != primarySP.Id { + if swapIn { + return types.ErrSwapInFailed.Wrapf( + "the primary id (%d) in global virtual group does not match the target primary sp id (%d)", gvg.PrimarySpId, primarySP.Id) + } return types.ErrSwapOutFailed.Wrapf( "the primary id (%d) in global virtual group is not match the primary sp id (%d)", gvg.PrimarySpId, primarySP.Id) } - for _, spID := range gvg.SecondarySpIds { - if spID == successorSP.Id { + for _, secondarySPID := range gvg.SecondarySpIds { + if secondarySPID == successorSP.Id { + // the successor SP might have played as secondary SP already in this GVG + if swapIn { + dstStat.BreakRedundancyReqmtGvgCount++ + break + } return types.ErrSwapOutFailed.Wrapf("the successor primary sp(ID: %d) can not be the secondary sp of gvg(%s).", successorSP.Id, gvg.String()) } } @@ -327,15 +335,24 @@ func (k Keeper) SwapOutAsPrimarySP(ctx sdk.Context, primarySP, successorSP *spty // settlement err := k.SettleAndDistributeGVGFamily(ctx, primarySP, family) if err != nil { + if swapIn { + return types.ErrSwapInFailed.Wrapf("fail to settle GVG family %d", familyID) + } return types.ErrSwapOutFailed.Wrapf("fail to settle GVG family %d", familyID) } if err := k.SetGVGFamilyAndEmitUpdateEvent(ctx, family); err != nil { + if swapIn { + return types.ErrSwapInFailed.Wrapf("failed to set gvg family and emit update event, err: %s", err) + } return types.ErrSwapOutFailed.Wrapf("failed to set gvg family and emit update event, err: %s", err) } for _, gvg := range gvgs { if err := k.SetGVGAndEmitUpdateEvent(ctx, gvg); err != nil { + if swapIn { + return types.ErrSwapInFailed.Wrapf("failed to set gvg and emit update event, err: %s", err) + } return types.ErrSwapOutFailed.Wrapf("failed to set gvg and emit update event, err: %s", err) } } @@ -610,7 +627,7 @@ func (k Keeper) CompleteSwapOut(ctx sdk.Context, gvgFamilyID uint32, gvgIDs []ui return sptypes.ErrStorageProviderNotFound.Wrapf("The storage provider(ID: %d) not found when complete swap out.", swapOutInfo.SpId) } - err := k.SwapOutAsPrimarySP(ctx, sp, successorSP, gvgFamilyID) + err := k.SwapAsPrimarySP(ctx, sp, successorSP, gvgFamilyID, false) if err != nil { return err } @@ -650,3 +667,211 @@ func (k Keeper) CompleteSwapOut(ctx sdk.Context, gvgFamilyID uint32, gvgIDs []ui } return nil } + +func (k Keeper) SwapIn(ctx sdk.Context, gvgFamilyID uint32, gvgID uint32, successorSPID uint32, targetSP *sptypes.StorageProvider, expirationTime int64) error { + // when swapIn a family as primary SP., the target sp needs to be exiting status. + if gvgFamilyID != types.NoSpecifiedFamilyId { + if targetSP.Status != sptypes.STATUS_GRACEFUL_EXITING && targetSP.Status != sptypes.STATUS_FORCED_EXITING { + return sptypes.ErrStorageProviderWrongStatus.Wrapf("The target sp is not exiting, can not be swapped") + } + family, found := k.GetGVGFamily(ctx, gvgFamilyID) + if !found { + return types.ErrGVGFamilyNotExist + } + if family.PrimarySpId != targetSP.Id { + return types.ErrSwapInFailed.Wrapf("the family(ID: %d) primary SP(ID: %d) does not match the target SP(ID: %d) which need to be swapped", family.Id, family.PrimarySpId, targetSP.Id) + } + return k.setSwapInInfo(ctx, types.GetSwapInFamilyKey(gvgFamilyID), successorSPID, targetSP.Id, expirationTime) + } + + // swapIn GVG as secondary SP when there is secondary SP exiting + gvg, found := k.GetGVG(ctx, gvgID) + if !found { + return types.ErrGVGNotExist + } + if gvg.PrimarySpId == successorSPID { + return types.ErrSwapInFailed.Wrapf("The SP(ID=%d) is already the primary SP of GVG(ID=%d)", successorSPID, gvgID) + } + exist := false + for _, sspID := range gvg.GetSecondarySpIds() { + if sspID == successorSPID { + return types.ErrSwapInFailed.Wrapf("The sp(ID: %d) is already one of the secondary in this GVG(ID:%d)", successorSPID, gvgID) + } + if sspID == targetSP.Id { + exist = true + } + } + if !exist { + return types.ErrSwapInFailed.Wrapf("The sp(ID: %d) that needs swap out is not one of the secondary sps of gvg gvg(%s).", targetSP.Id, gvg.String()) + } + if targetSP.Status == sptypes.STATUS_GRACEFUL_EXITING || targetSP.Status == sptypes.STATUS_FORCED_EXITING { + return k.setSwapInInfo(ctx, types.GetSwapInGVGKey(gvgID), successorSPID, targetSP.Id, expirationTime) + } + + // swap into GVG that no SP exiting but not fulfil redundancy requirement. e.g. [1|2,3,4,5,6,1] + breakRedundancyReqmt := false + for _, sspID := range gvg.GetSecondarySpIds() { + if sspID == gvg.PrimarySpId { + breakRedundancyReqmt = true + break + } + } + if !breakRedundancyReqmt { + return types.ErrSwapInFailed.Wrap("can not swap into GVG which all SP are unique") + } + return k.setSwapInInfo(ctx, types.GetSwapInGVGKey(gvgID), successorSPID, targetSP.Id, expirationTime) +} + +func (k Keeper) setSwapInInfo(ctx sdk.Context, key []byte, successorSPID, targetSPID uint32, expirationTime int64) error { + store := ctx.KVStore(k.storeKey) + swapInInfo := &types.SwapInInfo{ + SuccessorSpId: successorSPID, + TargetSpId: targetSPID, + ExpirationTime: uint64(expirationTime), + } + bz := store.Get(key) + if bz == nil { + store.Set(key, k.cdc.MustMarshal(swapInInfo)) + return nil + } + curSwapInInfo := &types.SwapInInfo{} + k.cdc.MustUnmarshal(bz, curSwapInInfo) + if uint64(ctx.BlockTime().Unix()) < curSwapInInfo.ExpirationTime { + return types.ErrSwapInFailed.Wrapf("already exist SP(ID=%d) reserved the swap, please re-check the GVG after timestamp %d.", curSwapInInfo.SuccessorSpId, curSwapInInfo.ExpirationTime) + } + // override the stale swapIn info of prev successor sp + if curSwapInInfo.SuccessorSpId == successorSPID { + return types.ErrSwapInFailed.Wrapf("already tried to swap in but expired") + } + store.Set(key, k.cdc.MustMarshal(swapInInfo)) + return nil +} + +func (k Keeper) DeleteSwapInInfo(ctx sdk.Context, gvgFamilyID, gvgID uint32, successorSPID uint32) error { + store := ctx.KVStore(k.storeKey) + + swapInInfo := types.SwapInInfo{} + deleteSwapInfo := func(key []byte) error { + bz := store.Get(key) + if bz == nil { + return types.ErrSwapInFailed.Wrapf("The swap info not found in blockchain.") + } + k.cdc.MustUnmarshal(bz, &swapInInfo) + if swapInInfo.SuccessorSpId != successorSPID { + return sptypes.ErrStorageProviderNotFound.Wrapf("spID(%d) is different from the spID(%d) in swapInInfo", successorSPID, swapInInfo.SuccessorSpId) + } + store.Delete(key) + return nil + } + + if gvgFamilyID != types.NoSpecifiedFamilyId { + if err := deleteSwapInfo(types.GetSwapInFamilyKey(gvgFamilyID)); err != nil { + return err + } + } else { + if err := deleteSwapInfo(types.GetSwapInGVGKey(gvgID)); err != nil { + return err + } + } + + if err := ctx.EventManager().EmitTypedEvents(&types.EventCancelSwapIn{ + StorageProviderId: swapInInfo.SuccessorSpId, + GlobalVirtualGroupFamilyId: gvgFamilyID, + GlobalVirtualGroupId: gvgID, + TargetSpId: swapInInfo.TargetSpId, + }); err != nil { + return err + } + return nil +} + +func (k Keeper) CompleteSwapIn(ctx sdk.Context, gvgFamilyID uint32, gvgID uint32, successorSP *sptypes.StorageProvider) error { + store := ctx.KVStore(k.storeKey) + swapInInfo := types.SwapInInfo{} + // swapIn family + if gvgFamilyID != types.NoSpecifiedFamilyId { + key := types.GetSwapInFamilyKey(gvgFamilyID) + bz := store.Get(key) + if bz == nil { + return types.ErrSwapInFailed.Wrapf("The swap info not found in blockchain.") + } + k.cdc.MustUnmarshal(bz, &swapInInfo) + if successorSP.Id != swapInInfo.SuccessorSpId { + return types.ErrSwapInFailed.Wrapf("The SP(ID: %d) has not reserved the swap(swapInfo=%s)", successorSP.Id, swapInInfo.String()) + } + targetPrimarySP, found := k.spKeeper.GetStorageProvider(ctx, swapInInfo.TargetSpId) + if !found { + return sptypes.ErrStorageProviderNotFound.Wrapf("The storage provider(ID: %d) not found when complete swap in.", swapInInfo.TargetSpId) + } + if err := k.SwapAsPrimarySP(ctx, targetPrimarySP, successorSP, gvgFamilyID, true); err != nil { + return err + } + store.Delete(key) + } else { + key := types.GetSwapInGVGKey(gvgID) + bz := store.Get(key) + if bz == nil { + return types.ErrSwapInFailed.Wrapf("The swap info not found in blockchain.") + } + k.cdc.MustUnmarshal(bz, &swapInInfo) + if successorSP.Id != swapInInfo.SuccessorSpId { + return types.ErrSwapInFailed.Wrapf("The sp(ID: %d) has not reserved the swap for secondary SP(ID: %d)", successorSP.Id, swapInInfo.TargetSpId) + } + targetSecondarySP, found := k.spKeeper.GetStorageProvider(ctx, swapInInfo.TargetSpId) + if !found { + return sptypes.ErrStorageProviderNotFound.Wrapf("The storage provider(ID: %d) not found when complete swap in.", swapInInfo.TargetSpId) + } + if err := k.completeSwapInGVG(ctx, successorSP.Id, targetSecondarySP.Id, gvgID); err != nil { + return err + } + store.Delete(key) + } + if err := ctx.EventManager().EmitTypedEvents(&types.EventCompleteSwapIn{ + StorageProviderId: successorSP.Id, + TargetStorageProviderId: swapInInfo.TargetSpId, + GlobalVirtualGroupFamilyId: gvgFamilyID, + GlobalVirtualGroupId: gvgID, + }); err != nil { + return err + } + return nil +} + +func (k Keeper) completeSwapInGVG(ctx sdk.Context, successorSPID, targetSecondarySPID uint32, gvgID uint32) error { + gvg, found := k.GetGVG(ctx, gvgID) + if !found { + return types.ErrGVGNotExist + } + if successorSPID == gvg.PrimarySpId { + return types.ErrSwapInFailed.Wrapf("the primary SP(ID: %d) can not swap into GVG's secondary (%s).", successorSPID, gvg.String()) + } + + // settlement + err := k.SettleAndDistributeGVG(ctx, gvg) + if err != nil { + return types.ErrSwapInFailed.Wrapf("fail to settle GVG %d", gvgID) + } + secondarySPIndex := -1 + for i, sspID := range gvg.GetSecondarySpIds() { + if sspID == targetSecondarySPID { + secondarySPIndex = i + } + } + if secondarySPIndex == -1 { + panic("secondary sp found but the index is not correct when swap out as secondary sp") + } + gvg.SecondarySpIds[secondarySPIndex] = successorSPID + origin := k.MustGetGVGStatisticsWithinSP(ctx, targetSecondarySPID) + successor, found := k.GetGVGStatisticsWithinSP(ctx, successorSPID) + if !found { + successor = &types.GVGStatisticsWithinSP{StorageProviderId: successorSPID} + } + if targetSecondarySPID == gvg.PrimarySpId { + origin.BreakRedundancyReqmtGvgCount-- + } + origin.SecondaryCount-- + successor.SecondaryCount++ + k.SetGVGStatisticsWithSP(ctx, origin) + k.SetGVGStatisticsWithSP(ctx, successor) + return k.SetGVGAndEmitUpdateEvent(ctx, gvg) +} diff --git a/x/virtualgroup/keeper/migrations.go b/x/virtualgroup/keeper/migrations.go new file mode 100644 index 000000000..9788512dd --- /dev/null +++ b/x/virtualgroup/keeper/migrations.go @@ -0,0 +1,19 @@ +package keeper + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + + v2 "github.com/bnb-chain/greenfield/x/virtualgroup/keeper/v2" +) + +type Migrator struct { + keeper Keeper +} + +func NewMigrator(keeper Keeper) Migrator { + return Migrator{keeper: keeper} +} + +func (m Migrator) MigrateV1toV2(ctx sdk.Context) error { + return v2.MigrateStore(ctx, m.keeper.storeKey, m.keeper.cdc) +} diff --git a/x/virtualgroup/keeper/msg_server.go b/x/virtualgroup/keeper/msg_server.go index 98ff91f77..b089493d9 100644 --- a/x/virtualgroup/keeper/msg_server.go +++ b/x/virtualgroup/keeper/msg_server.go @@ -11,6 +11,7 @@ import ( gnfdtypes "github.com/bnb-chain/greenfield/types" "github.com/bnb-chain/greenfield/types/errors" + paymenttypes "github.com/bnb-chain/greenfield/x/payment/types" sptypes "github.com/bnb-chain/greenfield/x/sp/types" "github.com/bnb-chain/greenfield/x/virtualgroup/types" ) @@ -460,6 +461,27 @@ func (k msgServer) StorageProviderExit(goCtx context.Context, msg *types.MsgStor return nil, sptypes.ErrStorageProviderExitFailed.Wrapf("sp not in service, status: %s", sp.Status.String()) } + if ctx.IsUpgraded(upgradetypes.Hulunbeier) { + stat, found := k.GetGVGStatisticsWithinSP(ctx, sp.Id) + if found && stat.BreakRedundancyReqmtGvgCount != 0 { + return nil, types.ErrSPCanNotExit.Wrapf("The SP has %d GVG that break the redundancy requirement, need to be resolved before exit.", stat.BreakRedundancyReqmtGvgCount) + } + + // can only allow 1 sp exit at a time, a GVG can have only 1 SwapInInfo associated. + exitingSPNum := uint32(0) + sps := k.spKeeper.GetAllStorageProviders(ctx) + maxSPExitingNum := k.SpConcurrentExitNum(ctx) + + for _, curSP := range sps { + if curSP.Status == sptypes.STATUS_GRACEFUL_EXITING || + curSP.Status == sptypes.STATUS_FORCED_EXITING { + exitingSPNum++ + if exitingSPNum >= maxSPExitingNum { + return nil, sptypes.ErrStorageProviderExitFailed.Wrapf("There are %d SP exiting, only allow %d sp exit concurrently", exitingSPNum, maxSPExitingNum) + } + } + } + } sp.Status = sptypes.STATUS_GRACEFUL_EXITING k.spKeeper.SetStorageProvider(ctx, sp) @@ -476,14 +498,14 @@ func (k msgServer) StorageProviderExit(goCtx context.Context, msg *types.MsgStor func (k msgServer) CompleteStorageProviderExit(goCtx context.Context, msg *types.MsgCompleteStorageProviderExit) (*types.MsgCompleteStorageProviderExitResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) - operatorAddr := sdk.MustAccAddressFromHex(msg.StorageProvider) + spAddr := sdk.MustAccAddressFromHex(msg.StorageProvider) - sp, found := k.spKeeper.GetStorageProviderByOperatorAddr(ctx, operatorAddr) + sp, found := k.spKeeper.GetStorageProviderByOperatorAddr(ctx, spAddr) if !found { - return nil, sptypes.ErrStorageProviderNotFound.Wrapf("The address must be operator address of sp.") + return nil, sptypes.ErrStorageProviderNotFound.Wrapf("The address must be the operator address of sp.") } - if sp.Status != sptypes.STATUS_GRACEFUL_EXITING { + if sp.Status != sptypes.STATUS_GRACEFUL_EXITING && sp.Status != sptypes.STATUS_FORCED_EXITING { return nil, sptypes.ErrStorageProviderExitFailed.Wrapf( "sp(id : %d, operator address: %s) not in the process of exiting", sp.Id, sp.OperatorAddress) } @@ -493,23 +515,143 @@ func (k msgServer) CompleteStorageProviderExit(goCtx context.Context, msg *types return nil, err } - // send back the total deposit - coins := sdk.NewCoins(sdk.NewCoin(k.spKeeper.DepositDenomForSP(ctx), sp.TotalDeposit)) - err = k.bankKeeper.SendCoinsFromModuleToAccount(ctx, sptypes.ModuleName, sdk.MustAccAddressFromHex(sp.FundingAddress), coins) + var forcedExit bool + if sp.Status == sptypes.STATUS_GRACEFUL_EXITING { + // send back the total deposit + coins := sdk.NewCoins(sdk.NewCoin(k.spKeeper.DepositDenomForSP(ctx), sp.TotalDeposit)) + err = k.bankKeeper.SendCoinsFromModuleToAccount(ctx, sptypes.ModuleName, sdk.MustAccAddressFromHex(sp.FundingAddress), coins) + if err != nil { + return nil, err + } + } else { + forcedExit = true + coins := sdk.NewCoins(sdk.NewCoin(k.spKeeper.DepositDenomForSP(ctx), sp.TotalDeposit)) + // the deposit will be transfer to the payment module gov addr stream record related bank account, when a stream record lack of + // static balance, it will check for its related bank account + err = k.bankKeeper.SendCoinsFromModuleToAccount(ctx, sptypes.ModuleName, paymenttypes.GovernanceAddress, coins) + if err != nil { + return nil, err + } + } + err = k.spKeeper.Exit(ctx, sp) if err != nil { return nil, err } + if ctx.IsUpgraded(upgradetypes.Hulunbeier) { + if err = ctx.EventManager().EmitTypedEvents(&types.EventCompleteStorageProviderExit{ + StorageProviderId: sp.Id, + OperatorAddress: msg.Operator, + StorageProviderAddress: sp.OperatorAddress, + TotalDeposit: sp.TotalDeposit, + ForcedExit: forcedExit, + }); err != nil { + return nil, err + } + } else { + if err = ctx.EventManager().EmitTypedEvents(&types.EventCompleteStorageProviderExit{ + StorageProviderId: sp.Id, + OperatorAddress: sp.OperatorAddress, + TotalDeposit: sp.TotalDeposit, + }); err != nil { + return nil, err + } + } + return &types.MsgCompleteStorageProviderExitResponse{}, nil +} - err = k.spKeeper.Exit(ctx, sp) +func (k msgServer) ReserveSwapIn(goCtx context.Context, msg *types.MsgReserveSwapIn) (*types.MsgReserveSwapInResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + operatorAddr := sdk.MustAccAddressFromHex(msg.StorageProvider) + successorSP, found := k.spKeeper.GetStorageProviderByOperatorAddr(ctx, operatorAddr) + if !found { + return nil, sptypes.ErrStorageProviderNotFound.Wrapf("The address must be the operator address of sp.") + } + if successorSP.Id == msg.TargetSpId { + return nil, types.ErrSwapInFailed.Wrapf("The SP(ID=%d) can not swap itself", successorSP.Id) + } + targetSP, found := k.spKeeper.GetStorageProvider(ctx, msg.TargetSpId) + if !found { + return nil, sptypes.ErrStorageProviderNotFound.Wrapf("Target sp(ID=%d) try to swap not found.", msg.TargetSpId) + } + expirationTime := ctx.BlockTime().Unix() + int64(k.SwapInValidityPeriod(ctx)) + + if err := k.Keeper.SwapIn(ctx, msg.GlobalVirtualGroupFamilyId, msg.GlobalVirtualGroupId, successorSP.Id, targetSP, expirationTime); err != nil { + return nil, err + } + if err := ctx.EventManager().EmitTypedEvents(&types.EventReserveSwapIn{ + StorageProviderId: successorSP.Id, + GlobalVirtualGroupFamilyId: msg.GlobalVirtualGroupFamilyId, + GlobalVirtualGroupId: msg.GlobalVirtualGroupId, + TargetSpId: msg.TargetSpId, + ExpirationTime: uint64(expirationTime), + }); err != nil { + return nil, err + } + return &types.MsgReserveSwapInResponse{}, nil +} + +func (k msgServer) CancelSwapIn(goCtx context.Context, msg *types.MsgCancelSwapIn) (*types.MsgCancelSwapInResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + + operatorAddr := sdk.MustAccAddressFromHex(msg.StorageProvider) + successorSP, found := k.spKeeper.GetStorageProviderByOperatorAddr(ctx, operatorAddr) + if !found { + return nil, sptypes.ErrStorageProviderNotFound.Wrapf("The address must be operator address of sp.") + } + err := k.DeleteSwapInInfo(ctx, msg.GlobalVirtualGroupFamilyId, msg.GlobalVirtualGroupId, successorSP.Id) if err != nil { return nil, err } - if err := ctx.EventManager().EmitTypedEvents(&types.EventCompleteStorageProviderExit{ + return &types.MsgCancelSwapInResponse{}, nil +} + +func (k msgServer) CompleteSwapIn(goCtx context.Context, msg *types.MsgCompleteSwapIn) (*types.MsgCompleteSwapInResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + + operatorAddr := sdk.MustAccAddressFromHex(msg.StorageProvider) + successorSP, found := k.spKeeper.GetStorageProviderByOperatorAddr(ctx, operatorAddr) + if !found { + return nil, sptypes.ErrStorageProviderNotFound.Wrapf("The address must be operator address of sp.") + } + err := k.Keeper.CompleteSwapIn(ctx, msg.GlobalVirtualGroupFamilyId, msg.GlobalVirtualGroupId, successorSP) + if err != nil { + return nil, err + } + return &types.MsgCompleteSwapInResponse{}, nil +} +func (k msgServer) StorageProviderForcedExit(goCtx context.Context, msg *types.MsgStorageProviderForcedExit) (*types.MsgStorageProviderForcedExitResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + if k.GetAuthority() != msg.Authority { + return nil, sdkerrors.Wrapf(govtypes.ErrInvalidSigner, "invalid authority; expected %s, got %s", k.GetAuthority(), msg.Authority) + } + + spAddr := sdk.MustAccAddressFromHex(msg.StorageProvider) + + sp, found := k.spKeeper.GetStorageProviderByOperatorAddr(ctx, spAddr) + if !found { + return nil, sptypes.ErrStorageProviderNotFound.Wrapf("The SP with operator address %s not found", msg.StorageProvider) + } + + exitingSPNum := uint32(0) + maxSPExitingNum := k.SpConcurrentExitNum(ctx) + sps := k.spKeeper.GetAllStorageProviders(ctx) + for _, curSP := range sps { + if curSP.Status == sptypes.STATUS_GRACEFUL_EXITING || + curSP.Status == sptypes.STATUS_FORCED_EXITING { + exitingSPNum++ + if exitingSPNum >= maxSPExitingNum { + return nil, sptypes.ErrStorageProviderExitFailed.Wrapf("%d SP are exiting, allow %d sp exit concurrently", exitingSPNum, maxSPExitingNum) + } + } + } + + // Governance can put an SP into force exiting status no matter what status it is in. + sp.Status = sptypes.STATUS_FORCED_EXITING + k.spKeeper.SetStorageProvider(ctx, sp) + if err := ctx.EventManager().EmitTypedEvents(&types.EventStorageProviderForcedExit{ StorageProviderId: sp.Id, - OperatorAddress: sp.OperatorAddress, - TotalDeposit: sp.TotalDeposit, }); err != nil { return nil, err } - return &types.MsgCompleteStorageProviderExitResponse{}, nil + return &types.MsgStorageProviderForcedExitResponse{}, nil } diff --git a/x/virtualgroup/keeper/params.go b/x/virtualgroup/keeper/params.go index 0fed21384..9c3cd0d2c 100644 --- a/x/virtualgroup/keeper/params.go +++ b/x/virtualgroup/keeper/params.go @@ -27,6 +27,16 @@ func (k Keeper) MaxStoreSizePerFamily(ctx sdk.Context) (res uint64) { return params.MaxStoreSizePerFamily } +func (k Keeper) SwapInValidityPeriod(ctx sdk.Context) (res uint64) { + params := k.GetParams(ctx) + return params.SwapInValidityPeriod.Uint64() +} + +func (k Keeper) SpConcurrentExitNum(ctx sdk.Context) (res uint32) { + params := k.GetParams(ctx) + return uint32(params.SpConcurrentExitNum.Uint64()) +} + // GetParams returns the current sp module parameters. func (k Keeper) GetParams(ctx sdk.Context) (p types.Params) { store := ctx.KVStore(k.storeKey) diff --git a/x/virtualgroup/keeper/v1/params.pb.go b/x/virtualgroup/keeper/v1/params.pb.go new file mode 100644 index 000000000..1e51d4fb3 --- /dev/null +++ b/x/virtualgroup/keeper/v1/params.pb.go @@ -0,0 +1,535 @@ +package v1 + +import ( + fmt "fmt" + io "io" + math "math" + math_bits "math/bits" + + _ "github.com/cosmos/cosmos-proto" + github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/proto" + "gopkg.in/yaml.v2" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// Params defines the parameters for the module. +type Params struct { + // deposit_denom defines the staking coin denomination. + DepositDenom string `protobuf:"bytes,1,opt,name=deposit_denom,json=depositDenom,proto3" json:"deposit_denom,omitempty"` + // store price, in bnb wei per charge byte + //nolint + GvgStakingPerBytes github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,2,opt,name=gvg_staking_per_bytes,json=gvgStakingPerBytes,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"gvg_staking_per_bytes"` + // the max number of lvg which allowed in a bucket + MaxLocalVirtualGroupNumPerBucket uint32 `protobuf:"varint,3,opt,name=max_local_virtual_group_num_per_bucket,json=maxLocalVirtualGroupNumPerBucket,proto3" json:"max_local_virtual_group_num_per_bucket,omitempty"` + // the max number of gvg which can exist in a family + MaxGlobalVirtualGroupNumPerFamily uint32 `protobuf:"varint,4,opt,name=max_global_virtual_group_num_per_family,json=maxGlobalVirtualGroupNumPerFamily,proto3" json:"max_global_virtual_group_num_per_family,omitempty"` + // if the store size reach the exceed, the family is not allowed to sever more buckets + MaxStoreSizePerFamily uint64 `protobuf:"varint,5,opt,name=max_store_size_per_family,json=maxStoreSizePerFamily,proto3" json:"max_store_size_per_family,omitempty"` +} + +func (m *Params) String() string { + out, _ := yaml.Marshal(m) + return string(out) +} + +func (m *Params) Reset() { *m = Params{} } +func (*Params) ProtoMessage() {} +func (*Params) Descriptor() ([]byte, []int) { + return fileDescriptor_d8ecf89dd5128885, []int{0} +} +func (m *Params) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Params.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Params) XXX_Merge(src proto.Message) { + xxx_messageInfo_Params.Merge(m, src) +} +func (m *Params) XXX_Size() int { + return m.Size() +} +func (m *Params) XXX_DiscardUnknown() { + xxx_messageInfo_Params.DiscardUnknown(m) +} + +var xxx_messageInfo_Params proto.InternalMessageInfo + +func (m *Params) GetDepositDenom() string { + if m != nil { + return m.DepositDenom + } + return "" +} + +func (m *Params) GetMaxLocalVirtualGroupNumPerBucket() uint32 { + if m != nil { + return m.MaxLocalVirtualGroupNumPerBucket + } + return 0 +} + +func (m *Params) GetMaxGlobalVirtualGroupNumPerFamily() uint32 { + if m != nil { + return m.MaxGlobalVirtualGroupNumPerFamily + } + return 0 +} + +func (m *Params) GetMaxStoreSizePerFamily() uint64 { + if m != nil { + return m.MaxStoreSizePerFamily + } + return 0 +} + +//func init() { +// proto.RegisterType((*Params)(nil), "greenfield.virtualgroup.Params") +//} +// +//func init() { +// proto.RegisterFile("greenfield/virtualgroup/params.proto", fileDescriptor_d8ecf89dd5128885) +//} + +var fileDescriptor_d8ecf89dd5128885 = []byte{ + // 414 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x92, 0x3f, 0x6f, 0xd4, 0x30, + 0x18, 0x87, 0x63, 0x5a, 0x2a, 0xb0, 0xe8, 0x12, 0x51, 0x91, 0x76, 0x48, 0xc2, 0x1f, 0x95, 0x5b, + 0x2e, 0x19, 0x60, 0x40, 0x88, 0xe9, 0x84, 0xa8, 0x2a, 0xa1, 0xea, 0x94, 0x93, 0x18, 0x58, 0x2c, + 0x27, 0x71, 0x5d, 0xeb, 0x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 0xb3, 0xce, 0x3c, 0x25, + 0x6a, 0x62, 0xbd, 0xfe, 0x14, 0x9e, 0x72, 0xdc, 0xa2, 0x4a, 0x16, 0xb8, 0x42, 0x7d, 0xaf, 0xc8, + 0x35, 0x8b, 0x44, 0xc3, 0xbb, 0x02, 0x9a, 0x62, 0x4e, 0x4c, 0xb0, 0x17, 0x83, 0xd1, 0x61, 0x16, + 0x73, 0xdc, 0xbe, 0xb7, 0xf0, 0x87, 0x8e, 0x3d, 0xb3, 0xe8, 0x45, 0xc3, 0xad, 0xd0, 0x71, 0x7e, + 0x06, 0x9f, 0x5b, 0x23, 0xad, 0x64, 0x7e, 0xab, 0xf2, 0x12, 0x73, 0x56, 0x2d, 0x83, 0x7d, 0xa7, + 0x7c, 0xcc, 0x71, 0x7b, 0xe6, 0xe8, 0xff, 0x9d, 0xef, 0x1c, 0xe8, 0xbf, 0x82, 0xc7, 0xd6, 0xa9, + 0x8d, 0x54, 0x04, 0x69, 0x76, 0x4d, 0x86, 0x96, 0xbb, 0x31, 0x18, 0xed, 0x67, 0x47, 0x1c, 0xb7, + 0x33, 0xfb, 0x7f, 0xc6, 0xae, 0xc9, 0x9f, 0x93, 0xaf, 0xef, 0x7d, 0xb9, 0x89, 0xbc, 0x5f, 0x37, + 0x11, 0x98, 0x5c, 0xac, 0xb6, 0x21, 0x58, 0x6f, 0x43, 0xf0, 0x73, 0x1b, 0x82, 0xcf, 0xbb, 0xd0, + 0x5b, 0xef, 0x42, 0xef, 0xfb, 0x2e, 0xf4, 0x3e, 0xbe, 0x1c, 0x4c, 0x33, 0x17, 0xf9, 0xb8, 0xb8, + 0xc2, 0x4c, 0xa4, 0x83, 0x4d, 0x69, 0xff, 0xdd, 0x15, 0x37, 0xdf, 0xfc, 0xc0, 0xdd, 0xf0, 0x8b, + 0xdf, 0x01, 0x00, 0x00, 0xff, 0xff, 0x12, 0x99, 0xe2, 0xe9, 0x53, 0x02, 0x00, 0x00, +} + +func (this *Params) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*Params) + if !ok { + that2, ok := that.(Params) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.DepositDenom != that1.DepositDenom { + return false + } + if !this.GvgStakingPerBytes.Equal(that1.GvgStakingPerBytes) { + return false + } + if this.MaxLocalVirtualGroupNumPerBucket != that1.MaxLocalVirtualGroupNumPerBucket { + return false + } + if this.MaxGlobalVirtualGroupNumPerFamily != that1.MaxGlobalVirtualGroupNumPerFamily { + return false + } + if this.MaxStoreSizePerFamily != that1.MaxStoreSizePerFamily { + return false + } + return true +} +func (m *Params) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Params) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.MaxStoreSizePerFamily != 0 { + i = encodeVarintParams(dAtA, i, uint64(m.MaxStoreSizePerFamily)) + i-- + dAtA[i] = 0x28 + } + if m.MaxGlobalVirtualGroupNumPerFamily != 0 { + i = encodeVarintParams(dAtA, i, uint64(m.MaxGlobalVirtualGroupNumPerFamily)) + i-- + dAtA[i] = 0x20 + } + if m.MaxLocalVirtualGroupNumPerBucket != 0 { + i = encodeVarintParams(dAtA, i, uint64(m.MaxLocalVirtualGroupNumPerBucket)) + i-- + dAtA[i] = 0x18 + } + { + size := m.GvgStakingPerBytes.Size() + i -= size + if _, err := m.GvgStakingPerBytes.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintParams(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if len(m.DepositDenom) > 0 { + i -= len(m.DepositDenom) + copy(dAtA[i:], m.DepositDenom) + i = encodeVarintParams(dAtA, i, uint64(len(m.DepositDenom))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintParams(dAtA []byte, offset int, v uint64) int { + offset -= sovParams(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *Params) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.DepositDenom) + if l > 0 { + n += 1 + l + sovParams(uint64(l)) + } + l = m.GvgStakingPerBytes.Size() + n += 1 + l + sovParams(uint64(l)) + if m.MaxLocalVirtualGroupNumPerBucket != 0 { + n += 1 + sovParams(uint64(m.MaxLocalVirtualGroupNumPerBucket)) + } + if m.MaxGlobalVirtualGroupNumPerFamily != 0 { + n += 1 + sovParams(uint64(m.MaxGlobalVirtualGroupNumPerFamily)) + } + if m.MaxStoreSizePerFamily != 0 { + n += 1 + sovParams(uint64(m.MaxStoreSizePerFamily)) + } + return n +} + +func sovParams(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} + +//lint:ignore U1000 Ignore unused function for it is auto generated ealier +func sozParams(x uint64) (n int) { + return sovParams(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *Params) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Params: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DepositDenom", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthParams + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthParams + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.DepositDenom = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field GvgStakingPerBytes", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthParams + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthParams + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.GvgStakingPerBytes.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MaxLocalVirtualGroupNumPerBucket", wireType) + } + m.MaxLocalVirtualGroupNumPerBucket = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.MaxLocalVirtualGroupNumPerBucket |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MaxGlobalVirtualGroupNumPerFamily", wireType) + } + m.MaxGlobalVirtualGroupNumPerFamily = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.MaxGlobalVirtualGroupNumPerFamily |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MaxStoreSizePerFamily", wireType) + } + m.MaxStoreSizePerFamily = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.MaxStoreSizePerFamily |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipParams(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthParams + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipParams(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowParams + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowParams + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowParams + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthParams + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupParams + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthParams + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthParams = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowParams = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupParams = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/virtualgroup/keeper/v2/migrations.go b/x/virtualgroup/keeper/v2/migrations.go new file mode 100644 index 000000000..a4e9ab003 --- /dev/null +++ b/x/virtualgroup/keeper/v2/migrations.go @@ -0,0 +1,28 @@ +package v2 + +import ( + "github.com/cosmos/cosmos-sdk/codec" + storetypes "github.com/cosmos/cosmos-sdk/store/types" + sdk "github.com/cosmos/cosmos-sdk/types" + + v1 "github.com/bnb-chain/greenfield/x/virtualgroup/keeper/v1" + "github.com/bnb-chain/greenfield/x/virtualgroup/types" +) + +func MigrateStore(ctx sdk.Context, storeKey storetypes.StoreKey, cdc codec.BinaryCodec) error { + store := ctx.KVStore(storeKey) + bz := store.Get(types.ParamsKey) + oldParams := &v1.Params{} + cdc.MustUnmarshal(bz, oldParams) + + newParams := types.NewParams( + oldParams.DepositDenom, + oldParams.GvgStakingPerBytes, + oldParams.MaxGlobalVirtualGroupNumPerFamily, + oldParams.MaxStoreSizePerFamily, + types.DefaultSwapInValidityPeriod, + types.DefaultSPConcurrentExitNum) + store.Set(types.ParamsKey, cdc.MustMarshal(&newParams)) + + return nil +} diff --git a/x/virtualgroup/module.go b/x/virtualgroup/module.go index 8d05904be..e0665f038 100644 --- a/x/virtualgroup/module.go +++ b/x/virtualgroup/module.go @@ -96,17 +96,19 @@ type AppModule struct { bankKeeper types.BankKeeper accountKeeper types.AccountKeeper spKeeper types.SpKeeper + version uint64 } func NewAppModule( cdc codec.Codec, keeper keeper.Keeper, spKeeper types.SpKeeper, -) AppModule { - return AppModule{ +) *AppModule { + return &AppModule{ AppModuleBasic: NewAppModuleBasic(cdc), keeper: keeper, spKeeper: spKeeper, + version: 1, } } @@ -114,6 +116,12 @@ func NewAppModule( func (am AppModule) RegisterServices(cfg module.Configurator) { types.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServerImpl(am.keeper)) types.RegisterQueryServer(cfg.QueryServer(), am.keeper) + + migrator := keeper.NewMigrator(am.keeper) + // register v1 -> v2 migration + if err := cfg.RegisterMigration(types.ModuleName, 1, migrator.MigrateV1toV2); err != nil { + panic(fmt.Errorf("failed to migrate %s to v2: %w", types.ModuleName, err)) + } } // RegisterInvariants registers the invariants of the module. If an invariant deviates from its predicted value, the InvariantRegistry triggers appropriate logic (most often the chain will be halted) @@ -137,7 +145,9 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw } // ConsensusVersion is a sequence number for state-breaking change of the module. It should be incremented on each consensus-breaking change introduced by the module. To avoid wrong/empty versions, the initial version should be set to 1 -func (AppModule) ConsensusVersion() uint64 { return 1 } +func (am AppModule) ConsensusVersion() uint64 { return am.version } + +func (am *AppModule) SetConsensusVersion(version uint64) { am.version = version } // BeginBlock contains the logic that is automatically triggered at the beginning of each block func (am AppModule) BeginBlock(_ sdk.Context, _ abci.RequestBeginBlock) {} diff --git a/x/virtualgroup/types/errors.go b/x/virtualgroup/types/errors.go index 4d19e72d5..15e8c84d5 100644 --- a/x/virtualgroup/types/errors.go +++ b/x/virtualgroup/types/errors.go @@ -23,6 +23,9 @@ var ( ErrDuplicateSecondarySP = errors.Register(ModuleName, 1124, "the global virtual group has duplicate secondary sp.") ErrInsufficientStaking = errors.Register(ModuleName, 1125, "insufficient staking for gvg") ErrDuplicateGVG = errors.Register(ModuleName, 1126, "global virtual group is duplicate") + ErrSwapInFailed = errors.Register(ModuleName, 1127, "swap in failed.") + ErrSwapInInfoNotExist = errors.Register(ModuleName, 1128, "swap in info not exist.") + ErrGVGStatisticsNotExist = errors.Register(ModuleName, 1129, "gvg statistics not exist.") ErrInvalidDenom = errors.Register(ModuleName, 2000, "Invalid denom.") ) diff --git a/x/virtualgroup/types/events.pb.go b/x/virtualgroup/types/events.pb.go index 8c1c0afca..ed1e7a9e8 100644 --- a/x/virtualgroup/types/events.pb.go +++ b/x/virtualgroup/types/events.pb.go @@ -887,10 +887,14 @@ func (m *EventStorageProviderExit) GetOperatorAddress() string { type EventCompleteStorageProviderExit struct { // The id of the storage provider who complete exit StorageProviderId uint32 `protobuf:"varint,1,opt,name=storage_provider_id,json=storageProviderId,proto3" json:"storage_provider_id,omitempty"` - // The operator address which initial the complete exit transaction + // The operator address which initials the complete exit transaction. OperatorAddress string `protobuf:"bytes,2,opt,name=operator_address,json=operatorAddress,proto3" json:"operator_address,omitempty"` + // The storage provider address which completes the exit + StorageProviderAddress string `protobuf:"bytes,3,opt,name=storage_provider_address,json=storageProviderAddress,proto3" json:"storage_provider_address,omitempty"` // total_deposit defines the number of tokens deposited by this storage provider for staking. - TotalDeposit github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,3,opt,name=total_deposit,json=totalDeposit,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"total_deposit"` + TotalDeposit github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,4,opt,name=total_deposit,json=totalDeposit,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"total_deposit"` + // forced_exit whether the exit is a forced exit + ForcedExit bool `protobuf:"varint,5,opt,name=forced_exit,json=forcedExit,proto3" json:"forced_exit,omitempty"` } func (m *EventCompleteStorageProviderExit) Reset() { *m = EventCompleteStorageProviderExit{} } @@ -940,6 +944,290 @@ func (m *EventCompleteStorageProviderExit) GetOperatorAddress() string { return "" } +func (m *EventCompleteStorageProviderExit) GetStorageProviderAddress() string { + if m != nil { + return m.StorageProviderAddress + } + return "" +} + +func (m *EventCompleteStorageProviderExit) GetForcedExit() bool { + if m != nil { + return m.ForcedExit + } + return false +} + +type EventReserveSwapIn struct { + // The id of the storage provider who wants to swap in + StorageProviderId uint32 `protobuf:"varint,1,opt,name=storage_provider_id,json=storageProviderId,proto3" json:"storage_provider_id,omitempty"` + // The id of the gvg family which the storage provider wants to swap in as primary sp + GlobalVirtualGroupFamilyId uint32 `protobuf:"varint,2,opt,name=global_virtual_group_family_id,json=globalVirtualGroupFamilyId,proto3" json:"global_virtual_group_family_id,omitempty"` + // The id of the gvg which the storage provider wants to swap in as secondary sp + GlobalVirtualGroupId uint32 `protobuf:"varint,3,opt,name=global_virtual_group_id,json=globalVirtualGroupId,proto3" json:"global_virtual_group_id,omitempty"` + // The id of the target sp who will be swapped + TargetSpId uint32 `protobuf:"varint,4,opt,name=target_sp_id,json=targetSpId,proto3" json:"target_sp_id,omitempty"` + // the expiration time of this reserved swapIn + ExpirationTime uint64 `protobuf:"varint,5,opt,name=expiration_time,json=expirationTime,proto3" json:"expiration_time,omitempty"` +} + +func (m *EventReserveSwapIn) Reset() { *m = EventReserveSwapIn{} } +func (m *EventReserveSwapIn) String() string { return proto.CompactTextString(m) } +func (*EventReserveSwapIn) ProtoMessage() {} +func (*EventReserveSwapIn) Descriptor() ([]byte, []int) { + return fileDescriptor_ece39ea12016bd5b, []int{14} +} +func (m *EventReserveSwapIn) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *EventReserveSwapIn) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_EventReserveSwapIn.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *EventReserveSwapIn) XXX_Merge(src proto.Message) { + xxx_messageInfo_EventReserveSwapIn.Merge(m, src) +} +func (m *EventReserveSwapIn) XXX_Size() int { + return m.Size() +} +func (m *EventReserveSwapIn) XXX_DiscardUnknown() { + xxx_messageInfo_EventReserveSwapIn.DiscardUnknown(m) +} + +var xxx_messageInfo_EventReserveSwapIn proto.InternalMessageInfo + +func (m *EventReserveSwapIn) GetStorageProviderId() uint32 { + if m != nil { + return m.StorageProviderId + } + return 0 +} + +func (m *EventReserveSwapIn) GetGlobalVirtualGroupFamilyId() uint32 { + if m != nil { + return m.GlobalVirtualGroupFamilyId + } + return 0 +} + +func (m *EventReserveSwapIn) GetGlobalVirtualGroupId() uint32 { + if m != nil { + return m.GlobalVirtualGroupId + } + return 0 +} + +func (m *EventReserveSwapIn) GetTargetSpId() uint32 { + if m != nil { + return m.TargetSpId + } + return 0 +} + +func (m *EventReserveSwapIn) GetExpirationTime() uint64 { + if m != nil { + return m.ExpirationTime + } + return 0 +} + +type EventCompleteSwapIn struct { + // The id of the storage provider who complete swap in. + StorageProviderId uint32 `protobuf:"varint,1,opt,name=storage_provider_id,json=storageProviderId,proto3" json:"storage_provider_id,omitempty"` + // The id of the storage provider who swap in the family or gvgs + TargetStorageProviderId uint32 `protobuf:"varint,2,opt,name=target_storage_provider_id,json=targetStorageProviderId,proto3" json:"target_storage_provider_id,omitempty"` + // The id of the gvg family + GlobalVirtualGroupFamilyId uint32 `protobuf:"varint,3,opt,name=global_virtual_group_family_id,json=globalVirtualGroupFamilyId,proto3" json:"global_virtual_group_family_id,omitempty"` + // The id of the gvg + GlobalVirtualGroupId uint32 `protobuf:"varint,4,opt,name=global_virtual_group_id,json=globalVirtualGroupId,proto3" json:"global_virtual_group_id,omitempty"` +} + +func (m *EventCompleteSwapIn) Reset() { *m = EventCompleteSwapIn{} } +func (m *EventCompleteSwapIn) String() string { return proto.CompactTextString(m) } +func (*EventCompleteSwapIn) ProtoMessage() {} +func (*EventCompleteSwapIn) Descriptor() ([]byte, []int) { + return fileDescriptor_ece39ea12016bd5b, []int{15} +} +func (m *EventCompleteSwapIn) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *EventCompleteSwapIn) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_EventCompleteSwapIn.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *EventCompleteSwapIn) XXX_Merge(src proto.Message) { + xxx_messageInfo_EventCompleteSwapIn.Merge(m, src) +} +func (m *EventCompleteSwapIn) XXX_Size() int { + return m.Size() +} +func (m *EventCompleteSwapIn) XXX_DiscardUnknown() { + xxx_messageInfo_EventCompleteSwapIn.DiscardUnknown(m) +} + +var xxx_messageInfo_EventCompleteSwapIn proto.InternalMessageInfo + +func (m *EventCompleteSwapIn) GetStorageProviderId() uint32 { + if m != nil { + return m.StorageProviderId + } + return 0 +} + +func (m *EventCompleteSwapIn) GetTargetStorageProviderId() uint32 { + if m != nil { + return m.TargetStorageProviderId + } + return 0 +} + +func (m *EventCompleteSwapIn) GetGlobalVirtualGroupFamilyId() uint32 { + if m != nil { + return m.GlobalVirtualGroupFamilyId + } + return 0 +} + +func (m *EventCompleteSwapIn) GetGlobalVirtualGroupId() uint32 { + if m != nil { + return m.GlobalVirtualGroupId + } + return 0 +} + +type EventCancelSwapIn struct { + // The id of the storage provider who cancel swap in. + StorageProviderId uint32 `protobuf:"varint,1,opt,name=storage_provider_id,json=storageProviderId,proto3" json:"storage_provider_id,omitempty"` + // The id of the gvg family + GlobalVirtualGroupFamilyId uint32 `protobuf:"varint,2,opt,name=global_virtual_group_family_id,json=globalVirtualGroupFamilyId,proto3" json:"global_virtual_group_family_id,omitempty"` + // The id of the gvg + GlobalVirtualGroupId uint32 `protobuf:"varint,3,opt,name=global_virtual_group_id,json=globalVirtualGroupId,proto3" json:"global_virtual_group_id,omitempty"` + // The id of the target sp who was swapped from family or gvgs + TargetSpId uint32 `protobuf:"varint,4,opt,name=target_sp_id,json=targetSpId,proto3" json:"target_sp_id,omitempty"` +} + +func (m *EventCancelSwapIn) Reset() { *m = EventCancelSwapIn{} } +func (m *EventCancelSwapIn) String() string { return proto.CompactTextString(m) } +func (*EventCancelSwapIn) ProtoMessage() {} +func (*EventCancelSwapIn) Descriptor() ([]byte, []int) { + return fileDescriptor_ece39ea12016bd5b, []int{16} +} +func (m *EventCancelSwapIn) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *EventCancelSwapIn) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_EventCancelSwapIn.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *EventCancelSwapIn) XXX_Merge(src proto.Message) { + xxx_messageInfo_EventCancelSwapIn.Merge(m, src) +} +func (m *EventCancelSwapIn) XXX_Size() int { + return m.Size() +} +func (m *EventCancelSwapIn) XXX_DiscardUnknown() { + xxx_messageInfo_EventCancelSwapIn.DiscardUnknown(m) +} + +var xxx_messageInfo_EventCancelSwapIn proto.InternalMessageInfo + +func (m *EventCancelSwapIn) GetStorageProviderId() uint32 { + if m != nil { + return m.StorageProviderId + } + return 0 +} + +func (m *EventCancelSwapIn) GetGlobalVirtualGroupFamilyId() uint32 { + if m != nil { + return m.GlobalVirtualGroupFamilyId + } + return 0 +} + +func (m *EventCancelSwapIn) GetGlobalVirtualGroupId() uint32 { + if m != nil { + return m.GlobalVirtualGroupId + } + return 0 +} + +func (m *EventCancelSwapIn) GetTargetSpId() uint32 { + if m != nil { + return m.TargetSpId + } + return 0 +} + +type EventStorageProviderForcedExit struct { + // The id of the storage provider who wants to exit + StorageProviderId uint32 `protobuf:"varint,1,opt,name=storage_provider_id,json=storageProviderId,proto3" json:"storage_provider_id,omitempty"` +} + +func (m *EventStorageProviderForcedExit) Reset() { *m = EventStorageProviderForcedExit{} } +func (m *EventStorageProviderForcedExit) String() string { return proto.CompactTextString(m) } +func (*EventStorageProviderForcedExit) ProtoMessage() {} +func (*EventStorageProviderForcedExit) Descriptor() ([]byte, []int) { + return fileDescriptor_ece39ea12016bd5b, []int{17} +} +func (m *EventStorageProviderForcedExit) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *EventStorageProviderForcedExit) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_EventStorageProviderForcedExit.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *EventStorageProviderForcedExit) XXX_Merge(src proto.Message) { + xxx_messageInfo_EventStorageProviderForcedExit.Merge(m, src) +} +func (m *EventStorageProviderForcedExit) XXX_Size() int { + return m.Size() +} +func (m *EventStorageProviderForcedExit) XXX_DiscardUnknown() { + xxx_messageInfo_EventStorageProviderForcedExit.DiscardUnknown(m) +} + +var xxx_messageInfo_EventStorageProviderForcedExit proto.InternalMessageInfo + +func (m *EventStorageProviderForcedExit) GetStorageProviderId() uint32 { + if m != nil { + return m.StorageProviderId + } + return 0 +} + func init() { proto.RegisterType((*EventCreateGlobalVirtualGroup)(nil), "greenfield.virtualgroup.EventCreateGlobalVirtualGroup") proto.RegisterType((*EventUpdateGlobalVirtualGroup)(nil), "greenfield.virtualgroup.EventUpdateGlobalVirtualGroup") @@ -955,6 +1243,10 @@ func init() { proto.RegisterType((*EventCancelSwapOut)(nil), "greenfield.virtualgroup.EventCancelSwapOut") proto.RegisterType((*EventStorageProviderExit)(nil), "greenfield.virtualgroup.EventStorageProviderExit") proto.RegisterType((*EventCompleteStorageProviderExit)(nil), "greenfield.virtualgroup.EventCompleteStorageProviderExit") + proto.RegisterType((*EventReserveSwapIn)(nil), "greenfield.virtualgroup.EventReserveSwapIn") + proto.RegisterType((*EventCompleteSwapIn)(nil), "greenfield.virtualgroup.EventCompleteSwapIn") + proto.RegisterType((*EventCancelSwapIn)(nil), "greenfield.virtualgroup.EventCancelSwapIn") + proto.RegisterType((*EventStorageProviderForcedExit)(nil), "greenfield.virtualgroup.EventStorageProviderForcedExit") } func init() { @@ -962,56 +1254,65 @@ func init() { } var fileDescriptor_ece39ea12016bd5b = []byte{ - // 778 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xdc, 0x56, 0xcf, 0x4f, 0x13, 0x4f, - 0x14, 0xef, 0xb6, 0x85, 0x2f, 0x1d, 0x28, 0xf0, 0x5d, 0x4b, 0xba, 0x82, 0x94, 0xa6, 0x1a, 0xd2, - 0x4b, 0xdb, 0x83, 0x12, 0x3d, 0x78, 0xb1, 0x80, 0xa4, 0x89, 0x51, 0xd2, 0x06, 0x13, 0xbd, 0x6c, - 0xb6, 0x3b, 0xc3, 0x32, 0x61, 0xbb, 0xb3, 0x99, 0x99, 0x22, 0xe5, 0x9f, 0xd0, 0xf8, 0xb7, 0xf0, - 0x07, 0x78, 0xe4, 0x48, 0x38, 0x19, 0x0f, 0xc4, 0x50, 0x2f, 0xde, 0x3c, 0x7b, 0xd1, 0xec, 0xcc, - 0xb4, 0xb4, 0xf4, 0x07, 0x58, 0xd4, 0xa8, 0xa7, 0x76, 0xdf, 0xbc, 0x79, 0xef, 0x7d, 0x3e, 0xef, - 0x33, 0x6f, 0x06, 0xdc, 0x71, 0x28, 0x42, 0xde, 0x36, 0x46, 0x2e, 0x2c, 0xec, 0x61, 0xca, 0xeb, - 0x96, 0xeb, 0x50, 0x52, 0xf7, 0x0b, 0x68, 0x0f, 0x79, 0x9c, 0xe5, 0x7d, 0x4a, 0x38, 0xd1, 0x93, - 0xe7, 0x5e, 0xf9, 0x4e, 0xaf, 0xf9, 0x9b, 0x36, 0x61, 0x35, 0xc2, 0x4c, 0xe1, 0x56, 0x90, 0x1f, - 0x72, 0xcf, 0x7c, 0xc2, 0x21, 0x0e, 0x91, 0xf6, 0xe0, 0x9f, 0xb4, 0x66, 0xbe, 0x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4f, 0x48, 0xef, 0x12, 0xd4, 0x57, 0x40, - 0x72, 0x00, 0x7c, 0x35, 0xc6, 0x12, 0xfd, 0xd0, 0x5f, 0x9c, 0x52, 0xd1, 0x8b, 0x53, 0xea, 0x1c, - 0x82, 0x6c, 0xd9, 0xdf, 0x08, 0x61, 0x47, 0x21, 0x90, 0x0d, 0xfe, 0x85, 0x08, 0x32, 0x4d, 0x0d, - 0x4c, 0x89, 0x54, 0x95, 0x57, 0x96, 0xff, 0xac, 0xce, 0xf5, 0x3c, 0xb8, 0x11, 0x14, 0x62, 0x39, - 0x28, 0xb8, 0xd5, 0xf6, 0x30, 0x44, 0xd4, 0x6c, 0xe7, 0xfa, 0x5f, 0x2d, 0x6d, 0xaa, 0x95, 0x12, - 0xd4, 0x8b, 0x20, 0xd5, 0x97, 0x82, 0x8b, 0x97, 0xd6, 0xbc, 0x33, 0x40, 0xa6, 0xd7, 0x38, 0x08, - 0xfa, 0x32, 0x98, 0x61, 0x75, 0xdb, 0x46, 0x8c, 0x11, 0xda, 0x35, 0x29, 0xe3, 0x6d, 0xb3, 0x50, - 0xf5, 0x57, 0x0d, 0x24, 0xa4, 0xaa, 0x49, 0xcd, 0x0f, 0x28, 0x1d, 0x15, 0xed, 0x0a, 0x48, 0x32, - 0x6a, 0x9b, 0xfd, 0xf6, 0x48, 0x98, 0x09, 0x46, 0xed, 0xca, 0x08, 0x24, 0x45, 0xae, 0x45, 0xd2, - 0xd0, 0x11, 0xf6, 0x59, 0x03, 0xba, 0x04, 0x6f, 0x79, 0x36, 0x72, 0xff, 0xe9, 0x46, 0xbf, 0xd6, - 0x80, 0x21, 0xe5, 0xdc, 0x5d, 0xff, 0xfa, 0x3e, 0xfe, 0x71, 0xc4, 0xab, 0x60, 0x96, 0xf8, 0x88, - 0x5a, 0x9c, 0xd0, 0xf6, 0xfd, 0x13, 0xbe, 0xe4, 0xfe, 0x99, 0x69, 0xed, 0x50, 0xe6, 0x40, 0x7a, - 0xe9, 0x6e, 0xe9, 0xfd, 0x21, 0x95, 0xfd, 0x86, 0x77, 0x4c, 0xf1, 0xe9, 0xd1, 0x59, 0x4a, 0x3b, - 0x3e, 0x4b, 0x69, 0x1f, 0xcf, 0x52, 0xda, 0x9b, 0x66, 0x2a, 0x74, 0xdc, 0x4c, 0x85, 0xde, 0x37, - 0x53, 0xa1, 0x97, 0xf7, 0x3a, 0xa2, 0x57, 0xbd, 0x6a, 0xce, 0xde, 0xb1, 0xb0, 0x57, 0xe8, 0x78, - 0x8d, 0xef, 0x77, 0xbf, 0xc7, 0x45, 0xbe, 0xea, 0xb8, 0x78, 0x45, 0xdf, 0xfd, 0x1e, 0x00, 0x00, - 0xff, 0xff, 0x21, 0xa5, 0x62, 0x6c, 0xb7, 0x0b, 0x00, 0x00, + // 927 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xdc, 0x57, 0x4f, 0x6f, 0x1b, 0x45, + 0x14, 0xcf, 0xac, 0xdd, 0x12, 0xbf, 0xc4, 0x49, 0xbb, 0x75, 0xf1, 0x92, 0x52, 0xc7, 0x5a, 0x50, + 0xf1, 0x25, 0xf6, 0x01, 0x2a, 0x90, 0xe0, 0x42, 0xfa, 0x4f, 0x96, 0x10, 0x44, 0x6b, 0x8a, 0x04, + 0x97, 0xd5, 0x78, 0x67, 0xb2, 0x19, 0xd5, 0xde, 0x59, 0xcd, 0x8c, 0x43, 0xd2, 0x8f, 0xc0, 0x05, + 0xc4, 0x67, 0xe9, 0x07, 0xe0, 0xd8, 0x63, 0xd5, 0x13, 0xe2, 0x50, 0x55, 0x09, 0x17, 0x4e, 0x70, + 0x46, 0x42, 0xa0, 0x9d, 0x19, 0x3b, 0xfe, 0xdf, 0xd4, 0x69, 0x05, 0xe4, 0x94, 0xf8, 0xcd, 0x9b, + 0x37, 0xef, 0xf7, 0x7b, 0xbf, 0xf7, 0x66, 0x16, 0xde, 0x8d, 0x05, 0xa5, 0xc9, 0x2e, 0xa3, 0x1d, + 0xd2, 0xd8, 0x67, 0x42, 0xf5, 0x70, 0x27, 0x16, 0xbc, 0x97, 0x36, 0xe8, 0x3e, 0x4d, 0x94, 0xac, + 0xa7, 0x82, 0x2b, 0xee, 0x96, 0x4f, 0xbc, 0xea, 0xc3, 0x5e, 0x1b, 0x6f, 0x45, 0x5c, 0x76, 0xb9, + 0x0c, 0xb5, 0x5b, 0xc3, 0xfc, 0x30, 0x7b, 0x36, 0x4a, 0x31, 0x8f, 0xb9, 0xb1, 0x67, 0xff, 0x19, + 0xab, 0xff, 0x87, 0x03, 0xd7, 0xef, 0x64, 0xa1, 0x6f, 0x09, 0x8a, 0x15, 0xbd, 0xd7, 0xe1, 0x6d, + 0xdc, 0xf9, 0xca, 0x84, 0xbc, 0x97, 0x85, 0x74, 0xd7, 0xc0, 0x61, 0xc4, 0x43, 0x55, 0x54, 0x2b, + 0x06, 0x0e, 0x23, 0xee, 0x35, 0x28, 0xec, 0xe2, 0x2e, 0xeb, 0x1c, 0x86, 0x8c, 0x78, 0x8e, 0x36, + 0x2f, 0x1b, 0x43, 0x93, 0xb8, 0x3e, 0x14, 0x53, 0xc1, 0xba, 0x58, 0x1c, 0x86, 0x32, 0xcd, 0x1c, + 0x72, 0xda, 0x61, 0xc5, 0x1a, 0x5b, 0x69, 0x93, 0xb8, 0x35, 0xb8, 0x24, 0x69, 0xc4, 0x13, 0x32, + 0xf0, 0x92, 0x5e, 0xbe, 0x9a, 0xab, 0x15, 0x83, 0xb5, 0x81, 0x3d, 0x73, 0x94, 0xee, 0x26, 0xac, + 0x48, 0xc5, 0x05, 0x25, 0xa1, 0x64, 0x0f, 0xa9, 0x77, 0xa1, 0x8a, 0x6a, 0xf9, 0x00, 0x8c, 0xa9, + 0xc5, 0x1e, 0x52, 0x77, 0x07, 0xca, 0x16, 0x7e, 0x98, 0xe2, 0xc3, 0x2e, 0x4d, 0x54, 0x88, 0x09, + 0x11, 0x54, 0x4a, 0xef, 0x62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x7f, 0x8e, 0xe0, 0xf2, 0xd8, 0xf0, 0x3b, 0x67, 0x5a, 0xf0, + 0x77, 0xa0, 0x32, 0x6d, 0xe4, 0xdd, 0x1d, 0x74, 0xc4, 0xcb, 0xc2, 0xdd, 0xfe, 0xfc, 0xf1, 0x51, + 0x05, 0x3d, 0x39, 0xaa, 0xa0, 0xe7, 0x47, 0x15, 0xf4, 0xc3, 0x71, 0x65, 0xe9, 0xc9, 0x71, 0x65, + 0xe9, 0xe7, 0xe3, 0xca, 0xd2, 0x37, 0x1f, 0x0c, 0x35, 0x70, 0x3b, 0x69, 0x6f, 0x45, 0x7b, 0x98, + 0x25, 0x8d, 0xa1, 0x8f, 0xe8, 0x83, 0xd1, 0xcf, 0x68, 0xdd, 0xd2, 0xed, 0x8b, 0xfa, 0xe3, 0xf7, + 0xfd, 0x7f, 0x02, 0x00, 0x00, 0xff, 0xff, 0xa6, 0xb9, 0x16, 0x32, 0x6e, 0x0f, 0x00, 0x00, } func (m *EventCreateGlobalVirtualGroup) Marshal() (dAtA []byte, err error) { @@ -1690,6 +1991,16 @@ func (m *EventCompleteStorageProviderExit) MarshalToSizedBuffer(dAtA []byte) (in _ = i var l int _ = l + if m.ForcedExit { + i-- + if m.ForcedExit { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x28 + } { size := m.TotalDeposit.Size() i -= size @@ -1699,7 +2010,14 @@ func (m *EventCompleteStorageProviderExit) MarshalToSizedBuffer(dAtA []byte) (in i = encodeVarintEvents(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x1a + dAtA[i] = 0x22 + if len(m.StorageProviderAddress) > 0 { + i -= len(m.StorageProviderAddress) + copy(dAtA[i:], m.StorageProviderAddress) + i = encodeVarintEvents(dAtA, i, uint64(len(m.StorageProviderAddress))) + i-- + dAtA[i] = 0x1a + } if len(m.OperatorAddress) > 0 { i -= len(m.OperatorAddress) copy(dAtA[i:], m.OperatorAddress) @@ -1715,47 +2033,209 @@ func (m *EventCompleteStorageProviderExit) MarshalToSizedBuffer(dAtA []byte) (in return len(dAtA) - i, nil } -func encodeVarintEvents(dAtA []byte, offset int, v uint64) int { - offset -= sovEvents(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ +func (m *EventReserveSwapIn) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } - dAtA[offset] = uint8(v) - return base + return dAtA[:n], nil } -func (m *EventCreateGlobalVirtualGroup) Size() (n int) { - if m == nil { - return 0 - } + +func (m *EventReserveSwapIn) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *EventReserveSwapIn) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - if m.Id != 0 { - n += 1 + sovEvents(uint64(m.Id)) - } - if m.FamilyId != 0 { - n += 1 + sovEvents(uint64(m.FamilyId)) + if m.ExpirationTime != 0 { + i = encodeVarintEvents(dAtA, i, uint64(m.ExpirationTime)) + i-- + dAtA[i] = 0x28 } - if m.PrimarySpId != 0 { - n += 1 + sovEvents(uint64(m.PrimarySpId)) + if m.TargetSpId != 0 { + i = encodeVarintEvents(dAtA, i, uint64(m.TargetSpId)) + i-- + dAtA[i] = 0x20 } - if len(m.SecondarySpIds) > 0 { - l = 0 - for _, e := range m.SecondarySpIds { - l += sovEvents(uint64(e)) - } - n += 1 + sovEvents(uint64(l)) + l + if m.GlobalVirtualGroupId != 0 { + i = encodeVarintEvents(dAtA, i, uint64(m.GlobalVirtualGroupId)) + i-- + dAtA[i] = 0x18 } - if m.StoredSize != 0 { - n += 1 + sovEvents(uint64(m.StoredSize)) + if m.GlobalVirtualGroupFamilyId != 0 { + i = encodeVarintEvents(dAtA, i, uint64(m.GlobalVirtualGroupFamilyId)) + i-- + dAtA[i] = 0x10 } - l = len(m.VirtualPaymentAddress) - if l > 0 { - n += 1 + l + sovEvents(uint64(l)) + if m.StorageProviderId != 0 { + i = encodeVarintEvents(dAtA, i, uint64(m.StorageProviderId)) + i-- + dAtA[i] = 0x8 } - l = m.TotalDeposit.Size() + return len(dAtA) - i, nil +} + +func (m *EventCompleteSwapIn) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *EventCompleteSwapIn) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *EventCompleteSwapIn) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.GlobalVirtualGroupId != 0 { + i = encodeVarintEvents(dAtA, i, uint64(m.GlobalVirtualGroupId)) + i-- + dAtA[i] = 0x20 + } + if m.GlobalVirtualGroupFamilyId != 0 { + i = encodeVarintEvents(dAtA, i, uint64(m.GlobalVirtualGroupFamilyId)) + i-- + dAtA[i] = 0x18 + } + if m.TargetStorageProviderId != 0 { + i = encodeVarintEvents(dAtA, i, uint64(m.TargetStorageProviderId)) + i-- + dAtA[i] = 0x10 + } + if m.StorageProviderId != 0 { + i = encodeVarintEvents(dAtA, i, uint64(m.StorageProviderId)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *EventCancelSwapIn) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *EventCancelSwapIn) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *EventCancelSwapIn) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.TargetSpId != 0 { + i = encodeVarintEvents(dAtA, i, uint64(m.TargetSpId)) + i-- + dAtA[i] = 0x20 + } + if m.GlobalVirtualGroupId != 0 { + i = encodeVarintEvents(dAtA, i, uint64(m.GlobalVirtualGroupId)) + i-- + dAtA[i] = 0x18 + } + if m.GlobalVirtualGroupFamilyId != 0 { + i = encodeVarintEvents(dAtA, i, uint64(m.GlobalVirtualGroupFamilyId)) + i-- + dAtA[i] = 0x10 + } + if m.StorageProviderId != 0 { + i = encodeVarintEvents(dAtA, i, uint64(m.StorageProviderId)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *EventStorageProviderForcedExit) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *EventStorageProviderForcedExit) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *EventStorageProviderForcedExit) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.StorageProviderId != 0 { + i = encodeVarintEvents(dAtA, i, uint64(m.StorageProviderId)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func encodeVarintEvents(dAtA []byte, offset int, v uint64) int { + offset -= sovEvents(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *EventCreateGlobalVirtualGroup) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Id != 0 { + n += 1 + sovEvents(uint64(m.Id)) + } + if m.FamilyId != 0 { + n += 1 + sovEvents(uint64(m.FamilyId)) + } + if m.PrimarySpId != 0 { + n += 1 + sovEvents(uint64(m.PrimarySpId)) + } + if len(m.SecondarySpIds) > 0 { + l = 0 + for _, e := range m.SecondarySpIds { + l += sovEvents(uint64(e)) + } + n += 1 + sovEvents(uint64(l)) + l + } + if m.StoredSize != 0 { + n += 1 + sovEvents(uint64(m.StoredSize)) + } + l = len(m.VirtualPaymentAddress) + if l > 0 { + n += 1 + l + sovEvents(uint64(l)) + } + l = m.TotalDeposit.Size() n += 1 + l + sovEvents(uint64(l)) return n } @@ -2023,8 +2503,93 @@ func (m *EventCompleteStorageProviderExit) Size() (n int) { if l > 0 { n += 1 + l + sovEvents(uint64(l)) } + l = len(m.StorageProviderAddress) + if l > 0 { + n += 1 + l + sovEvents(uint64(l)) + } l = m.TotalDeposit.Size() n += 1 + l + sovEvents(uint64(l)) + if m.ForcedExit { + n += 2 + } + return n +} + +func (m *EventReserveSwapIn) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.StorageProviderId != 0 { + n += 1 + sovEvents(uint64(m.StorageProviderId)) + } + if m.GlobalVirtualGroupFamilyId != 0 { + n += 1 + sovEvents(uint64(m.GlobalVirtualGroupFamilyId)) + } + if m.GlobalVirtualGroupId != 0 { + n += 1 + sovEvents(uint64(m.GlobalVirtualGroupId)) + } + if m.TargetSpId != 0 { + n += 1 + sovEvents(uint64(m.TargetSpId)) + } + if m.ExpirationTime != 0 { + n += 1 + sovEvents(uint64(m.ExpirationTime)) + } + return n +} + +func (m *EventCompleteSwapIn) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.StorageProviderId != 0 { + n += 1 + sovEvents(uint64(m.StorageProviderId)) + } + if m.TargetStorageProviderId != 0 { + n += 1 + sovEvents(uint64(m.TargetStorageProviderId)) + } + if m.GlobalVirtualGroupFamilyId != 0 { + n += 1 + sovEvents(uint64(m.GlobalVirtualGroupFamilyId)) + } + if m.GlobalVirtualGroupId != 0 { + n += 1 + sovEvents(uint64(m.GlobalVirtualGroupId)) + } + return n +} + +func (m *EventCancelSwapIn) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.StorageProviderId != 0 { + n += 1 + sovEvents(uint64(m.StorageProviderId)) + } + if m.GlobalVirtualGroupFamilyId != 0 { + n += 1 + sovEvents(uint64(m.GlobalVirtualGroupFamilyId)) + } + if m.GlobalVirtualGroupId != 0 { + n += 1 + sovEvents(uint64(m.GlobalVirtualGroupId)) + } + if m.TargetSpId != 0 { + n += 1 + sovEvents(uint64(m.TargetSpId)) + } + return n +} + +func (m *EventStorageProviderForcedExit) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.StorageProviderId != 0 { + n += 1 + sovEvents(uint64(m.StorageProviderId)) + } return n } @@ -4171,6 +4736,38 @@ func (m *EventCompleteStorageProviderExit) Unmarshal(dAtA []byte) error { m.OperatorAddress = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field StorageProviderAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthEvents + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.StorageProviderAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field TotalDeposit", wireType) } @@ -4204,6 +4801,492 @@ func (m *EventCompleteStorageProviderExit) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ForcedExit", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.ForcedExit = bool(v != 0) + default: + iNdEx = preIndex + skippy, err := skipEvents(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthEvents + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *EventReserveSwapIn) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: EventReserveSwapIn: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: EventReserveSwapIn: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field StorageProviderId", wireType) + } + m.StorageProviderId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.StorageProviderId |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field GlobalVirtualGroupFamilyId", wireType) + } + m.GlobalVirtualGroupFamilyId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.GlobalVirtualGroupFamilyId |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field GlobalVirtualGroupId", wireType) + } + m.GlobalVirtualGroupId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.GlobalVirtualGroupId |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field TargetSpId", wireType) + } + m.TargetSpId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.TargetSpId |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ExpirationTime", wireType) + } + m.ExpirationTime = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ExpirationTime |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipEvents(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthEvents + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *EventCompleteSwapIn) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: EventCompleteSwapIn: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: EventCompleteSwapIn: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field StorageProviderId", wireType) + } + m.StorageProviderId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.StorageProviderId |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field TargetStorageProviderId", wireType) + } + m.TargetStorageProviderId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.TargetStorageProviderId |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field GlobalVirtualGroupFamilyId", wireType) + } + m.GlobalVirtualGroupFamilyId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.GlobalVirtualGroupFamilyId |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field GlobalVirtualGroupId", wireType) + } + m.GlobalVirtualGroupId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.GlobalVirtualGroupId |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipEvents(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthEvents + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *EventCancelSwapIn) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: EventCancelSwapIn: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: EventCancelSwapIn: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field StorageProviderId", wireType) + } + m.StorageProviderId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.StorageProviderId |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field GlobalVirtualGroupFamilyId", wireType) + } + m.GlobalVirtualGroupFamilyId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.GlobalVirtualGroupFamilyId |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field GlobalVirtualGroupId", wireType) + } + m.GlobalVirtualGroupId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.GlobalVirtualGroupId |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field TargetSpId", wireType) + } + m.TargetSpId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.TargetSpId |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipEvents(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthEvents + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *EventStorageProviderForcedExit) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: EventStorageProviderForcedExit: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: EventStorageProviderForcedExit: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field StorageProviderId", wireType) + } + m.StorageProviderId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.StorageProviderId |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } default: iNdEx = preIndex skippy, err := skipEvents(dAtA[iNdEx:]) diff --git a/x/virtualgroup/types/expected_keepers.go b/x/virtualgroup/types/expected_keepers.go index 240915cb7..c2f8a8ba4 100644 --- a/x/virtualgroup/types/expected_keepers.go +++ b/x/virtualgroup/types/expected_keepers.go @@ -15,6 +15,7 @@ type SpKeeper interface { SetStorageProvider(ctx sdk.Context, sp *sptypes.StorageProvider) Exit(ctx sdk.Context, sp *sptypes.StorageProvider) error DepositDenomForSP(ctx sdk.Context) (res string) + GetAllStorageProviders(ctx sdk.Context) (sps []sptypes.StorageProvider) } // AccountKeeper defines the expected account keeper used for simulations (noalias) diff --git a/x/virtualgroup/types/expected_keepers_mocks.go b/x/virtualgroup/types/expected_keepers_mocks.go index eacf13dd3..06f27e5e2 100644 --- a/x/virtualgroup/types/expected_keepers_mocks.go +++ b/x/virtualgroup/types/expected_keepers_mocks.go @@ -122,6 +122,20 @@ func (mr *MockSpKeeperMockRecorder) SetStorageProvider(ctx, sp any) *gomock.Call return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetStorageProvider", reflect.TypeOf((*MockSpKeeper)(nil).SetStorageProvider), ctx, sp) } +// GetAllStorageProviders mocks base method. +func (m *MockSpKeeper) GetAllStorageProviders(ctx types0.Context) (sps []types.StorageProvider) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetAllStorageProviders", ctx) + ret0, _ := ret[0].([]types.StorageProvider) + return ret0 +} + +// GetAllStorageProviders indicates an expected call of GetAllStorageProviders. +func (mr *MockSpKeeperMockRecorder) GetAllStorageProviders(ctx any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAllStorageProviders", reflect.TypeOf((*MockSpKeeper)(nil).GetAllStorageProviders), ctx) +} + // MockAccountKeeper is a mock of AccountKeeper interface. type MockAccountKeeper struct { ctrl *gomock.Controller diff --git a/x/virtualgroup/types/keys.go b/x/virtualgroup/types/keys.go index a20f1d9c4..55ddf5a94 100644 --- a/x/virtualgroup/types/keys.go +++ b/x/virtualgroup/types/keys.go @@ -28,6 +28,8 @@ const ( // NoSpecifiedFamilyId defines NoSpecifiedFamilyId = uint32(0) + + NoSpecifiedGVGId = uint32(0) ) var ( @@ -43,6 +45,9 @@ var ( SwapOutFamilyKey = []byte{0x51} SwapOutGVGKey = []byte{0x61} + + SwapInFamilyKey = []byte{0x52} + SwapInGVGKey = []byte{0x62} ) func GetGVGKey(gvgID uint32) []byte { @@ -69,3 +74,13 @@ func GetSwapOutGVGKey(globalVirtualGroupID uint32) []byte { var uint32Seq sequence.Sequence[uint32] return append(SwapOutGVGKey, uint32Seq.EncodeSequence(globalVirtualGroupID)...) } + +func GetSwapInFamilyKey(globalVirtualGroupFamilyID uint32) []byte { + var uint32Seq sequence.Sequence[uint32] + return append(SwapInFamilyKey, uint32Seq.EncodeSequence(globalVirtualGroupFamilyID)...) +} + +func GetSwapInGVGKey(globalVirtualGroupID uint32) []byte { + var uint32Seq sequence.Sequence[uint32] + return append(SwapInGVGKey, uint32Seq.EncodeSequence(globalVirtualGroupID)...) +} diff --git a/x/virtualgroup/types/message.go b/x/virtualgroup/types/message.go index a1e1a08d0..5db2fcc01 100644 --- a/x/virtualgroup/types/message.go +++ b/x/virtualgroup/types/message.go @@ -17,6 +17,9 @@ const ( TypeMsgSwapOut = "swap_out" TypeMsgUpdateParams = "update_params" TypeMsgSettle = "settle" + TypeMsgReserveSwapIn = "reserve_swap_in" + TypeMsgCancelSwapIn = "cancel_swap_in" + TypeMsgCompleteSwapIn = "complete_swap_in" ) var ( @@ -27,6 +30,9 @@ var ( _ sdk.Msg = &MsgSwapOut{} _ sdk.Msg = &MsgUpdateParams{} _ sdk.Msg = &MsgSettle{} + _ sdk.Msg = &MsgReserveSwapIn{} + _ sdk.Msg = &MsgCancelSwapIn{} + _ sdk.Msg = &MsgCompleteSwapIn{} ) func NewMsgCreateGlobalVirtualGroup(primarySpAddress sdk.AccAddress, globalVirtualFamilyId uint32, secondarySpIds []uint32, deposit sdk.Coin) *MsgCreateGlobalVirtualGroup { @@ -325,3 +331,140 @@ func (msg *MsgSettle) ValidateBasic() error { return nil } + +func NewMsgReserveSwapIn(storageProvider sdk.AccAddress, targetSPId, globalVirtualGroupFamilyID, globalVirtualGroupID uint32) *MsgReserveSwapIn { + return &MsgReserveSwapIn{ + StorageProvider: storageProvider.String(), + TargetSpId: targetSPId, + GlobalVirtualGroupFamilyId: globalVirtualGroupFamilyID, + GlobalVirtualGroupId: globalVirtualGroupID, + } +} + +func (msg *MsgReserveSwapIn) Route() string { + return RouterKey +} + +func (msg *MsgReserveSwapIn) Type() string { + return TypeMsgReserveSwapIn +} + +func (msg *MsgReserveSwapIn) ValidateBasic() error { + _, err := sdk.AccAddressFromHexUnsafe(msg.StorageProvider) + if err != nil { + return sdkerrors.ErrInvalidAddress.Wrapf("invalid creator address (%s)", err) + } + if msg.GlobalVirtualGroupFamilyId == NoSpecifiedFamilyId { + if msg.GlobalVirtualGroupId == NoSpecifiedGVGId { + return gnfderrors.ErrInvalidMessage.Wrap("The gvg id need to be specified when familyID is not specified.") + } + } else { + if msg.GlobalVirtualGroupId != NoSpecifiedGVGId { + return gnfderrors.ErrInvalidMessage.Wrap("The gvg id need to be empty(0) when familyID is specified.") + } + } + if msg.TargetSpId == 0 { + return gnfderrors.ErrInvalidMessage.Wrap("The target sp id is not specified.") + } + return nil +} + +func (msg *MsgReserveSwapIn) GetSigners() []sdk.AccAddress { + operator, err := sdk.AccAddressFromHexUnsafe(msg.StorageProvider) + if err != nil { + panic(err) + } + return []sdk.AccAddress{operator} +} + +func (msg *MsgReserveSwapIn) GetSignBytes() []byte { + bz := ModuleCdc.MustMarshalJSON(msg) + return sdk.MustSortJSON(bz) +} + +func NewMsgCancelSwapIn(storageProvider sdk.AccAddress, globalVirtualGroupFamilyID, globalVirtualGroupID uint32) *MsgCancelSwapIn { + return &MsgCancelSwapIn{ + StorageProvider: storageProvider.String(), + GlobalVirtualGroupFamilyId: globalVirtualGroupFamilyID, + GlobalVirtualGroupId: globalVirtualGroupID, + } +} + +func (msg *MsgCancelSwapIn) Route() string { + return RouterKey +} + +func (msg *MsgCancelSwapIn) Type() string { + return TypeMsgCancelSwapIn +} + +func (msg *MsgCancelSwapIn) GetSigners() []sdk.AccAddress { + operator, err := sdk.AccAddressFromHexUnsafe(msg.StorageProvider) + if err != nil { + panic(err) + } + return []sdk.AccAddress{operator} +} + +func (msg *MsgCancelSwapIn) ValidateBasic() error { + _, err := sdk.AccAddressFromHexUnsafe(msg.StorageProvider) + if err != nil { + return sdkerrors.ErrInvalidAddress.Wrapf("invalid creator address (%s)", err) + } + if msg.GlobalVirtualGroupFamilyId == NoSpecifiedFamilyId { + if msg.GlobalVirtualGroupId == NoSpecifiedGVGId { + return gnfderrors.ErrInvalidMessage.Wrap("The gvg id need to be specified when familyID is not specified.") + } + } else { + if msg.GlobalVirtualGroupId != NoSpecifiedGVGId { + return gnfderrors.ErrInvalidMessage.Wrap("The gvg id need to be empty(0) when familyID is specified.") + } + } + return nil +} + +func NewMsgCompleteSwapIn(storageProvider sdk.AccAddress, globalVirtualGroupFamilyID, globalVirtualGroupID uint32) *MsgCompleteSwapIn { + return &MsgCompleteSwapIn{ + StorageProvider: storageProvider.String(), + GlobalVirtualGroupFamilyId: globalVirtualGroupFamilyID, + GlobalVirtualGroupId: globalVirtualGroupID, + } +} + +func (msg *MsgCompleteSwapIn) Route() string { + return RouterKey +} + +func (msg *MsgCompleteSwapIn) Type() string { + return TypeMsgCompleteSwapIn +} + +func (msg *MsgCompleteSwapIn) GetSigners() []sdk.AccAddress { + operator, err := sdk.AccAddressFromHexUnsafe(msg.StorageProvider) + if err != nil { + panic(err) + } + return []sdk.AccAddress{operator} +} + +func (msg *MsgCompleteSwapIn) GetSignBytes() []byte { + bz := ModuleCdc.MustMarshalJSON(msg) + return sdk.MustSortJSON(bz) +} + +func (msg *MsgCompleteSwapIn) ValidateBasic() error { + _, err := sdk.AccAddressFromHexUnsafe(msg.StorageProvider) + if err != nil { + return sdkerrors.ErrInvalidAddress.Wrapf("invalid creator address (%s)", err) + } + if msg.GlobalVirtualGroupFamilyId == NoSpecifiedFamilyId { + if msg.GlobalVirtualGroupId == NoSpecifiedGVGId { + return gnfderrors.ErrInvalidMessage.Wrap("The gvg id need to be specified when familyID is not specified.") + } + } else { + if msg.GlobalVirtualGroupId != NoSpecifiedGVGId { + return gnfderrors.ErrInvalidMessage.Wrap("The gvg id need to be empty(0) when familyID is specified.") + } + } + return nil +} diff --git a/x/virtualgroup/types/message_complete_storage_provider_exit.go b/x/virtualgroup/types/message_complete_storage_provider_exit.go index 9dc038f93..42d775f9b 100644 --- a/x/virtualgroup/types/message_complete_storage_provider_exit.go +++ b/x/virtualgroup/types/message_complete_storage_provider_exit.go @@ -4,15 +4,17 @@ import ( "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" ) const TypeMsgCompleteStorageProviderExit = "complete_storage_provider_exit" var _ sdk.Msg = &MsgCompleteStorageProviderExit{} -func NewMsgCompleteStorageProviderExit(operator sdk.AccAddress) *MsgCompleteStorageProviderExit { +func NewMsgCompleteStorageProviderExit(operator, storageProvider sdk.AccAddress) *MsgCompleteStorageProviderExit { return &MsgCompleteStorageProviderExit{ - StorageProvider: operator.String(), + Operator: operator.String(), + StorageProvider: storageProvider.String(), } } @@ -25,11 +27,12 @@ func (msg *MsgCompleteStorageProviderExit) Type() string { } func (msg *MsgCompleteStorageProviderExit) GetSigners() []sdk.AccAddress { - creator, err := sdk.AccAddressFromHexUnsafe(msg.StorageProvider) - if err != nil { - panic(err) + spAddr := sdk.MustAccAddressFromHex(msg.StorageProvider) + operator, err := sdk.AccAddressFromHexUnsafe(msg.Operator) + if err == nil { + return []sdk.AccAddress{operator} } - return []sdk.AccAddress{creator} + return []sdk.AccAddress{spAddr} } func (msg *MsgCompleteStorageProviderExit) GetSignBytes() []byte { @@ -40,7 +43,17 @@ func (msg *MsgCompleteStorageProviderExit) GetSignBytes() []byte { func (msg *MsgCompleteStorageProviderExit) ValidateBasic() error { _, err := sdk.AccAddressFromHexUnsafe(msg.StorageProvider) if err != nil { - return errors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err) + return errors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid storage provider address (%s)", err) + } + return nil +} + +func (msg *MsgCompleteStorageProviderExit) ValidateRuntime(ctx sdk.Context) error { + if ctx.IsUpgraded(upgradetypes.Hulunbeier) { + _, err := sdk.AccAddressFromHexUnsafe(msg.Operator) + if err != nil { + return errors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid operator address (%s)", err) + } } return nil } diff --git a/x/virtualgroup/types/message_complete_storage_provider_exit_test.go b/x/virtualgroup/types/message_complete_storage_provider_exit_test.go index b9948939f..a7ba8cf46 100644 --- a/x/virtualgroup/types/message_complete_storage_provider_exit_test.go +++ b/x/virtualgroup/types/message_complete_storage_provider_exit_test.go @@ -21,9 +21,17 @@ func TestMsgCompleteStorageProviderExit_ValidateBasic(t *testing.T) { StorageProvider: "invalid_address", }, err: sdkerrors.ErrInvalidAddress, - }, { + }, + { + name: "invalid operator", + msg: MsgCompleteStorageProviderExit{ + Operator: "invalid_address", + }, + err: sdkerrors.ErrInvalidAddress, + }, + { name: "valid address", - msg: *NewMsgCompleteStorageProviderExit(sample.RandAccAddress()), + msg: *NewMsgCompleteStorageProviderExit(sample.RandAccAddress(), sample.RandAccAddress()), }, } for _, tt := range tests { diff --git a/x/virtualgroup/types/message_storage_provider_forced_exit.go b/x/virtualgroup/types/message_storage_provider_forced_exit.go new file mode 100644 index 000000000..c9e953026 --- /dev/null +++ b/x/virtualgroup/types/message_storage_provider_forced_exit.go @@ -0,0 +1,45 @@ +package types + +import ( + "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" +) + +const TypeMsgStorageProviderForcedExit = "storage_provider_force_exit" + +var _ sdk.Msg = &MsgStorageProviderForcedExit{} + +func NewMsgStorageProviderForcedExit(authority string, spAddress sdk.AccAddress) *MsgStorageProviderForcedExit { + return &MsgStorageProviderForcedExit{ + Authority: authority, + StorageProvider: spAddress.String(), + } +} + +func (msg *MsgStorageProviderForcedExit) Route() string { + return RouterKey +} + +func (msg *MsgStorageProviderForcedExit) Type() string { + return TypeMsgStorageProviderForcedExit +} + +func (msg *MsgStorageProviderForcedExit) GetSigners() []sdk.AccAddress { + addr, _ := sdk.AccAddressFromHexUnsafe(msg.Authority) + return []sdk.AccAddress{addr} +} + +func (msg *MsgStorageProviderForcedExit) GetSignBytes() []byte { + return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(msg)) +} + +func (msg *MsgStorageProviderForcedExit) ValidateBasic() error { + if _, err := sdk.AccAddressFromHexUnsafe(msg.Authority); err != nil { + return errors.Wrap(err, "invalid authority address") + } + if _, err := sdk.AccAddressFromHexUnsafe(msg.StorageProvider); err != nil { + return errors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid sp address (%s)", err) + } + return nil +} diff --git a/x/virtualgroup/types/message_storage_provider_forced_exit_test.go b/x/virtualgroup/types/message_storage_provider_forced_exit_test.go new file mode 100644 index 000000000..97dca8cbe --- /dev/null +++ b/x/virtualgroup/types/message_storage_provider_forced_exit_test.go @@ -0,0 +1,49 @@ +package types + +import ( + "testing" + + "github.com/stretchr/testify/require" + + "github.com/bnb-chain/greenfield/testutil/sample" +) + +func TestMsgStorageProviderForcedExit_ValidateBasic(t *testing.T) { + tests := []struct { + name string + msg MsgStorageProviderForcedExit + expErr bool + expErrMsg string + }{ + { + name: "invalid authority", + msg: MsgStorageProviderForcedExit{ + Authority: "invalid authority address", + }, + expErr: true, + expErrMsg: "invalid authority address", + }, + { + name: "invalid address", + msg: MsgStorageProviderForcedExit{ + Authority: "0xaE4F00015B40eE402a7f05E46757c18Df86E49E1", + StorageProvider: "invalid_address", + }, + expErr: true, + expErrMsg: "invalid address", + }, { + name: "valid address", + msg: *NewMsgStorageProviderForcedExit(sample.RandAccAddress().String(), sample.RandAccAddress()), + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + err := tt.msg.ValidateBasic() + if tt.expErr { + require.Contains(t, err.Error(), tt.expErrMsg) + return + } + require.NoError(t, err) + }) + } +} diff --git a/x/virtualgroup/types/message_test.go b/x/virtualgroup/types/message_test.go index 8e77991dc..2ee993e3c 100644 --- a/x/virtualgroup/types/message_test.go +++ b/x/virtualgroup/types/message_test.go @@ -379,3 +379,204 @@ func TestMsgSettle_ValidateBasic(t *testing.T) { }) } } + +func TestMsgReserveSwapIn_ValidateBasic(t *testing.T) { + tests := []struct { + name string + msg MsgReserveSwapIn + err error + }{ + { + name: "valid case", + msg: MsgReserveSwapIn{ + StorageProvider: sample.RandAccAddressHex(), + GlobalVirtualGroupFamilyId: 1, + TargetSpId: 1, + GlobalVirtualGroupId: 0, + }, + }, + { + name: "valid case", + msg: MsgReserveSwapIn{ + StorageProvider: sample.RandAccAddressHex(), + GlobalVirtualGroupFamilyId: 0, + TargetSpId: 1, + GlobalVirtualGroupId: 1, + }, + }, + { + name: "invalid address", + msg: MsgReserveSwapIn{ + StorageProvider: "invalid_address", + GlobalVirtualGroupFamilyId: 0, + TargetSpId: 1, + GlobalVirtualGroupId: 1, + }, + err: sdkerrors.ErrInvalidAddress, + }, + { + name: "invalid virtual group family", + msg: MsgReserveSwapIn{ + StorageProvider: sample.RandAccAddressHex(), + GlobalVirtualGroupFamilyId: 0, + TargetSpId: 1, + GlobalVirtualGroupId: 0, + }, + err: gnfderrors.ErrInvalidMessage, + }, + { + name: "invalid virtual group", + msg: MsgReserveSwapIn{ + StorageProvider: sample.RandAccAddressHex(), + GlobalVirtualGroupFamilyId: 1, + TargetSpId: 1, + GlobalVirtualGroupId: 1, + }, + err: gnfderrors.ErrInvalidMessage, + }, + { + name: "invalid successor sp id", + msg: MsgReserveSwapIn{ + StorageProvider: sample.RandAccAddressHex(), + GlobalVirtualGroupFamilyId: 1, + GlobalVirtualGroupId: 0, + TargetSpId: 0, + }, + err: gnfderrors.ErrInvalidMessage, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + err := tt.msg.ValidateBasic() + if tt.err != nil { + require.ErrorIs(t, err, tt.err) + return + } + require.NoError(t, err) + }) + } +} + +func TestMsgCompleteSwapIn_ValidateBasic(t *testing.T) { + tests := []struct { + name string + msg MsgCompleteSwapIn + err error + }{ + { + name: "valid case", + msg: MsgCompleteSwapIn{ + StorageProvider: sample.RandAccAddressHex(), + GlobalVirtualGroupFamilyId: 1, + GlobalVirtualGroupId: 0, + }, + }, + { + name: "valid case", + msg: MsgCompleteSwapIn{ + StorageProvider: sample.RandAccAddressHex(), + GlobalVirtualGroupFamilyId: 0, + GlobalVirtualGroupId: 1, + }, + }, + { + name: "invalid address", + msg: MsgCompleteSwapIn{ + StorageProvider: "invalid_address", + GlobalVirtualGroupFamilyId: 0, + GlobalVirtualGroupId: 1, + }, + err: sdkerrors.ErrInvalidAddress, + }, + { + name: "invalid virtual group family", + msg: MsgCompleteSwapIn{ + StorageProvider: sample.RandAccAddressHex(), + GlobalVirtualGroupFamilyId: 0, + GlobalVirtualGroupId: 0, + }, + err: gnfderrors.ErrInvalidMessage, + }, + { + name: "invalid virtual group", + msg: MsgCompleteSwapIn{ + StorageProvider: sample.RandAccAddressHex(), + GlobalVirtualGroupFamilyId: 1, + GlobalVirtualGroupId: 1, + }, + err: gnfderrors.ErrInvalidMessage, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + err := tt.msg.ValidateBasic() + if tt.err != nil { + require.ErrorIs(t, err, tt.err) + return + } + require.NoError(t, err) + }) + } +} + +func TestMsgCancelSwapIn_ValidateBasic(t *testing.T) { + tests := []struct { + name string + msg MsgCancelSwapIn + err error + }{ + { + name: "valid case", + msg: MsgCancelSwapIn{ + StorageProvider: sample.RandAccAddressHex(), + GlobalVirtualGroupFamilyId: 1, + GlobalVirtualGroupId: 0, + }, + }, + { + name: "valid case", + msg: MsgCancelSwapIn{ + StorageProvider: sample.RandAccAddressHex(), + GlobalVirtualGroupFamilyId: 0, + GlobalVirtualGroupId: 1, + }, + }, + { + name: "invalid address", + msg: MsgCancelSwapIn{ + StorageProvider: "invalid_address", + GlobalVirtualGroupFamilyId: 0, + GlobalVirtualGroupId: 1, + }, + err: sdkerrors.ErrInvalidAddress, + }, + { + name: "invalid virtual group family", + msg: MsgCancelSwapIn{ + StorageProvider: sample.RandAccAddressHex(), + GlobalVirtualGroupFamilyId: 0, + GlobalVirtualGroupId: 0, + }, + err: gnfderrors.ErrInvalidMessage, + }, + { + name: "invalid virtual group", + msg: MsgCancelSwapIn{ + StorageProvider: sample.RandAccAddressHex(), + GlobalVirtualGroupFamilyId: 1, + GlobalVirtualGroupId: 1, + }, + err: gnfderrors.ErrInvalidMessage, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + err := tt.msg.ValidateBasic() + if tt.err != nil { + require.ErrorIs(t, err, tt.err) + return + } + require.NoError(t, err) + }) + } +} diff --git a/x/virtualgroup/types/params.go b/x/virtualgroup/types/params.go index 7637d6948..746a78cd5 100644 --- a/x/virtualgroup/types/params.go +++ b/x/virtualgroup/types/params.go @@ -21,11 +21,15 @@ var ( DefaultGVGStakingPerBytes = sdk.NewInt(16000) // 20%~30% of store price DefaultMaxGlobalVirtualGroupNumPerFamily = uint32(10) DefaultMaxStoreSizePerFamily = uint64(64) * 1024 * 1024 * 1024 * 1024 //64T + DefaultSwapInValidityPeriod = math.NewInt(60 * 60 * 24 * 7) // 7 days + DefaultSPConcurrentExitNum = math.NewInt(1) KeyDepositDenom = []byte("DepositDenom") KeyGVGStakingPerBytes = []byte("GVGStakingPerBytes") KeyMaxGlobalVirtualGroupNumPerFamily = []byte("MaxGlobalVirtualGroupNumPerFamily") KeyMaxStoreSizePerFamily = []byte("MaxStoreSizePerFamily") + KeySwapInValidityPeriod = []byte("SwapInValidityPeriod") + KeySPConcurrentExitNum = []byte("SPConcurrentExitNum") ) var _ paramtypes.ParamSet = (*Params)(nil) @@ -37,18 +41,25 @@ func ParamKeyTable() paramtypes.KeyTable { // NewParams creates a new Params instance func NewParams(depositDenom string, gvgStakingPerBytes math.Int, maxGlobalVirtualGroupPerFamily uint32, - maxStoreSizePerFamily uint64) Params { + maxStoreSizePerFamily uint64, swapInValidityPeriod, spConcurrentExitNum math.Int) Params { return Params{ DepositDenom: depositDenom, GvgStakingPerBytes: gvgStakingPerBytes, MaxGlobalVirtualGroupNumPerFamily: maxGlobalVirtualGroupPerFamily, MaxStoreSizePerFamily: maxStoreSizePerFamily, + SwapInValidityPeriod: &swapInValidityPeriod, + SpConcurrentExitNum: &spConcurrentExitNum, } } // DefaultParams returns a default set of parameters func DefaultParams() Params { - return NewParams(DefaultDepositDenom, DefaultGVGStakingPerBytes, DefaultMaxGlobalVirtualGroupNumPerFamily, DefaultMaxStoreSizePerFamily) + return NewParams(DefaultDepositDenom, + DefaultGVGStakingPerBytes, + DefaultMaxGlobalVirtualGroupNumPerFamily, + DefaultMaxStoreSizePerFamily, + DefaultSwapInValidityPeriod, + DefaultSPConcurrentExitNum) } // ParamSetPairs get the params.ParamSet @@ -58,6 +69,8 @@ func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { paramtypes.NewParamSetPair(KeyGVGStakingPerBytes, &p.GvgStakingPerBytes, validateGVGStakingPerBytes), paramtypes.NewParamSetPair(KeyMaxGlobalVirtualGroupNumPerFamily, &p.MaxGlobalVirtualGroupNumPerFamily, validateMaxGlobalVirtualGroupNumPerFamily), paramtypes.NewParamSetPair(KeyMaxStoreSizePerFamily, &p.MaxStoreSizePerFamily, validateMaxStoreSizePerFamily), + paramtypes.NewParamSetPair(KeySwapInValidityPeriod, &p.SwapInValidityPeriod, validateSwapInValidityPeriod), + paramtypes.NewParamSetPair(KeySPConcurrentExitNum, &p.SpConcurrentExitNum, validateSPConcurrentExitNum), } } @@ -75,6 +88,13 @@ func (p Params) Validate() error { if err := validateMaxStoreSizePerFamily(p.MaxStoreSizePerFamily); err != nil { return err } + if err := validateSwapInValidityPeriod(p.SwapInValidityPeriod); err != nil { + return err + } + if err := validateSPConcurrentExitNum(p.SpConcurrentExitNum); err != nil { + return err + } + return nil } @@ -137,3 +157,30 @@ func validateMaxStoreSizePerFamily(i interface{}) error { return nil } + +func validateSwapInValidityPeriod(i interface{}) error { + v, ok := i.(*math.Int) + if !ok { + return fmt.Errorf("invalid parameter type: %T", i) + } + if v != nil && !v.IsNil() { + if !v.IsPositive() { + return fmt.Errorf("swapIn info validity period must be positive: %s", v) + } + } + return nil +} + +func validateSPConcurrentExitNum(i interface{}) error { + v, ok := i.(*math.Int) + if !ok { + return fmt.Errorf("invalid parameter type: %T", i) + } + + if v != nil && !v.IsNil() { + if !v.IsPositive() { + return fmt.Errorf("number of sp concurrent exit must be positive: %s", v) + } + } + return nil +} diff --git a/x/virtualgroup/types/params.pb.go b/x/virtualgroup/types/params.pb.go index 4f0e126cd..957e54b9b 100644 --- a/x/virtualgroup/types/params.pb.go +++ b/x/virtualgroup/types/params.pb.go @@ -37,6 +37,10 @@ type Params struct { MaxGlobalVirtualGroupNumPerFamily uint32 `protobuf:"varint,4,opt,name=max_global_virtual_group_num_per_family,json=maxGlobalVirtualGroupNumPerFamily,proto3" json:"max_global_virtual_group_num_per_family,omitempty"` // if the store size reach the exceed, the family is not allowed to sever more buckets MaxStoreSizePerFamily uint64 `protobuf:"varint,5,opt,name=max_store_size_per_family,json=maxStoreSizePerFamily,proto3" json:"max_store_size_per_family,omitempty"` + // the validity period that a successor SP can reserve to complete the swap for Global virtual group/family + SwapInValidityPeriod *github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,6,opt,name=swap_in_validity_period,json=swapInValidityPeriod,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"swap_in_validity_period,omitempty"` + // the the number of sp allowed to exit concurrently. + SpConcurrentExitNum *github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,7,opt,name=sp_concurrent_exit_num,json=spConcurrentExitNum,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"sp_concurrent_exit_num,omitempty"` } func (m *Params) Reset() { *m = Params{} } @@ -108,33 +112,38 @@ func init() { } var fileDescriptor_d8ecf89dd5128885 = []byte{ - // 414 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x92, 0x3f, 0x6f, 0xd4, 0x30, - 0x18, 0x87, 0x63, 0x5a, 0x2a, 0xb0, 0xe8, 0x12, 0x51, 0x91, 0x76, 0x48, 0xc2, 0x1f, 0x95, 0x5b, - 0x2e, 0x19, 0x60, 0x40, 0x88, 0xe9, 0x84, 0xa8, 0x2a, 0xa1, 0xea, 0x94, 0x93, 0x18, 0x58, 0x2c, - 0x27, 0x71, 0x5d, 0xeb, 0x62, 0x3b, 0xb2, 0x9d, 0x53, 0xae, 0x9f, 0x80, 0x91, 0x91, 0xb1, 0x1f, - 0x82, 0x0f, 0x71, 0xe3, 0x89, 0x09, 0x31, 0x9c, 0xd0, 0xdd, 0xc2, 0xc7, 0x40, 0x76, 0x22, 0x08, - 0x42, 0x9d, 0x92, 0xfc, 0xf2, 0xf8, 0xd1, 0xfb, 0xbe, 0x7e, 0xe1, 0x33, 0xaa, 0x08, 0x11, 0x97, - 0x8c, 0x54, 0x65, 0xba, 0x60, 0xca, 0x34, 0xb8, 0xa2, 0x4a, 0x36, 0x75, 0x5a, 0x63, 0x85, 0xb9, - 0x4e, 0x6a, 0x25, 0x8d, 0xf4, 0x1f, 0xfd, 0xa5, 0x92, 0x21, 0x75, 0x72, 0x5c, 0x48, 0xcd, 0xa5, - 0x46, 0x0e, 0x4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0x1c, 0xe8, 0xbf, 0x82, 0xc7, 0xd6, 0xa9, - 0x8d, 0x54, 0x04, 0x69, 0x76, 0x4d, 0x86, 0x96, 0xbb, 0x31, 0x18, 0xed, 0x67, 0x47, 0x1c, 0xb7, - 0x33, 0xfb, 0x7f, 0xc6, 0xae, 0xc9, 0x9f, 0x93, 0xaf, 0xef, 0x7d, 0xb9, 0x89, 0xbc, 0x5f, 0x37, - 0x11, 0x98, 0x5c, 0xac, 0xb6, 0x21, 0x58, 0x6f, 0x43, 0xf0, 0x73, 0x1b, 0x82, 0xcf, 0xbb, 0xd0, - 0x5b, 0xef, 0x42, 0xef, 0xfb, 0x2e, 0xf4, 0x3e, 0xbe, 0x1c, 0x4c, 0x33, 0x17, 0xf9, 0xb8, 0xb8, - 0xc2, 0x4c, 0xa4, 0x83, 0x4d, 0x69, 0xff, 0xdd, 0x15, 0x37, 0xdf, 0xfc, 0xc0, 0xdd, 0xf0, 0x8b, - 0xdf, 0x01, 0x00, 0x00, 0xff, 0xff, 0x12, 0x99, 0xe2, 0xe9, 0x53, 0x02, 0x00, 0x00, + // 481 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x93, 0x3d, 0x6f, 0xd3, 0x40, + 0x18, 0xc7, 0x6d, 0x08, 0x01, 0x4e, 0x74, 0x31, 0x2d, 0x75, 0x3b, 0x38, 0xe1, 0x45, 0x25, 0x4b, + 0xe2, 0x01, 0x86, 0x0a, 0x31, 0x85, 0x97, 0x2a, 0x12, 0x8a, 0x22, 0x47, 0xea, 0xc0, 0x72, 0x3a, + 0xdb, 0xd7, 0xeb, 0x29, 0xbe, 0x17, 0xdd, 0x9d, 0x83, 0xd3, 0x4f, 0xc1, 0xc8, 0xd8, 0x0f, 0xc1, + 0x87, 0xe8, 0x58, 0x31, 0x21, 0x86, 0x0a, 0x25, 0x4b, 0x3f, 0x06, 0xba, 0xb3, 0x45, 0x82,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1, 0xe5, 0xc6, 0x72, 0x29, + 0x4f, 0xfb, 0xd9, 0x29, 0xa2, 0x3c, 0xde, 0xb8, 0x09, 0xd5, 0x9f, 0x77, 0xc1, 0x05, 0x48, 0xdb, + 0xee, 0x04, 0xbf, 0xf8, 0x15, 0x00, 0x00, 0xff, 0xff, 0x54, 0x16, 0x3f, 0x9d, 0x33, 0x03, 0x00, + 0x00, } func (this *Params) Equal(that interface{}) bool { @@ -171,6 +180,20 @@ func (this *Params) Equal(that interface{}) bool { if this.MaxStoreSizePerFamily != that1.MaxStoreSizePerFamily { return false } + if that1.SwapInValidityPeriod == nil { + if this.SwapInValidityPeriod != nil { + return false + } + } else if !this.SwapInValidityPeriod.Equal(*that1.SwapInValidityPeriod) { + return false + } + if that1.SpConcurrentExitNum == nil { + if this.SpConcurrentExitNum != nil { + return false + } + } else if !this.SpConcurrentExitNum.Equal(*that1.SpConcurrentExitNum) { + return false + } return true } func (m *Params) Marshal() (dAtA []byte, err error) { @@ -193,6 +216,30 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.SpConcurrentExitNum != nil { + { + size := m.SpConcurrentExitNum.Size() + i -= size + if _, err := m.SpConcurrentExitNum.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintParams(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x3a + } + if m.SwapInValidityPeriod != nil { + { + size := m.SwapInValidityPeriod.Size() + i -= size + if _, err := m.SwapInValidityPeriod.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintParams(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x32 + } if m.MaxStoreSizePerFamily != 0 { i = encodeVarintParams(dAtA, i, uint64(m.MaxStoreSizePerFamily)) i-- @@ -260,6 +307,14 @@ func (m *Params) Size() (n int) { if m.MaxStoreSizePerFamily != 0 { n += 1 + sovParams(uint64(m.MaxStoreSizePerFamily)) } + if m.SwapInValidityPeriod != nil { + l = m.SwapInValidityPeriod.Size() + n += 1 + l + sovParams(uint64(l)) + } + if m.SpConcurrentExitNum != nil { + l = m.SpConcurrentExitNum.Size() + n += 1 + l + sovParams(uint64(l)) + } return n } @@ -421,6 +476,78 @@ func (m *Params) Unmarshal(dAtA []byte) error { break } } + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SwapInValidityPeriod", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthParams + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthParams + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var v github_com_cosmos_cosmos_sdk_types.Int + m.SwapInValidityPeriod = &v + if err := m.SwapInValidityPeriod.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SpConcurrentExitNum", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthParams + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthParams + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var v github_com_cosmos_cosmos_sdk_types.Int + m.SpConcurrentExitNum = &v + if err := m.SpConcurrentExitNum.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipParams(dAtA[iNdEx:]) diff --git a/x/virtualgroup/types/query.pb.go b/x/virtualgroup/types/query.pb.go index 87be1e8f6..35d098dcc 100644 --- a/x/virtualgroup/types/query.pb.go +++ b/x/virtualgroup/types/query.pb.go @@ -579,6 +579,190 @@ func (m *AvailableGlobalVirtualGroupFamiliesResponse) GetGlobalVirtualGroupFamil return nil } +type QuerySwapInInfoRequest struct { + GlobalVirtualGroupFamilyId uint32 `protobuf:"varint,1,opt,name=global_virtual_group_family_id,json=globalVirtualGroupFamilyId,proto3" json:"global_virtual_group_family_id,omitempty"` + GlobalVirtualGroupId uint32 `protobuf:"varint,2,opt,name=global_virtual_group_id,json=globalVirtualGroupId,proto3" json:"global_virtual_group_id,omitempty"` +} + +func (m *QuerySwapInInfoRequest) Reset() { *m = QuerySwapInInfoRequest{} } +func (m *QuerySwapInInfoRequest) String() string { return proto.CompactTextString(m) } +func (*QuerySwapInInfoRequest) ProtoMessage() {} +func (*QuerySwapInInfoRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_83cd53fc415e00e7, []int{12} +} +func (m *QuerySwapInInfoRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QuerySwapInInfoRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QuerySwapInInfoRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QuerySwapInInfoRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QuerySwapInInfoRequest.Merge(m, src) +} +func (m *QuerySwapInInfoRequest) XXX_Size() int { + return m.Size() +} +func (m *QuerySwapInInfoRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QuerySwapInInfoRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QuerySwapInInfoRequest proto.InternalMessageInfo + +func (m *QuerySwapInInfoRequest) GetGlobalVirtualGroupFamilyId() uint32 { + if m != nil { + return m.GlobalVirtualGroupFamilyId + } + return 0 +} + +func (m *QuerySwapInInfoRequest) GetGlobalVirtualGroupId() uint32 { + if m != nil { + return m.GlobalVirtualGroupId + } + return 0 +} + +type QuerySwapInInfoResponse struct { + SwapInInfo *SwapInInfo `protobuf:"bytes,1,opt,name=swap_in_info,json=swapInInfo,proto3" json:"swap_in_info,omitempty"` +} + +func (m *QuerySwapInInfoResponse) Reset() { *m = QuerySwapInInfoResponse{} } +func (m *QuerySwapInInfoResponse) String() string { return proto.CompactTextString(m) } +func (*QuerySwapInInfoResponse) ProtoMessage() {} +func (*QuerySwapInInfoResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_83cd53fc415e00e7, []int{13} +} +func (m *QuerySwapInInfoResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QuerySwapInInfoResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QuerySwapInInfoResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QuerySwapInInfoResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QuerySwapInInfoResponse.Merge(m, src) +} +func (m *QuerySwapInInfoResponse) XXX_Size() int { + return m.Size() +} +func (m *QuerySwapInInfoResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QuerySwapInInfoResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QuerySwapInInfoResponse proto.InternalMessageInfo + +func (m *QuerySwapInInfoResponse) GetSwapInInfo() *SwapInInfo { + if m != nil { + return m.SwapInInfo + } + return nil +} + +type QuerySPGVGStatisticsRequest struct { + SpId uint32 `protobuf:"varint,1,opt,name=sp_id,json=spId,proto3" json:"sp_id,omitempty"` +} + +func (m *QuerySPGVGStatisticsRequest) Reset() { *m = QuerySPGVGStatisticsRequest{} } +func (m *QuerySPGVGStatisticsRequest) String() string { return proto.CompactTextString(m) } +func (*QuerySPGVGStatisticsRequest) ProtoMessage() {} +func (*QuerySPGVGStatisticsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_83cd53fc415e00e7, []int{14} +} +func (m *QuerySPGVGStatisticsRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QuerySPGVGStatisticsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QuerySPGVGStatisticsRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QuerySPGVGStatisticsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QuerySPGVGStatisticsRequest.Merge(m, src) +} +func (m *QuerySPGVGStatisticsRequest) XXX_Size() int { + return m.Size() +} +func (m *QuerySPGVGStatisticsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QuerySPGVGStatisticsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QuerySPGVGStatisticsRequest proto.InternalMessageInfo + +func (m *QuerySPGVGStatisticsRequest) GetSpId() uint32 { + if m != nil { + return m.SpId + } + return 0 +} + +type QuerySPGVGStatisticsResponse struct { + GvgStats *GVGStatisticsWithinSP `protobuf:"bytes,1,opt,name=gvg_stats,json=gvgStats,proto3" json:"gvg_stats,omitempty"` +} + +func (m *QuerySPGVGStatisticsResponse) Reset() { *m = QuerySPGVGStatisticsResponse{} } +func (m *QuerySPGVGStatisticsResponse) String() string { return proto.CompactTextString(m) } +func (*QuerySPGVGStatisticsResponse) ProtoMessage() {} +func (*QuerySPGVGStatisticsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_83cd53fc415e00e7, []int{15} +} +func (m *QuerySPGVGStatisticsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QuerySPGVGStatisticsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QuerySPGVGStatisticsResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QuerySPGVGStatisticsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QuerySPGVGStatisticsResponse.Merge(m, src) +} +func (m *QuerySPGVGStatisticsResponse) XXX_Size() int { + return m.Size() +} +func (m *QuerySPGVGStatisticsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QuerySPGVGStatisticsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QuerySPGVGStatisticsResponse proto.InternalMessageInfo + +func (m *QuerySPGVGStatisticsResponse) GetGvgStats() *GVGStatisticsWithinSP { + if m != nil { + return m.GvgStats + } + return nil +} + func init() { proto.RegisterType((*QueryParamsRequest)(nil), "greenfield.virtualgroup.QueryParamsRequest") proto.RegisterType((*QueryParamsResponse)(nil), "greenfield.virtualgroup.QueryParamsResponse") @@ -592,6 +776,10 @@ func init() { proto.RegisterType((*QueryGlobalVirtualGroupFamiliesResponse)(nil), "greenfield.virtualgroup.QueryGlobalVirtualGroupFamiliesResponse") proto.RegisterType((*AvailableGlobalVirtualGroupFamiliesRequest)(nil), "greenfield.virtualgroup.AvailableGlobalVirtualGroupFamiliesRequest") proto.RegisterType((*AvailableGlobalVirtualGroupFamiliesResponse)(nil), "greenfield.virtualgroup.AvailableGlobalVirtualGroupFamiliesResponse") + proto.RegisterType((*QuerySwapInInfoRequest)(nil), "greenfield.virtualgroup.QuerySwapInInfoRequest") + proto.RegisterType((*QuerySwapInInfoResponse)(nil), "greenfield.virtualgroup.QuerySwapInInfoResponse") + proto.RegisterType((*QuerySPGVGStatisticsRequest)(nil), "greenfield.virtualgroup.QuerySPGVGStatisticsRequest") + proto.RegisterType((*QuerySPGVGStatisticsResponse)(nil), "greenfield.virtualgroup.QuerySPGVGStatisticsResponse") } func init() { @@ -599,55 +787,67 @@ func init() { } var fileDescriptor_83cd53fc415e00e7 = []byte{ - // 762 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x96, 0xcf, 0x4f, 0x13, 0x41, - 0x14, 0xc7, 0x3b, 0xa8, 0x44, 0x1e, 0x72, 0x19, 0x6a, 0x20, 0x0b, 0xd9, 0xea, 0x82, 0x80, 0x20, - 0xbb, 0x01, 0x01, 0x89, 0x01, 0x84, 0x42, 0x40, 0x2e, 0x06, 0x1b, 0xa2, 0x89, 0x89, 0x69, 0x66, - 0xe9, 0x30, 0x6c, 0xb2, 0xdd, 0x5d, 0xba, 0xdb, 0xc6, 0xde, 0x8c, 0x67, 0x0e, 0x26, 0x9e, 0xfc, - 0x67, 0x3c, 0x73, 0x24, 0xf1, 0xa0, 0x27, 0x35, 0xe0, 0xc5, 0x7f, 0xc1, 0x78, 0x30, 0x9d, 0x99, - 0x4d, 0xa9, 0xed, 0xf4, 0x17, 0xde, 0x9a, 0xdd, 0xf7, 0xbe, 0xef, 0xfb, 0x79, 0xc3, 0x7c, 0x59, - 0x18, 0x63, 0x05, 0x4a, 0xbd, 0x43, 0x87, 0xba, 0x39, 0xab, 0xe4, 0x14, 0xa2, 0x22, 0x71, 0x59, - 0xc1, 0x2f, 0x06, 0xd6, 0x71, 0x91, 0x16, 0xca, 0x66, 0x50, 0xf0, 0x23, 0x1f, 0x0f, 0x55, 0x8b, - 0xcc, 0xcb, 0x45, 0xda, 0xf4, 0x81, 0x1f, 0xe6, 0xfd, 0xd0, 0xb2, 0x49, 0x48, 0x45, 0x87, 0x55, - 0x9a, 0xb3, 0x69, 0x44, 0xe6, 0xac, 0x80, 0x30, 0xc7, 0x23, 0x91, 0xe3, 0x7b, 0x42, 0x44, 0x4b, - 0x32, 0x9f, 0xf9, 0xfc, 0xa7, 0x55, 0xf9, 0x25, 0x9f, 0x8e, 0x32, 0xdf, 0x67, 0x2e, 0xb5, 0x48, - 0xe0, 0x58, 0xc4, 0xf3, 0xfc, 0x88, 0x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0x6c, 0xcf, 0x9e, 0x3d, 0x38, 0x22, 0x8e, - 0x77, 0x79, 0xde, 0x9b, 0x06, 0x9f, 0xa8, 0x76, 0x2f, 0xff, 0x46, 0x7d, 0xf8, 0x37, 0x00, 0x00, - 0xff, 0xff, 0x7c, 0x68, 0xc4, 0x2a, 0x8e, 0x0b, 0x00, 0x00, + // 954 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x97, 0xcf, 0x6f, 0xdc, 0x44, + 0x14, 0xc7, 0x33, 0xa1, 0x8d, 0xda, 0xd7, 0xe4, 0x32, 0x09, 0x24, 0x72, 0xa2, 0x5d, 0x70, 0xda, + 0xa6, 0xa4, 0x8d, 0x4d, 0x42, 0x52, 0x2a, 0xd4, 0x96, 0x76, 0x1b, 0xba, 0x44, 0x48, 0x28, 0x6c, + 0xaa, 0x56, 0x42, 0x42, 0x66, 0x9c, 0x78, 0x27, 0x23, 0x36, 0x1e, 0x77, 0xc7, 0xbb, 0x65, 0x6f, + 0x88, 0x73, 0x0f, 0x48, 0x3d, 0x71, 0xe1, 0x6f, 0xe0, 0x2f, 0xe0, 0x9c, 0x63, 0x24, 0x0e, 0x70, + 0x02, 0x94, 0x70, 0xe1, 0x5f, 0xe0, 0x84, 0x3c, 0x33, 0xee, 0xee, 0xd6, 0x3b, 0xde, 0xf5, 0xb6, + 0x37, 0xcb, 0x7e, 0xef, 0xfb, 0xbe, 0x9f, 0xf9, 0xf1, 0x9e, 0x0c, 0xcb, 0xb4, 0x19, 0x04, 0x61, + 0x9d, 0x05, 0x8d, 0x03, 0xb7, 0xcd, 0x9a, 0x71, 0x8b, 0x34, 0x68, 0x93, 0xb7, 0x22, 0xf7, 0x69, + 0x2b, 0x68, 0x76, 0x9c, 0xa8, 0xc9, 0x63, 0x8e, 0xe7, 0xbb, 0x41, 0x4e, 0x6f, 0x90, 0xb5, 0xba, + 0xcf, 0xc5, 0x11, 0x17, 0xae, 0x4f, 0x44, 0xa0, 0x32, 0xdc, 0xf6, 0xba, 0x1f, 0xc4, 0x64, 0xdd, + 0x8d, 0x08, 0x65, 0x21, 0x89, 0x19, 0x0f, 0x95, 0x88, 0x35, 0x47, 0x39, 0xe5, 0xf2, 0xd1, 0x4d, + 0x9e, 0xf4, 0xdb, 0x25, 0xca, 0x39, 0x6d, 0x04, 0x2e, 0x89, 0x98, 0x4b, 0xc2, 0x90, 0xc7, 0x32, + 0x45, 0xe8, 0xaf, 0x97, 0x4d, 0xee, 0x22, 0xd2, 0x24, 0x47, 0x69, 0x94, 0x91, 0x21, 0xee, 0x44, + 0x81, 0x0e, 0xb2, 0xe7, 0x00, 0x7f, 0x99, 0x18, 0xdc, 0x95, 0x99, 0xb5, 0xe0, 0x69, 0x2b, 0x10, + 0xb1, 0xfd, 0x08, 0x66, 0xfb, 0xde, 0x8a, 0x88, 0x87, 0x22, 0xc0, 0x77, 0x60, 0x4a, 0x55, 0x58, + 0x40, 0xef, 0xa2, 0x6b, 0x97, 0x36, 0xca, 0x8e, 0x61, 0x05, 0x1c, 0x95, 0x58, 0x39, 0x77, 0xfc, + 0x67, 0x79, 0xa2, 0xa6, 0x93, 0xec, 0x27, 0x50, 0x92, 0xaa, 0xd5, 0x06, 0xf7, 0x49, 0xe3, 0xb1, + 0x8a, 0xaf, 0x26, 0xf1, 0xba, 0x2e, 0xde, 0x82, 0x79, 0x2a, 0x3f, 0x7a, 0x5a, 0xcd, 0x93, 0x72, + 0x1e, 0x3b, 0x90, 0x15, 0x67, 0x6a, 0x73, 0x34, 0x93, 0xbb, 0x73, 0x60, 0x7f, 0x8f, 0xa0, 0x6c, + 0x54, 0xd6, 0xde, 0xbf, 0x86, 0xb9, 0x41, 0xd2, 0x9a, 0xe4, 0xba, 0x91, 0x64, 0x80, 0x24, 0xce, + 0x9a, 0xb0, 0x43, 0xb8, 0x66, 0x70, 0x50, 0xe9, 0x3c, 0x24, 0x47, 0xac, 0xd1, 0x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0x3a, 0x8d, 0x54, 0x6e, 0xe5, 0x8b, 0xe3, 0xd3, 0x12, 0x3a, 0x39, 0x2d, 0xa1, 0xbf, 0x4f, + 0x4b, 0xe8, 0xc7, 0xb3, 0xd2, 0xc4, 0xc9, 0x59, 0x69, 0xe2, 0x8f, 0xb3, 0xd2, 0xc4, 0x57, 0x9b, + 0x94, 0xc5, 0x87, 0x2d, 0xdf, 0xd9, 0xe7, 0x47, 0xae, 0x1f, 0xfa, 0x6b, 0xfb, 0x87, 0x84, 0x85, + 0xbd, 0xca, 0xdf, 0x0d, 0xf8, 0x1f, 0xf3, 0xa7, 0xe4, 0x0f, 0xd9, 0x87, 0xff, 0x07, 0x00, 0x00, + 0xff, 0xff, 0x90, 0x43, 0xb6, 0xb4, 0x7b, 0x0e, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -674,6 +874,10 @@ type QueryClient interface { GlobalVirtualGroupFamilies(ctx context.Context, in *QueryGlobalVirtualGroupFamiliesRequest, opts ...grpc.CallOption) (*QueryGlobalVirtualGroupFamiliesResponse, error) // AvailableGlobalVirtualGroupFamilies filters a list of GlobalVirtualGroupFamilies ID which are qualified to create bucket on AvailableGlobalVirtualGroupFamilies(ctx context.Context, in *AvailableGlobalVirtualGroupFamiliesRequest, opts ...grpc.CallOption) (*AvailableGlobalVirtualGroupFamiliesResponse, error) + // SwapInInfo gets reserved swapIn info for a specific global virtual group family or global virtual group + SwapInInfo(ctx context.Context, in *QuerySwapInInfoRequest, opts ...grpc.CallOption) (*QuerySwapInInfoResponse, error) + // GVGStatistics gets gvg statistics for a SP + GVGStatistics(ctx context.Context, in *QuerySPGVGStatisticsRequest, opts ...grpc.CallOption) (*QuerySPGVGStatisticsResponse, error) } type queryClient struct { @@ -738,6 +942,24 @@ func (c *queryClient) AvailableGlobalVirtualGroupFamilies(ctx context.Context, i return out, nil } +func (c *queryClient) SwapInInfo(ctx context.Context, in *QuerySwapInInfoRequest, opts ...grpc.CallOption) (*QuerySwapInInfoResponse, error) { + out := new(QuerySwapInInfoResponse) + err := c.cc.Invoke(ctx, "/greenfield.virtualgroup.Query/SwapInInfo", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) GVGStatistics(ctx context.Context, in *QuerySPGVGStatisticsRequest, opts ...grpc.CallOption) (*QuerySPGVGStatisticsResponse, error) { + out := new(QuerySPGVGStatisticsResponse) + err := c.cc.Invoke(ctx, "/greenfield.virtualgroup.Query/GVGStatistics", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // QueryServer is the server API for Query service. type QueryServer interface { // Parameters queries the parameters of the module. @@ -752,6 +974,10 @@ type QueryServer interface { GlobalVirtualGroupFamilies(context.Context, *QueryGlobalVirtualGroupFamiliesRequest) (*QueryGlobalVirtualGroupFamiliesResponse, error) // AvailableGlobalVirtualGroupFamilies filters a list of GlobalVirtualGroupFamilies ID which are qualified to create bucket on AvailableGlobalVirtualGroupFamilies(context.Context, *AvailableGlobalVirtualGroupFamiliesRequest) (*AvailableGlobalVirtualGroupFamiliesResponse, error) + // SwapInInfo gets reserved swapIn info for a specific global virtual group family or global virtual group + SwapInInfo(context.Context, *QuerySwapInInfoRequest) (*QuerySwapInInfoResponse, error) + // GVGStatistics gets gvg statistics for a SP + GVGStatistics(context.Context, *QuerySPGVGStatisticsRequest) (*QuerySPGVGStatisticsResponse, error) } // UnimplementedQueryServer can be embedded to have forward compatible implementations. @@ -776,6 +1002,12 @@ func (*UnimplementedQueryServer) GlobalVirtualGroupFamilies(ctx context.Context, func (*UnimplementedQueryServer) AvailableGlobalVirtualGroupFamilies(ctx context.Context, req *AvailableGlobalVirtualGroupFamiliesRequest) (*AvailableGlobalVirtualGroupFamiliesResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method AvailableGlobalVirtualGroupFamilies not implemented") } +func (*UnimplementedQueryServer) SwapInInfo(ctx context.Context, req *QuerySwapInInfoRequest) (*QuerySwapInInfoResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method SwapInInfo not implemented") +} +func (*UnimplementedQueryServer) GVGStatistics(ctx context.Context, req *QuerySPGVGStatisticsRequest) (*QuerySPGVGStatisticsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GVGStatistics not implemented") +} func RegisterQueryServer(s grpc1.Server, srv QueryServer) { s.RegisterService(&_Query_serviceDesc, srv) @@ -889,6 +1121,42 @@ func _Query_AvailableGlobalVirtualGroupFamilies_Handler(srv interface{}, ctx con return interceptor(ctx, in, info, handler) } +func _Query_SwapInInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QuerySwapInInfoRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).SwapInInfo(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/greenfield.virtualgroup.Query/SwapInInfo", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).SwapInInfo(ctx, req.(*QuerySwapInInfoRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_GVGStatistics_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QuerySPGVGStatisticsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).GVGStatistics(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/greenfield.virtualgroup.Query/GVGStatistics", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).GVGStatistics(ctx, req.(*QuerySPGVGStatisticsRequest)) + } + return interceptor(ctx, in, info, handler) +} + var _Query_serviceDesc = grpc.ServiceDesc{ ServiceName: "greenfield.virtualgroup.Query", HandlerType: (*QueryServer)(nil), @@ -917,6 +1185,14 @@ var _Query_serviceDesc = grpc.ServiceDesc{ MethodName: "AvailableGlobalVirtualGroupFamilies", Handler: _Query_AvailableGlobalVirtualGroupFamilies_Handler, }, + { + MethodName: "SwapInInfo", + Handler: _Query_SwapInInfo_Handler, + }, + { + MethodName: "GVGStatistics", + Handler: _Query_GVGStatistics_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "greenfield/virtualgroup/query.proto", @@ -1335,91 +1611,222 @@ func (m *AvailableGlobalVirtualGroupFamiliesResponse) MarshalToSizedBuffer(dAtA return len(dAtA) - i, nil } -func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { - offset -= sovQuery(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *QueryParamsRequest) Size() (n int) { - if m == nil { - return 0 +func (m *QuerySwapInInfoRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } - var l int - _ = l - return n + return dAtA[:n], nil } -func (m *QueryParamsResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.Params.Size() - n += 1 + l + sovQuery(uint64(l)) - return n +func (m *QuerySwapInInfoRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryGlobalVirtualGroupRequest) Size() (n int) { - if m == nil { - return 0 - } +func (m *QuerySwapInInfoRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l if m.GlobalVirtualGroupId != 0 { - n += 1 + sovQuery(uint64(m.GlobalVirtualGroupId)) + i = encodeVarintQuery(dAtA, i, uint64(m.GlobalVirtualGroupId)) + i-- + dAtA[i] = 0x10 } - return n + if m.GlobalVirtualGroupFamilyId != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.GlobalVirtualGroupFamilyId)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil } -func (m *QueryGlobalVirtualGroupResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.GlobalVirtualGroup != nil { - l = m.GlobalVirtualGroup.Size() - n += 1 + l + sovQuery(uint64(l)) +func (m *QuerySwapInInfoResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } - return n + return dAtA[:n], nil } -func (m *QueryGlobalVirtualGroupByFamilyIDRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.GlobalVirtualGroupFamilyId != 0 { - n += 1 + sovQuery(uint64(m.GlobalVirtualGroupFamilyId)) - } - return n +func (m *QuerySwapInInfoResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryGlobalVirtualGroupByFamilyIDResponse) Size() (n int) { - if m == nil { - return 0 - } +func (m *QuerySwapInInfoResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - if len(m.GlobalVirtualGroups) > 0 { - for _, e := range m.GlobalVirtualGroups { - l = e.Size() - n += 1 + l + sovQuery(uint64(l)) + if m.SwapInInfo != nil { + { + size, err := m.SwapInInfo.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0xa } - return n + return len(dAtA) - i, nil } -func (m *QueryGlobalVirtualGroupFamilyRequest) Size() (n int) { - if m == nil { +func (m *QuerySPGVGStatisticsRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QuerySPGVGStatisticsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QuerySPGVGStatisticsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.SpId != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.SpId)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *QuerySPGVGStatisticsResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QuerySPGVGStatisticsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QuerySPGVGStatisticsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.GvgStats != nil { + { + size, err := m.GvgStats.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { + offset -= sovQuery(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *QueryParamsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryParamsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Params.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *QueryGlobalVirtualGroupRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.GlobalVirtualGroupId != 0 { + n += 1 + sovQuery(uint64(m.GlobalVirtualGroupId)) + } + return n +} + +func (m *QueryGlobalVirtualGroupResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.GlobalVirtualGroup != nil { + l = m.GlobalVirtualGroup.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryGlobalVirtualGroupByFamilyIDRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.GlobalVirtualGroupFamilyId != 0 { + n += 1 + sovQuery(uint64(m.GlobalVirtualGroupFamilyId)) + } + return n +} + +func (m *QueryGlobalVirtualGroupByFamilyIDResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.GlobalVirtualGroups) > 0 { + for _, e := range m.GlobalVirtualGroups { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + return n +} + +func (m *QueryGlobalVirtualGroupFamilyRequest) Size() (n int) { + if m == nil { return 0 } var l int @@ -1507,6 +1914,59 @@ func (m *AvailableGlobalVirtualGroupFamiliesResponse) Size() (n int) { return n } +func (m *QuerySwapInInfoRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.GlobalVirtualGroupFamilyId != 0 { + n += 1 + sovQuery(uint64(m.GlobalVirtualGroupFamilyId)) + } + if m.GlobalVirtualGroupId != 0 { + n += 1 + sovQuery(uint64(m.GlobalVirtualGroupId)) + } + return n +} + +func (m *QuerySwapInInfoResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.SwapInInfo != nil { + l = m.SwapInInfo.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QuerySPGVGStatisticsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.SpId != 0 { + n += 1 + sovQuery(uint64(m.SpId)) + } + return n +} + +func (m *QuerySPGVGStatisticsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.GvgStats != nil { + l = m.GvgStats.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + func sovQuery(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -2567,6 +3027,335 @@ func (m *AvailableGlobalVirtualGroupFamiliesResponse) Unmarshal(dAtA []byte) err } return nil } +func (m *QuerySwapInInfoRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QuerySwapInInfoRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QuerySwapInInfoRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field GlobalVirtualGroupFamilyId", wireType) + } + m.GlobalVirtualGroupFamilyId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.GlobalVirtualGroupFamilyId |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field GlobalVirtualGroupId", wireType) + } + m.GlobalVirtualGroupId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.GlobalVirtualGroupId |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QuerySwapInInfoResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QuerySwapInInfoResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QuerySwapInInfoResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SwapInInfo", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.SwapInInfo == nil { + m.SwapInInfo = &SwapInInfo{} + } + if err := m.SwapInInfo.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QuerySPGVGStatisticsRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QuerySPGVGStatisticsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QuerySPGVGStatisticsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field SpId", wireType) + } + m.SpId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.SpId |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QuerySPGVGStatisticsResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QuerySPGVGStatisticsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QuerySPGVGStatisticsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field GvgStats", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.GvgStats == nil { + m.GvgStats = &GVGStatisticsWithinSP{} + } + if err := m.GvgStats.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipQuery(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/virtualgroup/types/query.pb.gw.go b/x/virtualgroup/types/query.pb.gw.go index 6cad96d24..f72c03634 100644 --- a/x/virtualgroup/types/query.pb.gw.go +++ b/x/virtualgroup/types/query.pb.gw.go @@ -231,6 +231,78 @@ func local_request_Query_AvailableGlobalVirtualGroupFamilies_0(ctx context.Conte } +var ( + filter_Query_SwapInInfo_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_Query_SwapInInfo_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QuerySwapInInfoRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_SwapInInfo_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.SwapInInfo(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_SwapInInfo_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QuerySwapInInfoRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_SwapInInfo_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.SwapInInfo(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_Query_GVGStatistics_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_Query_GVGStatistics_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QuerySPGVGStatisticsRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_GVGStatistics_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.GVGStatistics(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_GVGStatistics_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QuerySPGVGStatisticsRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_GVGStatistics_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.GVGStatistics(ctx, &protoReq) + return msg, metadata, err + +} + // RegisterQueryHandlerServer registers the http handlers for service Query to "mux". // UnaryRPC :call QueryServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. @@ -375,6 +447,52 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv }) + mux.Handle("GET", pattern_Query_SwapInInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_SwapInInfo_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_SwapInInfo_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_GVGStatistics_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_GVGStatistics_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_GVGStatistics_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -536,6 +654,46 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) + mux.Handle("GET", pattern_Query_SwapInInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_SwapInInfo_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_SwapInInfo_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_GVGStatistics_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_GVGStatistics_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_GVGStatistics_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -551,6 +709,10 @@ var ( pattern_Query_GlobalVirtualGroupFamilies_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"greenfield", "virtualgroup", "global_virtual_group_families"}, "", runtime.AssumeColonVerbOpt(false))) pattern_Query_AvailableGlobalVirtualGroupFamilies_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"greenfield", "virtualgroup", "available_global_virtual_group_families"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_SwapInInfo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"greenfield", "virtualgroup", "swap_in_info"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_GVGStatistics_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"greenfield", "virtualgroup", "sp_gvg_statistics"}, "", runtime.AssumeColonVerbOpt(false))) ) var ( @@ -565,4 +727,8 @@ var ( forward_Query_GlobalVirtualGroupFamilies_0 = runtime.ForwardResponseMessage forward_Query_AvailableGlobalVirtualGroupFamilies_0 = runtime.ForwardResponseMessage + + forward_Query_SwapInInfo_0 = runtime.ForwardResponseMessage + + forward_Query_GVGStatistics_0 = runtime.ForwardResponseMessage ) diff --git a/x/virtualgroup/types/tx.pb.go b/x/virtualgroup/types/tx.pb.go index 8b5d07a78..be0ef18b4 100644 --- a/x/virtualgroup/types/tx.pb.go +++ b/x/virtualgroup/types/tx.pb.go @@ -1034,8 +1034,10 @@ func (m *MsgStorageProviderExitResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgStorageProviderExitResponse proto.InternalMessageInfo type MsgCompleteStorageProviderExit struct { - // storage_provider defines the operator account address of the storage provider who want to exit from the greenfield storage network. + // storage_provider defines the operator account address of the storage provider who will exit StorageProvider string `protobuf:"bytes,1,opt,name=storage_provider,json=storageProvider,proto3" json:"storage_provider,omitempty"` + // operator defines the operator account address who initials this transaction. + Operator string `protobuf:"bytes,2,opt,name=operator,proto3" json:"operator,omitempty"` } func (m *MsgCompleteStorageProviderExit) Reset() { *m = MsgCompleteStorageProviderExit{} } @@ -1078,6 +1080,13 @@ func (m *MsgCompleteStorageProviderExit) GetStorageProvider() string { return "" } +func (m *MsgCompleteStorageProviderExit) GetOperator() string { + if m != nil { + return m.Operator + } + return "" +} + type MsgCompleteStorageProviderExitResponse struct { } @@ -1116,6 +1125,412 @@ func (m *MsgCompleteStorageProviderExitResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgCompleteStorageProviderExitResponse proto.InternalMessageInfo +type MsgReserveSwapIn struct { + // storage_provider defines the operator account address of the storage provider who want to swap into the virtual group family or global virtual group. + StorageProvider string `protobuf:"bytes,1,opt,name=storage_provider,json=storageProvider,proto3" json:"storage_provider,omitempty"` + // target_sp_id defines the storage provider id to be replaced by the successor sp. + TargetSpId uint32 `protobuf:"varint,2,opt,name=target_sp_id,json=targetSpId,proto3" json:"target_sp_id,omitempty"` + // virtual_group_family_id is the identifier of the virtual group family. + // if it set to non-zero, it represents that the operator swap in as the primary storage provider + // it it set to zero, it represents that the operator swap in as the secondary storage provider. + GlobalVirtualGroupFamilyId uint32 `protobuf:"varint,3,opt,name=global_virtual_group_family_id,json=globalVirtualGroupFamilyId,proto3" json:"global_virtual_group_family_id,omitempty"` + // global_virtual_group_id is a global virtual group ID associated with the swap in. + // It allows to be empty only when the operator wants to be the successor primary storage provider in a family. + GlobalVirtualGroupId uint32 `protobuf:"varint,4,opt,name=global_virtual_group_id,json=globalVirtualGroupId,proto3" json:"global_virtual_group_id,omitempty"` +} + +func (m *MsgReserveSwapIn) Reset() { *m = MsgReserveSwapIn{} } +func (m *MsgReserveSwapIn) String() string { return proto.CompactTextString(m) } +func (*MsgReserveSwapIn) ProtoMessage() {} +func (*MsgReserveSwapIn) Descriptor() ([]byte, []int) { + return fileDescriptor_478f7001009bf3f2, []int{22} +} +func (m *MsgReserveSwapIn) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgReserveSwapIn) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgReserveSwapIn.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgReserveSwapIn) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgReserveSwapIn.Merge(m, src) +} +func (m *MsgReserveSwapIn) XXX_Size() int { + return m.Size() +} +func (m *MsgReserveSwapIn) XXX_DiscardUnknown() { + xxx_messageInfo_MsgReserveSwapIn.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgReserveSwapIn proto.InternalMessageInfo + +func (m *MsgReserveSwapIn) GetStorageProvider() string { + if m != nil { + return m.StorageProvider + } + return "" +} + +func (m *MsgReserveSwapIn) GetTargetSpId() uint32 { + if m != nil { + return m.TargetSpId + } + return 0 +} + +func (m *MsgReserveSwapIn) GetGlobalVirtualGroupFamilyId() uint32 { + if m != nil { + return m.GlobalVirtualGroupFamilyId + } + return 0 +} + +func (m *MsgReserveSwapIn) GetGlobalVirtualGroupId() uint32 { + if m != nil { + return m.GlobalVirtualGroupId + } + return 0 +} + +type MsgReserveSwapInResponse struct { +} + +func (m *MsgReserveSwapInResponse) Reset() { *m = MsgReserveSwapInResponse{} } +func (m *MsgReserveSwapInResponse) String() string { return proto.CompactTextString(m) } +func (*MsgReserveSwapInResponse) ProtoMessage() {} +func (*MsgReserveSwapInResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_478f7001009bf3f2, []int{23} +} +func (m *MsgReserveSwapInResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgReserveSwapInResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgReserveSwapInResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgReserveSwapInResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgReserveSwapInResponse.Merge(m, src) +} +func (m *MsgReserveSwapInResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgReserveSwapInResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgReserveSwapInResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgReserveSwapInResponse proto.InternalMessageInfo + +type MsgCompleteSwapIn struct { + // storage_provider defines the operator account address of the storage provider who wants to swap into the virtual group family or global virtual group. + StorageProvider string `protobuf:"bytes,1,opt,name=storage_provider,json=storageProvider,proto3" json:"storage_provider,omitempty"` + // virtual_group_family_id is the identifier of the virtual group family. + // if it set to non-zero, it represents that the operator swap in as the primary storage provider + // it it set to zero, it represents that the operator swap in as the secondary storage provider. + GlobalVirtualGroupFamilyId uint32 `protobuf:"varint,2,opt,name=global_virtual_group_family_id,json=globalVirtualGroupFamilyId,proto3" json:"global_virtual_group_family_id,omitempty"` + // global_virtual_group_id is a global virtual group ID associated with the swap in. + // It allows to be empty only when the operator wants to be the successor primary storage provider in a family. + GlobalVirtualGroupId uint32 `protobuf:"varint,3,opt,name=global_virtual_group_id,json=globalVirtualGroupId,proto3" json:"global_virtual_group_id,omitempty"` +} + +func (m *MsgCompleteSwapIn) Reset() { *m = MsgCompleteSwapIn{} } +func (m *MsgCompleteSwapIn) String() string { return proto.CompactTextString(m) } +func (*MsgCompleteSwapIn) ProtoMessage() {} +func (*MsgCompleteSwapIn) Descriptor() ([]byte, []int) { + return fileDescriptor_478f7001009bf3f2, []int{24} +} +func (m *MsgCompleteSwapIn) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgCompleteSwapIn) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgCompleteSwapIn.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgCompleteSwapIn) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgCompleteSwapIn.Merge(m, src) +} +func (m *MsgCompleteSwapIn) XXX_Size() int { + return m.Size() +} +func (m *MsgCompleteSwapIn) XXX_DiscardUnknown() { + xxx_messageInfo_MsgCompleteSwapIn.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgCompleteSwapIn proto.InternalMessageInfo + +func (m *MsgCompleteSwapIn) GetStorageProvider() string { + if m != nil { + return m.StorageProvider + } + return "" +} + +func (m *MsgCompleteSwapIn) GetGlobalVirtualGroupFamilyId() uint32 { + if m != nil { + return m.GlobalVirtualGroupFamilyId + } + return 0 +} + +func (m *MsgCompleteSwapIn) GetGlobalVirtualGroupId() uint32 { + if m != nil { + return m.GlobalVirtualGroupId + } + return 0 +} + +type MsgCompleteSwapInResponse struct { +} + +func (m *MsgCompleteSwapInResponse) Reset() { *m = MsgCompleteSwapInResponse{} } +func (m *MsgCompleteSwapInResponse) String() string { return proto.CompactTextString(m) } +func (*MsgCompleteSwapInResponse) ProtoMessage() {} +func (*MsgCompleteSwapInResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_478f7001009bf3f2, []int{25} +} +func (m *MsgCompleteSwapInResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgCompleteSwapInResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgCompleteSwapInResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgCompleteSwapInResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgCompleteSwapInResponse.Merge(m, src) +} +func (m *MsgCompleteSwapInResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgCompleteSwapInResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgCompleteSwapInResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgCompleteSwapInResponse proto.InternalMessageInfo + +type MsgCancelSwapIn struct { + // storage_provider defines the operator account address of the storage provider who want to swap into the virtual group family or global virtual group. + StorageProvider string `protobuf:"bytes,1,opt,name=storage_provider,json=storageProvider,proto3" json:"storage_provider,omitempty"` + // virtual_group_family_id is the identifier of the virtual group family. + // if it set to non-zero, it represents that the operator swap in as the primary storage provider + // it it set to zero, it represents that the operator swap in as the secondary storage provider. + GlobalVirtualGroupFamilyId uint32 `protobuf:"varint,2,opt,name=global_virtual_group_family_id,json=globalVirtualGroupFamilyId,proto3" json:"global_virtual_group_family_id,omitempty"` + // global_virtual_group_id is a global virtual group IDs associated with the swap in. + // It allows to be empty only when the operator wants to be the successor primary storage provider in a family. + GlobalVirtualGroupId uint32 `protobuf:"varint,3,opt,name=global_virtual_group_id,json=globalVirtualGroupId,proto3" json:"global_virtual_group_id,omitempty"` +} + +func (m *MsgCancelSwapIn) Reset() { *m = MsgCancelSwapIn{} } +func (m *MsgCancelSwapIn) String() string { return proto.CompactTextString(m) } +func (*MsgCancelSwapIn) ProtoMessage() {} +func (*MsgCancelSwapIn) Descriptor() ([]byte, []int) { + return fileDescriptor_478f7001009bf3f2, []int{26} +} +func (m *MsgCancelSwapIn) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgCancelSwapIn) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgCancelSwapIn.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgCancelSwapIn) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgCancelSwapIn.Merge(m, src) +} +func (m *MsgCancelSwapIn) XXX_Size() int { + return m.Size() +} +func (m *MsgCancelSwapIn) XXX_DiscardUnknown() { + xxx_messageInfo_MsgCancelSwapIn.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgCancelSwapIn proto.InternalMessageInfo + +func (m *MsgCancelSwapIn) GetStorageProvider() string { + if m != nil { + return m.StorageProvider + } + return "" +} + +func (m *MsgCancelSwapIn) GetGlobalVirtualGroupFamilyId() uint32 { + if m != nil { + return m.GlobalVirtualGroupFamilyId + } + return 0 +} + +func (m *MsgCancelSwapIn) GetGlobalVirtualGroupId() uint32 { + if m != nil { + return m.GlobalVirtualGroupId + } + return 0 +} + +type MsgCancelSwapInResponse struct { +} + +func (m *MsgCancelSwapInResponse) Reset() { *m = MsgCancelSwapInResponse{} } +func (m *MsgCancelSwapInResponse) String() string { return proto.CompactTextString(m) } +func (*MsgCancelSwapInResponse) ProtoMessage() {} +func (*MsgCancelSwapInResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_478f7001009bf3f2, []int{27} +} +func (m *MsgCancelSwapInResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgCancelSwapInResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgCancelSwapInResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgCancelSwapInResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgCancelSwapInResponse.Merge(m, src) +} +func (m *MsgCancelSwapInResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgCancelSwapInResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgCancelSwapInResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgCancelSwapInResponse proto.InternalMessageInfo + +// this line is used by starport scaffolding # proto/tx/message +type MsgStorageProviderForcedExit struct { + // authority is the address that controls the module (defaults to x/gov unless overwritten). + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` + // storage_provider defines the account address of the storage provider forced to exit + StorageProvider string `protobuf:"bytes,2,opt,name=storage_provider,json=storageProvider,proto3" json:"storage_provider,omitempty"` +} + +func (m *MsgStorageProviderForcedExit) Reset() { *m = MsgStorageProviderForcedExit{} } +func (m *MsgStorageProviderForcedExit) String() string { return proto.CompactTextString(m) } +func (*MsgStorageProviderForcedExit) ProtoMessage() {} +func (*MsgStorageProviderForcedExit) Descriptor() ([]byte, []int) { + return fileDescriptor_478f7001009bf3f2, []int{28} +} +func (m *MsgStorageProviderForcedExit) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgStorageProviderForcedExit) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgStorageProviderForcedExit.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgStorageProviderForcedExit) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgStorageProviderForcedExit.Merge(m, src) +} +func (m *MsgStorageProviderForcedExit) XXX_Size() int { + return m.Size() +} +func (m *MsgStorageProviderForcedExit) XXX_DiscardUnknown() { + xxx_messageInfo_MsgStorageProviderForcedExit.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgStorageProviderForcedExit proto.InternalMessageInfo + +func (m *MsgStorageProviderForcedExit) GetAuthority() string { + if m != nil { + return m.Authority + } + return "" +} + +func (m *MsgStorageProviderForcedExit) GetStorageProvider() string { + if m != nil { + return m.StorageProvider + } + return "" +} + +type MsgStorageProviderForcedExitResponse struct { +} + +func (m *MsgStorageProviderForcedExitResponse) Reset() { *m = MsgStorageProviderForcedExitResponse{} } +func (m *MsgStorageProviderForcedExitResponse) String() string { return proto.CompactTextString(m) } +func (*MsgStorageProviderForcedExitResponse) ProtoMessage() {} +func (*MsgStorageProviderForcedExitResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_478f7001009bf3f2, []int{29} +} +func (m *MsgStorageProviderForcedExitResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgStorageProviderForcedExitResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgStorageProviderForcedExitResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgStorageProviderForcedExitResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgStorageProviderForcedExitResponse.Merge(m, src) +} +func (m *MsgStorageProviderForcedExitResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgStorageProviderForcedExitResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgStorageProviderForcedExitResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgStorageProviderForcedExitResponse proto.InternalMessageInfo + func init() { proto.RegisterType((*MsgUpdateParams)(nil), "greenfield.virtualgroup.MsgUpdateParams") proto.RegisterType((*MsgUpdateParamsResponse)(nil), "greenfield.virtualgroup.MsgUpdateParamsResponse") @@ -1139,73 +1554,94 @@ func init() { proto.RegisterType((*MsgStorageProviderExitResponse)(nil), "greenfield.virtualgroup.MsgStorageProviderExitResponse") proto.RegisterType((*MsgCompleteStorageProviderExit)(nil), "greenfield.virtualgroup.MsgCompleteStorageProviderExit") proto.RegisterType((*MsgCompleteStorageProviderExitResponse)(nil), "greenfield.virtualgroup.MsgCompleteStorageProviderExitResponse") + proto.RegisterType((*MsgReserveSwapIn)(nil), "greenfield.virtualgroup.MsgReserveSwapIn") + proto.RegisterType((*MsgReserveSwapInResponse)(nil), "greenfield.virtualgroup.MsgReserveSwapInResponse") + proto.RegisterType((*MsgCompleteSwapIn)(nil), "greenfield.virtualgroup.MsgCompleteSwapIn") + proto.RegisterType((*MsgCompleteSwapInResponse)(nil), "greenfield.virtualgroup.MsgCompleteSwapInResponse") + proto.RegisterType((*MsgCancelSwapIn)(nil), "greenfield.virtualgroup.MsgCancelSwapIn") + proto.RegisterType((*MsgCancelSwapInResponse)(nil), "greenfield.virtualgroup.MsgCancelSwapInResponse") + proto.RegisterType((*MsgStorageProviderForcedExit)(nil), "greenfield.virtualgroup.MsgStorageProviderForcedExit") + proto.RegisterType((*MsgStorageProviderForcedExitResponse)(nil), "greenfield.virtualgroup.MsgStorageProviderForcedExitResponse") } func init() { proto.RegisterFile("greenfield/virtualgroup/tx.proto", fileDescriptor_478f7001009bf3f2) } var fileDescriptor_478f7001009bf3f2 = []byte{ - // 970 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xdc, 0x58, 0xcf, 0x6f, 0xdc, 0x44, - 0x14, 0x8e, 0x9b, 0x92, 0x26, 0xaf, 0x6c, 0x13, 0x9c, 0x84, 0x38, 0x0e, 0x72, 0x57, 0xdb, 0x52, - 0x2d, 0x2d, 0xb5, 0x49, 0x5b, 0xa8, 0x28, 0x20, 0xd4, 0x04, 0xa8, 0x72, 0x08, 0xad, 0x36, 0xe2, - 0x87, 0x40, 0x62, 0x35, 0x6b, 0x4f, 0x1d, 0x23, 0xdb, 0x63, 0x79, 0x66, 0x37, 0x89, 0x84, 0x84, - 0xc4, 0x81, 0x23, 0xe2, 0x06, 0x7f, 0x46, 0x0f, 0xfc, 0x11, 0x3d, 0x56, 0x9c, 0x10, 0x12, 0x15, - 0x4a, 0x90, 0x38, 0x20, 0xfe, 0x02, 0x2e, 0xc8, 0xe3, 0xf1, 0xac, 0xb3, 0xbb, 0x9e, 0x6c, 0xab, - 0x40, 0xa5, 0x9c, 0x92, 0x9d, 0xf9, 0xde, 0x7b, 0xdf, 0xf7, 0xcd, 0xf8, 0xed, 0xf3, 0x42, 0xdd, - 0x4f, 0x31, 0x8e, 0xef, 0x07, 0x38, 0xf4, 0x9c, 0x5e, 0x90, 0xb2, 0x2e, 0x0a, 0xfd, 0x94, 0x74, - 0x13, 0x87, 0xed, 0xda, 0x49, 0x4a, 0x18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, 0xca, 0x40, 0xc9, - 0x8c, 0xc2, 0xec, 0xe0, 0xd0, 0x71, 0x65, 0xac, 0x9c, 0xe2, 0x36, 0x5d, 0x7f, 0x02, 0xb0, 0x2c, - 0x1a, 0x41, 0xed, 0xf0, 0x77, 0xfb, 0x2b, 0xca, 0x2c, 0x65, 0xa8, 0xb9, 0x3a, 0x36, 0xb4, 0x28, - 0xb7, 0xf6, 0xe1, 0xc3, 0x7d, 0x4b, 0x7b, 0xb4, 0x6f, 0x69, 0xbf, 0xef, 0x5b, 0xda, 0xf7, 0x07, - 0xd6, 0xc4, 0xa3, 0x03, 0x6b, 0xe2, 0x97, 0x03, 0x6b, 0xe2, 0xb3, 0x1b, 0x7e, 0xc0, 0xb6, 0xbb, - 0x9d, 0x6c, 0xa0, 0x73, 0x3a, 0x71, 0xe7, 0xaa, 0xbb, 0x8d, 0x82, 0xd8, 0x29, 0xbd, 0xc7, 0xef, - 0x0e, 0xfc, 0x20, 0xb1, 0x97, 0x60, 0xda, 0x99, 0xe2, 0x6f, 0xf2, 0xd7, 0xff, 0x0d, 0x00, 0x00, - 0xff, 0xff, 0xc0, 0xc3, 0x09, 0x30, 0xb8, 0x10, 0x00, 0x00, + // 1178 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xdc, 0x58, 0x4f, 0x6f, 0x1b, 0x45, + 0x14, 0xcf, 0xc6, 0x25, 0x4d, 0x5e, 0xeb, 0x24, 0x6c, 0x12, 0xe2, 0x6c, 0x2a, 0xd7, 0x4a, 0x43, + 0x64, 0x52, 0xea, 0x25, 0x69, 0x4a, 0x45, 0xa1, 0x42, 0x4d, 0xa0, 0x95, 0x0f, 0xa1, 0x95, 0x23, + 0xfe, 0x08, 0x24, 0xac, 0xb1, 0x77, 0xba, 0x59, 0x64, 0xef, 0xac, 0x66, 0xd6, 0x4e, 0x72, 0x42, + 0xe2, 0x8a, 0x84, 0xe0, 0x04,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xa3, 0x92, 0x6a, 0x14, 0x87, + 0x54, 0x21, 0x44, 0x6a, 0x78, 0x21, 0x96, 0x61, 0xa9, 0x8b, 0xab, 0x54, 0xe2, 0xaf, 0xb0, 0xa9, + 0x69, 0xd5, 0xb0, 0xb3, 0xab, 0x43, 0xd8, 0x24, 0xc5, 0x99, 0x4a, 0x15, 0x7e, 0xd4, 0xe0, 0x52, + 0x77, 0xed, 0xb8, 0x4b, 0x68, 0x15, 0x5b, 0xbc, 0x2c, 0x9c, 0xb6, 0xcf, 0xeb, 0x25, 0xe5, 0xf8, + 0xb0, 0xf5, 0xae, 0xb3, 0xdb, 0x5b, 0x83, 0x55, 0x55, 0xb0, 0x11, 0xab, 0xcd, 0x67, 0x69, 0x48, + 0xed, 0x32, 0x5b, 0xff, 0x46, 0x83, 0x4c, 0x62, 0xff, 0xb7, 0x95, 0xd8, 0x79, 0x2a, 0x1a, 0x27, + 0xe3, 0x9d, 0xd3, 0x58, 0x45, 0x81, 0xf1, 0x80, 0x12, 0x7b, 0x2d, 0x65, 0x40, 0x49, 0x56, 0xea, + 0x80, 0xfa, 0x75, 0x49, 0xfa, 0x67, 0x70, 0x3e, 0xea, 0x90, 0xae, 0xa8, 0x1d, 0x71, 0x90, 0x71, + 0x75, 0x00, 0x90, 0x74, 0xfe, 0x39, 0x4c, 0xca, 0x5e, 0x64, 0x55, 0x65, 0x18, 0xa1, 0x8c, 0xd7, + 0x07, 0x41, 0xc5, 0x83, 0x8f, 0x5e, 0x5a, 0xca, 0xe0, 0x05, 0x48, 0x1d, 0x7c, 0xc7, 0x33, 0x46, + 0xff, 0x04, 0x26, 0xc4, 0x13, 0x66, 0x45, 0x69, 0xc6, 0x31, 0xc6, 0x7a, 0x7f, 0x8c, 0xf4, 0xfc, + 0x05, 0x5c, 0x6c, 0xfb, 0x94, 0x92, 0x57, 0xd9, 0xc6, 0x91, 0xc6, 0x1b, 0x83, 0x22, 0xe5, 0x5a, + 0x5f, 0xc2, 0x5c, 0xaf, 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 0xfe, 0xc5, 0xf7, 0xfa, 0xff, 0x01, 0x00, 0x00, + 0xff, 0xff, 0xa9, 0xb5, 0xca, 0xe4, 0xe0, 0x16, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1232,6 +1668,12 @@ type MsgClient interface { CompleteStorageProviderExit(ctx context.Context, in *MsgCompleteStorageProviderExit, opts ...grpc.CallOption) (*MsgCompleteStorageProviderExitResponse, error) CompleteSwapOut(ctx context.Context, in *MsgCompleteSwapOut, opts ...grpc.CallOption) (*MsgCompleteSwapOutResponse, error) CancelSwapOut(ctx context.Context, in *MsgCancelSwapOut, opts ...grpc.CallOption) (*MsgCancelSwapOutResponse, error) + ReserveSwapIn(ctx context.Context, in *MsgReserveSwapIn, opts ...grpc.CallOption) (*MsgReserveSwapInResponse, error) + CancelSwapIn(ctx context.Context, in *MsgCancelSwapIn, opts ...grpc.CallOption) (*MsgCancelSwapInResponse, error) + CompleteSwapIn(ctx context.Context, in *MsgCompleteSwapIn, opts ...grpc.CallOption) (*MsgCompleteSwapInResponse, error) + // StorageProviderForcedExit defines a governance operation for a SP to be forced to exit + // The authority is defined in the keeper. + StorageProviderForcedExit(ctx context.Context, in *MsgStorageProviderForcedExit, opts ...grpc.CallOption) (*MsgStorageProviderForcedExitResponse, error) } type msgClient struct { @@ -1341,7 +1783,43 @@ func (c *msgClient) CancelSwapOut(ctx context.Context, in *MsgCancelSwapOut, opt return out, nil } -// MsgServer is the server API for Msg service. +func (c *msgClient) ReserveSwapIn(ctx context.Context, in *MsgReserveSwapIn, opts ...grpc.CallOption) (*MsgReserveSwapInResponse, error) { + out := new(MsgReserveSwapInResponse) + err := c.cc.Invoke(ctx, "/greenfield.virtualgroup.Msg/ReserveSwapIn", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) CancelSwapIn(ctx context.Context, in *MsgCancelSwapIn, opts ...grpc.CallOption) (*MsgCancelSwapInResponse, error) { + out := new(MsgCancelSwapInResponse) + err := c.cc.Invoke(ctx, "/greenfield.virtualgroup.Msg/CancelSwapIn", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) CompleteSwapIn(ctx context.Context, in *MsgCompleteSwapIn, opts ...grpc.CallOption) (*MsgCompleteSwapInResponse, error) { + out := new(MsgCompleteSwapInResponse) + err := c.cc.Invoke(ctx, "/greenfield.virtualgroup.Msg/CompleteSwapIn", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) StorageProviderForcedExit(ctx context.Context, in *MsgStorageProviderForcedExit, opts ...grpc.CallOption) (*MsgStorageProviderForcedExitResponse, error) { + out := new(MsgStorageProviderForcedExitResponse) + err := c.cc.Invoke(ctx, "/greenfield.virtualgroup.Msg/StorageProviderForcedExit", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// MsgServer is the server API for Msg service. type MsgServer interface { CreateGlobalVirtualGroup(context.Context, *MsgCreateGlobalVirtualGroup) (*MsgCreateGlobalVirtualGroupResponse, error) DeleteGlobalVirtualGroup(context.Context, *MsgDeleteGlobalVirtualGroup) (*MsgDeleteGlobalVirtualGroupResponse, error) @@ -1355,6 +1833,12 @@ type MsgServer interface { CompleteStorageProviderExit(context.Context, *MsgCompleteStorageProviderExit) (*MsgCompleteStorageProviderExitResponse, error) CompleteSwapOut(context.Context, *MsgCompleteSwapOut) (*MsgCompleteSwapOutResponse, error) CancelSwapOut(context.Context, *MsgCancelSwapOut) (*MsgCancelSwapOutResponse, error) + ReserveSwapIn(context.Context, *MsgReserveSwapIn) (*MsgReserveSwapInResponse, error) + CancelSwapIn(context.Context, *MsgCancelSwapIn) (*MsgCancelSwapInResponse, error) + CompleteSwapIn(context.Context, *MsgCompleteSwapIn) (*MsgCompleteSwapInResponse, error) + // StorageProviderForcedExit defines a governance operation for a SP to be forced to exit + // The authority is defined in the keeper. + StorageProviderForcedExit(context.Context, *MsgStorageProviderForcedExit) (*MsgStorageProviderForcedExitResponse, error) } // UnimplementedMsgServer can be embedded to have forward compatible implementations. @@ -1394,6 +1878,18 @@ func (*UnimplementedMsgServer) CompleteSwapOut(ctx context.Context, req *MsgComp func (*UnimplementedMsgServer) CancelSwapOut(ctx context.Context, req *MsgCancelSwapOut) (*MsgCancelSwapOutResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method CancelSwapOut not implemented") } +func (*UnimplementedMsgServer) ReserveSwapIn(ctx context.Context, req *MsgReserveSwapIn) (*MsgReserveSwapInResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ReserveSwapIn not implemented") +} +func (*UnimplementedMsgServer) CancelSwapIn(ctx context.Context, req *MsgCancelSwapIn) (*MsgCancelSwapInResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CancelSwapIn not implemented") +} +func (*UnimplementedMsgServer) CompleteSwapIn(ctx context.Context, req *MsgCompleteSwapIn) (*MsgCompleteSwapInResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CompleteSwapIn not implemented") +} +func (*UnimplementedMsgServer) StorageProviderForcedExit(ctx context.Context, req *MsgStorageProviderForcedExit) (*MsgStorageProviderForcedExitResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method StorageProviderForcedExit not implemented") +} func RegisterMsgServer(s grpc1.Server, srv MsgServer) { s.RegisterService(&_Msg_serviceDesc, srv) @@ -1597,6 +2093,78 @@ func _Msg_CancelSwapOut_Handler(srv interface{}, ctx context.Context, dec func(i return interceptor(ctx, in, info, handler) } +func _Msg_ReserveSwapIn_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgReserveSwapIn) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).ReserveSwapIn(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/greenfield.virtualgroup.Msg/ReserveSwapIn", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).ReserveSwapIn(ctx, req.(*MsgReserveSwapIn)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_CancelSwapIn_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgCancelSwapIn) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).CancelSwapIn(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/greenfield.virtualgroup.Msg/CancelSwapIn", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).CancelSwapIn(ctx, req.(*MsgCancelSwapIn)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_CompleteSwapIn_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgCompleteSwapIn) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).CompleteSwapIn(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/greenfield.virtualgroup.Msg/CompleteSwapIn", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).CompleteSwapIn(ctx, req.(*MsgCompleteSwapIn)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_StorageProviderForcedExit_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgStorageProviderForcedExit) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).StorageProviderForcedExit(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/greenfield.virtualgroup.Msg/StorageProviderForcedExit", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).StorageProviderForcedExit(ctx, req.(*MsgStorageProviderForcedExit)) + } + return interceptor(ctx, in, info, handler) +} + var _Msg_serviceDesc = grpc.ServiceDesc{ ServiceName: "greenfield.virtualgroup.Msg", HandlerType: (*MsgServer)(nil), @@ -1645,6 +2213,22 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ MethodName: "CancelSwapOut", Handler: _Msg_CancelSwapOut_Handler, }, + { + MethodName: "ReserveSwapIn", + Handler: _Msg_ReserveSwapIn_Handler, + }, + { + MethodName: "CancelSwapIn", + Handler: _Msg_CancelSwapIn_Handler, + }, + { + MethodName: "CompleteSwapIn", + Handler: _Msg_CompleteSwapIn_Handler, + }, + { + MethodName: "StorageProviderForcedExit", + Handler: _Msg_StorageProviderForcedExit_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "greenfield/virtualgroup/tx.proto", @@ -2387,6 +2971,13 @@ func (m *MsgCompleteStorageProviderExit) MarshalToSizedBuffer(dAtA []byte) (int, _ = i var l int _ = l + if len(m.Operator) > 0 { + i -= len(m.Operator) + copy(dAtA[i:], m.Operator) + i = encodeVarintTx(dAtA, i, uint64(len(m.Operator))) + i-- + dAtA[i] = 0x12 + } if len(m.StorageProvider) > 0 { i -= len(m.StorageProvider) copy(dAtA[i:], m.StorageProvider) @@ -2420,129 +3011,383 @@ func (m *MsgCompleteStorageProviderExitResponse) MarshalToSizedBuffer(dAtA []byt return len(dAtA) - i, nil } -func encodeVarintTx(dAtA []byte, offset int, v uint64) int { - offset -= sovTx(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *MsgUpdateParams) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Authority) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) +func (m *MsgReserveSwapIn) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } - l = m.Params.Size() - n += 1 + l + sovTx(uint64(l)) - return n + return dAtA[:n], nil } -func (m *MsgUpdateParamsResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n +func (m *MsgReserveSwapIn) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgCreateGlobalVirtualGroup) Size() (n int) { - if m == nil { - return 0 - } +func (m *MsgReserveSwapIn) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - l = len(m.StorageProvider) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) + if m.GlobalVirtualGroupId != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.GlobalVirtualGroupId)) + i-- + dAtA[i] = 0x20 } - if m.FamilyId != 0 { - n += 1 + sovTx(uint64(m.FamilyId)) + if m.GlobalVirtualGroupFamilyId != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.GlobalVirtualGroupFamilyId)) + i-- + dAtA[i] = 0x18 } - if len(m.SecondarySpIds) > 0 { - l = 0 - for _, e := range m.SecondarySpIds { - l += sovTx(uint64(e)) - } - n += 1 + sovTx(uint64(l)) + l + if m.TargetSpId != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.TargetSpId)) + i-- + dAtA[i] = 0x10 } - l = m.Deposit.Size() - n += 1 + l + sovTx(uint64(l)) - return n + if len(m.StorageProvider) > 0 { + i -= len(m.StorageProvider) + copy(dAtA[i:], m.StorageProvider) + i = encodeVarintTx(dAtA, i, uint64(len(m.StorageProvider))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil } -func (m *MsgCreateGlobalVirtualGroupResponse) Size() (n int) { - if m == nil { - return 0 +func (m *MsgReserveSwapInResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } - var l int - _ = l - return n + return dAtA[:n], nil } -func (m *MsgDeleteGlobalVirtualGroup) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.StorageProvider) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - if m.GlobalVirtualGroupId != 0 { - n += 1 + sovTx(uint64(m.GlobalVirtualGroupId)) - } - return n +func (m *MsgReserveSwapInResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgDeleteGlobalVirtualGroupResponse) Size() (n int) { - if m == nil { - return 0 - } +func (m *MsgReserveSwapInResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - return n + return len(dAtA) - i, nil } -func (m *MsgDeposit) Size() (n int) { - if m == nil { - return 0 +func (m *MsgCompleteSwapIn) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } + return dAtA[:n], nil +} + +func (m *MsgCompleteSwapIn) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgCompleteSwapIn) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - l = len(m.StorageProvider) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } if m.GlobalVirtualGroupId != 0 { - n += 1 + sovTx(uint64(m.GlobalVirtualGroupId)) + i = encodeVarintTx(dAtA, i, uint64(m.GlobalVirtualGroupId)) + i-- + dAtA[i] = 0x18 } - l = m.Deposit.Size() - n += 1 + l + sovTx(uint64(l)) - return n + if m.GlobalVirtualGroupFamilyId != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.GlobalVirtualGroupFamilyId)) + i-- + dAtA[i] = 0x10 + } + if len(m.StorageProvider) > 0 { + i -= len(m.StorageProvider) + copy(dAtA[i:], m.StorageProvider) + i = encodeVarintTx(dAtA, i, uint64(len(m.StorageProvider))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil } -func (m *MsgDepositResponse) Size() (n int) { - if m == nil { - return 0 +func (m *MsgCompleteSwapInResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } - var l int - _ = l - return n + return dAtA[:n], nil } -func (m *MsgWithdraw) Size() (n int) { - if m == nil { +func (m *MsgCompleteSwapInResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgCompleteSwapInResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgCancelSwapIn) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgCancelSwapIn) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgCancelSwapIn) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.GlobalVirtualGroupId != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.GlobalVirtualGroupId)) + i-- + dAtA[i] = 0x18 + } + if m.GlobalVirtualGroupFamilyId != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.GlobalVirtualGroupFamilyId)) + i-- + dAtA[i] = 0x10 + } + if len(m.StorageProvider) > 0 { + i -= len(m.StorageProvider) + copy(dAtA[i:], m.StorageProvider) + i = encodeVarintTx(dAtA, i, uint64(len(m.StorageProvider))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgCancelSwapInResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgCancelSwapInResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgCancelSwapInResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgStorageProviderForcedExit) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgStorageProviderForcedExit) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgStorageProviderForcedExit) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.StorageProvider) > 0 { + i -= len(m.StorageProvider) + copy(dAtA[i:], m.StorageProvider) + i = encodeVarintTx(dAtA, i, uint64(len(m.StorageProvider))) + i-- + dAtA[i] = 0x12 + } + if len(m.Authority) > 0 { + i -= len(m.Authority) + copy(dAtA[i:], m.Authority) + i = encodeVarintTx(dAtA, i, uint64(len(m.Authority))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgStorageProviderForcedExitResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgStorageProviderForcedExitResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgStorageProviderForcedExitResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func encodeVarintTx(dAtA []byte, offset int, v uint64) int { + offset -= sovTx(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *MsgUpdateParams) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Authority) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = m.Params.Size() + n += 1 + l + sovTx(uint64(l)) + return n +} + +func (m *MsgUpdateParamsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgCreateGlobalVirtualGroup) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.StorageProvider) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.FamilyId != 0 { + n += 1 + sovTx(uint64(m.FamilyId)) + } + if len(m.SecondarySpIds) > 0 { + l = 0 + for _, e := range m.SecondarySpIds { + l += sovTx(uint64(e)) + } + n += 1 + sovTx(uint64(l)) + l + } + l = m.Deposit.Size() + n += 1 + l + sovTx(uint64(l)) + return n +} + +func (m *MsgCreateGlobalVirtualGroupResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgDeleteGlobalVirtualGroup) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.StorageProvider) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.GlobalVirtualGroupId != 0 { + n += 1 + sovTx(uint64(m.GlobalVirtualGroupId)) + } + return n +} + +func (m *MsgDeleteGlobalVirtualGroupResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgDeposit) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.StorageProvider) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.GlobalVirtualGroupId != 0 { + n += 1 + sovTx(uint64(m.GlobalVirtualGroupId)) + } + l = m.Deposit.Size() + n += 1 + l + sovTx(uint64(l)) + return n +} + +func (m *MsgDepositResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgWithdraw) Size() (n int) { + if m == nil { return 0 } var l int @@ -2735,25 +3580,902 @@ func (m *MsgCompleteStorageProviderExit) Size() (n int) { if l > 0 { n += 1 + l + sovTx(uint64(l)) } - return n -} + l = len(m.Operator) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgCompleteStorageProviderExitResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgReserveSwapIn) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.StorageProvider) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.TargetSpId != 0 { + n += 1 + sovTx(uint64(m.TargetSpId)) + } + if m.GlobalVirtualGroupFamilyId != 0 { + n += 1 + sovTx(uint64(m.GlobalVirtualGroupFamilyId)) + } + if m.GlobalVirtualGroupId != 0 { + n += 1 + sovTx(uint64(m.GlobalVirtualGroupId)) + } + return n +} + +func (m *MsgReserveSwapInResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgCompleteSwapIn) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.StorageProvider) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.GlobalVirtualGroupFamilyId != 0 { + n += 1 + sovTx(uint64(m.GlobalVirtualGroupFamilyId)) + } + if m.GlobalVirtualGroupId != 0 { + n += 1 + sovTx(uint64(m.GlobalVirtualGroupId)) + } + return n +} + +func (m *MsgCompleteSwapInResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgCancelSwapIn) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.StorageProvider) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.GlobalVirtualGroupFamilyId != 0 { + n += 1 + sovTx(uint64(m.GlobalVirtualGroupFamilyId)) + } + if m.GlobalVirtualGroupId != 0 { + n += 1 + sovTx(uint64(m.GlobalVirtualGroupId)) + } + return n +} + +func (m *MsgCancelSwapInResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgStorageProviderForcedExit) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Authority) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.StorageProvider) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgStorageProviderForcedExitResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func sovTx(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozTx(x uint64) (n int) { + return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *MsgUpdateParams) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgUpdateParams: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateParams: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Authority = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgUpdateParamsResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgUpdateParamsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgCreateGlobalVirtualGroup) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgCreateGlobalVirtualGroup: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgCreateGlobalVirtualGroup: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field StorageProvider", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.StorageProvider = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field FamilyId", wireType) + } + m.FamilyId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.FamilyId |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType == 0 { + var v uint32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.SecondarySpIds = append(m.SecondarySpIds, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + var count int + for _, integer := range dAtA[iNdEx:postIndex] { + if integer < 128 { + count++ + } + } + elementCount = count + if elementCount != 0 && len(m.SecondarySpIds) == 0 { + m.SecondarySpIds = make([]uint32, 0, elementCount) + } + for iNdEx < postIndex { + var v uint32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.SecondarySpIds = append(m.SecondarySpIds, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field SecondarySpIds", wireType) + } + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Deposit", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Deposit.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgCreateGlobalVirtualGroupResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgCreateGlobalVirtualGroupResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgCreateGlobalVirtualGroupResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgDeleteGlobalVirtualGroup) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgDeleteGlobalVirtualGroup: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgDeleteGlobalVirtualGroup: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field StorageProvider", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.StorageProvider = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field GlobalVirtualGroupId", wireType) + } + m.GlobalVirtualGroupId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.GlobalVirtualGroupId |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgDeleteGlobalVirtualGroupResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgDeleteGlobalVirtualGroupResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgDeleteGlobalVirtualGroupResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgDeposit) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgDeposit: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgDeposit: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field StorageProvider", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.StorageProvider = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field GlobalVirtualGroupId", wireType) + } + m.GlobalVirtualGroupId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.GlobalVirtualGroupId |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Deposit", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Deposit.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgDepositResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgDepositResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgDepositResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } -func (m *MsgCompleteStorageProviderExitResponse) Size() (n int) { - if m == nil { - return 0 + if iNdEx > l { + return io.ErrUnexpectedEOF } - var l int - _ = l - return n -} - -func sovTx(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozTx(x uint64) (n int) { - return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63)))) + return nil } -func (m *MsgUpdateParams) Unmarshal(dAtA []byte) error { +func (m *MsgWithdraw) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2776,15 +4498,15 @@ func (m *MsgUpdateParams) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgUpdateParams: wiretype end group for non-group") + return fmt.Errorf("proto: MsgWithdraw: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgUpdateParams: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgWithdraw: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field StorageProvider", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -2812,11 +4534,30 @@ func (m *MsgUpdateParams) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Authority = string(dAtA[iNdEx:postIndex]) + m.StorageProvider = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field GlobalVirtualGroupId", wireType) + } + m.GlobalVirtualGroupId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.GlobalVirtualGroupId |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Withdraw", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -2843,7 +4584,7 @@ func (m *MsgUpdateParams) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.Withdraw.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -2868,7 +4609,7 @@ func (m *MsgUpdateParams) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgUpdateParamsResponse) Unmarshal(dAtA []byte) error { +func (m *MsgWithdrawResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2891,10 +4632,10 @@ func (m *MsgUpdateParamsResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgUpdateParamsResponse: wiretype end group for non-group") + return fmt.Errorf("proto: MsgWithdrawResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgUpdateParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgWithdrawResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: @@ -2918,7 +4659,7 @@ func (m *MsgUpdateParamsResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgCreateGlobalVirtualGroup) Unmarshal(dAtA []byte) error { +func (m *MsgSwapOut) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2941,10 +4682,10 @@ func (m *MsgCreateGlobalVirtualGroup) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgCreateGlobalVirtualGroup: wiretype end group for non-group") + return fmt.Errorf("proto: MsgSwapOut: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgCreateGlobalVirtualGroup: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgSwapOut: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -2981,9 +4722,9 @@ func (m *MsgCreateGlobalVirtualGroup) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 2: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field FamilyId", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field GlobalVirtualGroupFamilyId", wireType) } - m.FamilyId = 0 + m.GlobalVirtualGroupFamilyId = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -2993,7 +4734,7 @@ func (m *MsgCreateGlobalVirtualGroup) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.FamilyId |= uint32(b&0x7F) << shift + m.GlobalVirtualGroupFamilyId |= uint32(b&0x7F) << shift if b < 0x80 { break } @@ -3015,7 +4756,7 @@ func (m *MsgCreateGlobalVirtualGroup) Unmarshal(dAtA []byte) error { break } } - m.SecondarySpIds = append(m.SecondarySpIds, v) + m.GlobalVirtualGroupIds = append(m.GlobalVirtualGroupIds, v) } else if wireType == 2 { var packedLen int for shift := uint(0); ; shift += 7 { @@ -3050,8 +4791,8 @@ func (m *MsgCreateGlobalVirtualGroup) Unmarshal(dAtA []byte) error { } } elementCount = count - if elementCount != 0 && len(m.SecondarySpIds) == 0 { - m.SecondarySpIds = make([]uint32, 0, elementCount) + if elementCount != 0 && len(m.GlobalVirtualGroupIds) == 0 { + m.GlobalVirtualGroupIds = make([]uint32, 0, elementCount) } for iNdEx < postIndex { var v uint32 @@ -3069,16 +4810,16 @@ func (m *MsgCreateGlobalVirtualGroup) Unmarshal(dAtA []byte) error { break } } - m.SecondarySpIds = append(m.SecondarySpIds, v) + m.GlobalVirtualGroupIds = append(m.GlobalVirtualGroupIds, v) } } else { - return fmt.Errorf("proto: wrong wireType = %d for field SecondarySpIds", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field GlobalVirtualGroupIds", wireType) } case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Deposit", wireType) + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field SuccessorSpId", wireType) } - var msglen int + m.SuccessorSpId = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -3088,130 +4829,16 @@ func (m *MsgCreateGlobalVirtualGroup) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + m.SuccessorSpId |= uint32(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Deposit.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgCreateGlobalVirtualGroupResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MsgCreateGlobalVirtualGroupResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgCreateGlobalVirtualGroupResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgDeleteGlobalVirtualGroup) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MsgDeleteGlobalVirtualGroup: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgDeleteGlobalVirtualGroup: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: + case 5: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field StorageProvider", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field SuccessorSpApproval", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -3221,43 +4848,28 @@ func (m *MsgDeleteGlobalVirtualGroup) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthTx } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthTx } if postIndex > l { return io.ErrUnexpectedEOF } - m.StorageProvider = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field GlobalVirtualGroupId", wireType) + if m.SuccessorSpApproval == nil { + m.SuccessorSpApproval = &common.Approval{} } - m.GlobalVirtualGroupId = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.GlobalVirtualGroupId |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } + if err := m.SuccessorSpApproval.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipTx(dAtA[iNdEx:]) @@ -3279,7 +4891,7 @@ func (m *MsgDeleteGlobalVirtualGroup) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgDeleteGlobalVirtualGroupResponse) Unmarshal(dAtA []byte) error { +func (m *MsgSwapOutResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3302,10 +4914,10 @@ func (m *MsgDeleteGlobalVirtualGroupResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgDeleteGlobalVirtualGroupResponse: wiretype end group for non-group") + return fmt.Errorf("proto: MsgSwapOutResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgDeleteGlobalVirtualGroupResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgSwapOutResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: @@ -3329,7 +4941,7 @@ func (m *MsgDeleteGlobalVirtualGroupResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgDeposit) Unmarshal(dAtA []byte) error { +func (m *MsgCompleteSwapOut) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3352,10 +4964,10 @@ func (m *MsgDeposit) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgDeposit: wiretype end group for non-group") + return fmt.Errorf("proto: MsgCompleteSwapOut: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgDeposit: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgCompleteSwapOut: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -3392,9 +5004,9 @@ func (m *MsgDeposit) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 2: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field GlobalVirtualGroupId", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field GlobalVirtualGroupFamilyId", wireType) } - m.GlobalVirtualGroupId = 0 + m.GlobalVirtualGroupFamilyId = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -3404,44 +5016,87 @@ func (m *MsgDeposit) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.GlobalVirtualGroupId |= uint32(b&0x7F) << shift + m.GlobalVirtualGroupFamilyId |= uint32(b&0x7F) << shift if b < 0x80 { break } } case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Deposit", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx + if wireType == 0 { + var v uint32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } } - if iNdEx >= l { + m.GlobalVirtualGroupIds = append(m.GlobalVirtualGroupIds, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { return io.ErrUnexpectedEOF } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break + var elementCount int + var count int + for _, integer := range dAtA[iNdEx:postIndex] { + if integer < 128 { + count++ + } } + elementCount = count + if elementCount != 0 && len(m.GlobalVirtualGroupIds) == 0 { + m.GlobalVirtualGroupIds = make([]uint32, 0, elementCount) + } + for iNdEx < postIndex { + var v uint32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.GlobalVirtualGroupIds = append(m.GlobalVirtualGroupIds, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field GlobalVirtualGroupIds", wireType) } - if msglen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Deposit.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipTx(dAtA[iNdEx:]) @@ -3463,7 +5118,7 @@ func (m *MsgDeposit) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgDepositResponse) Unmarshal(dAtA []byte) error { +func (m *MsgCompleteSwapOutResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3486,10 +5141,10 @@ func (m *MsgDepositResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgDepositResponse: wiretype end group for non-group") + return fmt.Errorf("proto: MsgCompleteSwapOutResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgDepositResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgCompleteSwapOutResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: @@ -3513,7 +5168,7 @@ func (m *MsgDepositResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgWithdraw) Unmarshal(dAtA []byte) error { +func (m *MsgCancelSwapOut) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3536,10 +5191,10 @@ func (m *MsgWithdraw) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgWithdraw: wiretype end group for non-group") + return fmt.Errorf("proto: MsgCancelSwapOut: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgWithdraw: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgCancelSwapOut: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -3576,9 +5231,9 @@ func (m *MsgWithdraw) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 2: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field GlobalVirtualGroupId", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field GlobalVirtualGroupFamilyId", wireType) } - m.GlobalVirtualGroupId = 0 + m.GlobalVirtualGroupFamilyId = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -3588,44 +5243,87 @@ func (m *MsgWithdraw) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.GlobalVirtualGroupId |= uint32(b&0x7F) << shift + m.GlobalVirtualGroupFamilyId |= uint32(b&0x7F) << shift if b < 0x80 { break } } case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Withdraw", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx + if wireType == 0 { + var v uint32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } } - if iNdEx >= l { + m.GlobalVirtualGroupIds = append(m.GlobalVirtualGroupIds, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { return io.ErrUnexpectedEOF } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break + var elementCount int + var count int + for _, integer := range dAtA[iNdEx:postIndex] { + if integer < 128 { + count++ + } } + elementCount = count + if elementCount != 0 && len(m.GlobalVirtualGroupIds) == 0 { + m.GlobalVirtualGroupIds = make([]uint32, 0, elementCount) + } + for iNdEx < postIndex { + var v uint32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.GlobalVirtualGroupIds = append(m.GlobalVirtualGroupIds, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field GlobalVirtualGroupIds", wireType) } - if msglen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Withdraw.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipTx(dAtA[iNdEx:]) @@ -3647,7 +5345,7 @@ func (m *MsgWithdraw) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgWithdrawResponse) Unmarshal(dAtA []byte) error { +func (m *MsgCancelSwapOutResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3670,10 +5368,10 @@ func (m *MsgWithdrawResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgWithdrawResponse: wiretype end group for non-group") + return fmt.Errorf("proto: MsgCancelSwapOutResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgWithdrawResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgCancelSwapOutResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: @@ -3697,7 +5395,7 @@ func (m *MsgWithdrawResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgSwapOut) Unmarshal(dAtA []byte) error { +func (m *MsgSettle) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3720,10 +5418,10 @@ func (m *MsgSwapOut) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgSwapOut: wiretype end group for non-group") + return fmt.Errorf("proto: MsgSettle: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgSwapOut: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgSettle: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -3853,30 +5551,111 @@ func (m *MsgSwapOut) Unmarshal(dAtA []byte) error { } else { return fmt.Errorf("proto: wrong wireType = %d for field GlobalVirtualGroupIds", wireType) } - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field SuccessorSpId", wireType) + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgSettleResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF } - m.SuccessorSpId = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.SuccessorSpId |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break } - case 5: + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgSettleResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgSettleResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgStorageProviderExit) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgStorageProviderExit: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgStorageProviderExit: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SuccessorSpApproval", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field StorageProvider", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -3886,27 +5665,23 @@ func (m *MsgSwapOut) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthTx } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthTx } if postIndex > l { return io.ErrUnexpectedEOF } - if m.SuccessorSpApproval == nil { - m.SuccessorSpApproval = &common.Approval{} - } - if err := m.SuccessorSpApproval.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } + m.StorageProvider = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -3929,7 +5704,7 @@ func (m *MsgSwapOut) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgSwapOutResponse) Unmarshal(dAtA []byte) error { +func (m *MsgStorageProviderExitResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3952,10 +5727,10 @@ func (m *MsgSwapOutResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgSwapOutResponse: wiretype end group for non-group") + return fmt.Errorf("proto: MsgStorageProviderExitResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgSwapOutResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgStorageProviderExitResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: @@ -3979,7 +5754,7 @@ func (m *MsgSwapOutResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgCompleteSwapOut) Unmarshal(dAtA []byte) error { +func (m *MsgCompleteStorageProviderExit) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4002,10 +5777,10 @@ func (m *MsgCompleteSwapOut) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgCompleteSwapOut: wiretype end group for non-group") + return fmt.Errorf("proto: MsgCompleteStorageProviderExit: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgCompleteSwapOut: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgCompleteStorageProviderExit: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -4041,10 +5816,10 @@ func (m *MsgCompleteSwapOut) Unmarshal(dAtA []byte) error { m.StorageProvider = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field GlobalVirtualGroupFamilyId", wireType) + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Operator", wireType) } - m.GlobalVirtualGroupFamilyId = 0 + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -4054,87 +5829,24 @@ func (m *MsgCompleteSwapOut) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.GlobalVirtualGroupFamilyId |= uint32(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - case 3: - if wireType == 0 { - var v uint32 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.GlobalVirtualGroupIds = append(m.GlobalVirtualGroupIds, v) - } else if wireType == 2 { - var packedLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - packedLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if packedLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + packedLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - var elementCount int - var count int - for _, integer := range dAtA[iNdEx:postIndex] { - if integer < 128 { - count++ - } - } - elementCount = count - if elementCount != 0 && len(m.GlobalVirtualGroupIds) == 0 { - m.GlobalVirtualGroupIds = make([]uint32, 0, elementCount) - } - for iNdEx < postIndex { - var v uint32 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.GlobalVirtualGroupIds = append(m.GlobalVirtualGroupIds, v) - } - } else { - return fmt.Errorf("proto: wrong wireType = %d for field GlobalVirtualGroupIds", wireType) + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Operator = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipTx(dAtA[iNdEx:]) @@ -4156,7 +5868,7 @@ func (m *MsgCompleteSwapOut) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgCompleteSwapOutResponse) Unmarshal(dAtA []byte) error { +func (m *MsgCompleteStorageProviderExitResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4179,10 +5891,10 @@ func (m *MsgCompleteSwapOutResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgCompleteSwapOutResponse: wiretype end group for non-group") + return fmt.Errorf("proto: MsgCompleteStorageProviderExitResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgCompleteSwapOutResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgCompleteStorageProviderExitResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: @@ -4206,7 +5918,7 @@ func (m *MsgCompleteSwapOutResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgCancelSwapOut) Unmarshal(dAtA []byte) error { +func (m *MsgReserveSwapIn) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4229,10 +5941,10 @@ func (m *MsgCancelSwapOut) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgCancelSwapOut: wiretype end group for non-group") + return fmt.Errorf("proto: MsgReserveSwapIn: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgCancelSwapOut: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgReserveSwapIn: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -4269,9 +5981,47 @@ func (m *MsgCancelSwapOut) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 2: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field GlobalVirtualGroupFamilyId", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field TargetSpId", wireType) + } + m.TargetSpId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.TargetSpId |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field GlobalVirtualGroupFamilyId", wireType) + } + m.GlobalVirtualGroupFamilyId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.GlobalVirtualGroupFamilyId |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field GlobalVirtualGroupId", wireType) } - m.GlobalVirtualGroupFamilyId = 0 + m.GlobalVirtualGroupId = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -4281,87 +6031,11 @@ func (m *MsgCancelSwapOut) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.GlobalVirtualGroupFamilyId |= uint32(b&0x7F) << shift + m.GlobalVirtualGroupId |= uint32(b&0x7F) << shift if b < 0x80 { break } } - case 3: - if wireType == 0 { - var v uint32 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.GlobalVirtualGroupIds = append(m.GlobalVirtualGroupIds, v) - } else if wireType == 2 { - var packedLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - packedLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if packedLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + packedLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - var elementCount int - var count int - for _, integer := range dAtA[iNdEx:postIndex] { - if integer < 128 { - count++ - } - } - elementCount = count - if elementCount != 0 && len(m.GlobalVirtualGroupIds) == 0 { - m.GlobalVirtualGroupIds = make([]uint32, 0, elementCount) - } - for iNdEx < postIndex { - var v uint32 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.GlobalVirtualGroupIds = append(m.GlobalVirtualGroupIds, v) - } - } else { - return fmt.Errorf("proto: wrong wireType = %d for field GlobalVirtualGroupIds", wireType) - } default: iNdEx = preIndex skippy, err := skipTx(dAtA[iNdEx:]) @@ -4383,7 +6057,7 @@ func (m *MsgCancelSwapOut) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgCancelSwapOutResponse) Unmarshal(dAtA []byte) error { +func (m *MsgReserveSwapInResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4406,10 +6080,10 @@ func (m *MsgCancelSwapOutResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgCancelSwapOutResponse: wiretype end group for non-group") + return fmt.Errorf("proto: MsgReserveSwapInResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgCancelSwapOutResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgReserveSwapInResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: @@ -4433,7 +6107,7 @@ func (m *MsgCancelSwapOutResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgSettle) Unmarshal(dAtA []byte) error { +func (m *MsgCompleteSwapIn) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4456,10 +6130,10 @@ func (m *MsgSettle) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgSettle: wiretype end group for non-group") + return fmt.Errorf("proto: MsgCompleteSwapIn: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgSettle: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgCompleteSwapIn: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -4514,80 +6188,23 @@ func (m *MsgSettle) Unmarshal(dAtA []byte) error { } } case 3: - if wireType == 0 { - var v uint32 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.GlobalVirtualGroupIds = append(m.GlobalVirtualGroupIds, v) - } else if wireType == 2 { - var packedLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - packedLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if packedLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + packedLen - if postIndex < 0 { - return ErrInvalidLengthTx + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field GlobalVirtualGroupId", wireType) + } + m.GlobalVirtualGroupId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx } - if postIndex > l { + if iNdEx >= l { return io.ErrUnexpectedEOF } - var elementCount int - var count int - for _, integer := range dAtA[iNdEx:postIndex] { - if integer < 128 { - count++ - } - } - elementCount = count - if elementCount != 0 && len(m.GlobalVirtualGroupIds) == 0 { - m.GlobalVirtualGroupIds = make([]uint32, 0, elementCount) - } - for iNdEx < postIndex { - var v uint32 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.GlobalVirtualGroupIds = append(m.GlobalVirtualGroupIds, v) + b := dAtA[iNdEx] + iNdEx++ + m.GlobalVirtualGroupId |= uint32(b&0x7F) << shift + if b < 0x80 { + break } - } else { - return fmt.Errorf("proto: wrong wireType = %d for field GlobalVirtualGroupIds", wireType) } default: iNdEx = preIndex @@ -4610,7 +6227,7 @@ func (m *MsgSettle) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgSettleResponse) Unmarshal(dAtA []byte) error { +func (m *MsgCompleteSwapInResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4633,10 +6250,10 @@ func (m *MsgSettleResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgSettleResponse: wiretype end group for non-group") + return fmt.Errorf("proto: MsgCompleteSwapInResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgSettleResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgCompleteSwapInResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: @@ -4660,7 +6277,7 @@ func (m *MsgSettleResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgStorageProviderExit) Unmarshal(dAtA []byte) error { +func (m *MsgCancelSwapIn) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4683,10 +6300,10 @@ func (m *MsgStorageProviderExit) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgStorageProviderExit: wiretype end group for non-group") + return fmt.Errorf("proto: MsgCancelSwapIn: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgStorageProviderExit: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgCancelSwapIn: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -4721,6 +6338,44 @@ func (m *MsgStorageProviderExit) Unmarshal(dAtA []byte) error { } m.StorageProvider = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field GlobalVirtualGroupFamilyId", wireType) + } + m.GlobalVirtualGroupFamilyId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.GlobalVirtualGroupFamilyId |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field GlobalVirtualGroupId", wireType) + } + m.GlobalVirtualGroupId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.GlobalVirtualGroupId |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } default: iNdEx = preIndex skippy, err := skipTx(dAtA[iNdEx:]) @@ -4742,7 +6397,7 @@ func (m *MsgStorageProviderExit) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgStorageProviderExitResponse) Unmarshal(dAtA []byte) error { +func (m *MsgCancelSwapInResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4765,10 +6420,10 @@ func (m *MsgStorageProviderExitResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgStorageProviderExitResponse: wiretype end group for non-group") + return fmt.Errorf("proto: MsgCancelSwapInResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgStorageProviderExitResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgCancelSwapInResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: @@ -4792,7 +6447,7 @@ func (m *MsgStorageProviderExitResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgCompleteStorageProviderExit) Unmarshal(dAtA []byte) error { +func (m *MsgStorageProviderForcedExit) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4815,13 +6470,45 @@ func (m *MsgCompleteStorageProviderExit) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgCompleteStorageProviderExit: wiretype end group for non-group") + return fmt.Errorf("proto: MsgStorageProviderForcedExit: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgCompleteStorageProviderExit: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgStorageProviderForcedExit: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Authority = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field StorageProvider", wireType) } @@ -4874,7 +6561,7 @@ func (m *MsgCompleteStorageProviderExit) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgCompleteStorageProviderExitResponse) Unmarshal(dAtA []byte) error { +func (m *MsgStorageProviderForcedExitResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4897,10 +6584,10 @@ func (m *MsgCompleteStorageProviderExitResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgCompleteStorageProviderExitResponse: wiretype end group for non-group") + return fmt.Errorf("proto: MsgStorageProviderForcedExitResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgCompleteStorageProviderExitResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgStorageProviderForcedExitResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: diff --git a/x/virtualgroup/types/types.pb.go b/x/virtualgroup/types/types.pb.go index bb3ff54f1..7b408d6ee 100644 --- a/x/virtualgroup/types/types.pb.go +++ b/x/virtualgroup/types/types.pb.go @@ -253,11 +253,18 @@ func (m *GlobalVirtualGroupsBindingOnBucket) GetLocalVirtualGroupIds() []uint32 type GVGStatisticsWithinSP struct { // storage_provider_id defines the id of the sp which the statistics associated to StorageProviderId uint32 `protobuf:"varint,1,opt,name=storage_provider_id,json=storageProviderId,proto3" json:"storage_provider_id,omitempty"` - // primary_sp_family_count defines the number of the family which this sp serves as primary sp + // primary_count defines the number of global virtual groups (GVGs) which this sp serves as primary sp PrimaryCount uint32 `protobuf:"varint,2,opt,name=primary_count,json=primaryCount,proto3" json:"primary_count,omitempty"` // secondary_count defines the number of global virtual groups (GVGs) in // which this storage provider serves as a secondary storage provider. SecondaryCount uint32 `protobuf:"varint,3,opt,name=secondary_count,json=secondaryCount,proto3" json:"secondary_count,omitempty"` + // Redundancy defines the number of gvg that sp serves as sp and secondary sp, which breaks the data redundancy requirement. + // In most case, this should not happen, + // during sp exit, a successor sp might need to swapIn GVG(s) that it is already a secondary and become the primary SP + // of whole family. + // a successor sp which need to swapIn a GVG as secondary must be unique to all other SP. So this will not be used for + // swapIn individual GVG as secondary + BreakRedundancyReqmtGvgCount uint32 `protobuf:"varint,4,opt,name=break_redundancy_reqmt_gvg_count,json=breakRedundancyReqmtGvgCount,proto3" json:"break_redundancy_reqmt_gvg_count,omitempty"` } func (m *GVGStatisticsWithinSP) Reset() { *m = GVGStatisticsWithinSP{} } @@ -314,6 +321,13 @@ func (m *GVGStatisticsWithinSP) GetSecondaryCount() uint32 { return 0 } +func (m *GVGStatisticsWithinSP) GetBreakRedundancyReqmtGvgCount() uint32 { + if m != nil { + return m.BreakRedundancyReqmtGvgCount + } + return 0 +} + type SwapOutInfo struct { // sp_id is the unique id of the storage provider who want to swap out. SpId uint32 `protobuf:"varint,1,opt,name=sp_id,json=spId,proto3" json:"sp_id,omitempty"` @@ -368,12 +382,76 @@ func (m *SwapOutInfo) GetSuccessorSpId() uint32 { return 0 } +type SwapInInfo struct { + // successor_sp_id defines the id of SP who wants to join the family or GVG + SuccessorSpId uint32 `protobuf:"varint,1,opt,name=successor_sp_id,json=successorSpId,proto3" json:"successor_sp_id,omitempty"` + // target_sp_id is the id of SP in the family or GVG to be swapped. + TargetSpId uint32 `protobuf:"varint,2,opt,name=target_sp_id,json=targetSpId,proto3" json:"target_sp_id,omitempty"` + // expiration_time is the expiration of epoch time for the swapInInfo + ExpirationTime uint64 `protobuf:"varint,3,opt,name=expiration_time,json=expirationTime,proto3" json:"expiration_time,omitempty"` +} + +func (m *SwapInInfo) Reset() { *m = SwapInInfo{} } +func (m *SwapInInfo) String() string { return proto.CompactTextString(m) } +func (*SwapInInfo) ProtoMessage() {} +func (*SwapInInfo) Descriptor() ([]byte, []int) { + return fileDescriptor_1fe6fc664532d0c3, []int{5} +} +func (m *SwapInInfo) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *SwapInInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_SwapInInfo.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *SwapInInfo) XXX_Merge(src proto.Message) { + xxx_messageInfo_SwapInInfo.Merge(m, src) +} +func (m *SwapInInfo) XXX_Size() int { + return m.Size() +} +func (m *SwapInInfo) XXX_DiscardUnknown() { + xxx_messageInfo_SwapInInfo.DiscardUnknown(m) +} + +var xxx_messageInfo_SwapInInfo proto.InternalMessageInfo + +func (m *SwapInInfo) GetSuccessorSpId() uint32 { + if m != nil { + return m.SuccessorSpId + } + return 0 +} + +func (m *SwapInInfo) GetTargetSpId() uint32 { + if m != nil { + return m.TargetSpId + } + return 0 +} + +func (m *SwapInInfo) GetExpirationTime() uint64 { + if m != nil { + return m.ExpirationTime + } + return 0 +} + func init() { proto.RegisterType((*GlobalVirtualGroup)(nil), "greenfield.virtualgroup.GlobalVirtualGroup") proto.RegisterType((*GlobalVirtualGroupFamily)(nil), "greenfield.virtualgroup.GlobalVirtualGroupFamily") proto.RegisterType((*GlobalVirtualGroupsBindingOnBucket)(nil), "greenfield.virtualgroup.GlobalVirtualGroupsBindingOnBucket") proto.RegisterType((*GVGStatisticsWithinSP)(nil), "greenfield.virtualgroup.GVGStatisticsWithinSP") proto.RegisterType((*SwapOutInfo)(nil), "greenfield.virtualgroup.SwapOutInfo") + proto.RegisterType((*SwapInInfo)(nil), "greenfield.virtualgroup.SwapInInfo") } func init() { @@ -381,47 +459,52 @@ func init() { } var fileDescriptor_1fe6fc664532d0c3 = []byte{ - // 627 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x94, 0x41, 0x6f, 0xd3, 0x3c, - 0x18, 0xc7, 0x9b, 0xae, 0xdb, 0xbb, 0xba, 0xeb, 0xf6, 0xe2, 0x6d, 0x5a, 0xd8, 0xa4, 0xae, 0xca, - 0xa4, 0xd1, 0x4b, 0xdb, 0x03, 0x20, 0x38, 0x70, 0xa1, 0x20, 0xaa, 0x70, 0x60, 0x55, 0x22, 0x86, - 0xc4, 0x25, 0x72, 0x62, 0x2f, 0xb3, 0x96, 0xda, 0x51, 0xec, 0x0c, 0xba, 0x4f, 0xc1, 0x85, 0x6f, - 0xb2, 0x0f, 0xb1, 0x13, 0x9a, 0x76, 0x02, 0x0e, 0x13, 0xda, 0xc4, 0xf7, 0x40, 0xb1, 0x4d, 0x3b, - 0x08, 0x1a, 0x12, 0xa7, 0xc4, 0xff, 0xe7, 0xef, 0xc7, 0x7a, 0x7e, 0x7e, 0x1e, 0x83, 0x9d, 0x38, - 0x23, 0x84, 0x1d, 0x50, 0x92, 0xe0, 0xfe, 0x31, 0xcd, 0x64, 0x8e, 0x92, 0x38, 0xe3, 0x79, 0xda, - 0x97, 0x93, 0x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28, - 0x26, 0xc5, 0x88, 0x1d, 0x53, 0x4c, 0xb2, 0x60, 0x7a, 0x75, 0x77, 0x4c, 0x68, 0x64, 0x22, 0x2e, - 0x86, 0x3b, 0xb3, 0x9b, 0x8c, 0x78, 0xce, 0xa4, 0xb9, 0xc9, 0x25, 0x23, 0x3e, 0x2b, 0x34, 0x78, - 0x0f, 0xac, 0xcc, 0x66, 0x43, 0xdb, 0xf4, 0x04, 0xcd, 0x46, 0x43, 0x19, 0x9d, 0x97, 0xa0, 0xe1, - 0xbf, 0x43, 0xe9, 0x5e, 0x2e, 0x5d, 0x76, 0xc0, 0xe1, 0x2a, 0x98, 0xd7, 0xed, 0xa1, 0x8f, 0xaf, - 0x89, 0xa2, 0x2f, 0x76, 0xc1, 0x8a, 0xc8, 0xa3, 0x88, 0x08, 0xc1, 0xb3, 0x5f, 0xba, 0xa7, 0x39, - 0x95, 0x8b, 0xfe, 0x19, 0xbc, 0x3a, 0xbb, 0x6a, 0x59, 0xe7, 0x57, 0x2d, 0xeb, 0xdb, 0x55, 0xcb, - 0xfa, 0x70, 0xdd, 0xaa, 0x9c, 0x5f, 0xb7, 0x2a, 0x9f, 0xaf, 0x5b, 0x95, 0xb7, 0x0f, 0x6e, 0xb4, - 0x7b, 0xc8, 0xc2, 0x6e, 0x74, 0x88, 0x28, 0xeb, 0xdf, 0x78, 0x96, 0xde, 0xff, 0xe1, 0x61, 0x0a, - 0x17, 0xd4, 0x7b, 0x72, 0xff, 0x47, 0x00, 0x00, 0x00, 0xff, 0xff, 0x3c, 0x83, 0x77, 0xa9, 0xc0, - 0x04, 0x00, 0x00, + // 714 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x54, 0x41, 0x4f, 0x1b, 0x39, + 0x14, 0xce, 0x84, 0xc0, 0x12, 0x87, 0xc0, 0xae, 0x01, 0x31, 0x0b, 0xab, 0x10, 0x0d, 0x12, 0xe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, 0x0c, 0x66, 0xcd, 0x98, 0x99, 0x32, 0x0a, 0x32, 0x9b, 0xaf, 0x6d, 0xb0, 0x24, 0xd3, 0x30, + 0x24, 0x52, 0x72, 0x71, 0x6b, 0x0a, 0xcb, 0x63, 0x38, 0x9b, 0x43, 0xef, 0x1d, 0x00, 0x99, 0x56, + 0x87, 0x69, 0xa9, 0x3b, 0xb2, 0x9c, 0x3b, 0xb2, 0x60, 0x15, 0x2c, 0x28, 0x24, 0x22, 0xa2, 0x6e, + 0x49, 0x03, 0x83, 0x69, 0xc6, 0x0e, 0x58, 0x22, 0xc7, 0x09, 0x15, 0x48, 0x51, 0xce, 0x02, 0x45, + 0x63, 0xa2, 0x4d, 0x29, 0xf8, 0x8b, 0x13, 0xf8, 0x05, 0x8d, 0x49, 0xeb, 0xf9, 0xd9, 0x55, 0xc5, + 0x39, 0xbf, 0xaa, 0x38, 0x5f, 0xaf, 0x2a, 0xce, 0xfb, 0xeb, 0x4a, 0xee, 0xfc, 0xba, 0x92, 0xfb, + 0x78, 0x5d, 0xc9, 0xbd, 0xfe, 0xef, 0xc6, 0xde, 0xf6, 0x59, 0xbf, 0x1e, 0x1e, 0x22, 0xca, 0x9a, + 0x37, 0xde, 0xd7, 0xe3, 0x3b, 0x5e, 0xd8, 0xfe, 0x9c, 0x7e, 0x18, 0xff, 0xfd, 0x1e, 0x00, 0x00, + 0xff, 0xff, 0xa6, 0x34, 0xd1, 0x03, 0x89, 0x05, 0x00, 0x00, } func (m *GlobalVirtualGroup) Marshal() (dAtA []byte, err error) { @@ -649,6 +732,11 @@ func (m *GVGStatisticsWithinSP) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.BreakRedundancyReqmtGvgCount != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.BreakRedundancyReqmtGvgCount)) + i-- + dAtA[i] = 0x20 + } if m.SecondaryCount != 0 { i = encodeVarintTypes(dAtA, i, uint64(m.SecondaryCount)) i-- @@ -700,6 +788,44 @@ func (m *SwapOutInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *SwapInInfo) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *SwapInInfo) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *SwapInInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.ExpirationTime != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.ExpirationTime)) + i-- + dAtA[i] = 0x18 + } + if m.TargetSpId != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.TargetSpId)) + i-- + dAtA[i] = 0x10 + } + if m.SuccessorSpId != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.SuccessorSpId)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + func encodeVarintTypes(dAtA []byte, offset int, v uint64) int { offset -= sovTypes(v) base := offset @@ -811,6 +937,9 @@ func (m *GVGStatisticsWithinSP) Size() (n int) { if m.SecondaryCount != 0 { n += 1 + sovTypes(uint64(m.SecondaryCount)) } + if m.BreakRedundancyReqmtGvgCount != 0 { + n += 1 + sovTypes(uint64(m.BreakRedundancyReqmtGvgCount)) + } return n } @@ -829,6 +958,24 @@ func (m *SwapOutInfo) Size() (n int) { return n } +func (m *SwapInInfo) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.SuccessorSpId != 0 { + n += 1 + sovTypes(uint64(m.SuccessorSpId)) + } + if m.TargetSpId != 0 { + n += 1 + sovTypes(uint64(m.TargetSpId)) + } + if m.ExpirationTime != 0 { + n += 1 + sovTypes(uint64(m.ExpirationTime)) + } + return n +} + func sovTypes(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -1621,6 +1768,25 @@ func (m *GVGStatisticsWithinSP) Unmarshal(dAtA []byte) error { break } } + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field BreakRedundancyReqmtGvgCount", wireType) + } + m.BreakRedundancyReqmtGvgCount = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.BreakRedundancyReqmtGvgCount |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } default: iNdEx = preIndex skippy, err := skipTypes(dAtA[iNdEx:]) @@ -1730,6 +1896,113 @@ func (m *SwapOutInfo) Unmarshal(dAtA []byte) error { } return nil } +func (m *SwapInInfo) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: SwapInInfo: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: SwapInInfo: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field SuccessorSpId", wireType) + } + m.SuccessorSpId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.SuccessorSpId |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field TargetSpId", wireType) + } + m.TargetSpId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.TargetSpId |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ExpirationTime", wireType) + } + m.ExpirationTime = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ExpirationTime |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipTypes(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0