From f635c1a872c9947df52e6f3f8e3ad4741d5d91e2 Mon Sep 17 00:00:00 2001 From: sampocs Date: Wed, 18 Jan 2023 10:09:32 -0600 Subject: [PATCH] v5 Store Migration (#573) Co-authored-by: Hieu Vu <72878483+hieuvubk@users.noreply.github.com> --- Makefile | 12 + app/apptesting/test_helpers.go | 18 +- app/upgrades.go | 15 +- app/upgrades/README.md | 83 +- app/upgrades/v3/upgrades_test.go | 40 +- app/upgrades/v4/upgrades_test.go | 31 +- app/upgrades/v5/upgrades.go | 67 +- app/upgrades/v5/upgrades_test.go | 428 +++ dockernet/config.sh | 11 +- dockernet/docker-compose.yml | 7 + dockernet/tests/integration_tests.bats | 2 +- dockernet/tests/run_tests_upgrade.sh | 14 + dockernet/upgrades/Dockerfile.stride | 1 + dockernet/upgrades/README.md | 17 +- dockernet/upgrades/submit_upgrade.sh | 2 +- proto/stride/stakeibc/ica_account.proto | 3 +- testutil/localstride/README.md | 4 +- x/claim/migrations/v2/convert.go | 28 + x/claim/migrations/v2/convert_test.go | 73 + x/claim/migrations/v2/migrations.go | 37 + x/claim/migrations/v2/types/params.pb.go | 763 +++++ x/claim/module.go | 2 +- x/icacallbacks/migrations/v2/convert.go | 138 + x/icacallbacks/migrations/v2/convert_test.go | 227 ++ x/icacallbacks/migrations/v2/migrations.go | 49 + x/icacallbacks/module.go | 2 +- x/records/migrations/v2/convert.go | 54 + x/records/migrations/v2/convert_test.go | 135 + x/records/migrations/v2/migrations.go | 112 + x/records/migrations/v2/types/genesis.pb.go | 2806 +++++++++++++++++ x/records/migrations/v2/types/params.go | 39 + x/records/module.go | 2 +- x/stakeibc/migrations/v2/convert.go | 67 + x/stakeibc/migrations/v2/convert_test.go | 150 + x/stakeibc/migrations/v2/migrations.go | 46 + .../migrations/v2/types/callbacks.pb.go | 2238 +++++++++++++ .../migrations/v2/types/host_zone.pb.go | 1193 +++++++ .../migrations/v2/types/ica_account.pb.go | 392 +++ .../migrations/v2/types/validator.pb.go | 816 +++++ x/stakeibc/module.go | 2 +- x/stakeibc/types/ica_account.pb.go | 25 +- 41 files changed, 9982 insertions(+), 169 deletions(-) create mode 100644 app/upgrades/v5/upgrades_test.go create mode 100755 dockernet/tests/run_tests_upgrade.sh create mode 100644 x/claim/migrations/v2/convert.go create mode 100644 x/claim/migrations/v2/convert_test.go create mode 100644 x/claim/migrations/v2/migrations.go create mode 100644 x/claim/migrations/v2/types/params.pb.go create mode 100644 x/icacallbacks/migrations/v2/convert.go create mode 100644 x/icacallbacks/migrations/v2/convert_test.go create mode 100644 x/icacallbacks/migrations/v2/migrations.go create mode 100644 x/records/migrations/v2/convert.go create mode 100644 x/records/migrations/v2/convert_test.go create mode 100644 x/records/migrations/v2/migrations.go create mode 100644 x/records/migrations/v2/types/genesis.pb.go create mode 100644 x/records/migrations/v2/types/params.go create mode 100644 x/stakeibc/migrations/v2/convert.go create mode 100644 x/stakeibc/migrations/v2/convert_test.go create mode 100644 x/stakeibc/migrations/v2/migrations.go create mode 100644 x/stakeibc/migrations/v2/types/callbacks.pb.go create mode 100644 x/stakeibc/migrations/v2/types/host_zone.pb.go create mode 100644 x/stakeibc/migrations/v2/types/ica_account.pb.go create mode 100644 x/stakeibc/migrations/v2/types/validator.pb.go diff --git a/Makefile b/Makefile index 9516239331..7e6ff57ad0 100644 --- a/Makefile +++ b/Makefile @@ -101,6 +101,9 @@ lint: ############################################################################### test-unit: + @go test -mod=readonly ./x/... ./app/... + +test-unit-module: @go test -mod=readonly ./x/$(module)/... test-cover: @@ -134,6 +137,15 @@ stop-docker: @pkill -f "tail .*.log" | true docker-compose -f $(DOCKERNET_COMPOSE_FILE) down +upgrade-init: + PART=1 bash $(DOCKERNET_HOME)/tests/run_tests_upgrade.sh + +upgrade-submit: + UPGRADE_HEIGHT=750 bash $(DOCKERNET_HOME)/upgrades/submit_upgrade.sh + +upgrade-validate: + PART=2 bash $(DOCKERNET_HOME)/tests/run_tests_upgrade.sh + ############################################################################### ### Protobuf ### ############################################################################### diff --git a/app/apptesting/test_helpers.go b/app/apptesting/test_helpers.go index 9afe804c41..47314d7589 100644 --- a/app/apptesting/test_helpers.go +++ b/app/apptesting/test_helpers.go @@ -318,26 +318,18 @@ func (s *AppTestHelper) MarshalledICS20PacketData() sdk.AccAddress { return data.GetBytes() } -func (s *AppTestHelper) ICS20PacketAcknowledgement() channeltypes.Acknowledgement { - // see: https://github.com/cosmos/ibc-go/blob/8de555db76d0320842dacaa32e5500e1fd55e667/modules/apps/transfer/keeper/relay.go#L151 - ack := channeltypes.NewResultAcknowledgement(s.MarshalledICS20PacketData()) - return ack -} - func (s *AppTestHelper) ConfirmUpgradeSucceededs(upgradeName string, upgradeHeight int64) { - contextBeforeUpgrade := s.Ctx.WithBlockHeight(upgradeHeight - 1) - contextAtUpgrade := s.Ctx.WithBlockHeight(upgradeHeight) - + s.Ctx = s.Ctx.WithBlockHeight(upgradeHeight - 1) plan := upgradetypes.Plan{Name: upgradeName, Height: upgradeHeight} - err := s.App.UpgradeKeeper.ScheduleUpgrade(contextBeforeUpgrade, plan) + err := s.App.UpgradeKeeper.ScheduleUpgrade(s.Ctx, plan) s.Require().NoError(err) - - _, exists := s.App.UpgradeKeeper.GetUpgradePlan(contextBeforeUpgrade) + _, exists := s.App.UpgradeKeeper.GetUpgradePlan(s.Ctx) s.Require().True(exists) + s.Ctx = s.Ctx.WithBlockHeight(upgradeHeight) s.Require().NotPanics(func() { beginBlockRequest := abci.RequestBeginBlock{} - s.App.BeginBlocker(contextAtUpgrade, beginBlockRequest) + s.App.BeginBlocker(s.Ctx, beginBlockRequest) }) } diff --git a/app/upgrades.go b/app/upgrades.go index fbb66279a2..3506fe4642 100644 --- a/app/upgrades.go +++ b/app/upgrades.go @@ -13,6 +13,9 @@ import ( v4 "github.com/Stride-Labs/stride/v4/app/upgrades/v4" v5 "github.com/Stride-Labs/stride/v4/app/upgrades/v5" claimtypes "github.com/Stride-Labs/stride/v4/x/claim/types" + icacallbacktypes "github.com/Stride-Labs/stride/v4/x/icacallbacks/types" + recordtypes "github.com/Stride-Labs/stride/v4/x/records/types" + stakeibctypes "github.com/Stride-Labs/stride/v4/x/stakeibc/types" ) func (app *StrideApp) setupUpgradeHandlers() { @@ -37,7 +40,17 @@ func (app *StrideApp) setupUpgradeHandlers() { // v5 upgrade handler app.UpgradeKeeper.SetUpgradeHandler( v5.UpgradeName, - v5.CreateUpgradeHandler(app.mm, app.configurator, app.InterchainqueryKeeper, app.StakeibcKeeper), + v5.CreateUpgradeHandler( + app.mm, + app.configurator, + app.appCodec, + app.InterchainqueryKeeper, + app.StakeibcKeeper, + app.keys[claimtypes.StoreKey], + app.keys[icacallbacktypes.StoreKey], + app.keys[recordtypes.StoreKey], + app.keys[stakeibctypes.StoreKey], + ), ) upgradeInfo, err := app.UpgradeKeeper.ReadUpgradeInfoFromDisk() diff --git a/app/upgrades/README.md b/app/upgrades/README.md index 2fd181429a..9de0978352 100644 --- a/app/upgrades/README.md +++ b/app/upgrades/README.md @@ -84,60 +84,20 @@ func (app *StrideApp) setupUpgradeHandlers() { ``` ## Increment the Module's Consensus Version +* The consensus version is different from the chain version - it is specific to each module and is incremented every time state is migrated ```go // x/{moduleName}/module.go func (AppModule) ConsensusVersion() uint64 { return 2 } ``` -## Specify the Migration in the Upgrade Handler -```go -// app/upgrades/{upgradeVersion}/upgrades.go - -// CreateUpgradeHandler creates an SDK upgrade handler for {upgradeVersion} -func CreateUpgradeHandler( - mm *module.Manager, - configurator module.Configurator, -) upgradetypes.UpgradeHandler { - return func(ctx sdk.Context, _ upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) { - vm[{moduleName}] = 2 // <- ADD THIS - return mm.RunMigrations(ctx, configurator, vm) - } -} -``` - -## Add Migration Handler -```go -// x/{moduleName}/keeper/migrations.go - -package keeper - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - - {upgradeVersion} "github.com/Stride-Labs/stride/v3/x/records/migrations/{upgradeVersion}" -) - -type Migrator struct { - keeper Keeper -} - -func NewMigrator(keeper Keeper) Migrator { - return Migrator{keeper: keeper} -} - -func (m Migrator) Migrate1to2(ctx sdk.Context) error { - return {upgradeVersion}.MigrateStore(ctx) -} -``` - ## Define Migration Logic ```go -// x/{moduleName}/migrations/{upgradeVersion}/migrations.go +// x/{moduleName}/migrations/{new-consensus-version}/migrations.go package {upgradeVersion} import ( sdk "github.com/cosmos/cosmos-sdk/types" - {oldVersion} "github.com/Stride-Labs/stride/v3/x/records/migrations/{oldVersion}" + {new-consensus-version} "github.com/Stride-Labs/stride/v3/x/records/migrations/{new-consensus-version}" ) // TODO: Add migration logic to deserialize with old protos and re-serialize with new ones @@ -147,16 +107,35 @@ func MigrateStore(ctx sdk.Context) error { } ``` -## Register Migration Handler +## Specify the Migration in the Upgrade Handler ```go -// x/{moduleName}/module.go -... -func (am AppModule) RegisterServices(cfg module.Configurator) { - types.RegisterQueryServer(cfg.QueryServer(), am.keeper) - migrator := keeper.NewMigrator(am.keeper) +// app/upgrades/{upgradeVersion}/upgrades.go + +import ( + {module}migration "github.com/Stride-Labs/stride/v4/x/{module}/migrations/{new-consensus-version}" +) - if err := cfg.RegisterMigration(types.ModuleName, 1, migrator.Migrate1to2); err != nil { - panic(fmt.Errorf("failed to migrate %s to {upgradeVersion}: %w", types.ModuleName, err)) +// CreateUpgradeHandler creates an SDK upgrade handler for {upgradeVersion} +func CreateUpgradeHandler( + mm *module.Manager, + configurator module.Configurator, + cdc codec.Codec, + {module}StoreKey, +) upgradetypes.UpgradeHandler { + return func(ctx sdk.Context, _ upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) { + if err := {module}migration.MigrateStore(ctx, {module}StoreKey, cdc); err != nil { + return vm, sdkerrors.Wrapf(err, "unable to migrate {module} store") + } + vm[{moduleName}] = mm.GetVersionMap()[{moduleName}] + return mm.RunMigrations(ctx, configurator, vm) } } -``` \ No newline at end of file +``` + +## Add Additional Parameters to `CreateUpgradeHandler` Invocation +```go +// app/upgrades.go + ... + {upgradeVersion}.CreateUpgradeHandler(app.mm, app.configurator, app.appCodec, app.{module}Keeper), + ... +``` diff --git a/app/upgrades/v3/upgrades_test.go b/app/upgrades/v3/upgrades_test.go index b662896f27..3c770bf2d1 100644 --- a/app/upgrades/v3/upgrades_test.go +++ b/app/upgrades/v3/upgrades_test.go @@ -1,7 +1,6 @@ package v3_test import ( - "fmt" "testing" "github.com/stretchr/testify/suite" @@ -28,39 +27,14 @@ func TestKeeperTestSuite(t *testing.T) { } func (suite *UpgradeTestSuite) TestUpgrade() { - testCases := []struct { - msg string - preUpdate func() - update func() - postUpdate func() - expPass bool - }{ - { - "Test that upgrade does not panic", - func() { - suite.Setup() - }, - func() { - suite.ConfirmUpgradeSucceededs("v3", dummyUpgradeHeight) + suite.Setup() - // make sure claim record was set - afterCtx := suite.Ctx.WithBlockHeight(dummyUpgradeHeight) - for _, identifier := range airdropIdentifiers { - claimRecords := suite.App.ClaimKeeper.GetClaimRecords(afterCtx, identifier) - suite.Require().NotEqual(0, len(claimRecords)) - } - }, - func() { - }, - true, - }, - } + suite.ConfirmUpgradeSucceededs("v3", dummyUpgradeHeight) - for _, tc := range testCases { - suite.Run(fmt.Sprintf("Case %s", tc.msg), func() { - tc.preUpdate() - tc.update() - tc.postUpdate() - }) + // make sure claim record was set + afterCtx := suite.Ctx.WithBlockHeight(dummyUpgradeHeight) + for _, identifier := range airdropIdentifiers { + claimRecords := suite.App.ClaimKeeper.GetClaimRecords(afterCtx, identifier) + suite.Require().NotEqual(0, len(claimRecords)) } } diff --git a/app/upgrades/v4/upgrades_test.go b/app/upgrades/v4/upgrades_test.go index 2daa8d5350..e616a972d0 100644 --- a/app/upgrades/v4/upgrades_test.go +++ b/app/upgrades/v4/upgrades_test.go @@ -1,7 +1,6 @@ package v4_test import ( - "fmt" "testing" "github.com/stretchr/testify/suite" @@ -24,32 +23,6 @@ func TestKeeperTestSuite(t *testing.T) { } func (suite *UpgradeTestSuite) TestUpgrade() { - testCases := []struct { - msg string - preUpdate func() - update func() - postUpdate func() - expPass bool - }{ - { - "Test that upgrade does not panic", - func() { - suite.Setup() - }, - func() { - suite.ConfirmUpgradeSucceededs("v4", dummyUpgradeHeight) - }, - func() { - }, - true, - }, - } - - for _, tc := range testCases { - suite.Run(fmt.Sprintf("Case %s", tc.msg), func() { - tc.preUpdate() - tc.update() - tc.postUpdate() - }) - } + suite.Setup() + suite.ConfirmUpgradeSucceededs("v4", dummyUpgradeHeight) } diff --git a/app/upgrades/v5/upgrades.go b/app/upgrades/v5/upgrades.go index 8e797ab3e8..b51e56dfae 100644 --- a/app/upgrades/v5/upgrades.go +++ b/app/upgrades/v5/upgrades.go @@ -1,41 +1,90 @@ -package v4 +package v5 import ( + "github.com/cosmos/cosmos-sdk/codec" + storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/cosmos/cosmos-sdk/types/module" authz "github.com/cosmos/cosmos-sdk/x/authz" upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" + claimmigration "github.com/Stride-Labs/stride/v4/x/claim/migrations/v2" + claimtypes "github.com/Stride-Labs/stride/v4/x/claim/types" + icacallbacksmigration "github.com/Stride-Labs/stride/v4/x/icacallbacks/migrations/v2" + icacallbacktypes "github.com/Stride-Labs/stride/v4/x/icacallbacks/types" interchainquerykeeper "github.com/Stride-Labs/stride/v4/x/interchainquery/keeper" + recordsmigration "github.com/Stride-Labs/stride/v4/x/records/migrations/v2" + recordtypes "github.com/Stride-Labs/stride/v4/x/records/types" stakeibckeeper "github.com/Stride-Labs/stride/v4/x/stakeibc/keeper" + stakeibcmigration "github.com/Stride-Labs/stride/v4/x/stakeibc/migrations/v2" stakeibctypes "github.com/Stride-Labs/stride/v4/x/stakeibc/types" ) // Note: ensure these values are properly set before running upgrade var ( UpgradeName = "v5" + + // This query used an old query ID format and got stuck after the format was updated + StaleQueryId = "60b8e09dc7a65938cd6e6e5728b8aa0ca3726ffbe5511946a4f08ced316174ab" ) // CreateUpgradeHandler creates an SDK upgrade handler for v5 func CreateUpgradeHandler( mm *module.Manager, configurator module.Configurator, + cdc codec.Codec, interchainqueryKeeper interchainquerykeeper.Keeper, stakeibcKeeper stakeibckeeper.Keeper, + claimStoreKey storetypes.StoreKey, + icacallbackStorekey storetypes.StoreKey, + recordStoreKey storetypes.StoreKey, + stakeibcStoreKey storetypes.StoreKey, ) upgradetypes.UpgradeHandler { return func(ctx sdk.Context, _ upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) { // Remove authz from store as it causes an issue with state sync delete(vm, authz.ModuleName) // Remove a stale query from the interchainquery store - // This query used an old query ID format and got stuck after the format was updated - staleQueryId := "60b8e09dc7a65938cd6e6e5728b8aa0ca3726ffbe5511946a4f08ced316174ab" - interchainqueryKeeper.DeleteQuery(ctx, staleQueryId) - - // Add the SafetyMaxSlashPercent param to the stakeibc param store - stakeibcParams := stakeibcKeeper.GetParams(ctx) - stakeibcParams.SafetyMaxSlashPercent = stakeibctypes.DefaultSafetyMaxSlashPercent - stakeibcKeeper.SetParams(ctx, stakeibcParams) + interchainqueryKeeper.DeleteQuery(ctx, StaleQueryId) + + // To add the SafetyMaxSlashPercent param to the stakeibc param store, + // we just re-initialize all the params with their default value + // The alternative would be to migrate the entire paramstore, but since each param is still + // set to it's default value, this is a safer/less error-prone approach + stakeibcKeeper.SetParams(ctx, stakeibctypes.DefaultParams()) + + // The following modules need state migrations as a result of a change from uints to sdk.Ints + // - claim + // - icacallbacks + // - records + // - stakeibc + if err := claimmigration.MigrateStore(ctx, claimStoreKey, cdc); err != nil { + return vm, sdkerrors.Wrapf(err, "unable to migrate claim store") + } + if err := icacallbacksmigration.MigrateStore(ctx, icacallbackStorekey, cdc); err != nil { + return vm, sdkerrors.Wrapf(err, "unable to migrate icacallbacks store") + } + if err := recordsmigration.MigrateStore(ctx, recordStoreKey, cdc); err != nil { + return vm, sdkerrors.Wrapf(err, "unable to migrate records store") + } + if err := stakeibcmigration.MigrateStore(ctx, stakeibcStoreKey, cdc); err != nil { + return vm, sdkerrors.Wrapf(err, "unable to migrate stakeibc store") + } + + // `RunMigrations` (below) checks the old consensus version of each module (found in + // the store) and compares it against the updated consensus version in the binary + // If the old and new consensus versions are not the same, it attempts to call that + // module's migration function that must be registered ahead of time + // + // Since the migrations above were executed directly (instead of being registered + // and invoked through a Migrator), we need to set the module versions in the versionMap + // to the new version, to prevent RunMigrations from attempting to re-run each migrations + currentVersions := mm.GetVersionMap() + vm[claimtypes.ModuleName] = currentVersions[claimtypes.ModuleName] + vm[icacallbacktypes.ModuleName] = currentVersions[icacallbacktypes.ModuleName] + vm[recordtypes.ModuleName] = currentVersions[recordtypes.ModuleName] + vm[stakeibctypes.ModuleName] = currentVersions[stakeibctypes.ModuleName] return mm.RunMigrations(ctx, configurator, vm) } diff --git a/app/upgrades/v5/upgrades_test.go b/app/upgrades/v5/upgrades_test.go new file mode 100644 index 0000000000..33d574ec79 --- /dev/null +++ b/app/upgrades/v5/upgrades_test.go @@ -0,0 +1,428 @@ +package v5_test + +import ( + "testing" + + "github.com/cosmos/cosmos-sdk/codec" + "github.com/cosmos/cosmos-sdk/store/prefix" + "github.com/golang/protobuf/proto" //nolint:staticcheck + + sdkmath "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/stretchr/testify/suite" + + "github.com/Stride-Labs/stride/v4/app" + + "github.com/Stride-Labs/stride/v4/app/apptesting" + upgradev5 "github.com/Stride-Labs/stride/v4/app/upgrades/v5" + oldclaimtypes "github.com/Stride-Labs/stride/v4/x/claim/migrations/v2/types" + claimtypes "github.com/Stride-Labs/stride/v4/x/claim/types" + icacallbacktypes "github.com/Stride-Labs/stride/v4/x/icacallbacks/types" + icqtypes "github.com/Stride-Labs/stride/v4/x/interchainquery/types" + recordkeeper "github.com/Stride-Labs/stride/v4/x/records/keeper" + oldrecordtypes "github.com/Stride-Labs/stride/v4/x/records/migrations/v2/types" + recordtypes "github.com/Stride-Labs/stride/v4/x/records/types" + stakeibckeeper "github.com/Stride-Labs/stride/v4/x/stakeibc/keeper" + oldstakeibctypes "github.com/Stride-Labs/stride/v4/x/stakeibc/migrations/v2/types" + stakeibctypes "github.com/Stride-Labs/stride/v4/x/stakeibc/types" +) + +const dummyUpgradeHeight = 5 + +type UpgradeTestSuite struct { + apptesting.AppTestHelper +} + +func (s *UpgradeTestSuite) SetupTest() { + s.Setup() +} + +func TestKeeperTestSuite(t *testing.T) { + suite.Run(t, new(UpgradeTestSuite)) +} + +func (s *UpgradeTestSuite) TestUpgrade() { + s.Setup() + + // Setup stores for migrated modules + codec := app.MakeEncodingConfig().Marshaler + checkClaimStoreAfterMigration := s.SetupOldClaimStore(codec) + checkIcacallbackStoreAfterMigration := s.SetupOldIcacallbackStore(codec) + checkRecordStoreAfterMigration := s.SetupOldRecordStore(codec) + checkStakeibcStoreAfterMigration := s.SetupOldStakeibcStore(codec) + + // Setup store for stale query and max slash percent param + checkStaleQueryRemoval := s.SetupRemoveStaleQuery() + checkMaxSlashParamAdded := s.SetupAddMaxSlashPercentParam() + + // Run upgrade + s.ConfirmUpgradeSucceededs("v5", dummyUpgradeHeight) + + // Confirm store migrations were successful + checkClaimStoreAfterMigration() + checkIcacallbackStoreAfterMigration() + checkRecordStoreAfterMigration() + checkStakeibcStoreAfterMigration() + + // Confirm query was removed and max slash percent parameter was added + checkStaleQueryRemoval() + checkMaxSlashParamAdded() +} + +// Sets up the old claim store and returns a callback function that can be used to verify +// the store migration was successful +func (s *UpgradeTestSuite) SetupOldClaimStore(codec codec.Codec) func() { + claimStore := s.Ctx.KVStore(s.App.GetKey(claimtypes.StoreKey)) + + airdropId := "id" + params := oldclaimtypes.Params{ + Airdrops: []*oldclaimtypes.Airdrop{ + { + AirdropIdentifier: airdropId, + ClaimedSoFar: 1000000, + }, + }, + } + + paramsBz, err := codec.MarshalJSON(¶ms) + s.Require().NoError(err) + claimStore.Set([]byte(claimtypes.ParamsKey), paramsBz) + + // Callback to check claim store after migration + return func() { + claimParams, err := s.App.ClaimKeeper.GetParams(s.Ctx) + s.Require().NoError(err, "no error expected when getting claims") + s.Require().Equal(claimParams.Airdrops[0].AirdropIdentifier, airdropId, "airdrop identifier") + s.Require().Equal(claimParams.Airdrops[0].ClaimedSoFar, sdkmath.NewInt(1000000), "claimed so far") + } +} + +// Stores delegate callback args in the icacallback store and returns a function used to verify +// the store was migrated successfully +// The callback args should get migrated +func (s *UpgradeTestSuite) SetupOldDelegateCallback(codec codec.Codec, callbackDataStore sdk.KVStore) func() { + // Create the marshalled callback args + delegateValidator := "dval" + delegateCallback := oldstakeibctypes.DelegateCallback{ + SplitDelegations: []*oldstakeibctypes.SplitDelegation{ + {Validator: delegateValidator, Amount: uint64(1000000)}, + }, + } + delegateCallbackArgs, err := proto.Marshal(&delegateCallback) + s.Require().NoError(err) + + // Create the callback data (which has callback args as an attribute) + delegateKey := "delegate_key" + delegateCallbackData := icacallbacktypes.CallbackData{ + CallbackKey: delegateKey, + CallbackId: stakeibckeeper.ICACallbackID_Delegate, + CallbackArgs: delegateCallbackArgs, + } + delegateCallbackDataBz, err := codec.Marshal(&delegateCallbackData) + s.Require().NoError(err) + + // Store the callback data + callbackDataStore.Set(icacallbacktypes.CallbackDataKey(delegateKey), delegateCallbackDataBz) + + // Check delegate callback args after the migration + return func() { + delegateCallbackData, found := s.App.IcacallbacksKeeper.GetCallbackData(s.Ctx, delegateKey) + s.Require().True(found, "found delegate callback data") + + var delegateCallback stakeibctypes.DelegateCallback + err := proto.Unmarshal(delegateCallbackData.CallbackArgs, &delegateCallback) + s.Require().NoError(err, "unmarshaling delegate callback args should not error") + + s.Require().Equal(delegateValidator, delegateCallback.SplitDelegations[0].Validator, "delegate callback validator") + s.Require().Equal(sdkmath.NewInt(1000000), delegateCallback.SplitDelegations[0].Amount, "delegate callback amount") + } +} + +// Stores undelegate callback args in the icacallback store and returns a function used to verify +// the store was migrated successfully +// The callback args should get migrated +func (s *UpgradeTestSuite) SetupOldUndelegateCallback(codec codec.Codec, callbackDataStore sdk.KVStore) func() { + // Create the marshalled callback args + undelegateValidator := "uval" + undelegateCallback := oldstakeibctypes.UndelegateCallback{ + SplitDelegations: []*oldstakeibctypes.SplitDelegation{{Validator: undelegateValidator, Amount: uint64(3000000)}}, + } + undelegateCallbackArgs, err := proto.Marshal(&undelegateCallback) + s.Require().NoError(err) + + // Create the callback data (which has callback args as an attribute) + undelegateKey := "undelegate_key" + undelegateCallbackData := icacallbacktypes.CallbackData{ + CallbackKey: undelegateKey, + CallbackId: stakeibckeeper.ICACallbackID_Undelegate, + CallbackArgs: undelegateCallbackArgs, + } + undelegateCallbackDataBz, err := codec.Marshal(&undelegateCallbackData) + s.Require().NoError(err) + + // Store the callback data + callbackDataStore.Set(icacallbacktypes.CallbackDataKey(undelegateKey), undelegateCallbackDataBz) + + // Check undelegate callback args after the migration + return func() { + undelegateCallbackData, found := s.App.IcacallbacksKeeper.GetCallbackData(s.Ctx, undelegateKey) + s.Require().True(found, "found undelegate callback data") + + var undelegateCallback stakeibctypes.UndelegateCallback + err = proto.Unmarshal(undelegateCallbackData.CallbackArgs, &undelegateCallback) + s.Require().NoError(err, "unmarshaling undelegate callback args should not error") + + s.Require().Equal(undelegateValidator, undelegateCallback.SplitDelegations[0].Validator, "undelegate callback validator") + s.Require().Equal(sdkmath.NewInt(3000000), undelegateCallback.SplitDelegations[0].Amount, "undelegate callback amount") + } +} + +// Stores rebalance callback args in the icacallback store and returns a function used to verify +// the store was migrated successfully +// The callback args should get migrated +func (s *UpgradeTestSuite) SetupOldRebalanceCallback(codec codec.Codec, callbackDataStore sdk.KVStore) func() { + // Create the marshalled callback args + rebalanceValidator := "rval" + rebalanceCallback := oldstakeibctypes.RebalanceCallback{ + Rebalancings: []*oldstakeibctypes.Rebalancing{ + {SrcValidator: rebalanceValidator, Amt: uint64(2000000)}, + }, + } + rebalanceCallbackArgs, err := proto.Marshal(&rebalanceCallback) + s.Require().NoError(err) + + // Create the callback data (which has callback args as an attribute) + rebalanceKey := "rebalance_key" + rebalanceCallbackData := icacallbacktypes.CallbackData{ + CallbackKey: rebalanceKey, + CallbackId: stakeibckeeper.ICACallbackID_Rebalance, + CallbackArgs: rebalanceCallbackArgs, + } + rebalanceCallbackDataBz, err := codec.Marshal(&rebalanceCallbackData) + s.Require().NoError(err) + + // Store the callback data + callbackDataStore.Set(icacallbacktypes.CallbackDataKey(rebalanceKey), rebalanceCallbackDataBz) + + // Check rebalance callback args after the migration + return func() { + rebalanceCallbackData, found := s.App.IcacallbacksKeeper.GetCallbackData(s.Ctx, rebalanceKey) + s.Require().True(found, "found rebalance callback data") + + var rebalanceCallback stakeibctypes.RebalanceCallback + err = proto.Unmarshal(rebalanceCallbackData.CallbackArgs, &rebalanceCallback) + s.Require().NoError(err, "unmarshaling rebalance callback args should not error") + + s.Require().Equal(rebalanceValidator, rebalanceCallback.Rebalancings[0].SrcValidator, "rebalance callback validator") + s.Require().Equal(sdkmath.NewInt(2000000), rebalanceCallback.Rebalancings[0].Amt, "rebalance callback amount") + } +} + +// Stores claim callback args in the icacallback store and returns a function used to verify +// the store was migrated successfully +// The callback args should NOT get migrated +func (s *UpgradeTestSuite) SetupOldClaimCallback(codec codec.Codec, callbackDataStore sdk.KVStore) func() { + // Create the callback data for the claim callback + claimKey := "claim_key" + oldClaimCallbackData := icacallbacktypes.CallbackData{ + CallbackKey: claimKey, + CallbackId: stakeibckeeper.ICACallbackID_Claim, + CallbackArgs: []byte{1, 2, 3}, + } + claimCallbackDataBz, err := codec.Marshal(&oldClaimCallbackData) + s.Require().NoError(err) + + // Store the callback data + callbackDataStore.Set(icacallbacktypes.CallbackDataKey(claimKey), claimCallbackDataBz) + + // Check rebalance callback args after the migration + // The callback data should not have been modified + return func() { + newClaimCallbackData, found := s.App.IcacallbacksKeeper.GetCallbackData(s.Ctx, claimKey) + s.Require().True(found, "found claim callback data") + s.Require().Equal(oldClaimCallbackData, newClaimCallbackData, "claim callback data") + } +} + +// Sets up the old icacallbacks store and returns a callback function that can be used to verify +// the store migration was successful +func (s *UpgradeTestSuite) SetupOldIcacallbackStore(codec codec.Codec) func() { + icacallbackStore := s.Ctx.KVStore(s.App.GetKey(icacallbacktypes.StoreKey)) + callbackDataStore := prefix.NewStore(icacallbackStore, icacallbacktypes.KeyPrefix(icacallbacktypes.CallbackDataKeyPrefix)) + + checkDelegateCallbackAfterMigration := s.SetupOldDelegateCallback(codec, callbackDataStore) + checkUndelegateCallbackAfterMigration := s.SetupOldUndelegateCallback(codec, callbackDataStore) + checkRebalanceCallbackAfterMigration := s.SetupOldRebalanceCallback(codec, callbackDataStore) + checkClaimCallbackAfterMigration := s.SetupOldClaimCallback(codec, callbackDataStore) + + // Callback to check store after migration + return func() { + checkDelegateCallbackAfterMigration() + checkUndelegateCallbackAfterMigration() + checkRebalanceCallbackAfterMigration() + checkClaimCallbackAfterMigration() + } +} + +// Sets up the old records store and returns a callback function that can be used to verify +// the store migration was successful +func (s *UpgradeTestSuite) SetupOldRecordStore(codec codec.Codec) func() { + recordStore := s.Ctx.KVStore(s.App.GetKey(recordtypes.StoreKey)) + + // set old deposit record + depositRecordId := uint64(1) + depositRecord := oldrecordtypes.DepositRecord{ + Id: depositRecordId, + Amount: int64(1000000), + Status: oldrecordtypes.DepositRecord_DELEGATION_QUEUE, + Source: oldrecordtypes.DepositRecord_WITHDRAWAL_ICA, + } + depositBz, err := codec.Marshal(&depositRecord) + s.Require().NoError(err) + + depositRecordStore := prefix.NewStore(recordStore, recordtypes.KeyPrefix(recordtypes.DepositRecordKey)) + depositRecordStore.Set(recordkeeper.GetDepositRecordIDBytes(depositRecord.Id), depositBz) + + // set old user redemption record + userRedemptionRecordId := "1" + userRedemptionRecord := oldrecordtypes.UserRedemptionRecord{ + Id: "1", + Amount: uint64(1000000), + } + userRedemptionBz, err := codec.Marshal(&userRedemptionRecord) + s.Require().NoError(err) + + userRedemptionRecordStore := prefix.NewStore(recordStore, recordtypes.KeyPrefix(recordtypes.UserRedemptionRecordKey)) + userRedemptionRecordStore.Set([]byte(userRedemptionRecord.Id), userRedemptionBz) + + // set old epoch unbongding record + epochNumber := uint64(1) + hostZoneId := "hz" + epochUnbondingRecord := oldrecordtypes.EpochUnbondingRecord{ + EpochNumber: 1, + HostZoneUnbondings: []*oldrecordtypes.HostZoneUnbonding{ + { + HostZoneId: "hz", + NativeTokenAmount: uint64(1000000), + StTokenAmount: uint64(2000000), + Status: oldrecordtypes.HostZoneUnbonding_CLAIMABLE, + }, + }, + } + epochUnbondingBz, err := codec.Marshal(&epochUnbondingRecord) + s.Require().NoError(err) + + epochUnbondingRecordStore := prefix.NewStore(recordStore, recordtypes.KeyPrefix(recordtypes.EpochUnbondingRecordKey)) + epochUnbondingRecordStore.Set(recordkeeper.GetEpochUnbondingRecordIDBytes(epochUnbondingRecord.EpochNumber), epochUnbondingBz) + + // Callback to check record store after migration + return func() { + depositRecord, found := s.App.RecordsKeeper.GetDepositRecord(s.Ctx, depositRecordId) + s.Require().True(found, "deposit record found") + s.Require().Equal(depositRecord.Id, depositRecordId, "deposit record id") + s.Require().Equal(depositRecord.Amount, sdkmath.NewInt(1000000), "deposit record amount") + s.Require().Equal(depositRecord.Status, recordtypes.DepositRecord_DELEGATION_QUEUE, "deposit record status") + s.Require().Equal(depositRecord.Source, recordtypes.DepositRecord_WITHDRAWAL_ICA, "deposit record source") + + userRedemptionRecord, found := s.App.RecordsKeeper.GetUserRedemptionRecord(s.Ctx, userRedemptionRecordId) + s.Require().True(found, "redemption record found") + s.Require().Equal(userRedemptionRecord.Id, userRedemptionRecordId, "redemption record id") + s.Require().Equal(userRedemptionRecord.Amount, sdkmath.NewInt(1000000), "redemption record amount") + + epochUnbondingRecord, found := s.App.RecordsKeeper.GetEpochUnbondingRecord(s.Ctx, epochNumber) + s.Require().True(found, "epoch unbonding record found") + s.Require().Equal(epochUnbondingRecord.HostZoneUnbondings[0].HostZoneId, hostZoneId, "host zone unbonding host zone id") + s.Require().Equal(epochUnbondingRecord.HostZoneUnbondings[0].NativeTokenAmount, sdkmath.NewInt(1000000), "host zone unbonding native token amount") + s.Require().Equal(epochUnbondingRecord.HostZoneUnbondings[0].StTokenAmount, sdkmath.NewInt(2000000), "host zone unbonding sttoken amount") + s.Require().Equal(epochUnbondingRecord.HostZoneUnbondings[0].Status, recordtypes.HostZoneUnbonding_CLAIMABLE, "host zone unbonding status") + } +} + +func (s *UpgradeTestSuite) SetupOldStakeibcStore(codec codec.Codec) func() { + stakeibcStore := s.Ctx.KVStore(s.App.GetKey(stakeibctypes.StoreKey)) + + // set old hostzone + hostZoneId := "hz" + delegationAddress := "delegation" + redemptionAddress := "redemption" + hostZone := oldstakeibctypes.HostZone{ + ChainId: hostZoneId, + DelegationAccount: &oldstakeibctypes.ICAAccount{Address: delegationAddress, Target: oldstakeibctypes.ICAAccountType_DELEGATION}, + RedemptionAccount: &oldstakeibctypes.ICAAccount{Address: redemptionAddress, Target: oldstakeibctypes.ICAAccountType_REDEMPTION}, + Validators: []*oldstakeibctypes.Validator{ + { + DelegationAmt: uint64(1000000), + }, + }, + BlacklistedValidators: []*oldstakeibctypes.Validator{ + { + DelegationAmt: uint64(2000000), + }, + }, + StakedBal: uint64(3000000), + LastRedemptionRate: sdk.OneDec(), + RedemptionRate: sdk.OneDec(), + } + hostZoneBz, err := codec.Marshal(&hostZone) + s.Require().NoError(err) + + hostzoneStore := prefix.NewStore(stakeibcStore, stakeibctypes.KeyPrefix(stakeibctypes.HostZoneKey)) + hostzoneStore.Set([]byte(hostZone.ChainId), hostZoneBz) + + // Callback to check stakeibc store after migration + return func() { + hostZone, found := s.App.StakeibcKeeper.GetHostZone(s.Ctx, hostZoneId) + s.Require().True(found, "host zone found") + s.Require().Equal(hostZone.ChainId, hostZoneId, "host zone chain id") + + s.Require().Equal(hostZone.DelegationAccount.Address, delegationAddress, "delegation address") + s.Require().Equal(hostZone.RedemptionAccount.Address, redemptionAddress, "redemption address") + + s.Require().Equal(hostZone.DelegationAccount.Target, stakeibctypes.ICAAccountType_DELEGATION, "delegation target") + s.Require().Equal(hostZone.RedemptionAccount.Target, stakeibctypes.ICAAccountType_REDEMPTION, "redemption target") + + s.Require().Nil(hostZone.FeeAccount, "fee account") + s.Require().Nil(hostZone.WithdrawalAccount, "withdrawal account") + + s.Require().Equal(hostZone.Validators[0].DelegationAmt, sdkmath.NewInt(1000000), "host zone validators delegation amount") + s.Require().Equal(hostZone.BlacklistedValidators[0].DelegationAmt, sdkmath.NewInt(2000000), "host zone blacklisted validators delegation amount") + s.Require().Equal(hostZone.StakedBal, sdkmath.NewInt(3000000), "host zone staked balance") + } +} + +// Adds the stale query to the store and returns a callback to check +// that it was successfully removed after the upgrade +func (s *UpgradeTestSuite) SetupRemoveStaleQuery() func() { + // Add the stale query + s.App.InterchainqueryKeeper.SetQuery(s.Ctx, icqtypes.Query{Id: upgradev5.StaleQueryId}) + query, found := s.App.InterchainqueryKeeper.GetQuery(s.Ctx, upgradev5.StaleQueryId) + + // Confirm it was added successfully + s.Require().True(found, "stale query successfully added to store") + s.Require().Equal(upgradev5.StaleQueryId, query.Id, "query id") + + // Callback to check that the query was successfully removed + return func() { + _, found := s.App.InterchainqueryKeeper.GetQuery(s.Ctx, upgradev5.StaleQueryId) + s.Require().False(found) + } +} + +// Changes the SafetyMaxSlashPercent parameter to 0 and returns a callback to check +// the the parameter was successfully updated back to it's default value after the upgrade +func (s *UpgradeTestSuite) SetupAddMaxSlashPercentParam() func() { + // Set the max slash percent to 0 + stakeibcParamStore := s.App.GetSubspace(stakeibctypes.ModuleName) + stakeibcParamStore.Set(s.Ctx, stakeibctypes.KeySafetyMaxSlashPercent, uint64(0)) + + // Confirm it was updated + maxSlashPercent := s.App.StakeibcKeeper.GetParam(s.Ctx, stakeibctypes.KeySafetyMaxSlashPercent) + s.Require().Equal(uint64(0), maxSlashPercent, "max slash percent should be 0") + + // Callback to check that the parameter was added to the store + return func() { + // Confirm MaxSlashPercent was added with the default value + maxSlashPercent := s.App.StakeibcKeeper.GetParam(s.Ctx, stakeibctypes.KeySafetyMaxSlashPercent) + s.Require().Equal(stakeibctypes.DefaultSafetyMaxSlashPercent, maxSlashPercent, "max slash percent should be default") + } +} diff --git a/dockernet/config.sh b/dockernet/config.sh index 7967a34854..24641cd783 100644 --- a/dockernet/config.sh +++ b/dockernet/config.sh @@ -126,6 +126,7 @@ STRIDE_CHAIN_ID=STRIDE STRIDE_NODE_PREFIX=stride STRIDE_NUM_NODES=3 STRIDE_VAL_PREFIX=val +STRIDE_ADDRESS_PREFIX=stride STRIDE_DENOM=$STRD_DENOM STRIDE_RPC_PORT=26657 STRIDE_ADMIN_ACCT=admin @@ -137,7 +138,11 @@ STRIDE_FEE_ADDRESS=stride1czvrk3jkvtj8m27kqsqu2yrkhw3h3ykwj3rxh6 if [[ "$UPGRADE_NAME" == "" ]]; then STRIDE_BINARY="$DOCKERNET_HOME/../build/strided" else - STRIDE_BINARY="$UPGRADES/binaries/strided1" + if [[ "${NEW_BINARY:-false}" == "false" ]]; then + STRIDE_BINARY="$UPGRADES/binaries/strided1" + else + STRIDE_BINARY="$UPGRADES/binaries/strided2" + fi fi STRIDE_MAIN_CMD="$STRIDE_BINARY --home $DOCKERNET_HOME/state/${STRIDE_NODE_PREFIX}1" @@ -241,7 +246,9 @@ RELAYER_MNEMONICS=( ) STRIDE_ADDRESS() { - $STRIDE_MAIN_CMD keys show ${STRIDE_VAL_PREFIX}1 --keyring-backend test -a + # After an upgrade, the keys query can sometimes print migration info, + # so we need to filter by valid addresses using the prefix + $STRIDE_MAIN_CMD keys show ${STRIDE_VAL_PREFIX}1 --keyring-backend test -a | grep $STRIDE_ADDRESS_PREFIX } GAIA_ADDRESS() { $GAIA_MAIN_CMD keys show ${GAIA_VAL_PREFIX}1 --keyring-backend test -a diff --git a/dockernet/docker-compose.yml b/dockernet/docker-compose.yml index d46c824a78..addc6f318d 100644 --- a/dockernet/docker-compose.yml +++ b/dockernet/docker-compose.yml @@ -135,8 +135,11 @@ services: volumes: - ./state/stars5:/home/stars/.starsd + # For the host chain, we must override the command to prevent an old binary from + # being run when testing upgrades host1: image: stridezone:stride + command: strided start volumes: - ./state/host1:/home/stride/.stride ports: @@ -146,21 +149,25 @@ services: host2: image: stridezone:stride + command: strided start volumes: - ./state/host2:/home/stride/.stride host3: image: stridezone:stride + command: strided start volumes: - ./state/host3:/home/stride/.stride host4: image: stridezone:stride + command: strided start volumes: - ./state/host4:/home/stride/.stride host5: image: stridezone:stride + command: strided start volumes: - ./state/host5:/home/stride/.stride diff --git a/dockernet/tests/integration_tests.bats b/dockernet/tests/integration_tests.bats index 41a63a00bc..b92dbd31c7 100644 --- a/dockernet/tests/integration_tests.bats +++ b/dockernet/tests/integration_tests.bats @@ -17,7 +17,7 @@ setup_file() { # set allows us to export all variables in account_vars set -a - source dockernet/config.sh + NEW_BINARY="${NEW_BINARY:-false}" source dockernet/config.sh HOST_CHAIN_ID=$(GET_VAR_VALUE ${CHAIN_NAME}_CHAIN_ID) HOST_DENOM=$(GET_VAR_VALUE ${CHAIN_NAME}_DENOM) diff --git a/dockernet/tests/run_tests_upgrade.sh b/dockernet/tests/run_tests_upgrade.sh new file mode 100755 index 0000000000..7b22afec61 --- /dev/null +++ b/dockernet/tests/run_tests_upgrade.sh @@ -0,0 +1,14 @@ +#!/bin/bash +SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) + +# run test files +BATS=${SCRIPT_DIR}/bats/bats-core/bin/bats +INTEGRATION_TEST_FILE=${SCRIPT_DIR}/integration_tests.bats + +if [[ "$PART" == "1" ]]; then + CHAIN_NAME=GAIA TRANSFER_CHANNEL_NUMBER=0 $BATS $INTEGRATION_TEST_FILE +elif [[ "$PART" == "2" ]]; then + CHAIN_NAME=OSMO TRANSFER_CHANNEL_NUMBER=1 $BATS $INTEGRATION_TEST_FILE + NEW_BINARY=true CHAIN_NAME=HOST TRANSFER_CHANNEL_NUMBER=2 $BATS $INTEGRATION_TEST_FILE +fi + diff --git a/dockernet/upgrades/Dockerfile.stride b/dockernet/upgrades/Dockerfile.stride index b7b0590a19..111252ebc0 100644 --- a/dockernet/upgrades/Dockerfile.stride +++ b/dockernet/upgrades/Dockerfile.stride @@ -16,6 +16,7 @@ RUN apk add --update vim bash \ COPY --from=stridezone:cosmovisor /opt/cosmos-sdk/cosmovisor/cosmovisor /usr/local/bin/cosmovisor COPY --from=stridezone:cosmovisor --chown=stride:stride /opt/build/strided1 ${COSMOVISOR_HOME}/genesis/bin/strided COPY --from=stridezone:stride --chown=stride:stride /usr/local/bin/strided ${COSMOVISOR_HOME}/upgrades/${UPGRADE_NAME}/bin/strided +COPY --from=stridezone:stride --chown=stride:stride /usr/local/bin/strided /usr/local/bin/strided USER stride WORKDIR /home/stride diff --git a/dockernet/upgrades/README.md b/dockernet/upgrades/README.md index e85ea061a8..321a51fcf4 100644 --- a/dockernet/upgrades/README.md +++ b/dockernet/upgrades/README.md @@ -30,10 +30,13 @@ bash dockernet/upgrades/submit_upgrade.sh * After the upgrade has occured, check a post-upgrade condition using `dockernet/upgrades/binaries/strided2` ## Testing Upgrades with Integration Tests -* **WARNING**: The integration tests may change between versions - the following only works if there were not breaking changes. If there are breaking changes, you can replace the GAIA and JUNO integration test files with those from the old version. -* Follow the instructions above to start the network but stop before submitting the proposal -* Run integration tests for GAIA and JUNO (comment out OSMO and STARS in `dockernet/tests/run_all_tests.sh`) -* Once the tests pass, grab the current block height, modify `dockernet/upgrades/submit_upgrade.sh` to have an upgrade height ~50 blocks in the future, and run the script -* Check the stride logs to confirm the upgrade passes successfully -* Modify `STRIDE_BINARY` in `config.sh` to point to the **new** binary (`STRIDE_BINARY="$UPGRADES/binaries/strided2"`) -* Finally, run integration tests for OSMO and STARS (comment out GAIA and JUNO in `dockernet/tests/run_all_tests.sh`) +* **WARNING**: The integration tests may change between versions - the following only works if there were not breaking changes. If there are breaking changes, you can replace the GAIA and OSMO integration test files with those from the old version. +* Start the network, run the integration tests on the old binary, and then propose and vote on the upgrade: +``` + make start-docker-all && make upgrade-init && make upgrade-submit +``` +* Once the integration tests pass and the upgrade has been proposed, wait for the upgrade to occur at block 750. Check the stride logs to confirm the upgrade passes successfully +* Finally, run the remaining integration tests +``` +make upgrade-validate +``` diff --git a/dockernet/upgrades/submit_upgrade.sh b/dockernet/upgrades/submit_upgrade.sh index 5594a5105a..047eab869c 100644 --- a/dockernet/upgrades/submit_upgrade.sh +++ b/dockernet/upgrades/submit_upgrade.sh @@ -4,7 +4,7 @@ set -eu SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) source ${SCRIPT_DIR}/../config.sh -UPGRADE_HEIGHT=250 +UPGRADE_HEIGHT="${UPGRADE_HEIGHT:-250}" PROPOSAL_ID=1 diff --git a/proto/stride/stakeibc/ica_account.proto b/proto/stride/stakeibc/ica_account.proto index e312441917..bc789bd335 100755 --- a/proto/stride/stakeibc/ica_account.proto +++ b/proto/stride/stakeibc/ica_account.proto @@ -12,9 +12,8 @@ enum ICAAccountType { REDEMPTION = 3; } -// TODO(TEST-XX): Update these fields to be more useful (e.g. balances should be -// coins, maybe store port name directly) message ICAAccount { string address = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; ICAAccountType target = 3; + reserved 2; } diff --git a/testutil/localstride/README.md b/testutil/localstride/README.md index 4261f34336..2afbf9740b 100644 --- a/testutil/localstride/README.md +++ b/testutil/localstride/README.md @@ -91,7 +91,7 @@ This will create a file called `state_export.json` which is a snapshot of the cu ### Use the state export in LocalStride -1. Copy the `state_export.json` to the `localstride/state_export` folder within the stride repo +5. Copy the `state_export.json` to the `localstride/state_export` folder within the stride repo ```sh cp $HOME/state_export.json $HOME/stride/testutil/localstride/state_export/ @@ -120,7 +120,7 @@ The command: - Builds a local docker image with the latest changes - Cleans the `$HOME/.stride` folder -3. Start LocalStride: +8. Start LocalStride: ```bash make localnet-state-export-start diff --git a/x/claim/migrations/v2/convert.go b/x/claim/migrations/v2/convert.go new file mode 100644 index 0000000000..183db0c96a --- /dev/null +++ b/x/claim/migrations/v2/convert.go @@ -0,0 +1,28 @@ +package v2 + +import ( + sdkmath "cosmossdk.io/math" + + oldclaimtypes "github.com/Stride-Labs/stride/v4/x/claim/migrations/v2/types" + claimtypes "github.com/Stride-Labs/stride/v4/x/claim/types" +) + +func convertToNewAirdrop(oldAirdrop oldclaimtypes.Airdrop) claimtypes.Airdrop { + return claimtypes.Airdrop{ + AirdropIdentifier: oldAirdrop.AirdropIdentifier, + AirdropStartTime: oldAirdrop.AirdropStartTime, + AirdropDuration: oldAirdrop.AirdropDuration, + ClaimDenom: oldAirdrop.ClaimDenom, + DistributorAddress: oldAirdrop.DistributorAddress, + ClaimedSoFar: sdkmath.NewInt(oldAirdrop.ClaimedSoFar), + } +} + +func convertToNewClaimParams(oldParams oldclaimtypes.Params) claimtypes.Params { + var newParams claimtypes.Params + for _, oldAirdrop := range oldParams.Airdrops { + newAirDrop := convertToNewAirdrop(*oldAirdrop) + newParams.Airdrops = append(newParams.Airdrops, &newAirDrop) + } + return newParams +} diff --git a/x/claim/migrations/v2/convert_test.go b/x/claim/migrations/v2/convert_test.go new file mode 100644 index 0000000000..eb297bd5af --- /dev/null +++ b/x/claim/migrations/v2/convert_test.go @@ -0,0 +1,73 @@ +package v2 + +import ( + "fmt" + "testing" + "time" + + sdkmath "cosmossdk.io/math" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/stretchr/testify/require" + + oldclaimtypes "github.com/Stride-Labs/stride/v4/x/claim/migrations/v2/types" + claimtypes "github.com/Stride-Labs/stride/v4/x/claim/types" +) + +func TestConvertToNewAirdrop(t *testing.T) { + id := "id1" + startTime := time.Date(2021, 1, 1, 0, 0, 0, 0, time.Local) + duration := time.Duration(1) + denom := "denom1" + address := "address1" + + // Only the ClaimedSoFar field of the Airdrop should change + oldAirdrop := oldclaimtypes.Airdrop{ + AirdropIdentifier: id, + AirdropStartTime: startTime, + AirdropDuration: duration, + ClaimDenom: denom, + DistributorAddress: address, + ClaimedSoFar: 1, + } + expectedNewAirdrop := claimtypes.Airdrop{ + AirdropIdentifier: id, + AirdropStartTime: startTime, + AirdropDuration: duration, + ClaimDenom: denom, + DistributorAddress: address, + ClaimedSoFar: sdkmath.NewInt(1), + } + actualNewAirdrop := convertToNewAirdrop(oldAirdrop) + require.Equal(t, expectedNewAirdrop, actualNewAirdrop) +} + +func TestConvertToNewClaimParams(t *testing.T) { + numAirdrops := 3 + + // Build a list of old airdrops as well as the new expected type + oldParams := oldclaimtypes.Params{} + expectedNewParams := claimtypes.Params{} + for i := 0; i <= numAirdrops-1; i++ { + id := fmt.Sprintf("id-%d", i) + + oldParams.Airdrops = append(oldParams.Airdrops, &oldclaimtypes.Airdrop{ + AirdropIdentifier: id, + ClaimedSoFar: int64(i), + }) + + expectedNewParams.Airdrops = append(expectedNewParams.Airdrops, &claimtypes.Airdrop{ + AirdropIdentifier: id, + ClaimedSoFar: sdk.NewInt(int64(i)), + }) + } + + // Convert airdrop params + actualNewParams := convertToNewClaimParams(oldParams) + + // Confirm new params align with expectations + require.Equal(t, len(expectedNewParams.Airdrops), len(actualNewParams.Airdrops)) + for i := 0; i <= numAirdrops-1; i++ { + require.Equal(t, expectedNewParams.Airdrops[i], actualNewParams.Airdrops[i], "index: %d", i) + } +} diff --git a/x/claim/migrations/v2/migrations.go b/x/claim/migrations/v2/migrations.go new file mode 100644 index 0000000000..0fdc159710 --- /dev/null +++ b/x/claim/migrations/v2/migrations.go @@ -0,0 +1,37 @@ +package v2 + +import ( + "github.com/cosmos/cosmos-sdk/codec" + storetypes "github.com/cosmos/cosmos-sdk/store/types" + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + + oldclaimtypes "github.com/Stride-Labs/stride/v4/x/claim/migrations/v2/types" + claimtypes "github.com/Stride-Labs/stride/v4/x/claim/types" +) + +func migrateClaimParams(store sdk.KVStore, cdc codec.Codec) error { + // Deserialize with old data type + oldParamsBz := store.Get([]byte(claimtypes.ParamsKey)) + var oldParams oldclaimtypes.Params + err := cdc.UnmarshalJSON(oldParamsBz, &oldParams) + if err != nil { + return sdkerrors.Wrapf(err, "unable to unmarshal claims params using old data types") + } + + // Convert and serialize using the new type + newParams := convertToNewClaimParams(oldParams) + newParamsBz, err := cdc.MarshalJSON(&newParams) + if err != nil { + return sdkerrors.Wrapf(err, "unable to marshal claims params using new data types") + } + + // Store new type + store.Set([]byte(claimtypes.ParamsKey), newParamsBz) + return nil +} + +func MigrateStore(ctx sdk.Context, storeKey storetypes.StoreKey, cdc codec.Codec) error { + store := ctx.KVStore(storeKey) + return migrateClaimParams(store, cdc) +} diff --git a/x/claim/migrations/v2/types/params.pb.go b/x/claim/migrations/v2/types/params.pb.go new file mode 100644 index 0000000000..dd99dc2c06 --- /dev/null +++ b/x/claim/migrations/v2/types/params.pb.go @@ -0,0 +1,763 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: stride/claim/params.proto + +package types + +import ( + fmt "fmt" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/gogo/protobuf/proto" + _ "github.com/gogo/protobuf/types" + github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" + io "io" + math "math" + math_bits "math/bits" + time "time" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf +var _ = time.Kitchen + +// 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 claim module's parameters. +type Params struct { + Airdrops []*Airdrop `protobuf:"bytes,1,rep,name=airdrops,proto3" json:"airdrops,omitempty"` +} + +func (m *Params) Reset() { *m = Params{} } +func (m *Params) String() string { return proto.CompactTextString(m) } +func (*Params) ProtoMessage() {} +func (*Params) Descriptor() ([]byte, []int) { + return fileDescriptor_dd7ac871d3875dc3, []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) GetAirdrops() []*Airdrop { + if m != nil { + return m.Airdrops + } + return nil +} + +type Airdrop struct { + AirdropIdentifier string `protobuf:"bytes,1,opt,name=airdrop_identifier,json=airdropIdentifier,proto3" json:"airdrop_identifier,omitempty" yaml:"airdrop_identifier"` + // seconds + AirdropStartTime time.Time `protobuf:"bytes,2,opt,name=airdrop_start_time,json=airdropStartTime,proto3,stdtime" json:"airdrop_start_time" yaml:"airdrop_start_time"` + // seconds + AirdropDuration time.Duration `protobuf:"bytes,3,opt,name=airdrop_duration,json=airdropDuration,proto3,stdduration" json:"airdrop_duration,omitempty" yaml:"airdrop_duration"` + // denom of claimable asset + ClaimDenom string `protobuf:"bytes,4,opt,name=claim_denom,json=claimDenom,proto3" json:"claim_denom,omitempty"` + // airdrop distribution account + DistributorAddress string `protobuf:"bytes,5,opt,name=distributor_address,json=distributorAddress,proto3" json:"distributor_address,omitempty"` + // ustrd tokens claimed so far in the current period + ClaimedSoFar int64 `protobuf:"varint,6,opt,name=claimed_so_far,json=claimedSoFar,proto3" json:"claimed_so_far,omitempty"` +} + +func (m *Airdrop) Reset() { *m = Airdrop{} } +func (m *Airdrop) String() string { return proto.CompactTextString(m) } +func (*Airdrop) ProtoMessage() {} +func (*Airdrop) Descriptor() ([]byte, []int) { + return fileDescriptor_dd7ac871d3875dc3, []int{1} +} +func (m *Airdrop) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Airdrop) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Airdrop.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 *Airdrop) XXX_Merge(src proto.Message) { + xxx_messageInfo_Airdrop.Merge(m, src) +} +func (m *Airdrop) XXX_Size() int { + return m.Size() +} +func (m *Airdrop) XXX_DiscardUnknown() { + xxx_messageInfo_Airdrop.DiscardUnknown(m) +} + +var xxx_messageInfo_Airdrop proto.InternalMessageInfo + +func (m *Airdrop) GetAirdropIdentifier() string { + if m != nil { + return m.AirdropIdentifier + } + return "" +} + +func (m *Airdrop) GetAirdropStartTime() time.Time { + if m != nil { + return m.AirdropStartTime + } + return time.Time{} +} + +func (m *Airdrop) GetAirdropDuration() time.Duration { + if m != nil { + return m.AirdropDuration + } + return 0 +} + +func (m *Airdrop) GetClaimDenom() string { + if m != nil { + return m.ClaimDenom + } + return "" +} + +func (m *Airdrop) GetDistributorAddress() string { + if m != nil { + return m.DistributorAddress + } + return "" +} + +func (m *Airdrop) GetClaimedSoFar() int64 { + if m != nil { + return m.ClaimedSoFar + } + return 0 +} + +func init() { + proto.RegisterType((*Params)(nil), "stride.claim.V2Params") + proto.RegisterType((*Airdrop)(nil), "stride.claim.V2Airdrop") +} + +func init() { proto.RegisterFile("stride/claim/params.proto", fileDescriptor_dd7ac871d3875dc3) } + +var fileDescriptor_dd7ac871d3875dc3 = []byte{ + // 445 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x64, 0x92, 0x3d, 0x8f, 0xd3, 0x30, + 0x18, 0xc7, 0x6b, 0x0a, 0x05, 0xdc, 0x13, 0x2f, 0x06, 0x44, 0x5a, 0x89, 0xa4, 0x8a, 0x40, 0xea, + 0x00, 0xb6, 0x38, 0x98, 0x60, 0x6a, 0x75, 0x42, 0x20, 0xdd, 0x80, 0x52, 0x26, 0x96, 0xc8, 0x39, + 0xbb, 0xc1, 0x52, 0x5d, 0x47, 0xb6, 0x8b, 0xe8, 0x27, 0x60, 0xbd, 0x91, 0x8f, 0x74, 0x62, 0xba, + 0x91, 0x29, 0xa0, 0x76, 0x63, 0xbc, 0x4f, 0x80, 0xec, 0x38, 0x77, 0xc7, 0x75, 0x4b, 0x7e, 0xff, + 0xff, 0xf3, 0xea, 0x07, 0x0e, 0x8c, 0xd5, 0x82, 0x71, 0x72, 0xb4, 0xa0, 0x42, 0x92, 0x8a, 0x6a, + 0x2a, 0x0d, 0xae, 0xb4, 0xb2, 0x0a, 0xed, 0x35, 0x12, 0xf6, 0xd2, 0xf0, 0x61, 0xa9, 0x4a, 0xe5, + 0x05, 0xe2, 0xbe, 0x1a, 0xcf, 0x30, 0x2e, 0x95, 0x2a, 0x17, 0x9c, 0xf8, 0xbf, 0x62, 0x35, 0x27, + 0x6c, 0xa5, 0xa9, 0x15, 0x6a, 0x19, 0xf4, 0xe4, 0xaa, 0x6e, 0x85, 0xe4, 0xc6, 0x52, 0x59, 0x35, + 0x86, 0xf4, 0x2d, 0xec, 0x7d, 0xf4, 0x45, 0xd1, 0x4b, 0x78, 0x8b, 0x0a, 0xcd, 0xb4, 0xaa, 0x4c, + 0x04, 0x46, 0xdd, 0x71, 0x7f, 0xff, 0x11, 0xbe, 0xdc, 0x01, 0x9e, 0x34, 0x6a, 0x76, 0x6e, 0x4b, + 0x7f, 0x76, 0xe1, 0xcd, 0x40, 0xd1, 0x21, 0x44, 0x81, 0xe7, 0x82, 0xf1, 0xa5, 0x15, 0x73, 0xc1, + 0x75, 0x04, 0x46, 0x60, 0x7c, 0x7b, 0xfa, 0xe4, 0xac, 0x4e, 0x06, 0x6b, 0x2a, 0x17, 0x6f, 0xd2, + 0x5d, 0x4f, 0x9a, 0xdd, 0x0f, 0xf0, 0xc3, 0x39, 0x43, 0xea, 0x22, 0x9b, 0xb1, 0x54, 0xdb, 0xdc, + 0xf5, 0x1d, 0x5d, 0x1b, 0x81, 0x71, 0x7f, 0x7f, 0x88, 0x9b, 0xa1, 0x70, 0x3b, 0x14, 0xfe, 0xd4, + 0x0e, 0x35, 0x7d, 0x76, 0x52, 0x27, 0x9d, 0xdd, 0x6a, 0x17, 0x39, 0xd2, 0xe3, 0xdf, 0x09, 0xc8, + 0xee, 0x05, 0x61, 0xe6, 0xb8, 0x8b, 0x46, 0xdf, 0x01, 0x6c, 0x61, 0xde, 0xee, 0x30, 0xea, 0xfa, + 0x7a, 0x83, 0x9d, 0x7a, 0x07, 0xc1, 0x30, 0x9d, 0xb8, 0x72, 0x7f, 0xeb, 0x64, 0x78, 0x35, 0xf4, + 0xb9, 0x92, 0xc2, 0x72, 0x59, 0xd9, 0xf5, 0x59, 0x9d, 0x3c, 0xfe, 0xbf, 0x99, 0xd6, 0x93, 0xfe, + 0x70, 0xad, 0xdc, 0x0d, 0xb8, 0xcd, 0x89, 0x12, 0xd8, 0xf7, 0xfb, 0xce, 0x19, 0x5f, 0x2a, 0x19, + 0x5d, 0x77, 0x1b, 0xcc, 0xa0, 0x47, 0x07, 0x8e, 0x20, 0x02, 0x1f, 0x30, 0xe1, 0x5e, 0xa6, 0x58, + 0x59, 0xa5, 0x73, 0xca, 0x98, 0xe6, 0xc6, 0x44, 0x37, 0xbc, 0x11, 0x5d, 0x92, 0x26, 0x8d, 0x82, + 0x9e, 0xc2, 0x3b, 0x3e, 0x9c, 0xb3, 0xdc, 0xa8, 0x7c, 0x4e, 0x75, 0xd4, 0x1b, 0x81, 0x71, 0x37, + 0xdb, 0x0b, 0x74, 0xa6, 0xde, 0x51, 0x3d, 0x7d, 0x7f, 0xb2, 0x89, 0xc1, 0xe9, 0x26, 0x06, 0x7f, + 0x36, 0x31, 0x38, 0xde, 0xc6, 0x9d, 0xd3, 0x6d, 0xdc, 0xf9, 0xb5, 0x8d, 0x3b, 0x9f, 0x71, 0x29, + 0xec, 0x97, 0x55, 0x81, 0x8f, 0x94, 0x24, 0x33, 0x7f, 0x11, 0x2f, 0x0e, 0x69, 0x61, 0x48, 0x38, + 0xdd, 0xaf, 0xaf, 0xc9, 0xb7, 0x70, 0xbf, 0x76, 0x5d, 0x71, 0x53, 0xf4, 0xfc, 0xa2, 0x5e, 0xfd, + 0x0b, 0x00, 0x00, 0xff, 0xff, 0x1a, 0xdb, 0x32, 0x0a, 0xdc, 0x02, 0x00, 0x00, +} + +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 len(m.Airdrops) > 0 { + for iNdEx := len(m.Airdrops) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Airdrops[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintParams(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *Airdrop) 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 *Airdrop) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Airdrop) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.ClaimedSoFar != 0 { + i = encodeVarintParams(dAtA, i, uint64(m.ClaimedSoFar)) + i-- + dAtA[i] = 0x30 + } + if len(m.DistributorAddress) > 0 { + i -= len(m.DistributorAddress) + copy(dAtA[i:], m.DistributorAddress) + i = encodeVarintParams(dAtA, i, uint64(len(m.DistributorAddress))) + i-- + dAtA[i] = 0x2a + } + if len(m.ClaimDenom) > 0 { + i -= len(m.ClaimDenom) + copy(dAtA[i:], m.ClaimDenom) + i = encodeVarintParams(dAtA, i, uint64(len(m.ClaimDenom))) + i-- + dAtA[i] = 0x22 + } + n1, err1 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.AirdropDuration, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.AirdropDuration):]) + if err1 != nil { + return 0, err1 + } + i -= n1 + i = encodeVarintParams(dAtA, i, uint64(n1)) + i-- + dAtA[i] = 0x1a + n2, err2 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.AirdropStartTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.AirdropStartTime):]) + if err2 != nil { + return 0, err2 + } + i -= n2 + i = encodeVarintParams(dAtA, i, uint64(n2)) + i-- + dAtA[i] = 0x12 + if len(m.AirdropIdentifier) > 0 { + i -= len(m.AirdropIdentifier) + copy(dAtA[i:], m.AirdropIdentifier) + i = encodeVarintParams(dAtA, i, uint64(len(m.AirdropIdentifier))) + 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 + if len(m.Airdrops) > 0 { + for _, e := range m.Airdrops { + l = e.Size() + n += 1 + l + sovParams(uint64(l)) + } + } + return n +} + +func (m *Airdrop) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.AirdropIdentifier) + if l > 0 { + n += 1 + l + sovParams(uint64(l)) + } + l = github_com_gogo_protobuf_types.SizeOfStdTime(m.AirdropStartTime) + n += 1 + l + sovParams(uint64(l)) + l = github_com_gogo_protobuf_types.SizeOfStdDuration(m.AirdropDuration) + n += 1 + l + sovParams(uint64(l)) + l = len(m.ClaimDenom) + if l > 0 { + n += 1 + l + sovParams(uint64(l)) + } + l = len(m.DistributorAddress) + if l > 0 { + n += 1 + l + sovParams(uint64(l)) + } + if m.ClaimedSoFar != 0 { + n += 1 + sovParams(uint64(m.ClaimedSoFar)) + } + return n +} + +func sovParams(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +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 Airdrops", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthParams + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthParams + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Airdrops = append(m.Airdrops, &Airdrop{}) + if err := m.Airdrops[len(m.Airdrops)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + 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 (m *Airdrop) 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: Airdrop: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Airdrop: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AirdropIdentifier", 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.AirdropIdentifier = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AirdropStartTime", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthParams + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthParams + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.AirdropStartTime, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AirdropDuration", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthParams + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthParams + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_gogo_protobuf_types.StdDurationUnmarshal(&m.AirdropDuration, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ClaimDenom", 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.ClaimDenom = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DistributorAddress", 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.DistributorAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ClaimedSoFar", wireType) + } + m.ClaimedSoFar = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ClaimedSoFar |= int64(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/claim/module.go b/x/claim/module.go index 262c18dd4d..614aa79706 100644 --- a/x/claim/module.go +++ b/x/claim/module.go @@ -155,4 +155,4 @@ func (am AppModule) EndBlock(ctx sdk.Context, _ abci.RequestEndBlock) []abci.Val } // ConsensusVersion implements AppModule/ConsensusVersion. -func (AppModule) ConsensusVersion() uint64 { return 1 } +func (AppModule) ConsensusVersion() uint64 { return 2 } diff --git a/x/icacallbacks/migrations/v2/convert.go b/x/icacallbacks/migrations/v2/convert.go new file mode 100644 index 0000000000..266f4728f4 --- /dev/null +++ b/x/icacallbacks/migrations/v2/convert.go @@ -0,0 +1,138 @@ +package v2 + +import ( + sdkmath "cosmossdk.io/math" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/golang/protobuf/proto" //nolint:staticcheck + + icacallbacktypes "github.com/Stride-Labs/stride/v4/x/icacallbacks/types" + oldstakeibctypes "github.com/Stride-Labs/stride/v4/x/stakeibc/migrations/v2/types" + stakeibctypes "github.com/Stride-Labs/stride/v4/x/stakeibc/types" +) + +const ( + ICACallbackID_Delegate = "delegate" + ICACallbackID_Rebalance = "rebalance" + ICACallbackID_Undelegate = "undelegate" +) + +func convertDelegateCallback(oldDelegateCallback oldstakeibctypes.DelegateCallback) stakeibctypes.DelegateCallback { + newSplitDelegations := []*stakeibctypes.SplitDelegation{} + for _, oldSplitDelegation := range oldDelegateCallback.SplitDelegations { + newSplitDelegation := stakeibctypes.SplitDelegation{ + Validator: oldSplitDelegation.Validator, + Amount: sdkmath.NewIntFromUint64(oldSplitDelegation.Amount), + } + newSplitDelegations = append(newSplitDelegations, &newSplitDelegation) + } + + return stakeibctypes.DelegateCallback{ + HostZoneId: oldDelegateCallback.HostZoneId, + DepositRecordId: oldDelegateCallback.DepositRecordId, + SplitDelegations: newSplitDelegations, + } +} + +func convertUndelegateCallback(oldUndelegateCallback oldstakeibctypes.UndelegateCallback) stakeibctypes.UndelegateCallback { + newSplitDelegations := []*stakeibctypes.SplitDelegation{} + for _, oldSplitDelegation := range oldUndelegateCallback.SplitDelegations { + newSplitDelegation := stakeibctypes.SplitDelegation{ + Validator: oldSplitDelegation.Validator, + Amount: sdkmath.NewIntFromUint64(oldSplitDelegation.Amount), + } + newSplitDelegations = append(newSplitDelegations, &newSplitDelegation) + } + + return stakeibctypes.UndelegateCallback{ + HostZoneId: oldUndelegateCallback.HostZoneId, + SplitDelegations: newSplitDelegations, + EpochUnbondingRecordIds: oldUndelegateCallback.EpochUnbondingRecordIds, + } +} + +func convertRebalanceCallback(oldRebalanceCallback oldstakeibctypes.RebalanceCallback) stakeibctypes.RebalanceCallback { + newRebalancings := []*stakeibctypes.Rebalancing{} + for _, oldRebalancing := range oldRebalanceCallback.Rebalancings { + newRebalancing := stakeibctypes.Rebalancing{ + SrcValidator: oldRebalancing.SrcValidator, + DstValidator: oldRebalancing.DstValidator, + Amt: sdkmath.NewIntFromUint64(oldRebalancing.Amt), + } + newRebalancings = append(newRebalancings, &newRebalancing) + } + + return stakeibctypes.RebalanceCallback{ + HostZoneId: oldRebalanceCallback.HostZoneId, + Rebalancings: newRebalancings, + } +} + +func convertCallbackData(oldCallbackData icacallbacktypes.CallbackData) (icacallbacktypes.CallbackData, error) { + var newCallbackArgs []byte + switch oldCallbackData.CallbackId { + case ICACallbackID_Delegate: + // Deserialize the callback args with the old DelegateCallback type + oldDelegateCallback := oldstakeibctypes.DelegateCallback{} + if err := proto.Unmarshal(oldCallbackData.CallbackArgs, &oldDelegateCallback); err != nil { + return icacallbacktypes.CallbackData{}, sdkerrors.Wrapf(stakeibctypes.ErrUnmarshalFailure, err.Error()) + } + + // Convert and serialize with the new DelegateCallback type + newDelegateCallback := convertDelegateCallback(oldDelegateCallback) + newDelegateCallbackBz, err := proto.Marshal(&newDelegateCallback) + if err != nil { + return icacallbacktypes.CallbackData{}, sdkerrors.Wrapf(stakeibctypes.ErrMarshalFailure, err.Error()) + } + + // Update the CallbackData with the new args + newCallbackArgs = newDelegateCallbackBz + + case ICACallbackID_Undelegate: + // Deserialize the callback args with the old UndelegateCallback type + oldUndelegateCallback := oldstakeibctypes.UndelegateCallback{} + if err := proto.Unmarshal(oldCallbackData.CallbackArgs, &oldUndelegateCallback); err != nil { + return icacallbacktypes.CallbackData{}, sdkerrors.Wrapf(stakeibctypes.ErrUnmarshalFailure, err.Error()) + } + + // Convert and serialize with the new UndelegateCallback type + newUndelegateCallback := convertUndelegateCallback(oldUndelegateCallback) + newUndelegateCallbackBz, err := proto.Marshal(&newUndelegateCallback) + if err != nil { + return icacallbacktypes.CallbackData{}, sdkerrors.Wrapf(stakeibctypes.ErrMarshalFailure, err.Error()) + } + + // Update the CallbackData with the new args + newCallbackArgs = newUndelegateCallbackBz + + case ICACallbackID_Rebalance: + // Deserialize the callback args with the old RebalanceCallback type + oldRebalanceCallback := oldstakeibctypes.RebalanceCallback{} + if err := proto.Unmarshal(oldCallbackData.CallbackArgs, &oldRebalanceCallback); err != nil { + return icacallbacktypes.CallbackData{}, sdkerrors.Wrapf(stakeibctypes.ErrUnmarshalFailure, err.Error()) + } + + // Convert and serialize with the new RebalanceCallback type + newRebalanceCallback := convertRebalanceCallback(oldRebalanceCallback) + newRebalanceCallbackBz, err := proto.Marshal(&newRebalanceCallback) + if err != nil { + return icacallbacktypes.CallbackData{}, sdkerrors.Wrapf(stakeibctypes.ErrMarshalFailure, err.Error()) + } + + // Update the CallbackData with the new args + newCallbackArgs = newRebalanceCallbackBz + + default: + newCallbackArgs = oldCallbackData.CallbackArgs + } + + newCallbackData := icacallbacktypes.CallbackData{ + CallbackKey: oldCallbackData.CallbackKey, + PortId: oldCallbackData.PortId, + ChannelId: oldCallbackData.ChannelId, + Sequence: oldCallbackData.Sequence, + CallbackId: oldCallbackData.CallbackId, + CallbackArgs: newCallbackArgs, + } + + return newCallbackData, nil +} diff --git a/x/icacallbacks/migrations/v2/convert_test.go b/x/icacallbacks/migrations/v2/convert_test.go new file mode 100644 index 0000000000..5ed0e9b900 --- /dev/null +++ b/x/icacallbacks/migrations/v2/convert_test.go @@ -0,0 +1,227 @@ +package v2 + +import ( + "testing" + + sdkmath "cosmossdk.io/math" + "github.com/golang/protobuf/proto" //nolint:staticcheck + "github.com/stretchr/testify/require" + + icacallbacktypes "github.com/Stride-Labs/stride/v4/x/icacallbacks/types" + oldstakeibctypes "github.com/Stride-Labs/stride/v4/x/stakeibc/migrations/v2/types" +) + +func TestConvertDelegateCallback(t *testing.T) { + hostZoneId := "hz" + depositRecordId := uint64(1) + val1 := "val1" + val2 := "val2" + + // Define old callback type and convert to new type + oldDelegateCallback := oldstakeibctypes.DelegateCallback{ + HostZoneId: hostZoneId, + DepositRecordId: depositRecordId, + SplitDelegations: []*oldstakeibctypes.SplitDelegation{ + { + Validator: val1, + Amount: uint64(1), + }, + { + Validator: val2, + Amount: uint64(2), + }, + }, + } + newDelegateCallback := convertDelegateCallback(oldDelegateCallback) + + // Check unchanged fields + require.Equal(t, hostZoneId, newDelegateCallback.HostZoneId, "host zone id") + require.Equal(t, depositRecordId, newDelegateCallback.DepositRecordId, "deposit record id") + require.Equal(t, val1, newDelegateCallback.SplitDelegations[0].Validator, "validator 1 address") + require.Equal(t, val2, newDelegateCallback.SplitDelegations[1].Validator, "validator 2 address") + + // Check update fields + require.Equal(t, sdkmath.NewInt(1), newDelegateCallback.SplitDelegations[0].Amount, "validator 1 amount") + require.Equal(t, sdkmath.NewInt(2), newDelegateCallback.SplitDelegations[1].Amount, "validator 2 amount") +} + +func TestConvertUndelegateCallback(t *testing.T) { + hostZoneId := "hz" + epochUnbondingIds := []uint64{1} + val1 := "val1" + val2 := "val2" + + // Define old callback type and convert to new type + oldUndelegateCallback := oldstakeibctypes.UndelegateCallback{ + HostZoneId: hostZoneId, + SplitDelegations: []*oldstakeibctypes.SplitDelegation{ + { + Validator: val1, + Amount: uint64(1), + }, + { + Validator: val2, + Amount: uint64(2), + }, + }, + EpochUnbondingRecordIds: epochUnbondingIds, + } + newUndelegateCallback := convertUndelegateCallback(oldUndelegateCallback) + + // Check unchanged fields + require.Equal(t, hostZoneId, newUndelegateCallback.HostZoneId, "host zone id") + require.Equal(t, epochUnbondingIds[0], newUndelegateCallback.EpochUnbondingRecordIds[0], "epoch unbonding record id") + require.Equal(t, val1, newUndelegateCallback.SplitDelegations[0].Validator, "validator 1 address") + require.Equal(t, val2, newUndelegateCallback.SplitDelegations[1].Validator, "validator 2 address") + + // Check update fields + require.Equal(t, sdkmath.NewInt(1), newUndelegateCallback.SplitDelegations[0].Amount, "validator 1 amount") + require.Equal(t, sdkmath.NewInt(2), newUndelegateCallback.SplitDelegations[1].Amount, "validator 2 amount") +} + +func TestConvertRebalanceCallback(t *testing.T) { + hostZoneId := "hz1" + srcVal1 := "src_val1" + srcVal2 := "src_val2" + dstVal1 := "dst_val1" + dstVal2 := "dst_val2" + + // Define old callback type and convert to new type + oldRebalanceCallback := oldstakeibctypes.RebalanceCallback{ + HostZoneId: hostZoneId, + Rebalancings: []*oldstakeibctypes.Rebalancing{ + { + SrcValidator: srcVal1, + DstValidator: dstVal1, + Amt: uint64(1), + }, + { + SrcValidator: srcVal2, + DstValidator: dstVal2, + Amt: uint64(2), + }, + }, + } + newRebalanceCallback := convertRebalanceCallback(oldRebalanceCallback) + + // Check unchanged fields + require.Equal(t, hostZoneId, newRebalanceCallback.HostZoneId, "host zone id") + + require.Equal(t, srcVal1, newRebalanceCallback.Rebalancings[0].SrcValidator, "srcValidator 1 address") + require.Equal(t, dstVal1, newRebalanceCallback.Rebalancings[0].DstValidator, "dstValidator 1 address") + + require.Equal(t, srcVal2, newRebalanceCallback.Rebalancings[1].SrcValidator, "srcValidator 2 address") + require.Equal(t, dstVal2, newRebalanceCallback.Rebalancings[1].DstValidator, "dstValidator 2 address") + + // Check updated fields + require.Equal(t, sdkmath.NewInt(1), newRebalanceCallback.Rebalancings[0].Amt) + require.Equal(t, sdkmath.NewInt(2), newRebalanceCallback.Rebalancings[1].Amt) +} + +func TestConvertCallbackData_Delegate_Success(t *testing.T) { + // Marshal delegate callback for callback args in CallbackData struct + delegateCallbackBz, err := proto.Marshal(&oldstakeibctypes.DelegateCallback{ + SplitDelegations: []*oldstakeibctypes.SplitDelegation{{Amount: uint64(1)}}, + }) + require.NoError(t, err, "no error expected when marshalling delegate callback") + + // Define old delegate callback data type and convert to new type + oldCallbackData := icacallbacktypes.CallbackData{ + CallbackKey: "key", + PortId: "port", + ChannelId: "channel", + Sequence: uint64(1), + CallbackId: ICACallbackID_Delegate, + CallbackArgs: delegateCallbackBz, + } + newCallbackData, err := convertCallbackData(oldCallbackData) + require.NoError(t, err) + + // If the callback was was type delegate, the callback args SHOULD have changed + require.NotEqual(t, oldCallbackData.CallbackArgs, newCallbackData.CallbackArgs, "callback args should have changed") + + // All other fields SHOULD NOT have changed + require.Equal(t, oldCallbackData.CallbackKey, newCallbackData.CallbackKey, "callback key") + require.Equal(t, oldCallbackData.PortId, newCallbackData.PortId, "port ID") + require.Equal(t, oldCallbackData.ChannelId, newCallbackData.ChannelId, "channel ID") + require.Equal(t, oldCallbackData.Sequence, newCallbackData.Sequence, "sequence") + require.Equal(t, oldCallbackData.CallbackId, newCallbackData.CallbackId, "callback ID") +} + +func TestConvertCallbackData_Delegate_Error(t *testing.T) { + // Define old delegate callback data type with invalid callback args + oldCallbackData := icacallbacktypes.CallbackData{ + CallbackKey: "key", + PortId: "port", + ChannelId: "channel", + Sequence: uint64(1), + CallbackId: ICACallbackID_Delegate, + CallbackArgs: []byte{1, 2, 3}, + } + + // The convert function should fail since it cannot unmarshal the callback args into a DelegateCallback + _, err := convertCallbackData(oldCallbackData) + require.ErrorContains(t, err, "unable to unmarshal data structure") +} + +func TestConvertCallbackData_Rebalance_Success(t *testing.T) { + // Marshal rebalance callback for callback args in CallbackData struct + rebalanceCallbackBz, err := proto.Marshal(&oldstakeibctypes.RebalanceCallback{ + Rebalancings: []*oldstakeibctypes.Rebalancing{{Amt: uint64(1)}}, + }) + require.NoError(t, err, "no error expected when marshalling rebalance callback") + + // Define old rebalance callback data type and convert to new type + oldCallbackData := icacallbacktypes.CallbackData{ + CallbackKey: "key", + PortId: "port", + ChannelId: "channel", + Sequence: uint64(1), + CallbackId: ICACallbackID_Rebalance, + CallbackArgs: rebalanceCallbackBz, + } + newCallbackData, err := convertCallbackData(oldCallbackData) + require.NoError(t, err) + + // If the callback was was type delegate, the callback args SHOULD have changed + require.NotEqual(t, oldCallbackData.CallbackArgs, newCallbackData.CallbackArgs, "callback args should have changed") + + // All other fields SHOULD NOT have changed + require.Equal(t, oldCallbackData.CallbackKey, newCallbackData.CallbackKey, "callback key") + require.Equal(t, oldCallbackData.PortId, newCallbackData.PortId, "port ID") + require.Equal(t, oldCallbackData.ChannelId, newCallbackData.ChannelId, "channel ID") + require.Equal(t, oldCallbackData.Sequence, newCallbackData.Sequence, "sequence") + require.Equal(t, oldCallbackData.CallbackId, newCallbackData.CallbackId, "callback ID") +} + +func TestConvertCallbackData_Rebalance_Error(t *testing.T) { + // Define old rebalance callback data type and convert to new type + oldCallbackData := icacallbacktypes.CallbackData{ + CallbackKey: "key", + PortId: "port", + ChannelId: "channel", + Sequence: uint64(1), + CallbackId: ICACallbackID_Rebalance, + CallbackArgs: []byte{1, 2, 3}, + } + + // The convert function should fail since it cannot unmarshal the callback args into a RebalanceCallback + _, err := convertCallbackData(oldCallbackData) + require.ErrorContains(t, err, "unable to unmarshal data structure") +} + +func TestConvertCallbackData_Other(t *testing.T) { + oldCallbackData := icacallbacktypes.CallbackData{ + CallbackKey: "key", + PortId: "port", + ChannelId: "channel", + Sequence: uint64(1), + CallbackId: "different_callback", + CallbackArgs: []byte{1, 2, 3}, + } + + // If the callback is not delegate or rebalance, it should not have been changed + newCallbackData, err := convertCallbackData(oldCallbackData) + require.NoError(t, err) + require.Equal(t, oldCallbackData, newCallbackData) +} diff --git a/x/icacallbacks/migrations/v2/migrations.go b/x/icacallbacks/migrations/v2/migrations.go new file mode 100644 index 0000000000..3279554c53 --- /dev/null +++ b/x/icacallbacks/migrations/v2/migrations.go @@ -0,0 +1,49 @@ +package v2 + +import ( + "github.com/cosmos/cosmos-sdk/codec" + "github.com/cosmos/cosmos-sdk/store/prefix" + storetypes "github.com/cosmos/cosmos-sdk/store/types" + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + + icacallbacktypes "github.com/Stride-Labs/stride/v4/x/icacallbacks/types" +) + +func migrateCallbacks(store sdk.KVStore, cdc codec.BinaryCodec) error { + icacallbackStore := prefix.NewStore(store, []byte(icacallbacktypes.CallbackDataKeyPrefix)) + + iter := icacallbackStore.Iterator(nil, nil) + defer iter.Close() + + for ; iter.Valid(); iter.Next() { + + // Deserialize the callback data + var oldCallbackData icacallbacktypes.CallbackData + err := cdc.Unmarshal(iter.Value(), &oldCallbackData) + if err != nil { + return sdkerrors.Wrapf(err, "unable to unmarshal callback data") + } + + // Convert the callback data + // This will only convert the callback data args, of which the serialization has changed + newCallbackData, err := convertCallbackData(oldCallbackData) + if err != nil { + return sdkerrors.Wrapf(err, "unable to convert callback data to new schema") + } + newCallbackDataBz, err := cdc.Marshal(&newCallbackData) + if err != nil { + return sdkerrors.Wrapf(err, "unable to marshal callback data") + } + + // Set new value on store. + icacallbackStore.Set(iter.Key(), newCallbackDataBz) + } + + return nil +} + +func MigrateStore(ctx sdk.Context, storeKey storetypes.StoreKey, cdc codec.BinaryCodec) error { + store := ctx.KVStore(storeKey) + return migrateCallbacks(store, cdc) +} diff --git a/x/icacallbacks/module.go b/x/icacallbacks/module.go index cd327324ae..f248ba0c04 100644 --- a/x/icacallbacks/module.go +++ b/x/icacallbacks/module.go @@ -167,7 +167,7 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw } // ConsensusVersion implements ConsensusVersion. -func (AppModule) ConsensusVersion() uint64 { return 1 } +func (AppModule) ConsensusVersion() uint64 { return 2 } // BeginBlock executes all ABCI BeginBlock logic respective to the capability module. func (am AppModule) BeginBlock(_ sdk.Context, _ abci.RequestBeginBlock) {} diff --git a/x/records/migrations/v2/convert.go b/x/records/migrations/v2/convert.go new file mode 100644 index 0000000000..e8c52b6505 --- /dev/null +++ b/x/records/migrations/v2/convert.go @@ -0,0 +1,54 @@ +package v2 + +import ( + sdkmath "cosmossdk.io/math" + + oldrecordstypes "github.com/Stride-Labs/stride/v4/x/records/migrations/v2/types" + recordstypes "github.com/Stride-Labs/stride/v4/x/records/types" +) + +func convertToNewDepositRecord(oldDepositRecord oldrecordstypes.DepositRecord) recordstypes.DepositRecord { + return recordstypes.DepositRecord{ + Id: oldDepositRecord.Id, + Amount: sdkmath.NewInt(oldDepositRecord.Amount), + Denom: oldDepositRecord.Denom, + HostZoneId: oldDepositRecord.HostZoneId, + Status: recordstypes.DepositRecord_Status(oldDepositRecord.Status), + DepositEpochNumber: oldDepositRecord.DepositEpochNumber, + Source: recordstypes.DepositRecord_Source(oldDepositRecord.Source), + } +} + +func convertToNewHostZoneUnbonding(oldHostZoneUnbondings oldrecordstypes.HostZoneUnbonding) recordstypes.HostZoneUnbonding { + return recordstypes.HostZoneUnbonding{ + StTokenAmount: sdkmath.NewIntFromUint64(oldHostZoneUnbondings.StTokenAmount), + NativeTokenAmount: sdkmath.NewIntFromUint64(oldHostZoneUnbondings.NativeTokenAmount), + Denom: oldHostZoneUnbondings.Denom, + HostZoneId: oldHostZoneUnbondings.HostZoneId, + UnbondingTime: oldHostZoneUnbondings.UnbondingTime, + Status: recordstypes.HostZoneUnbonding_Status(oldHostZoneUnbondings.Status), + UserRedemptionRecords: oldHostZoneUnbondings.UserRedemptionRecords, + } +} + +func convertToNewEpochUnbondingRecord(oldEpochUnbondingRecord oldrecordstypes.EpochUnbondingRecord) recordstypes.EpochUnbondingRecord { + var epochUnbondingRecord recordstypes.EpochUnbondingRecord + for _, oldHostZoneUnbonding := range oldEpochUnbondingRecord.HostZoneUnbondings { + newHostZoneUnbonding := convertToNewHostZoneUnbonding(*oldHostZoneUnbonding) + epochUnbondingRecord.HostZoneUnbondings = append(epochUnbondingRecord.HostZoneUnbondings, &newHostZoneUnbonding) + } + return epochUnbondingRecord +} + +func convertToNewUserRedemptionRecord(oldRedemptionRecord oldrecordstypes.UserRedemptionRecord) recordstypes.UserRedemptionRecord { + return recordstypes.UserRedemptionRecord{ + Id: oldRedemptionRecord.Id, + Sender: oldRedemptionRecord.Sender, + Receiver: oldRedemptionRecord.Receiver, + Amount: sdkmath.NewIntFromUint64(oldRedemptionRecord.Amount), + Denom: oldRedemptionRecord.Denom, + HostZoneId: oldRedemptionRecord.HostZoneId, + EpochNumber: oldRedemptionRecord.EpochNumber, + ClaimIsPending: oldRedemptionRecord.ClaimIsPending, + } +} diff --git a/x/records/migrations/v2/convert_test.go b/x/records/migrations/v2/convert_test.go new file mode 100644 index 0000000000..d650c3f01c --- /dev/null +++ b/x/records/migrations/v2/convert_test.go @@ -0,0 +1,135 @@ +package v2 + +import ( + "testing" + + sdkmath "cosmossdk.io/math" + + "github.com/stretchr/testify/require" + + oldrecordstypes "github.com/Stride-Labs/stride/v4/x/records/migrations/v2/types" + recordstypes "github.com/Stride-Labs/stride/v4/x/records/types" +) + +func TestConvertDepositRecord(t *testing.T) { + id := uint64(1) + denom := "denom" + hostZoneId := "hz" + epochNumber := uint64(2) + + // Only the Amount field of the DepositRecord should change + oldDepositRecord := oldrecordstypes.DepositRecord{ + Id: id, + Amount: int64(1), + Denom: denom, + HostZoneId: hostZoneId, + Status: oldrecordstypes.DepositRecord_DELEGATION_QUEUE, + DepositEpochNumber: epochNumber, + Source: oldrecordstypes.DepositRecord_WITHDRAWAL_ICA, + } + expectedNewDepositRecord := recordstypes.DepositRecord{ + Id: id, + Amount: sdkmath.NewInt(1), + Denom: denom, + HostZoneId: hostZoneId, + Status: recordstypes.DepositRecord_DELEGATION_QUEUE, + DepositEpochNumber: epochNumber, + Source: recordstypes.DepositRecord_WITHDRAWAL_ICA, + } + + actualNewDepositRecord := convertToNewDepositRecord(oldDepositRecord) + require.Equal(t, expectedNewDepositRecord, actualNewDepositRecord) +} + +func TestConvertHostZoneUnbonding(t *testing.T) { + denom := "denom" + hostZoneId := "hz" + unbondingTime := uint64(3) + userRedemptionRecords := []string{"a", "b", "c"} + + // The StTokenAmount and NativeTokenAmount should change + oldHostZoneUnbonding := oldrecordstypes.HostZoneUnbonding{ + StTokenAmount: uint64(1), + NativeTokenAmount: uint64(2), + Denom: denom, + HostZoneId: hostZoneId, + UnbondingTime: unbondingTime, + Status: oldrecordstypes.HostZoneUnbonding_CLAIMABLE, + UserRedemptionRecords: userRedemptionRecords, + } + expectedNewHostZoneUnbonding := recordstypes.HostZoneUnbonding{ + StTokenAmount: sdkmath.NewInt(1), + NativeTokenAmount: sdkmath.NewInt(2), + Denom: denom, + HostZoneId: hostZoneId, + UnbondingTime: unbondingTime, + Status: recordstypes.HostZoneUnbonding_CLAIMABLE, + UserRedemptionRecords: userRedemptionRecords, + } + + actualNewHostZoneUnbonding := convertToNewHostZoneUnbonding(oldHostZoneUnbonding) + require.Equal(t, expectedNewHostZoneUnbonding, actualNewHostZoneUnbonding) +} + +func TestConvertEpochUnbondingRecord(t *testing.T) { + numHostZoneUnbondings := 3 + + // Build a list of old hostZoneUnbondings as well as the new expected type + oldEpochUnbondingRecord := oldrecordstypes.EpochUnbondingRecord{} + expectedNewEpochUnbondingRecord := recordstypes.EpochUnbondingRecord{} + for i := 0; i <= numHostZoneUnbondings-1; i++ { + oldEpochUnbondingRecord.HostZoneUnbondings = append(oldEpochUnbondingRecord.HostZoneUnbondings, &oldrecordstypes.HostZoneUnbonding{ + StTokenAmount: uint64(i), + NativeTokenAmount: uint64(i * 10), + }) + + expectedNewEpochUnbondingRecord.HostZoneUnbondings = append(expectedNewEpochUnbondingRecord.HostZoneUnbondings, &recordstypes.HostZoneUnbonding{ + StTokenAmount: sdkmath.NewInt(int64(i)), + NativeTokenAmount: sdkmath.NewInt(int64(i * 10)), + }) + } + + // Convert epoch unbonding record + actualNewEpochUnbondingRecord := convertToNewEpochUnbondingRecord(oldEpochUnbondingRecord) + + // Confirm new host zone unbondings align with expectations + require.Equal(t, len(expectedNewEpochUnbondingRecord.HostZoneUnbondings), len(actualNewEpochUnbondingRecord.HostZoneUnbondings)) + for i := 0; i <= numHostZoneUnbondings-1; i++ { + require.Equal(t, expectedNewEpochUnbondingRecord.HostZoneUnbondings[i], actualNewEpochUnbondingRecord.HostZoneUnbondings[i], "index: %d", i) + } +} + +func TestConvertUserRedemptionRecord(t *testing.T) { + id := "id" + sender := "sender" + receiver := "receiver" + denom := "denom" + hostZoneId := "hz" + epochNumber := uint64(1) + claimIsPending := true + + // Only the Amount field of the UserRedemptionRecord should change + oldUserRedemptionRecord := oldrecordstypes.UserRedemptionRecord{ + Id: id, + Sender: sender, + Receiver: receiver, + Amount: uint64(1), + Denom: denom, + HostZoneId: hostZoneId, + EpochNumber: epochNumber, + ClaimIsPending: claimIsPending, + } + expectedNewUserRedemptionRecord := recordstypes.UserRedemptionRecord{ + Id: id, + Sender: sender, + Receiver: receiver, + Amount: sdkmath.NewInt(1), + Denom: denom, + HostZoneId: hostZoneId, + EpochNumber: epochNumber, + ClaimIsPending: claimIsPending, + } + + actualNewUserRedemptionRecord := convertToNewUserRedemptionRecord(oldUserRedemptionRecord) + require.Equal(t, expectedNewUserRedemptionRecord, actualNewUserRedemptionRecord) +} diff --git a/x/records/migrations/v2/migrations.go b/x/records/migrations/v2/migrations.go new file mode 100644 index 0000000000..66b5cfcdc3 --- /dev/null +++ b/x/records/migrations/v2/migrations.go @@ -0,0 +1,112 @@ +package v2 + +import ( + "github.com/cosmos/cosmos-sdk/codec" + "github.com/cosmos/cosmos-sdk/store/prefix" + storetypes "github.com/cosmos/cosmos-sdk/store/types" + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + + oldrecordtypes "github.com/Stride-Labs/stride/v4/x/records/migrations/v2/types" + recordtypes "github.com/Stride-Labs/stride/v4/x/records/types" +) + +func migrateDepositRecord(store sdk.KVStore, cdc codec.BinaryCodec) error { + depositRecordStore := prefix.NewStore(store, []byte(recordtypes.DepositRecordKey)) + + iterator := depositRecordStore.Iterator(nil, nil) + defer iterator.Close() + + for ; iterator.Valid(); iterator.Next() { + // Deserialize using the old type + var oldDepositRecord oldrecordtypes.DepositRecord + err := cdc.Unmarshal(iterator.Value(), &oldDepositRecord) + if err != nil { + return sdkerrors.Wrapf(err, "unable to unmarshal deposit record (%v) using old data type", iterator.Key()) + } + + // Convert and serialize using the new type + newDepositRecord := convertToNewDepositRecord(oldDepositRecord) + newDepositRecordBz, err := cdc.Marshal(&newDepositRecord) + if err != nil { + return sdkerrors.Wrapf(err, "unable to marshal deposit record (%v) using new data type", iterator.Key()) + } + + // Store the new type + depositRecordStore.Set(iterator.Key(), newDepositRecordBz) + } + + return nil +} + +func migrateUserRedemptionRecord(store sdk.KVStore, cdc codec.BinaryCodec) error { + redemptionRecordStore := prefix.NewStore(store, []byte(recordtypes.UserRedemptionRecordKey)) + + iterator := redemptionRecordStore.Iterator(nil, nil) + defer iterator.Close() + + for ; iterator.Valid(); iterator.Next() { + // Deserialize using the old type + var oldRedemptionRecord oldrecordtypes.UserRedemptionRecord + err := cdc.Unmarshal(iterator.Value(), &oldRedemptionRecord) + if err != nil { + return sdkerrors.Wrapf(err, "unable to unmarshal redemption record (%v) using old data type", iterator.Key()) + } + + // Convert and serialize using the new type + newRedemptionRecord := convertToNewUserRedemptionRecord(oldRedemptionRecord) + newRedemptionRecordBz, err := cdc.Marshal(&newRedemptionRecord) + if err != nil { + return sdkerrors.Wrapf(err, "unable to marshal redemption record (%v) using new data type", iterator.Key()) + } + + // Store the new type + redemptionRecordStore.Set(iterator.Key(), newRedemptionRecordBz) + } + + return nil +} + +func migrateEpochUnbondingRecord(store sdk.KVStore, cdc codec.BinaryCodec) error { + epochUnbondingRecordStore := prefix.NewStore(store, []byte(recordtypes.EpochUnbondingRecordKey)) + + iterator := epochUnbondingRecordStore.Iterator(nil, nil) + defer iterator.Close() + + for ; iterator.Valid(); iterator.Next() { + // Deserialize using the old type + var oldEpochUnbondingRecord oldrecordtypes.EpochUnbondingRecord + err := cdc.Unmarshal(iterator.Value(), &oldEpochUnbondingRecord) + if err != nil { + return sdkerrors.Wrapf(err, "unable to unmarshal epoch unbonding record (%v) using old data type", iterator.Key()) + } + + // Convert and serialize using the new type + newEpochUnbondingRecord := convertToNewEpochUnbondingRecord(oldEpochUnbondingRecord) + newEpochUnbondingRecordBz, err := cdc.Marshal(&newEpochUnbondingRecord) + if err != nil { + return sdkerrors.Wrapf(err, "unable to marshal epoch unbonding record (%v) using new data type", iterator.Key()) + } + + // Store the new type + epochUnbondingRecordStore.Set(iterator.Key(), newEpochUnbondingRecordBz) + } + + return nil +} + +func MigrateStore(ctx sdk.Context, storeKey storetypes.StoreKey, cdc codec.BinaryCodec) error { + store := ctx.KVStore(storeKey) + + err := migrateDepositRecord(store, cdc) + if err != nil { + return err + } + + err = migrateUserRedemptionRecord(store, cdc) + if err != nil { + return err + } + + return migrateEpochUnbondingRecord(store, cdc) +} diff --git a/x/records/migrations/v2/types/genesis.pb.go b/x/records/migrations/v2/types/genesis.pb.go new file mode 100644 index 0000000000..4c7e5c7679 --- /dev/null +++ b/x/records/migrations/v2/types/genesis.pb.go @@ -0,0 +1,2806 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: stride/records/genesis.proto + +package types + +import ( + context "context" + fmt "fmt" + _ "github.com/cosmos/gogoproto/gogoproto" + grpc1 "github.com/gogo/protobuf/grpc" + proto "github.com/gogo/protobuf/proto" + grpc "google.golang.org/grpc" + io "io" + math "math" + math_bits "math/bits" +) + +// 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 + +type DepositRecord_Status int32 + +const ( + // in transfer queue to be sent to the delegation ICA + DepositRecord_TRANSFER_QUEUE DepositRecord_Status = 0 + // transfer in progress (IBC packet sent, ack not received) + DepositRecord_TRANSFER_IN_PROGRESS DepositRecord_Status = 2 + // in staking queue on delegation ICA + DepositRecord_DELEGATION_QUEUE DepositRecord_Status = 1 + // staking in progress (ICA packet sent, ack not received) + DepositRecord_DELEGATION_IN_PROGRESS DepositRecord_Status = 3 +) + +var DepositRecord_Status_name = map[int32]string{ + 0: "TRANSFER_QUEUE", + 2: "TRANSFER_IN_PROGRESS", + 1: "DELEGATION_QUEUE", + 3: "DELEGATION_IN_PROGRESS", +} + +var DepositRecord_Status_value = map[string]int32{ + "TRANSFER_QUEUE": 0, + "TRANSFER_IN_PROGRESS": 2, + "DELEGATION_QUEUE": 1, + "DELEGATION_IN_PROGRESS": 3, +} + +func (x DepositRecord_Status) String() string { + return proto.EnumName(DepositRecord_Status_name, int32(x)) +} + +func (DepositRecord_Status) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_98cfd0253c8b6797, []int{4, 0} +} + +type DepositRecord_Source int32 + +const ( + DepositRecord_STRIDE DepositRecord_Source = 0 + DepositRecord_WITHDRAWAL_ICA DepositRecord_Source = 1 +) + +var DepositRecord_Source_name = map[int32]string{ + 0: "STRIDE", + 1: "WITHDRAWAL_ICA", +} + +var DepositRecord_Source_value = map[string]int32{ + "STRIDE": 0, + "WITHDRAWAL_ICA": 1, +} + +func (x DepositRecord_Source) String() string { + return proto.EnumName(DepositRecord_Source_name, int32(x)) +} + +func (DepositRecord_Source) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_98cfd0253c8b6797, []int{4, 1} +} + +type HostZoneUnbonding_Status int32 + +const ( + // tokens bonded on delegate account + HostZoneUnbonding_UNBONDING_QUEUE HostZoneUnbonding_Status = 0 + HostZoneUnbonding_UNBONDING_IN_PROGRESS HostZoneUnbonding_Status = 3 + // unbonding completed on delegate account + HostZoneUnbonding_EXIT_TRANSFER_QUEUE HostZoneUnbonding_Status = 1 + HostZoneUnbonding_EXIT_TRANSFER_IN_PROGRESS HostZoneUnbonding_Status = 4 + // transfer success + HostZoneUnbonding_CLAIMABLE HostZoneUnbonding_Status = 2 +) + +var HostZoneUnbonding_Status_name = map[int32]string{ + 0: "UNBONDING_QUEUE", + 3: "UNBONDING_IN_PROGRESS", + 1: "EXIT_TRANSFER_QUEUE", + 4: "EXIT_TRANSFER_IN_PROGRESS", + 2: "CLAIMABLE", +} + +var HostZoneUnbonding_Status_value = map[string]int32{ + "UNBONDING_QUEUE": 0, + "UNBONDING_IN_PROGRESS": 3, + "EXIT_TRANSFER_QUEUE": 1, + "EXIT_TRANSFER_IN_PROGRESS": 4, + "CLAIMABLE": 2, +} + +func (x HostZoneUnbonding_Status) String() string { + return proto.EnumName(HostZoneUnbonding_Status_name, int32(x)) +} + +func (HostZoneUnbonding_Status) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_98cfd0253c8b6797, []int{5, 0} +} + +type UserRedemptionRecord struct { + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Sender string `protobuf:"bytes,2,opt,name=sender,proto3" json:"sender,omitempty"` + Receiver string `protobuf:"bytes,3,opt,name=receiver,proto3" json:"receiver,omitempty"` + Amount uint64 `protobuf:"varint,4,opt,name=amount,proto3" json:"amount,omitempty"` + Denom string `protobuf:"bytes,5,opt,name=denom,proto3" json:"denom,omitempty"` + HostZoneId string `protobuf:"bytes,6,opt,name=host_zone_id,json=hostZoneId,proto3" json:"host_zone_id,omitempty"` + EpochNumber uint64 `protobuf:"varint,7,opt,name=epoch_number,json=epochNumber,proto3" json:"epoch_number,omitempty"` + ClaimIsPending bool `protobuf:"varint,8,opt,name=claim_is_pending,json=claimIsPending,proto3" json:"claim_is_pending,omitempty"` +} + +func (m *UserRedemptionRecord) Reset() { *m = UserRedemptionRecord{} } +func (m *UserRedemptionRecord) String() string { return proto.CompactTextString(m) } +func (*UserRedemptionRecord) ProtoMessage() {} +func (*UserRedemptionRecord) Descriptor() ([]byte, []int) { + return fileDescriptor_98cfd0253c8b6797, []int{0} +} +func (m *UserRedemptionRecord) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *UserRedemptionRecord) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_UserRedemptionRecord.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 *UserRedemptionRecord) XXX_Merge(src proto.Message) { + xxx_messageInfo_UserRedemptionRecord.Merge(m, src) +} +func (m *UserRedemptionRecord) XXX_Size() int { + return m.Size() +} +func (m *UserRedemptionRecord) XXX_DiscardUnknown() { + xxx_messageInfo_UserRedemptionRecord.DiscardUnknown(m) +} + +var xxx_messageInfo_UserRedemptionRecord proto.InternalMessageInfo + +func (m *UserRedemptionRecord) GetId() string { + if m != nil { + return m.Id + } + return "" +} + +func (m *UserRedemptionRecord) GetSender() string { + if m != nil { + return m.Sender + } + return "" +} + +func (m *UserRedemptionRecord) GetReceiver() string { + if m != nil { + return m.Receiver + } + return "" +} + +func (m *UserRedemptionRecord) GetAmount() uint64 { + if m != nil { + return m.Amount + } + return 0 +} + +func (m *UserRedemptionRecord) GetDenom() string { + if m != nil { + return m.Denom + } + return "" +} + +func (m *UserRedemptionRecord) GetHostZoneId() string { + if m != nil { + return m.HostZoneId + } + return "" +} + +func (m *UserRedemptionRecord) GetEpochNumber() uint64 { + if m != nil { + return m.EpochNumber + } + return 0 +} + +func (m *UserRedemptionRecord) GetClaimIsPending() bool { + if m != nil { + return m.ClaimIsPending + } + return false +} + +// Params defines the parameters for the module. +type Params struct { +} + +func (m *Params) Reset() { *m = Params{} } +func (*Params) ProtoMessage() {} +func (*Params) Descriptor() ([]byte, []int) { + return fileDescriptor_98cfd0253c8b6797, []int{1} +} +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 + +type RecordsPacketData struct { + // Types that are valid to be assigned to Packet: + // *RecordsPacketData_NoData + Packet isRecordsPacketData_Packet `protobuf_oneof:"packet"` +} + +func (m *RecordsPacketData) Reset() { *m = RecordsPacketData{} } +func (m *RecordsPacketData) String() string { return proto.CompactTextString(m) } +func (*RecordsPacketData) ProtoMessage() {} +func (*RecordsPacketData) Descriptor() ([]byte, []int) { + return fileDescriptor_98cfd0253c8b6797, []int{2} +} +func (m *RecordsPacketData) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *RecordsPacketData) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_RecordsPacketData.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 *RecordsPacketData) XXX_Merge(src proto.Message) { + xxx_messageInfo_RecordsPacketData.Merge(m, src) +} +func (m *RecordsPacketData) XXX_Size() int { + return m.Size() +} +func (m *RecordsPacketData) XXX_DiscardUnknown() { + xxx_messageInfo_RecordsPacketData.DiscardUnknown(m) +} + +var xxx_messageInfo_RecordsPacketData proto.InternalMessageInfo + +type isRecordsPacketData_Packet interface { + isRecordsPacketData_Packet() + MarshalTo([]byte) (int, error) + Size() int +} + +type RecordsPacketData_NoData struct { + NoData *NoData `protobuf:"bytes,1,opt,name=no_data,json=noData,proto3,oneof" json:"no_data,omitempty"` +} + +func (*RecordsPacketData_NoData) isRecordsPacketData_Packet() {} + +func (m *RecordsPacketData) GetPacket() isRecordsPacketData_Packet { + if m != nil { + return m.Packet + } + return nil +} + +func (m *RecordsPacketData) GetNoData() *NoData { + if x, ok := m.GetPacket().(*RecordsPacketData_NoData); ok { + return x.NoData + } + return nil +} + +// XXX_OneofWrappers is for the internal use of the proto package. +func (*RecordsPacketData) XXX_OneofWrappers() []interface{} { + return []interface{}{ + (*RecordsPacketData_NoData)(nil), + } +} + +type NoData struct { +} + +func (m *NoData) Reset() { *m = NoData{} } +func (m *NoData) String() string { return proto.CompactTextString(m) } +func (*NoData) ProtoMessage() {} +func (*NoData) Descriptor() ([]byte, []int) { + return fileDescriptor_98cfd0253c8b6797, []int{3} +} +func (m *NoData) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *NoData) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_NoData.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 *NoData) XXX_Merge(src proto.Message) { + xxx_messageInfo_NoData.Merge(m, src) +} +func (m *NoData) XXX_Size() int { + return m.Size() +} +func (m *NoData) XXX_DiscardUnknown() { + xxx_messageInfo_NoData.DiscardUnknown(m) +} + +var xxx_messageInfo_NoData proto.InternalMessageInfo + +type DepositRecord struct { + Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + Amount int64 `protobuf:"varint,2,opt,name=amount,proto3" json:"amount,omitempty"` + Denom string `protobuf:"bytes,3,opt,name=denom,proto3" json:"denom,omitempty"` + HostZoneId string `protobuf:"bytes,4,opt,name=host_zone_id,json=hostZoneId,proto3" json:"host_zone_id,omitempty"` + Status DepositRecord_Status `protobuf:"varint,6,opt,name=status,proto3,enum=stride.records.DepositRecord_Status" json:"status,omitempty"` + DepositEpochNumber uint64 `protobuf:"varint,7,opt,name=deposit_epoch_number,json=depositEpochNumber,proto3" json:"deposit_epoch_number,omitempty"` + Source DepositRecord_Source `protobuf:"varint,8,opt,name=source,proto3,enum=stride.records.DepositRecord_Source" json:"source,omitempty"` +} + +func (m *DepositRecord) Reset() { *m = DepositRecord{} } +func (m *DepositRecord) String() string { return proto.CompactTextString(m) } +func (*DepositRecord) ProtoMessage() {} +func (*DepositRecord) Descriptor() ([]byte, []int) { + return fileDescriptor_98cfd0253c8b6797, []int{4} +} +func (m *DepositRecord) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *DepositRecord) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_DepositRecord.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 *DepositRecord) XXX_Merge(src proto.Message) { + xxx_messageInfo_DepositRecord.Merge(m, src) +} +func (m *DepositRecord) XXX_Size() int { + return m.Size() +} +func (m *DepositRecord) XXX_DiscardUnknown() { + xxx_messageInfo_DepositRecord.DiscardUnknown(m) +} + +var xxx_messageInfo_DepositRecord proto.InternalMessageInfo + +func (m *DepositRecord) GetId() uint64 { + if m != nil { + return m.Id + } + return 0 +} + +func (m *DepositRecord) GetAmount() int64 { + if m != nil { + return m.Amount + } + return 0 +} + +func (m *DepositRecord) GetDenom() string { + if m != nil { + return m.Denom + } + return "" +} + +func (m *DepositRecord) GetHostZoneId() string { + if m != nil { + return m.HostZoneId + } + return "" +} + +func (m *DepositRecord) GetStatus() DepositRecord_Status { + if m != nil { + return m.Status + } + return DepositRecord_TRANSFER_QUEUE +} + +func (m *DepositRecord) GetDepositEpochNumber() uint64 { + if m != nil { + return m.DepositEpochNumber + } + return 0 +} + +func (m *DepositRecord) GetSource() DepositRecord_Source { + if m != nil { + return m.Source + } + return DepositRecord_STRIDE +} + +type HostZoneUnbonding struct { + StTokenAmount uint64 `protobuf:"varint,1,opt,name=st_token_amount,json=stTokenAmount,proto3" json:"st_token_amount,omitempty"` + NativeTokenAmount uint64 `protobuf:"varint,2,opt,name=native_token_amount,json=nativeTokenAmount,proto3" json:"native_token_amount,omitempty"` + Denom string `protobuf:"bytes,3,opt,name=denom,proto3" json:"denom,omitempty"` + HostZoneId string `protobuf:"bytes,4,opt,name=host_zone_id,json=hostZoneId,proto3" json:"host_zone_id,omitempty"` + UnbondingTime uint64 `protobuf:"varint,5,opt,name=unbonding_time,json=unbondingTime,proto3" json:"unbonding_time,omitempty"` + Status HostZoneUnbonding_Status `protobuf:"varint,6,opt,name=status,proto3,enum=stride.records.HostZoneUnbonding_Status" json:"status,omitempty"` + UserRedemptionRecords []string `protobuf:"bytes,7,rep,name=user_redemption_records,json=userRedemptionRecords,proto3" json:"user_redemption_records,omitempty"` +} + +func (m *HostZoneUnbonding) Reset() { *m = HostZoneUnbonding{} } +func (m *HostZoneUnbonding) String() string { return proto.CompactTextString(m) } +func (*HostZoneUnbonding) ProtoMessage() {} +func (*HostZoneUnbonding) Descriptor() ([]byte, []int) { + return fileDescriptor_98cfd0253c8b6797, []int{5} +} +func (m *HostZoneUnbonding) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *HostZoneUnbonding) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_HostZoneUnbonding.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 *HostZoneUnbonding) XXX_Merge(src proto.Message) { + xxx_messageInfo_HostZoneUnbonding.Merge(m, src) +} +func (m *HostZoneUnbonding) XXX_Size() int { + return m.Size() +} +func (m *HostZoneUnbonding) XXX_DiscardUnknown() { + xxx_messageInfo_HostZoneUnbonding.DiscardUnknown(m) +} + +var xxx_messageInfo_HostZoneUnbonding proto.InternalMessageInfo + +func (m *HostZoneUnbonding) GetStTokenAmount() uint64 { + if m != nil { + return m.StTokenAmount + } + return 0 +} + +func (m *HostZoneUnbonding) GetNativeTokenAmount() uint64 { + if m != nil { + return m.NativeTokenAmount + } + return 0 +} + +func (m *HostZoneUnbonding) GetDenom() string { + if m != nil { + return m.Denom + } + return "" +} + +func (m *HostZoneUnbonding) GetHostZoneId() string { + if m != nil { + return m.HostZoneId + } + return "" +} + +func (m *HostZoneUnbonding) GetUnbondingTime() uint64 { + if m != nil { + return m.UnbondingTime + } + return 0 +} + +func (m *HostZoneUnbonding) GetStatus() HostZoneUnbonding_Status { + if m != nil { + return m.Status + } + return HostZoneUnbonding_UNBONDING_QUEUE +} + +func (m *HostZoneUnbonding) GetUserRedemptionRecords() []string { + if m != nil { + return m.UserRedemptionRecords + } + return nil +} + +type EpochUnbondingRecord struct { + EpochNumber uint64 `protobuf:"varint,1,opt,name=epoch_number,json=epochNumber,proto3" json:"epoch_number,omitempty"` + HostZoneUnbondings []*HostZoneUnbonding `protobuf:"bytes,3,rep,name=host_zone_unbondings,json=hostZoneUnbondings,proto3" json:"host_zone_unbondings,omitempty"` +} + +func (m *EpochUnbondingRecord) Reset() { *m = EpochUnbondingRecord{} } +func (m *EpochUnbondingRecord) String() string { return proto.CompactTextString(m) } +func (*EpochUnbondingRecord) ProtoMessage() {} +func (*EpochUnbondingRecord) Descriptor() ([]byte, []int) { + return fileDescriptor_98cfd0253c8b6797, []int{6} +} +func (m *EpochUnbondingRecord) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *EpochUnbondingRecord) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_EpochUnbondingRecord.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 *EpochUnbondingRecord) XXX_Merge(src proto.Message) { + xxx_messageInfo_EpochUnbondingRecord.Merge(m, src) +} +func (m *EpochUnbondingRecord) XXX_Size() int { + return m.Size() +} +func (m *EpochUnbondingRecord) XXX_DiscardUnknown() { + xxx_messageInfo_EpochUnbondingRecord.DiscardUnknown(m) +} + +var xxx_messageInfo_EpochUnbondingRecord proto.InternalMessageInfo + +func (m *EpochUnbondingRecord) GetEpochNumber() uint64 { + if m != nil { + return m.EpochNumber + } + return 0 +} + +func (m *EpochUnbondingRecord) GetHostZoneUnbondings() []*HostZoneUnbonding { + if m != nil { + return m.HostZoneUnbondings + } + return nil +} + +// GenesisState defines the recordÏ€s module's genesis state. +// next id: 9 +type GenesisState struct { + Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` + PortId string `protobuf:"bytes,2,opt,name=port_id,json=portId,proto3" json:"port_id,omitempty"` + UserRedemptionRecordList []UserRedemptionRecord `protobuf:"bytes,3,rep,name=user_redemption_record_list,json=userRedemptionRecordList,proto3" json:"user_redemption_record_list"` + UserRedemptionRecordCount uint64 `protobuf:"varint,4,opt,name=user_redemption_record_count,json=userRedemptionRecordCount,proto3" json:"user_redemption_record_count,omitempty"` + EpochUnbondingRecordList []EpochUnbondingRecord `protobuf:"bytes,5,rep,name=epoch_unbonding_record_list,json=epochUnbondingRecordList,proto3" json:"epoch_unbonding_record_list"` + DepositRecordList []DepositRecord `protobuf:"bytes,7,rep,name=deposit_record_list,json=depositRecordList,proto3" json:"deposit_record_list"` + DepositRecordCount uint64 `protobuf:"varint,8,opt,name=deposit_record_count,json=depositRecordCount,proto3" json:"deposit_record_count,omitempty"` +} + +func (m *GenesisState) Reset() { *m = GenesisState{} } +func (m *GenesisState) String() string { return proto.CompactTextString(m) } +func (*GenesisState) ProtoMessage() {} +func (*GenesisState) Descriptor() ([]byte, []int) { + return fileDescriptor_98cfd0253c8b6797, []int{7} +} +func (m *GenesisState) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_GenesisState.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 *GenesisState) XXX_Merge(src proto.Message) { + xxx_messageInfo_GenesisState.Merge(m, src) +} +func (m *GenesisState) XXX_Size() int { + return m.Size() +} +func (m *GenesisState) XXX_DiscardUnknown() { + xxx_messageInfo_GenesisState.DiscardUnknown(m) +} + +var xxx_messageInfo_GenesisState proto.InternalMessageInfo + +func (m *GenesisState) GetParams() Params { + if m != nil { + return m.Params + } + return Params{} +} + +func (m *GenesisState) GetPortId() string { + if m != nil { + return m.PortId + } + return "" +} + +func (m *GenesisState) GetUserRedemptionRecordList() []UserRedemptionRecord { + if m != nil { + return m.UserRedemptionRecordList + } + return nil +} + +func (m *GenesisState) GetUserRedemptionRecordCount() uint64 { + if m != nil { + return m.UserRedemptionRecordCount + } + return 0 +} + +func (m *GenesisState) GetEpochUnbondingRecordList() []EpochUnbondingRecord { + if m != nil { + return m.EpochUnbondingRecordList + } + return nil +} + +func (m *GenesisState) GetDepositRecordList() []DepositRecord { + if m != nil { + return m.DepositRecordList + } + return nil +} + +func (m *GenesisState) GetDepositRecordCount() uint64 { + if m != nil { + return m.DepositRecordCount + } + return 0 +} + +func init() { + proto.RegisterEnum("stride.records.V2DepositRecord_Status", DepositRecord_Status_name, DepositRecord_Status_value) + proto.RegisterEnum("stride.records.V2DepositRecord_Source", DepositRecord_Source_name, DepositRecord_Source_value) + proto.RegisterEnum("stride.records.V2HostZoneUnbonding_Status", HostZoneUnbonding_Status_name, HostZoneUnbonding_Status_value) + proto.RegisterType((*UserRedemptionRecord)(nil), "stride.records.V2UserRedemptionRecord") + proto.RegisterType((*Params)(nil), "stride.records.V2Params") + proto.RegisterType((*RecordsPacketData)(nil), "stride.records.V2RecordsPacketData") + proto.RegisterType((*NoData)(nil), "stride.records.V2NoData") + proto.RegisterType((*DepositRecord)(nil), "stride.records.V2DepositRecord") + proto.RegisterType((*HostZoneUnbonding)(nil), "stride.records.V2HostZoneUnbonding") + proto.RegisterType((*EpochUnbondingRecord)(nil), "stride.records.V2EpochUnbondingRecord") + proto.RegisterType((*GenesisState)(nil), "stride.records.V2GenesisState") +} + +func init() { proto.RegisterFile("stride/records/genesis.proto", fileDescriptor_98cfd0253c8b6797) } + +var fileDescriptor_98cfd0253c8b6797 = []byte{ + // 944 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x55, 0xcf, 0x6e, 0xdb, 0xc6, + 0x13, 0x16, 0x45, 0x8a, 0x92, 0xc7, 0xb6, 0x22, 0xaf, 0x15, 0x9b, 0x76, 0x12, 0x45, 0x21, 0x7e, + 0xbf, 0x42, 0x97, 0x4a, 0xa9, 0x1b, 0xf4, 0x50, 0x14, 0x68, 0x25, 0x4b, 0xb5, 0x69, 0x28, 0xb2, + 0xba, 0x92, 0x90, 0x22, 0x17, 0x82, 0x12, 0x17, 0xd2, 0x22, 0x11, 0x57, 0xe0, 0xae, 0x8c, 0xb6, + 0x97, 0xbe, 0x42, 0x0f, 0x3d, 0xf4, 0xd8, 0xb7, 0xe8, 0x13, 0x14, 0xc8, 0x31, 0xc7, 0x9e, 0x8a, + 0xc2, 0x7e, 0x88, 0x1e, 0x7a, 0x29, 0xb8, 0x5c, 0xcb, 0xd4, 0x9f, 0x24, 0x40, 0x6f, 0xdc, 0x6f, + 0x66, 0x76, 0x66, 0xbe, 0x19, 0x7e, 0x0b, 0x0f, 0xb9, 0x08, 0xa9, 0x4f, 0x6a, 0x21, 0x19, 0xb1, + 0xd0, 0xe7, 0xb5, 0x31, 0x09, 0x08, 0xa7, 0xbc, 0x3a, 0x0b, 0x99, 0x60, 0x28, 0x1f, 0x5b, 0xab, + 0xca, 0x7a, 0x5c, 0x1c, 0xb3, 0x31, 0x93, 0xa6, 0x5a, 0xf4, 0x15, 0x7b, 0xd9, 0x7f, 0x6b, 0x50, + 0x1c, 0x70, 0x12, 0x62, 0xe2, 0x93, 0xe9, 0x4c, 0x50, 0x16, 0x60, 0xe9, 0x8f, 0xf2, 0x90, 0xa6, + 0xbe, 0xa5, 0x95, 0xb5, 0xca, 0x16, 0x4e, 0x53, 0x1f, 0x1d, 0x80, 0xc9, 0x49, 0xe0, 0x93, 0xd0, + 0x4a, 0x4b, 0x4c, 0x9d, 0xd0, 0x31, 0xe4, 0x42, 0x32, 0x22, 0xf4, 0x8a, 0x84, 0x96, 0x2e, 0x2d, + 0x8b, 0x73, 0x14, 0xe3, 0x4d, 0xd9, 0x3c, 0x10, 0x96, 0x51, 0xd6, 0x2a, 0x06, 0x56, 0x27, 0x54, + 0x84, 0x8c, 0x4f, 0x02, 0x36, 0xb5, 0x32, 0x32, 0x20, 0x3e, 0xa0, 0x32, 0xec, 0x4c, 0x18, 0x17, + 0xee, 0x0f, 0x2c, 0x20, 0x2e, 0xf5, 0x2d, 0x53, 0x1a, 0x21, 0xc2, 0x5e, 0xb2, 0x80, 0x38, 0x3e, + 0x7a, 0x02, 0x3b, 0x64, 0xc6, 0x46, 0x13, 0x37, 0x98, 0x4f, 0x87, 0x24, 0xb4, 0xb2, 0xf2, 0xd6, + 0x6d, 0x89, 0x75, 0x24, 0x84, 0x2a, 0x50, 0x18, 0xbd, 0xf6, 0xe8, 0xd4, 0xa5, 0xdc, 0x9d, 0x91, + 0xc0, 0xa7, 0xc1, 0xd8, 0xca, 0x95, 0xb5, 0x4a, 0x0e, 0xe7, 0x25, 0xee, 0xf0, 0x6e, 0x8c, 0xda, + 0x79, 0x30, 0xbb, 0x5e, 0xe8, 0x4d, 0xf9, 0xe7, 0xc6, 0x2f, 0xbf, 0x3e, 0x4e, 0xd9, 0x5d, 0xd8, + 0x8b, 0x5b, 0xe7, 0x5d, 0x6f, 0xf4, 0x8a, 0x88, 0xa6, 0x27, 0x3c, 0xf4, 0x09, 0x64, 0x03, 0xe6, + 0xfa, 0x9e, 0xf0, 0x24, 0x15, 0xdb, 0x27, 0x07, 0xd5, 0x65, 0x5a, 0xab, 0x1d, 0x16, 0x39, 0x9e, + 0xa7, 0xb0, 0x19, 0xc8, 0xaf, 0x46, 0x0e, 0xcc, 0x99, 0xbc, 0xc0, 0xce, 0x81, 0x19, 0x5b, 0xed, + 0xdf, 0x74, 0xd8, 0x6d, 0x92, 0x19, 0xe3, 0x54, 0xac, 0xd1, 0x6b, 0xdc, 0xd2, 0xab, 0xa8, 0x8a, + 0xe8, 0xd5, 0xd7, 0xa9, 0xd2, 0xdf, 0x47, 0x95, 0xb1, 0x46, 0xd5, 0x17, 0x60, 0x72, 0xe1, 0x89, + 0x39, 0x97, 0x34, 0xe6, 0x4f, 0xfe, 0xb7, 0x5a, 0xf7, 0x52, 0x39, 0xd5, 0x9e, 0xf4, 0xc5, 0x2a, + 0x06, 0x3d, 0x85, 0xa2, 0x1f, 0xdb, 0xdd, 0x0d, 0x84, 0x23, 0x65, 0x6b, 0x25, 0x78, 0x8f, 0xf2, + 0xb1, 0x79, 0x38, 0x22, 0x92, 0xed, 0x0f, 0xe7, 0x93, 0xbe, 0x58, 0xc5, 0xd8, 0x13, 0x30, 0xe3, + 0x0a, 0x10, 0x82, 0x7c, 0x1f, 0xd7, 0x3b, 0xbd, 0xaf, 0x5b, 0xd8, 0xfd, 0x66, 0xd0, 0x1a, 0xb4, + 0x0a, 0x29, 0x64, 0x41, 0x71, 0x81, 0x39, 0x1d, 0xb7, 0x8b, 0x2f, 0xcf, 0x70, 0xab, 0xd7, 0x2b, + 0xa4, 0x51, 0x11, 0x0a, 0xcd, 0x56, 0xbb, 0x75, 0x56, 0xef, 0x3b, 0x97, 0x1d, 0xe5, 0xaf, 0xa1, + 0x63, 0x38, 0x48, 0xa0, 0xc9, 0x08, 0xdd, 0xae, 0x80, 0x19, 0xe7, 0x46, 0x00, 0x66, 0xaf, 0x8f, + 0x9d, 0x66, 0x94, 0x01, 0x41, 0xfe, 0x85, 0xd3, 0x3f, 0x6f, 0xe2, 0xfa, 0x8b, 0x7a, 0xdb, 0x75, + 0x4e, 0xeb, 0x05, 0xed, 0xc2, 0xc8, 0x65, 0x0a, 0xa6, 0xfd, 0xbb, 0x0e, 0x7b, 0xe7, 0x8a, 0xd6, + 0x41, 0x30, 0x64, 0x72, 0x77, 0xd0, 0x47, 0x70, 0x8f, 0x0b, 0x57, 0xb0, 0x57, 0x24, 0x70, 0xd5, + 0xd8, 0xe2, 0x51, 0xee, 0x72, 0xd1, 0x8f, 0xd0, 0x7a, 0x3c, 0xbd, 0x2a, 0xec, 0x07, 0x9e, 0xa0, + 0x57, 0x64, 0xd9, 0x37, 0x2d, 0x7d, 0xf7, 0x62, 0x53, 0xd2, 0xff, 0xbf, 0x4e, 0xfb, 0xff, 0x90, + 0x9f, 0xdf, 0x16, 0xe7, 0x0a, 0x3a, 0x25, 0xf2, 0xcf, 0x32, 0xf0, 0xee, 0x02, 0xed, 0xd3, 0x29, + 0x41, 0x5f, 0xad, 0x2c, 0x45, 0x65, 0x75, 0x48, 0x6b, 0x9d, 0xae, 0x2e, 0xc6, 0x67, 0x70, 0x38, + 0xe7, 0x24, 0x74, 0xc3, 0x85, 0x5c, 0xb8, 0x2a, 0xd6, 0xca, 0x96, 0xf5, 0xca, 0x16, 0xbe, 0x3f, + 0xdf, 0x20, 0x26, 0xdc, 0xfe, 0x71, 0x31, 0xe0, 0x7d, 0xb8, 0x37, 0xe8, 0x34, 0x2e, 0x3b, 0x4d, + 0xa7, 0x73, 0xb6, 0x98, 0xf0, 0x11, 0xdc, 0xbf, 0x03, 0x97, 0x06, 0x86, 0x0e, 0x61, 0xbf, 0xf5, + 0xad, 0xd3, 0x77, 0x57, 0xb6, 0x42, 0x43, 0x8f, 0xe0, 0x68, 0xd9, 0x90, 0x8c, 0x33, 0xd0, 0x2e, + 0x6c, 0x9d, 0xb6, 0xeb, 0xce, 0xf3, 0x7a, 0xa3, 0xdd, 0x2a, 0xa4, 0xed, 0x9f, 0x35, 0x28, 0xca, + 0x7d, 0x5d, 0xb4, 0xa6, 0x7e, 0xc4, 0x55, 0x4d, 0xd1, 0xd6, 0x35, 0xa5, 0x07, 0xc5, 0x3b, 0xfe, + 0x17, 0x8c, 0x72, 0x4b, 0x2f, 0xeb, 0x95, 0xed, 0x93, 0x27, 0x1f, 0x24, 0x11, 0xa3, 0xc9, 0x2a, + 0xc4, 0x2f, 0x8c, 0x5c, 0xba, 0xa0, 0xdb, 0xff, 0xe8, 0xb0, 0x73, 0x16, 0xcb, 0x76, 0xc4, 0x0f, + 0x41, 0xcf, 0x22, 0xf5, 0x88, 0x54, 0xe9, 0x5d, 0x7a, 0x13, 0x6b, 0x56, 0xc3, 0x78, 0xf3, 0xe7, + 0xe3, 0x14, 0x56, 0xbe, 0xe8, 0x10, 0xb2, 0x33, 0x16, 0x8a, 0x68, 0x39, 0x94, 0x3a, 0x47, 0x47, + 0xc7, 0x47, 0x14, 0x1e, 0x6c, 0x9e, 0x97, 0xfb, 0x9a, 0x72, 0xa1, 0x3a, 0x58, 0xfb, 0x57, 0x37, + 0x3d, 0x08, 0x2a, 0xa3, 0xb5, 0x69, 0xbe, 0x6d, 0xca, 0x05, 0xfa, 0x12, 0x1e, 0xbe, 0x23, 0xd5, + 0x28, 0xf1, 0x04, 0x1c, 0x6d, 0x8a, 0x3f, 0x95, 0xcb, 0x4f, 0xe1, 0x41, 0x3c, 0x89, 0xbb, 0x55, + 0x4e, 0xd6, 0x9a, 0xd9, 0x5c, 0xeb, 0xa6, 0xa1, 0xde, 0xd6, 0x4a, 0x36, 0xd8, 0x64, 0xad, 0x3d, + 0xd8, 0xbf, 0xd5, 0xb7, 0x64, 0x8a, 0xac, 0x4c, 0xf1, 0xe8, 0xbd, 0xd2, 0xa5, 0xee, 0xde, 0xf3, + 0x93, 0xa0, 0xbc, 0x34, 0x21, 0x9a, 0x4b, 0x8d, 0xe7, 0x96, 0x44, 0x33, 0xd1, 0xf1, 0x49, 0x06, + 0xf4, 0xe7, 0x7c, 0xdc, 0xb8, 0x78, 0x73, 0x5d, 0xd2, 0xde, 0x5e, 0x97, 0xb4, 0xbf, 0xae, 0x4b, + 0xda, 0x4f, 0x37, 0xa5, 0xd4, 0xdb, 0x9b, 0x52, 0xea, 0x8f, 0x9b, 0x52, 0xea, 0xe5, 0xd3, 0x31, + 0x15, 0x93, 0xf9, 0xb0, 0x3a, 0x62, 0xd3, 0x5a, 0x4f, 0x16, 0xf5, 0x71, 0xdb, 0x1b, 0xf2, 0x9a, + 0x7a, 0xf8, 0xaf, 0x9e, 0xd5, 0xbe, 0x5b, 0xbc, 0xfe, 0xe2, 0xfb, 0x19, 0xe1, 0x43, 0x53, 0x3e, + 0xeb, 0x9f, 0xfe, 0x1b, 0x00, 0x00, 0xff, 0xff, 0x71, 0xad, 0x82, 0x28, 0x1c, 0x08, 0x00, 0x00, +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// MsgClient is the client API for Msg service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type MsgClient interface { +} + +type msgClient struct { + cc grpc1.ClientConn +} + +func NewMsgClient(cc grpc1.ClientConn) MsgClient { + return &msgClient{cc} +} + +// MsgServer is the server API for Msg service. +type MsgServer interface { +} + +// UnimplementedMsgServer can be embedded to have forward compatible implementations. +type UnimplementedMsgServer struct { +} + +func RegisterMsgServer(s grpc1.Server, srv MsgServer) { + s.RegisterService(&_Msg_serviceDesc, srv) +} + +var _Msg_serviceDesc = grpc.ServiceDesc{ + ServiceName: "stride.records.Msg", + HandlerType: (*MsgServer)(nil), + Methods: []grpc.MethodDesc{}, + Streams: []grpc.StreamDesc{}, + Metadata: "stride/records/genesis.proto", +} + +func (m *UserRedemptionRecord) 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 *UserRedemptionRecord) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *UserRedemptionRecord) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.ClaimIsPending { + i-- + if m.ClaimIsPending { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x40 + } + if m.EpochNumber != 0 { + i = encodeVarintGenesis(dAtA, i, uint64(m.EpochNumber)) + i-- + dAtA[i] = 0x38 + } + if len(m.HostZoneId) > 0 { + i -= len(m.HostZoneId) + copy(dAtA[i:], m.HostZoneId) + i = encodeVarintGenesis(dAtA, i, uint64(len(m.HostZoneId))) + i-- + dAtA[i] = 0x32 + } + if len(m.Denom) > 0 { + i -= len(m.Denom) + copy(dAtA[i:], m.Denom) + i = encodeVarintGenesis(dAtA, i, uint64(len(m.Denom))) + i-- + dAtA[i] = 0x2a + } + if m.Amount != 0 { + i = encodeVarintGenesis(dAtA, i, uint64(m.Amount)) + i-- + dAtA[i] = 0x20 + } + if len(m.Receiver) > 0 { + i -= len(m.Receiver) + copy(dAtA[i:], m.Receiver) + i = encodeVarintGenesis(dAtA, i, uint64(len(m.Receiver))) + i-- + dAtA[i] = 0x1a + } + if len(m.Sender) > 0 { + i -= len(m.Sender) + copy(dAtA[i:], m.Sender) + i = encodeVarintGenesis(dAtA, i, uint64(len(m.Sender))) + i-- + dAtA[i] = 0x12 + } + if len(m.Id) > 0 { + i -= len(m.Id) + copy(dAtA[i:], m.Id) + i = encodeVarintGenesis(dAtA, i, uint64(len(m.Id))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +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 + return len(dAtA) - i, nil +} + +func (m *RecordsPacketData) 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 *RecordsPacketData) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *RecordsPacketData) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Packet != nil { + { + size := m.Packet.Size() + i -= size + if _, err := m.Packet.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + } + } + return len(dAtA) - i, nil +} + +func (m *RecordsPacketData_NoData) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *RecordsPacketData_NoData) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + if m.NoData != nil { + { + size, err := m.NoData.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} +func (m *NoData) 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 *NoData) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *NoData) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *DepositRecord) 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 *DepositRecord) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *DepositRecord) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Source != 0 { + i = encodeVarintGenesis(dAtA, i, uint64(m.Source)) + i-- + dAtA[i] = 0x40 + } + if m.DepositEpochNumber != 0 { + i = encodeVarintGenesis(dAtA, i, uint64(m.DepositEpochNumber)) + i-- + dAtA[i] = 0x38 + } + if m.Status != 0 { + i = encodeVarintGenesis(dAtA, i, uint64(m.Status)) + i-- + dAtA[i] = 0x30 + } + if len(m.HostZoneId) > 0 { + i -= len(m.HostZoneId) + copy(dAtA[i:], m.HostZoneId) + i = encodeVarintGenesis(dAtA, i, uint64(len(m.HostZoneId))) + i-- + dAtA[i] = 0x22 + } + if len(m.Denom) > 0 { + i -= len(m.Denom) + copy(dAtA[i:], m.Denom) + i = encodeVarintGenesis(dAtA, i, uint64(len(m.Denom))) + i-- + dAtA[i] = 0x1a + } + if m.Amount != 0 { + i = encodeVarintGenesis(dAtA, i, uint64(m.Amount)) + i-- + dAtA[i] = 0x10 + } + if m.Id != 0 { + i = encodeVarintGenesis(dAtA, i, uint64(m.Id)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *HostZoneUnbonding) 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 *HostZoneUnbonding) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *HostZoneUnbonding) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.UserRedemptionRecords) > 0 { + for iNdEx := len(m.UserRedemptionRecords) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.UserRedemptionRecords[iNdEx]) + copy(dAtA[i:], m.UserRedemptionRecords[iNdEx]) + i = encodeVarintGenesis(dAtA, i, uint64(len(m.UserRedemptionRecords[iNdEx]))) + i-- + dAtA[i] = 0x3a + } + } + if m.Status != 0 { + i = encodeVarintGenesis(dAtA, i, uint64(m.Status)) + i-- + dAtA[i] = 0x30 + } + if m.UnbondingTime != 0 { + i = encodeVarintGenesis(dAtA, i, uint64(m.UnbondingTime)) + i-- + dAtA[i] = 0x28 + } + if len(m.HostZoneId) > 0 { + i -= len(m.HostZoneId) + copy(dAtA[i:], m.HostZoneId) + i = encodeVarintGenesis(dAtA, i, uint64(len(m.HostZoneId))) + i-- + dAtA[i] = 0x22 + } + if len(m.Denom) > 0 { + i -= len(m.Denom) + copy(dAtA[i:], m.Denom) + i = encodeVarintGenesis(dAtA, i, uint64(len(m.Denom))) + i-- + dAtA[i] = 0x1a + } + if m.NativeTokenAmount != 0 { + i = encodeVarintGenesis(dAtA, i, uint64(m.NativeTokenAmount)) + i-- + dAtA[i] = 0x10 + } + if m.StTokenAmount != 0 { + i = encodeVarintGenesis(dAtA, i, uint64(m.StTokenAmount)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *EpochUnbondingRecord) 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 *EpochUnbondingRecord) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *EpochUnbondingRecord) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.HostZoneUnbondings) > 0 { + for iNdEx := len(m.HostZoneUnbondings) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.HostZoneUnbondings[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + } + if m.EpochNumber != 0 { + i = encodeVarintGenesis(dAtA, i, uint64(m.EpochNumber)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *GenesisState) 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 *GenesisState) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.DepositRecordCount != 0 { + i = encodeVarintGenesis(dAtA, i, uint64(m.DepositRecordCount)) + i-- + dAtA[i] = 0x40 + } + if len(m.DepositRecordList) > 0 { + for iNdEx := len(m.DepositRecordList) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.DepositRecordList[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x3a + } + } + if len(m.EpochUnbondingRecordList) > 0 { + for iNdEx := len(m.EpochUnbondingRecordList) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.EpochUnbondingRecordList[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a + } + } + if m.UserRedemptionRecordCount != 0 { + i = encodeVarintGenesis(dAtA, i, uint64(m.UserRedemptionRecordCount)) + i-- + dAtA[i] = 0x20 + } + if len(m.UserRedemptionRecordList) > 0 { + for iNdEx := len(m.UserRedemptionRecordList) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.UserRedemptionRecordList[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + } + if len(m.PortId) > 0 { + i -= len(m.PortId) + copy(dAtA[i:], m.PortId) + i = encodeVarintGenesis(dAtA, i, uint64(len(m.PortId))) + i-- + dAtA[i] = 0x12 + } + { + size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func encodeVarintGenesis(dAtA []byte, offset int, v uint64) int { + offset -= sovGenesis(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *UserRedemptionRecord) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Id) + if l > 0 { + n += 1 + l + sovGenesis(uint64(l)) + } + l = len(m.Sender) + if l > 0 { + n += 1 + l + sovGenesis(uint64(l)) + } + l = len(m.Receiver) + if l > 0 { + n += 1 + l + sovGenesis(uint64(l)) + } + if m.Amount != 0 { + n += 1 + sovGenesis(uint64(m.Amount)) + } + l = len(m.Denom) + if l > 0 { + n += 1 + l + sovGenesis(uint64(l)) + } + l = len(m.HostZoneId) + if l > 0 { + n += 1 + l + sovGenesis(uint64(l)) + } + if m.EpochNumber != 0 { + n += 1 + sovGenesis(uint64(m.EpochNumber)) + } + if m.ClaimIsPending { + n += 2 + } + return n +} + +func (m *Params) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *RecordsPacketData) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Packet != nil { + n += m.Packet.Size() + } + return n +} + +func (m *RecordsPacketData_NoData) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.NoData != nil { + l = m.NoData.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + return n +} +func (m *NoData) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *DepositRecord) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Id != 0 { + n += 1 + sovGenesis(uint64(m.Id)) + } + if m.Amount != 0 { + n += 1 + sovGenesis(uint64(m.Amount)) + } + l = len(m.Denom) + if l > 0 { + n += 1 + l + sovGenesis(uint64(l)) + } + l = len(m.HostZoneId) + if l > 0 { + n += 1 + l + sovGenesis(uint64(l)) + } + if m.Status != 0 { + n += 1 + sovGenesis(uint64(m.Status)) + } + if m.DepositEpochNumber != 0 { + n += 1 + sovGenesis(uint64(m.DepositEpochNumber)) + } + if m.Source != 0 { + n += 1 + sovGenesis(uint64(m.Source)) + } + return n +} + +func (m *HostZoneUnbonding) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.StTokenAmount != 0 { + n += 1 + sovGenesis(uint64(m.StTokenAmount)) + } + if m.NativeTokenAmount != 0 { + n += 1 + sovGenesis(uint64(m.NativeTokenAmount)) + } + l = len(m.Denom) + if l > 0 { + n += 1 + l + sovGenesis(uint64(l)) + } + l = len(m.HostZoneId) + if l > 0 { + n += 1 + l + sovGenesis(uint64(l)) + } + if m.UnbondingTime != 0 { + n += 1 + sovGenesis(uint64(m.UnbondingTime)) + } + if m.Status != 0 { + n += 1 + sovGenesis(uint64(m.Status)) + } + if len(m.UserRedemptionRecords) > 0 { + for _, s := range m.UserRedemptionRecords { + l = len(s) + n += 1 + l + sovGenesis(uint64(l)) + } + } + return n +} + +func (m *EpochUnbondingRecord) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.EpochNumber != 0 { + n += 1 + sovGenesis(uint64(m.EpochNumber)) + } + if len(m.HostZoneUnbondings) > 0 { + for _, e := range m.HostZoneUnbondings { + l = e.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + } + return n +} + +func (m *GenesisState) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Params.Size() + n += 1 + l + sovGenesis(uint64(l)) + l = len(m.PortId) + if l > 0 { + n += 1 + l + sovGenesis(uint64(l)) + } + if len(m.UserRedemptionRecordList) > 0 { + for _, e := range m.UserRedemptionRecordList { + l = e.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + } + if m.UserRedemptionRecordCount != 0 { + n += 1 + sovGenesis(uint64(m.UserRedemptionRecordCount)) + } + if len(m.EpochUnbondingRecordList) > 0 { + for _, e := range m.EpochUnbondingRecordList { + l = e.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + } + if len(m.DepositRecordList) > 0 { + for _, e := range m.DepositRecordList { + l = e.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + } + if m.DepositRecordCount != 0 { + n += 1 + sovGenesis(uint64(m.DepositRecordCount)) + } + return n +} + +func sovGenesis(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozGenesis(x uint64) (n int) { + return sovGenesis(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *UserRedemptionRecord) 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 ErrIntOverflowGenesis + } + 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: UserRedemptionRecord: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: UserRedemptionRecord: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + 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 ErrInvalidLengthGenesis + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Id = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + 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 ErrInvalidLengthGenesis + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Sender = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Receiver", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + 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 ErrInvalidLengthGenesis + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Receiver = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) + } + m.Amount = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Amount |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Denom", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + 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 ErrInvalidLengthGenesis + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Denom = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field HostZoneId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + 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 ErrInvalidLengthGenesis + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.HostZoneId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 7: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field EpochNumber", wireType) + } + m.EpochNumber = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.EpochNumber |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 8: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ClaimIsPending", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.ClaimIsPending = bool(v != 0) + default: + iNdEx = preIndex + skippy, err := skipGenesis(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenesis + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +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 ErrIntOverflowGenesis + } + 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 { + default: + iNdEx = preIndex + skippy, err := skipGenesis(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenesis + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *RecordsPacketData) 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 ErrIntOverflowGenesis + } + 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: RecordsPacketData: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: RecordsPacketData: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NoData", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &NoData{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.Packet = &RecordsPacketData_NoData{v} + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenesis(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenesis + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *NoData) 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 ErrIntOverflowGenesis + } + 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: NoData: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: NoData: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipGenesis(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenesis + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *DepositRecord) 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 ErrIntOverflowGenesis + } + 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: DepositRecord: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DepositRecord: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) + } + m.Id = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Id |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) + } + m.Amount = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Amount |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Denom", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + 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 ErrInvalidLengthGenesis + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Denom = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field HostZoneId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + 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 ErrInvalidLengthGenesis + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.HostZoneId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) + } + m.Status = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Status |= DepositRecord_Status(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 7: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field DepositEpochNumber", wireType) + } + m.DepositEpochNumber = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.DepositEpochNumber |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 8: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Source", wireType) + } + m.Source = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Source |= DepositRecord_Source(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipGenesis(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenesis + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *HostZoneUnbonding) 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 ErrIntOverflowGenesis + } + 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: HostZoneUnbonding: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: HostZoneUnbonding: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field StTokenAmount", wireType) + } + m.StTokenAmount = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.StTokenAmount |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field NativeTokenAmount", wireType) + } + m.NativeTokenAmount = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.NativeTokenAmount |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Denom", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + 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 ErrInvalidLengthGenesis + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Denom = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field HostZoneId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + 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 ErrInvalidLengthGenesis + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.HostZoneId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field UnbondingTime", wireType) + } + m.UnbondingTime = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.UnbondingTime |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) + } + m.Status = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Status |= HostZoneUnbonding_Status(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field UserRedemptionRecords", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + 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 ErrInvalidLengthGenesis + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.UserRedemptionRecords = append(m.UserRedemptionRecords, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenesis(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenesis + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *EpochUnbondingRecord) 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 ErrIntOverflowGenesis + } + 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: EpochUnbondingRecord: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: EpochUnbondingRecord: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field EpochNumber", wireType) + } + m.EpochNumber = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.EpochNumber |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field HostZoneUnbondings", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.HostZoneUnbondings = append(m.HostZoneUnbondings, &HostZoneUnbonding{}) + if err := m.HostZoneUnbondings[len(m.HostZoneUnbondings)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenesis(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenesis + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *GenesisState) 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 ErrIntOverflowGenesis + } + 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: GenesisState: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GenesisState: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + 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 ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PortId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + 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 ErrInvalidLengthGenesis + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.PortId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field UserRedemptionRecordList", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.UserRedemptionRecordList = append(m.UserRedemptionRecordList, UserRedemptionRecord{}) + if err := m.UserRedemptionRecordList[len(m.UserRedemptionRecordList)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field UserRedemptionRecordCount", wireType) + } + m.UserRedemptionRecordCount = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.UserRedemptionRecordCount |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field EpochUnbondingRecordList", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.EpochUnbondingRecordList = append(m.EpochUnbondingRecordList, EpochUnbondingRecord{}) + if err := m.EpochUnbondingRecordList[len(m.EpochUnbondingRecordList)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DepositRecordList", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.DepositRecordList = append(m.DepositRecordList, DepositRecord{}) + if err := m.DepositRecordList[len(m.DepositRecordList)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 8: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field DepositRecordCount", wireType) + } + m.DepositRecordCount = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.DepositRecordCount |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipGenesis(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenesis + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipGenesis(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, ErrIntOverflowGenesis + } + 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, ErrIntOverflowGenesis + } + 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, ErrIntOverflowGenesis + } + 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, ErrInvalidLengthGenesis + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupGenesis + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthGenesis + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthGenesis = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowGenesis = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupGenesis = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/records/migrations/v2/types/params.go b/x/records/migrations/v2/types/params.go new file mode 100644 index 0000000000..357196ad6a --- /dev/null +++ b/x/records/migrations/v2/types/params.go @@ -0,0 +1,39 @@ +package types + +import ( + paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" + "gopkg.in/yaml.v2" +) + +var _ paramtypes.ParamSet = (*Params)(nil) + +// ParamKeyTable the param key table for launch module +func ParamKeyTable() paramtypes.KeyTable { + return paramtypes.NewKeyTable().RegisterParamSet(&Params{}) +} + +// NewParams creates a new Params instance +func NewParams() Params { + return Params{} +} + +// DefaultParams returns a default set of parameters +func DefaultParams() Params { + return NewParams() +} + +// ParamSetPairs get the params.ParamSet +func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { + return paramtypes.ParamSetPairs{} +} + +// Validate validates the set of params +func (p Params) Validate() error { + return nil +} + +// String implements the Stringer interface. +func (p Params) String() string { + out, _ := yaml.Marshal(p) + return string(out) +} diff --git a/x/records/module.go b/x/records/module.go index 44d983669f..68dac6df04 100644 --- a/x/records/module.go +++ b/x/records/module.go @@ -167,7 +167,7 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw } // ConsensusVersion implements ConsensusVersion. -func (AppModule) ConsensusVersion() uint64 { return 1 } +func (AppModule) ConsensusVersion() uint64 { return 2 } // BeginBlock executes all ABCI BeginBlock logic respective to the capability module. func (am AppModule) BeginBlock(_ sdk.Context, _ abci.RequestBeginBlock) {} diff --git a/x/stakeibc/migrations/v2/convert.go b/x/stakeibc/migrations/v2/convert.go new file mode 100644 index 0000000000..e43dcb0ebe --- /dev/null +++ b/x/stakeibc/migrations/v2/convert.go @@ -0,0 +1,67 @@ +package v2 + +import ( + sdkmath "cosmossdk.io/math" + + oldstakeibctypes "github.com/Stride-Labs/stride/v4/x/stakeibc/migrations/v2/types" + stakeibctypes "github.com/Stride-Labs/stride/v4/x/stakeibc/types" +) + +func convertToNewValidator(oldValidator oldstakeibctypes.Validator) stakeibctypes.Validator { + return stakeibctypes.Validator{ + Name: oldValidator.Name, + Address: oldValidator.Address, + Status: stakeibctypes.Validator_ValidatorStatus(oldValidator.Status), + CommissionRate: oldValidator.CommissionRate, + DelegationAmt: sdkmath.NewIntFromUint64(oldValidator.DelegationAmt), + Weight: oldValidator.Weight, + InternalExchangeRate: (*stakeibctypes.ValidatorExchangeRate)(oldValidator.InternalExchangeRate), + } +} + +func convertToNewICAAccount(oldAccount *oldstakeibctypes.ICAAccount) *stakeibctypes.ICAAccount { + if oldAccount == nil { + return nil + } + return &stakeibctypes.ICAAccount{Address: oldAccount.Address, Target: stakeibctypes.ICAAccountType(oldAccount.Target)} +} + +func convertToNewHostZone(oldHostZone oldstakeibctypes.HostZone) stakeibctypes.HostZone { + var validators []*stakeibctypes.Validator + var blacklistValidator []*stakeibctypes.Validator + + for _, oldValidator := range oldHostZone.Validators { + newValidator := convertToNewValidator(*oldValidator) + validators = append(validators, &newValidator) + } + + for _, oldValidator := range oldHostZone.BlacklistedValidators { + newValidator := convertToNewValidator(*oldValidator) + blacklistValidator = append(blacklistValidator, &newValidator) + } + + newWithdrawalAccount := convertToNewICAAccount(oldHostZone.WithdrawalAccount) + newFeeAccount := convertToNewICAAccount(oldHostZone.FeeAccount) + newDelegationAccount := convertToNewICAAccount(oldHostZone.DelegationAccount) + newRedemptionAccount := convertToNewICAAccount(oldHostZone.RedemptionAccount) + + return stakeibctypes.HostZone{ + ChainId: oldHostZone.ChainId, + ConnectionId: oldHostZone.ConnectionId, + Bech32Prefix: oldHostZone.Bech32Prefix, + TransferChannelId: oldHostZone.TransferChannelId, + Validators: validators, + BlacklistedValidators: blacklistValidator, + WithdrawalAccount: newWithdrawalAccount, + FeeAccount: newFeeAccount, + DelegationAccount: newDelegationAccount, + RedemptionAccount: newRedemptionAccount, + IbcDenom: oldHostZone.IbcDenom, + HostDenom: oldHostZone.HostDenom, + LastRedemptionRate: oldHostZone.LastRedemptionRate, + RedemptionRate: oldHostZone.RedemptionRate, + UnbondingFrequency: oldHostZone.UnbondingFrequency, + StakedBal: sdkmath.NewIntFromUint64(oldHostZone.StakedBal), + Address: oldHostZone.Address, + } +} diff --git a/x/stakeibc/migrations/v2/convert_test.go b/x/stakeibc/migrations/v2/convert_test.go new file mode 100644 index 0000000000..8eb095ccdd --- /dev/null +++ b/x/stakeibc/migrations/v2/convert_test.go @@ -0,0 +1,150 @@ +package v2 + +import ( + "testing" + + sdkmath "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/stretchr/testify/require" + + oldstakeibctypes "github.com/Stride-Labs/stride/v4/x/stakeibc/migrations/v2/types" + stakeibctypes "github.com/Stride-Labs/stride/v4/x/stakeibc/types" +) + +func TestConvertToNewValidator(t *testing.T) { + name := "name" + address := "address" + commmissionRate := uint64(2) + weight := uint64(3) + epochNumber := uint64(4) + tokensToShares := sdk.NewDec(5) + + // Only the DelegationAmt field of the Validator should change + oldValidator := oldstakeibctypes.Validator{ + Name: name, + Address: address, + Status: oldstakeibctypes.Validator_ACTIVE, + CommissionRate: commmissionRate, + DelegationAmt: uint64(1), + Weight: weight, + InternalExchangeRate: &oldstakeibctypes.ValidatorExchangeRate{ + InternalTokensToSharesRate: tokensToShares, + EpochNumber: epochNumber, + }, + } + expectedNewValidator := stakeibctypes.Validator{ + Name: name, + Address: address, + Status: stakeibctypes.Validator_ACTIVE, + CommissionRate: commmissionRate, + DelegationAmt: sdkmath.NewInt(1), + Weight: weight, + InternalExchangeRate: &stakeibctypes.ValidatorExchangeRate{ + InternalTokensToSharesRate: tokensToShares, + EpochNumber: epochNumber, + }, + } + + actualNewValidator := convertToNewValidator(oldValidator) + require.Equal(t, expectedNewValidator, actualNewValidator) +} + +func TestConvertToNewICAAccount(t *testing.T) { + oldAccount := oldstakeibctypes.ICAAccount{Address: "address", Target: oldstakeibctypes.ICAAccountType_FEE} + expectedNewAccount := stakeibctypes.ICAAccount{Address: "address", Target: stakeibctypes.ICAAccountType_FEE} + actualNewAccount := convertToNewICAAccount(&oldAccount) + require.Equal(t, expectedNewAccount, *actualNewAccount) +} + +func TestConvertToNewICAAccount_Nil(t *testing.T) { + actualNewAccount := convertToNewICAAccount(nil) + require.Nil(t, actualNewAccount) +} + +func TestConvertToNewHostZone(t *testing.T) { + chainId := "chain" + connectionId := "connection" + bechPrefix := "bech" + channelId := "channel" + valAddress := "val" + blacklistedValAddress := "black_val" + withdrawalAddress := "withdrawal" + feeAddress := "fee" + delegationAddress := "delegation" + redemptionAddress := "redemption" + ibcDenom := "ibc" + hostDenom := "host" + redemptionRate := sdk.NewDec(1) + lastRedemptionRate := sdk.NewDec(2) + unbondingFrequency := uint64(3) + hostAddress := "address" + + // The stakedBal field and validators get updated on the host zone + oldHostZone := oldstakeibctypes.HostZone{ + ChainId: chainId, + ConnectionId: connectionId, + Bech32Prefix: bechPrefix, + TransferChannelId: channelId, + Validators: []*oldstakeibctypes.Validator{ + {Address: valAddress, DelegationAmt: uint64(1)}, + }, + BlacklistedValidators: []*oldstakeibctypes.Validator{ + {Address: blacklistedValAddress, DelegationAmt: uint64(2)}, + }, + WithdrawalAccount: &oldstakeibctypes.ICAAccount{ + Address: withdrawalAddress, Target: oldstakeibctypes.ICAAccountType_WITHDRAWAL, + }, + FeeAccount: &oldstakeibctypes.ICAAccount{ + Address: feeAddress, Target: oldstakeibctypes.ICAAccountType_FEE, + }, + DelegationAccount: &oldstakeibctypes.ICAAccount{ + Address: delegationAddress, Target: oldstakeibctypes.ICAAccountType_DELEGATION, + }, + RedemptionAccount: &oldstakeibctypes.ICAAccount{ + Address: redemptionAddress, Target: oldstakeibctypes.ICAAccountType_REDEMPTION, + }, + IbcDenom: ibcDenom, + HostDenom: hostDenom, + RedemptionRate: redemptionRate, + LastRedemptionRate: lastRedemptionRate, + UnbondingFrequency: unbondingFrequency, + StakedBal: uint64(3), + Address: hostAddress, + } + + expectedNewHostZone := stakeibctypes.HostZone{ + ChainId: chainId, + ConnectionId: connectionId, + Bech32Prefix: bechPrefix, + TransferChannelId: channelId, + Validators: []*stakeibctypes.Validator{ + {Address: valAddress, DelegationAmt: sdkmath.NewInt(1)}, + }, + BlacklistedValidators: []*stakeibctypes.Validator{ + {Address: blacklistedValAddress, DelegationAmt: sdkmath.NewInt(2)}, + }, + WithdrawalAccount: &stakeibctypes.ICAAccount{ + Address: withdrawalAddress, Target: stakeibctypes.ICAAccountType_WITHDRAWAL, + }, + FeeAccount: &stakeibctypes.ICAAccount{ + Address: feeAddress, Target: stakeibctypes.ICAAccountType_FEE, + }, + DelegationAccount: &stakeibctypes.ICAAccount{ + Address: delegationAddress, Target: stakeibctypes.ICAAccountType_DELEGATION, + }, + RedemptionAccount: &stakeibctypes.ICAAccount{ + Address: redemptionAddress, Target: stakeibctypes.ICAAccountType_REDEMPTION, + }, + IbcDenom: ibcDenom, + HostDenom: hostDenom, + RedemptionRate: redemptionRate, + LastRedemptionRate: lastRedemptionRate, + UnbondingFrequency: unbondingFrequency, + StakedBal: sdkmath.NewInt(3), + Address: hostAddress, + } + + actualNewHostZone := convertToNewHostZone(oldHostZone) + require.Equal(t, expectedNewHostZone, actualNewHostZone) +} diff --git a/x/stakeibc/migrations/v2/migrations.go b/x/stakeibc/migrations/v2/migrations.go new file mode 100644 index 0000000000..0b895b4a59 --- /dev/null +++ b/x/stakeibc/migrations/v2/migrations.go @@ -0,0 +1,46 @@ +package v2 + +import ( + "github.com/cosmos/cosmos-sdk/codec" + "github.com/cosmos/cosmos-sdk/store/prefix" + storetypes "github.com/cosmos/cosmos-sdk/store/types" + + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + + oldstakeibctypes "github.com/Stride-Labs/stride/v4/x/stakeibc/migrations/v2/types" + stakeibctypes "github.com/Stride-Labs/stride/v4/x/stakeibc/types" +) + +func migrateHostZone(store sdk.KVStore, cdc codec.BinaryCodec) error { + stakeibcStore := prefix.NewStore(store, []byte(stakeibctypes.HostZoneKey)) + + iterator := stakeibcStore.Iterator(nil, nil) + defer iterator.Close() + + for ; iterator.Valid(); iterator.Next() { + // Deserialize using the old type + var oldHostZone oldstakeibctypes.HostZone + err := cdc.Unmarshal(iterator.Value(), &oldHostZone) + if err != nil { + return sdkerrors.Wrapf(err, "unable to unmarshal host zone (%v) using old data type", iterator.Key()) + } + + // Convert and serialize using the new type + newHostZone := convertToNewHostZone(oldHostZone) + newHostZoneBz, err := cdc.Marshal(&newHostZone) + if err != nil { + return sdkerrors.Wrapf(err, "unable to marshal host zone (%v) using new data type", iterator.Key()) + } + + // Store new type + stakeibcStore.Set(iterator.Key(), newHostZoneBz) + } + + return nil +} + +func MigrateStore(ctx sdk.Context, storeKey storetypes.StoreKey, cdc codec.BinaryCodec) error { + store := ctx.KVStore(storeKey) + return migrateHostZone(store, cdc) +} diff --git a/x/stakeibc/migrations/v2/types/callbacks.pb.go b/x/stakeibc/migrations/v2/types/callbacks.pb.go new file mode 100644 index 0000000000..a17458ac27 --- /dev/null +++ b/x/stakeibc/migrations/v2/types/callbacks.pb.go @@ -0,0 +1,2238 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: stride/stakeibc/callbacks.proto + +package types + +import ( + fmt "fmt" + types "github.com/cosmos/cosmos-sdk/types" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/gogo/protobuf/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// 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 + +// ---------------------- Delegation Callbacks ---------------------- // +type SplitDelegation struct { + Validator string `protobuf:"bytes,1,opt,name=validator,proto3" json:"validator,omitempty"` + Amount uint64 `protobuf:"varint,2,opt,name=amount,proto3" json:"amount,omitempty"` +} + +func (m *SplitDelegation) Reset() { *m = SplitDelegation{} } +func (m *SplitDelegation) String() string { return proto.CompactTextString(m) } +func (*SplitDelegation) ProtoMessage() {} +func (*SplitDelegation) Descriptor() ([]byte, []int) { + return fileDescriptor_f41c99b09b96a5ac, []int{0} +} +func (m *SplitDelegation) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *SplitDelegation) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_SplitDelegation.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 *SplitDelegation) XXX_Merge(src proto.Message) { + xxx_messageInfo_SplitDelegation.Merge(m, src) +} +func (m *SplitDelegation) XXX_Size() int { + return m.Size() +} +func (m *SplitDelegation) XXX_DiscardUnknown() { + xxx_messageInfo_SplitDelegation.DiscardUnknown(m) +} + +var xxx_messageInfo_SplitDelegation proto.InternalMessageInfo + +func (m *SplitDelegation) GetValidator() string { + if m != nil { + return m.Validator + } + return "" +} + +func (m *SplitDelegation) GetAmount() uint64 { + if m != nil { + return m.Amount + } + return 0 +} + +type DelegateCallback struct { + HostZoneId string `protobuf:"bytes,1,opt,name=host_zone_id,json=hostZoneId,proto3" json:"host_zone_id,omitempty"` + DepositRecordId uint64 `protobuf:"varint,2,opt,name=deposit_record_id,json=depositRecordId,proto3" json:"deposit_record_id,omitempty"` + SplitDelegations []*SplitDelegation `protobuf:"bytes,3,rep,name=split_delegations,json=splitDelegations,proto3" json:"split_delegations,omitempty"` +} + +func (m *DelegateCallback) Reset() { *m = DelegateCallback{} } +func (m *DelegateCallback) String() string { return proto.CompactTextString(m) } +func (*DelegateCallback) ProtoMessage() {} +func (*DelegateCallback) Descriptor() ([]byte, []int) { + return fileDescriptor_f41c99b09b96a5ac, []int{1} +} +func (m *DelegateCallback) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *DelegateCallback) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_DelegateCallback.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 *DelegateCallback) XXX_Merge(src proto.Message) { + xxx_messageInfo_DelegateCallback.Merge(m, src) +} +func (m *DelegateCallback) XXX_Size() int { + return m.Size() +} +func (m *DelegateCallback) XXX_DiscardUnknown() { + xxx_messageInfo_DelegateCallback.DiscardUnknown(m) +} + +var xxx_messageInfo_DelegateCallback proto.InternalMessageInfo + +func (m *DelegateCallback) GetHostZoneId() string { + if m != nil { + return m.HostZoneId + } + return "" +} + +func (m *DelegateCallback) GetDepositRecordId() uint64 { + if m != nil { + return m.DepositRecordId + } + return 0 +} + +func (m *DelegateCallback) GetSplitDelegations() []*SplitDelegation { + if m != nil { + return m.SplitDelegations + } + return nil +} + +type ClaimCallback struct { + UserRedemptionRecordId string `protobuf:"bytes,1,opt,name=user_redemption_record_id,json=userRedemptionRecordId,proto3" json:"user_redemption_record_id,omitempty"` + ChainId string `protobuf:"bytes,2,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` + EpochNumber uint64 `protobuf:"varint,3,opt,name=epoch_number,json=epochNumber,proto3" json:"epoch_number,omitempty"` +} + +func (m *ClaimCallback) Reset() { *m = ClaimCallback{} } +func (m *ClaimCallback) String() string { return proto.CompactTextString(m) } +func (*ClaimCallback) ProtoMessage() {} +func (*ClaimCallback) Descriptor() ([]byte, []int) { + return fileDescriptor_f41c99b09b96a5ac, []int{2} +} +func (m *ClaimCallback) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ClaimCallback) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ClaimCallback.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 *ClaimCallback) XXX_Merge(src proto.Message) { + xxx_messageInfo_ClaimCallback.Merge(m, src) +} +func (m *ClaimCallback) XXX_Size() int { + return m.Size() +} +func (m *ClaimCallback) XXX_DiscardUnknown() { + xxx_messageInfo_ClaimCallback.DiscardUnknown(m) +} + +var xxx_messageInfo_ClaimCallback proto.InternalMessageInfo + +func (m *ClaimCallback) GetUserRedemptionRecordId() string { + if m != nil { + return m.UserRedemptionRecordId + } + return "" +} + +func (m *ClaimCallback) GetChainId() string { + if m != nil { + return m.ChainId + } + return "" +} + +func (m *ClaimCallback) GetEpochNumber() uint64 { + if m != nil { + return m.EpochNumber + } + return 0 +} + +// ---------------------- Reinvest Callback ---------------------- // +type ReinvestCallback struct { + ReinvestAmount types.Coin `protobuf:"bytes,1,opt,name=reinvest_amount,json=reinvestAmount,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coin" json:"reinvest_amount"` + HostZoneId string `protobuf:"bytes,3,opt,name=host_zone_id,json=hostZoneId,proto3" json:"host_zone_id,omitempty"` +} + +func (m *ReinvestCallback) Reset() { *m = ReinvestCallback{} } +func (m *ReinvestCallback) String() string { return proto.CompactTextString(m) } +func (*ReinvestCallback) ProtoMessage() {} +func (*ReinvestCallback) Descriptor() ([]byte, []int) { + return fileDescriptor_f41c99b09b96a5ac, []int{3} +} +func (m *ReinvestCallback) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ReinvestCallback) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ReinvestCallback.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 *ReinvestCallback) XXX_Merge(src proto.Message) { + xxx_messageInfo_ReinvestCallback.Merge(m, src) +} +func (m *ReinvestCallback) XXX_Size() int { + return m.Size() +} +func (m *ReinvestCallback) XXX_DiscardUnknown() { + xxx_messageInfo_ReinvestCallback.DiscardUnknown(m) +} + +var xxx_messageInfo_ReinvestCallback proto.InternalMessageInfo + +func (m *ReinvestCallback) GetReinvestAmount() types.Coin { + if m != nil { + return m.ReinvestAmount + } + return types.Coin{} +} + +func (m *ReinvestCallback) GetHostZoneId() string { + if m != nil { + return m.HostZoneId + } + return "" +} + +// ---------------------- Undelegation Callbacks ---------------------- // +type UndelegateCallback struct { + HostZoneId string `protobuf:"bytes,1,opt,name=host_zone_id,json=hostZoneId,proto3" json:"host_zone_id,omitempty"` + SplitDelegations []*SplitDelegation `protobuf:"bytes,2,rep,name=split_delegations,json=splitDelegations,proto3" json:"split_delegations,omitempty"` + EpochUnbondingRecordIds []uint64 `protobuf:"varint,3,rep,packed,name=epoch_unbonding_record_ids,json=epochUnbondingRecordIds,proto3" json:"epoch_unbonding_record_ids,omitempty"` +} + +func (m *UndelegateCallback) Reset() { *m = UndelegateCallback{} } +func (m *UndelegateCallback) String() string { return proto.CompactTextString(m) } +func (*UndelegateCallback) ProtoMessage() {} +func (*UndelegateCallback) Descriptor() ([]byte, []int) { + return fileDescriptor_f41c99b09b96a5ac, []int{4} +} +func (m *UndelegateCallback) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *UndelegateCallback) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_UndelegateCallback.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 *UndelegateCallback) XXX_Merge(src proto.Message) { + xxx_messageInfo_UndelegateCallback.Merge(m, src) +} +func (m *UndelegateCallback) XXX_Size() int { + return m.Size() +} +func (m *UndelegateCallback) XXX_DiscardUnknown() { + xxx_messageInfo_UndelegateCallback.DiscardUnknown(m) +} + +var xxx_messageInfo_UndelegateCallback proto.InternalMessageInfo + +func (m *UndelegateCallback) GetHostZoneId() string { + if m != nil { + return m.HostZoneId + } + return "" +} + +func (m *UndelegateCallback) GetSplitDelegations() []*SplitDelegation { + if m != nil { + return m.SplitDelegations + } + return nil +} + +func (m *UndelegateCallback) GetEpochUnbondingRecordIds() []uint64 { + if m != nil { + return m.EpochUnbondingRecordIds + } + return nil +} + +// ---------------------- Redemption Callbacks ---------------------- // +type RedemptionCallback struct { + HostZoneId string `protobuf:"bytes,1,opt,name=host_zone_id,json=hostZoneId,proto3" json:"host_zone_id,omitempty"` + EpochUnbondingRecordIds []uint64 `protobuf:"varint,2,rep,packed,name=epoch_unbonding_record_ids,json=epochUnbondingRecordIds,proto3" json:"epoch_unbonding_record_ids,omitempty"` +} + +func (m *RedemptionCallback) Reset() { *m = RedemptionCallback{} } +func (m *RedemptionCallback) String() string { return proto.CompactTextString(m) } +func (*RedemptionCallback) ProtoMessage() {} +func (*RedemptionCallback) Descriptor() ([]byte, []int) { + return fileDescriptor_f41c99b09b96a5ac, []int{5} +} +func (m *RedemptionCallback) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *RedemptionCallback) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_RedemptionCallback.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 *RedemptionCallback) XXX_Merge(src proto.Message) { + xxx_messageInfo_RedemptionCallback.Merge(m, src) +} +func (m *RedemptionCallback) XXX_Size() int { + return m.Size() +} +func (m *RedemptionCallback) XXX_DiscardUnknown() { + xxx_messageInfo_RedemptionCallback.DiscardUnknown(m) +} + +var xxx_messageInfo_RedemptionCallback proto.InternalMessageInfo + +func (m *RedemptionCallback) GetHostZoneId() string { + if m != nil { + return m.HostZoneId + } + return "" +} + +func (m *RedemptionCallback) GetEpochUnbondingRecordIds() []uint64 { + if m != nil { + return m.EpochUnbondingRecordIds + } + return nil +} + +type Rebalancing struct { + SrcValidator string `protobuf:"bytes,1,opt,name=src_validator,json=srcValidator,proto3" json:"src_validator,omitempty"` + DstValidator string `protobuf:"bytes,2,opt,name=dst_validator,json=dstValidator,proto3" json:"dst_validator,omitempty"` + Amt uint64 `protobuf:"varint,3,opt,name=amt,proto3" json:"amt,omitempty"` +} + +func (m *Rebalancing) Reset() { *m = Rebalancing{} } +func (m *Rebalancing) String() string { return proto.CompactTextString(m) } +func (*Rebalancing) ProtoMessage() {} +func (*Rebalancing) Descriptor() ([]byte, []int) { + return fileDescriptor_f41c99b09b96a5ac, []int{6} +} +func (m *Rebalancing) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Rebalancing) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Rebalancing.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 *Rebalancing) XXX_Merge(src proto.Message) { + xxx_messageInfo_Rebalancing.Merge(m, src) +} +func (m *Rebalancing) XXX_Size() int { + return m.Size() +} +func (m *Rebalancing) XXX_DiscardUnknown() { + xxx_messageInfo_Rebalancing.DiscardUnknown(m) +} + +var xxx_messageInfo_Rebalancing proto.InternalMessageInfo + +func (m *Rebalancing) GetSrcValidator() string { + if m != nil { + return m.SrcValidator + } + return "" +} + +func (m *Rebalancing) GetDstValidator() string { + if m != nil { + return m.DstValidator + } + return "" +} + +func (m *Rebalancing) GetAmt() uint64 { + if m != nil { + return m.Amt + } + return 0 +} + +type RebalanceCallback struct { + HostZoneId string `protobuf:"bytes,1,opt,name=host_zone_id,json=hostZoneId,proto3" json:"host_zone_id,omitempty"` + Rebalancings []*Rebalancing `protobuf:"bytes,2,rep,name=rebalancings,proto3" json:"rebalancings,omitempty"` +} + +func (m *RebalanceCallback) Reset() { *m = RebalanceCallback{} } +func (m *RebalanceCallback) String() string { return proto.CompactTextString(m) } +func (*RebalanceCallback) ProtoMessage() {} +func (*RebalanceCallback) Descriptor() ([]byte, []int) { + return fileDescriptor_f41c99b09b96a5ac, []int{7} +} +func (m *RebalanceCallback) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *RebalanceCallback) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_RebalanceCallback.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 *RebalanceCallback) XXX_Merge(src proto.Message) { + xxx_messageInfo_RebalanceCallback.Merge(m, src) +} +func (m *RebalanceCallback) XXX_Size() int { + return m.Size() +} +func (m *RebalanceCallback) XXX_DiscardUnknown() { + xxx_messageInfo_RebalanceCallback.DiscardUnknown(m) +} + +var xxx_messageInfo_RebalanceCallback proto.InternalMessageInfo + +func (m *RebalanceCallback) GetHostZoneId() string { + if m != nil { + return m.HostZoneId + } + return "" +} + +func (m *RebalanceCallback) GetRebalancings() []*Rebalancing { + if m != nil { + return m.Rebalancings + } + return nil +} + +func init() { + proto.RegisterType((*SplitDelegation)(nil), "stride.stakeibc.V2SplitDelegation") + proto.RegisterType((*DelegateCallback)(nil), "stride.stakeibc.V2DelegateCallback") + proto.RegisterType((*ClaimCallback)(nil), "stride.stakeibc.V2laimCallback") + proto.RegisterType((*ReinvestCallback)(nil), "stride.stakeibc.V2ReinvestCallback") + proto.RegisterType((*UndelegateCallback)(nil), "stride.stakeibc.V2UndelegateCallback") + proto.RegisterType((*RedemptionCallback)(nil), "stride.stakeibc.V2RedemptionCallback") + proto.RegisterType((*Rebalancing)(nil), "stride.stakeibc.V2Rebalancing") + proto.RegisterType((*RebalanceCallback)(nil), "stride.stakeibc.V2RebalanceCallback") +} + +func init() { proto.RegisterFile("stride/stakeibc/callbacks.proto", fileDescriptor_f41c99b09b96a5ac) } + +var fileDescriptor_f41c99b09b96a5ac = []byte{ + // 610 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x54, 0xcd, 0x6e, 0xd3, 0x40, + 0x10, 0x8e, 0x9b, 0xaa, 0xd0, 0x49, 0x4a, 0x52, 0x0b, 0x95, 0xb4, 0xaa, 0xdc, 0xe0, 0x1e, 0xa8, + 0x90, 0x6a, 0xab, 0x85, 0x0b, 0xe2, 0x02, 0x2d, 0x12, 0xaa, 0xf8, 0x39, 0xb8, 0x2a, 0x87, 0x5e, + 0xac, 0xf5, 0xee, 0x2a, 0x59, 0xd5, 0xde, 0x8d, 0x76, 0x36, 0xe1, 0xe7, 0x09, 0x38, 0xf2, 0x1a, + 0x70, 0xe1, 0x1d, 0x38, 0xf5, 0xd8, 0x23, 0x27, 0x40, 0xed, 0x8b, 0x20, 0xaf, 0xed, 0x24, 0x4d, + 0x51, 0xa5, 0x72, 0xb2, 0xf7, 0x9b, 0x6f, 0x67, 0xbe, 0xd9, 0x6f, 0x76, 0x61, 0x03, 0x8d, 0x16, + 0x8c, 0x87, 0x68, 0xc8, 0x09, 0x17, 0x09, 0x0d, 0x29, 0x49, 0xd3, 0x84, 0xd0, 0x13, 0x0c, 0x06, + 0x5a, 0x19, 0xe5, 0xb6, 0x0a, 0x42, 0x50, 0x11, 0xd6, 0xee, 0xf6, 0x54, 0x4f, 0xd9, 0x58, 0x98, + 0xff, 0x15, 0xb4, 0x35, 0x8f, 0x2a, 0xcc, 0x14, 0x86, 0x09, 0x41, 0x1e, 0x8e, 0x76, 0x12, 0x6e, + 0xc8, 0x4e, 0x48, 0x95, 0x90, 0x45, 0xdc, 0x7f, 0x09, 0xad, 0xc3, 0x41, 0x2a, 0xcc, 0x0b, 0x9e, + 0xf2, 0x1e, 0x31, 0x42, 0x49, 0x77, 0x1d, 0x16, 0x47, 0x24, 0x15, 0x8c, 0x18, 0xa5, 0x3b, 0x4e, + 0xd7, 0xd9, 0x5a, 0x8c, 0x26, 0x80, 0xbb, 0x02, 0x0b, 0x24, 0x53, 0x43, 0x69, 0x3a, 0x73, 0x5d, + 0x67, 0x6b, 0x3e, 0x2a, 0x57, 0xfe, 0x77, 0x07, 0xda, 0x65, 0x12, 0xbe, 0x5f, 0x6a, 0x75, 0xbb, + 0xd0, 0xec, 0x2b, 0x34, 0xf1, 0x27, 0x25, 0x79, 0x2c, 0x58, 0x99, 0x0d, 0x72, 0xec, 0x58, 0x49, + 0x7e, 0xc0, 0xdc, 0x87, 0xb0, 0xcc, 0xf8, 0x40, 0xa1, 0x30, 0xb1, 0xe6, 0x54, 0x69, 0x96, 0xd3, + 0x8a, 0xcc, 0xad, 0x32, 0x10, 0x59, 0xfc, 0x80, 0xb9, 0x6f, 0x60, 0x19, 0x73, 0xad, 0x31, 0x1b, + 0x8b, 0xc5, 0x4e, 0xbd, 0x5b, 0xdf, 0x6a, 0xec, 0x76, 0x83, 0x99, 0xe3, 0x08, 0x66, 0xba, 0x8a, + 0xda, 0x78, 0x19, 0x40, 0xff, 0xb3, 0x03, 0x4b, 0xfb, 0x29, 0x11, 0xd9, 0x58, 0xee, 0x13, 0x58, + 0x1d, 0x22, 0xd7, 0xb1, 0xe6, 0x8c, 0x67, 0x83, 0x9c, 0x35, 0x25, 0xaa, 0xd0, 0xbe, 0x92, 0x13, + 0xa2, 0x71, 0x7c, 0xac, 0x6d, 0x15, 0x6e, 0xd3, 0x3e, 0x11, 0xb2, 0x92, 0xbf, 0x18, 0xdd, 0xb2, + 0xeb, 0x03, 0xe6, 0xde, 0x87, 0x26, 0x1f, 0x28, 0xda, 0x8f, 0xe5, 0x30, 0x4b, 0xb8, 0xee, 0xd4, + 0x6d, 0x77, 0x0d, 0x8b, 0xbd, 0xb5, 0x90, 0xff, 0xd5, 0x81, 0x76, 0xc4, 0x85, 0x1c, 0x71, 0x34, + 0x63, 0x35, 0x08, 0x2d, 0x5d, 0x62, 0x71, 0x79, 0xe4, 0xb9, 0x86, 0xc6, 0xee, 0x6a, 0x50, 0x98, + 0x1a, 0xe4, 0xa6, 0x06, 0xa5, 0xa9, 0xc1, 0xbe, 0x12, 0x72, 0x2f, 0x3c, 0xfd, 0xb5, 0x51, 0xfb, + 0xf6, 0x7b, 0xe3, 0x41, 0x4f, 0x98, 0xfe, 0x30, 0x09, 0xa8, 0xca, 0xc2, 0x72, 0x02, 0x8a, 0xcf, + 0x36, 0xb2, 0x93, 0xd0, 0x7c, 0x1c, 0x70, 0xb4, 0x1b, 0xa2, 0x3b, 0x55, 0x89, 0xe7, 0xb6, 0xc2, + 0x15, 0xc7, 0xea, 0xb3, 0x8e, 0xf9, 0x3f, 0x1c, 0x70, 0x8f, 0x24, 0xbb, 0xb9, 0xd5, 0xff, 0xb4, + 0x6f, 0xee, 0x7f, 0xed, 0x73, 0x9f, 0xc2, 0x5a, 0x71, 0xac, 0x43, 0x99, 0x28, 0xc9, 0x84, 0xec, + 0x4d, 0xcc, 0x2a, 0xc6, 0x62, 0x3e, 0xba, 0x67, 0x19, 0x47, 0x15, 0xa1, 0x72, 0x0b, 0x7d, 0x04, + 0x77, 0x62, 0xe2, 0x0d, 0x7a, 0xb8, 0xbe, 0xe8, 0xdc, 0xf5, 0x45, 0x05, 0x34, 0x22, 0x9e, 0x90, + 0x94, 0x48, 0x2a, 0x64, 0xcf, 0xdd, 0x84, 0x25, 0xd4, 0x34, 0x9e, 0xbd, 0x6b, 0x4d, 0xd4, 0xf4, + 0xdd, 0xf8, 0xba, 0x6d, 0xc2, 0x12, 0x43, 0x33, 0x45, 0x2a, 0x86, 0xab, 0xc9, 0xd0, 0x4c, 0x48, + 0x6d, 0xa8, 0x93, 0xcc, 0x94, 0x83, 0x95, 0xff, 0xfa, 0xef, 0x61, 0xb9, 0x2a, 0x75, 0x13, 0x8b, + 0x9e, 0x41, 0x53, 0x4f, 0x14, 0x56, 0xee, 0xac, 0x5f, 0x71, 0x67, 0xaa, 0x8d, 0xe8, 0xd2, 0x8e, + 0xbd, 0x57, 0xa7, 0xe7, 0x9e, 0x73, 0x76, 0xee, 0x39, 0x7f, 0xce, 0x3d, 0xe7, 0xcb, 0x85, 0x57, + 0x3b, 0xbb, 0xf0, 0x6a, 0x3f, 0x2f, 0xbc, 0xda, 0xf1, 0xce, 0xd4, 0x48, 0x1e, 0xda, 0x7c, 0xdb, + 0xaf, 0x49, 0x82, 0x61, 0xf9, 0xd0, 0x8d, 0x1e, 0x87, 0x1f, 0x26, 0xaf, 0x9d, 0x9d, 0xd0, 0x64, + 0xc1, 0xbe, 0x51, 0x8f, 0xfe, 0x06, 0x00, 0x00, 0xff, 0xff, 0xe7, 0x83, 0x0f, 0xbb, 0x0d, 0x05, + 0x00, 0x00, +} + +func (m *SplitDelegation) 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 *SplitDelegation) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *SplitDelegation) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Amount != 0 { + i = encodeVarintCallbacks(dAtA, i, uint64(m.Amount)) + i-- + dAtA[i] = 0x10 + } + if len(m.Validator) > 0 { + i -= len(m.Validator) + copy(dAtA[i:], m.Validator) + i = encodeVarintCallbacks(dAtA, i, uint64(len(m.Validator))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *DelegateCallback) 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 *DelegateCallback) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *DelegateCallback) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.SplitDelegations) > 0 { + for iNdEx := len(m.SplitDelegations) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.SplitDelegations[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintCallbacks(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + } + if m.DepositRecordId != 0 { + i = encodeVarintCallbacks(dAtA, i, uint64(m.DepositRecordId)) + i-- + dAtA[i] = 0x10 + } + if len(m.HostZoneId) > 0 { + i -= len(m.HostZoneId) + copy(dAtA[i:], m.HostZoneId) + i = encodeVarintCallbacks(dAtA, i, uint64(len(m.HostZoneId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *ClaimCallback) 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 *ClaimCallback) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ClaimCallback) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.EpochNumber != 0 { + i = encodeVarintCallbacks(dAtA, i, uint64(m.EpochNumber)) + i-- + dAtA[i] = 0x18 + } + if len(m.ChainId) > 0 { + i -= len(m.ChainId) + copy(dAtA[i:], m.ChainId) + i = encodeVarintCallbacks(dAtA, i, uint64(len(m.ChainId))) + i-- + dAtA[i] = 0x12 + } + if len(m.UserRedemptionRecordId) > 0 { + i -= len(m.UserRedemptionRecordId) + copy(dAtA[i:], m.UserRedemptionRecordId) + i = encodeVarintCallbacks(dAtA, i, uint64(len(m.UserRedemptionRecordId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *ReinvestCallback) 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 *ReinvestCallback) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ReinvestCallback) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.HostZoneId) > 0 { + i -= len(m.HostZoneId) + copy(dAtA[i:], m.HostZoneId) + i = encodeVarintCallbacks(dAtA, i, uint64(len(m.HostZoneId))) + i-- + dAtA[i] = 0x1a + } + { + size, err := m.ReinvestAmount.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintCallbacks(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *UndelegateCallback) 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 *UndelegateCallback) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *UndelegateCallback) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.EpochUnbondingRecordIds) > 0 { + dAtA3 := make([]byte, len(m.EpochUnbondingRecordIds)*10) + var j2 int + for _, num := range m.EpochUnbondingRecordIds { + for num >= 1<<7 { + dAtA3[j2] = uint8(uint64(num)&0x7f | 0x80) + num >>= 7 + j2++ + } + dAtA3[j2] = uint8(num) + j2++ + } + i -= j2 + copy(dAtA[i:], dAtA3[:j2]) + i = encodeVarintCallbacks(dAtA, i, uint64(j2)) + i-- + dAtA[i] = 0x1a + } + if len(m.SplitDelegations) > 0 { + for iNdEx := len(m.SplitDelegations) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.SplitDelegations[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintCallbacks(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + if len(m.HostZoneId) > 0 { + i -= len(m.HostZoneId) + copy(dAtA[i:], m.HostZoneId) + i = encodeVarintCallbacks(dAtA, i, uint64(len(m.HostZoneId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *RedemptionCallback) 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 *RedemptionCallback) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *RedemptionCallback) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.EpochUnbondingRecordIds) > 0 { + dAtA5 := make([]byte, len(m.EpochUnbondingRecordIds)*10) + var j4 int + for _, num := range m.EpochUnbondingRecordIds { + for num >= 1<<7 { + dAtA5[j4] = uint8(uint64(num)&0x7f | 0x80) + num >>= 7 + j4++ + } + dAtA5[j4] = uint8(num) + j4++ + } + i -= j4 + copy(dAtA[i:], dAtA5[:j4]) + i = encodeVarintCallbacks(dAtA, i, uint64(j4)) + i-- + dAtA[i] = 0x12 + } + if len(m.HostZoneId) > 0 { + i -= len(m.HostZoneId) + copy(dAtA[i:], m.HostZoneId) + i = encodeVarintCallbacks(dAtA, i, uint64(len(m.HostZoneId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *Rebalancing) 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 *Rebalancing) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Rebalancing) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Amt != 0 { + i = encodeVarintCallbacks(dAtA, i, uint64(m.Amt)) + i-- + dAtA[i] = 0x18 + } + if len(m.DstValidator) > 0 { + i -= len(m.DstValidator) + copy(dAtA[i:], m.DstValidator) + i = encodeVarintCallbacks(dAtA, i, uint64(len(m.DstValidator))) + i-- + dAtA[i] = 0x12 + } + if len(m.SrcValidator) > 0 { + i -= len(m.SrcValidator) + copy(dAtA[i:], m.SrcValidator) + i = encodeVarintCallbacks(dAtA, i, uint64(len(m.SrcValidator))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *RebalanceCallback) 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 *RebalanceCallback) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *RebalanceCallback) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Rebalancings) > 0 { + for iNdEx := len(m.Rebalancings) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Rebalancings[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintCallbacks(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + if len(m.HostZoneId) > 0 { + i -= len(m.HostZoneId) + copy(dAtA[i:], m.HostZoneId) + i = encodeVarintCallbacks(dAtA, i, uint64(len(m.HostZoneId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintCallbacks(dAtA []byte, offset int, v uint64) int { + offset -= sovCallbacks(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *SplitDelegation) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Validator) + if l > 0 { + n += 1 + l + sovCallbacks(uint64(l)) + } + if m.Amount != 0 { + n += 1 + sovCallbacks(uint64(m.Amount)) + } + return n +} + +func (m *DelegateCallback) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.HostZoneId) + if l > 0 { + n += 1 + l + sovCallbacks(uint64(l)) + } + if m.DepositRecordId != 0 { + n += 1 + sovCallbacks(uint64(m.DepositRecordId)) + } + if len(m.SplitDelegations) > 0 { + for _, e := range m.SplitDelegations { + l = e.Size() + n += 1 + l + sovCallbacks(uint64(l)) + } + } + return n +} + +func (m *ClaimCallback) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.UserRedemptionRecordId) + if l > 0 { + n += 1 + l + sovCallbacks(uint64(l)) + } + l = len(m.ChainId) + if l > 0 { + n += 1 + l + sovCallbacks(uint64(l)) + } + if m.EpochNumber != 0 { + n += 1 + sovCallbacks(uint64(m.EpochNumber)) + } + return n +} + +func (m *ReinvestCallback) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.ReinvestAmount.Size() + n += 1 + l + sovCallbacks(uint64(l)) + l = len(m.HostZoneId) + if l > 0 { + n += 1 + l + sovCallbacks(uint64(l)) + } + return n +} + +func (m *UndelegateCallback) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.HostZoneId) + if l > 0 { + n += 1 + l + sovCallbacks(uint64(l)) + } + if len(m.SplitDelegations) > 0 { + for _, e := range m.SplitDelegations { + l = e.Size() + n += 1 + l + sovCallbacks(uint64(l)) + } + } + if len(m.EpochUnbondingRecordIds) > 0 { + l = 0 + for _, e := range m.EpochUnbondingRecordIds { + l += sovCallbacks(uint64(e)) + } + n += 1 + sovCallbacks(uint64(l)) + l + } + return n +} + +func (m *RedemptionCallback) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.HostZoneId) + if l > 0 { + n += 1 + l + sovCallbacks(uint64(l)) + } + if len(m.EpochUnbondingRecordIds) > 0 { + l = 0 + for _, e := range m.EpochUnbondingRecordIds { + l += sovCallbacks(uint64(e)) + } + n += 1 + sovCallbacks(uint64(l)) + l + } + return n +} + +func (m *Rebalancing) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.SrcValidator) + if l > 0 { + n += 1 + l + sovCallbacks(uint64(l)) + } + l = len(m.DstValidator) + if l > 0 { + n += 1 + l + sovCallbacks(uint64(l)) + } + if m.Amt != 0 { + n += 1 + sovCallbacks(uint64(m.Amt)) + } + return n +} + +func (m *RebalanceCallback) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.HostZoneId) + if l > 0 { + n += 1 + l + sovCallbacks(uint64(l)) + } + if len(m.Rebalancings) > 0 { + for _, e := range m.Rebalancings { + l = e.Size() + n += 1 + l + sovCallbacks(uint64(l)) + } + } + return n +} + +func sovCallbacks(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozCallbacks(x uint64) (n int) { + return sovCallbacks(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *SplitDelegation) 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 ErrIntOverflowCallbacks + } + 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: SplitDelegation: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: SplitDelegation: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Validator", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCallbacks + } + 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 ErrInvalidLengthCallbacks + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthCallbacks + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Validator = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) + } + m.Amount = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCallbacks + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Amount |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipCallbacks(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthCallbacks + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *DelegateCallback) 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 ErrIntOverflowCallbacks + } + 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: DelegateCallback: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DelegateCallback: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field HostZoneId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCallbacks + } + 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 ErrInvalidLengthCallbacks + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthCallbacks + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.HostZoneId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field DepositRecordId", wireType) + } + m.DepositRecordId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCallbacks + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.DepositRecordId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SplitDelegations", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCallbacks + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthCallbacks + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthCallbacks + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SplitDelegations = append(m.SplitDelegations, &SplitDelegation{}) + if err := m.SplitDelegations[len(m.SplitDelegations)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipCallbacks(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthCallbacks + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ClaimCallback) 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 ErrIntOverflowCallbacks + } + 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: ClaimCallback: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ClaimCallback: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field UserRedemptionRecordId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCallbacks + } + 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 ErrInvalidLengthCallbacks + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthCallbacks + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.UserRedemptionRecordId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ChainId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCallbacks + } + 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 ErrInvalidLengthCallbacks + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthCallbacks + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ChainId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field EpochNumber", wireType) + } + m.EpochNumber = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCallbacks + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.EpochNumber |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipCallbacks(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthCallbacks + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ReinvestCallback) 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 ErrIntOverflowCallbacks + } + 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: ReinvestCallback: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ReinvestCallback: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ReinvestAmount", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCallbacks + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthCallbacks + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthCallbacks + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ReinvestAmount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field HostZoneId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCallbacks + } + 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 ErrInvalidLengthCallbacks + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthCallbacks + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.HostZoneId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipCallbacks(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthCallbacks + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *UndelegateCallback) 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 ErrIntOverflowCallbacks + } + 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: UndelegateCallback: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: UndelegateCallback: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field HostZoneId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCallbacks + } + 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 ErrInvalidLengthCallbacks + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthCallbacks + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.HostZoneId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SplitDelegations", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCallbacks + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthCallbacks + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthCallbacks + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SplitDelegations = append(m.SplitDelegations, &SplitDelegation{}) + if err := m.SplitDelegations[len(m.SplitDelegations)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType == 0 { + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCallbacks + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.EpochUnbondingRecordIds = append(m.EpochUnbondingRecordIds, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCallbacks + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLengthCallbacks + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLengthCallbacks + } + 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.EpochUnbondingRecordIds) == 0 { + m.EpochUnbondingRecordIds = make([]uint64, 0, elementCount) + } + for iNdEx < postIndex { + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCallbacks + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.EpochUnbondingRecordIds = append(m.EpochUnbondingRecordIds, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field EpochUnbondingRecordIds", wireType) + } + default: + iNdEx = preIndex + skippy, err := skipCallbacks(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthCallbacks + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *RedemptionCallback) 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 ErrIntOverflowCallbacks + } + 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: RedemptionCallback: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: RedemptionCallback: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field HostZoneId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCallbacks + } + 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 ErrInvalidLengthCallbacks + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthCallbacks + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.HostZoneId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType == 0 { + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCallbacks + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.EpochUnbondingRecordIds = append(m.EpochUnbondingRecordIds, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCallbacks + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLengthCallbacks + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLengthCallbacks + } + 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.EpochUnbondingRecordIds) == 0 { + m.EpochUnbondingRecordIds = make([]uint64, 0, elementCount) + } + for iNdEx < postIndex { + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCallbacks + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.EpochUnbondingRecordIds = append(m.EpochUnbondingRecordIds, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field EpochUnbondingRecordIds", wireType) + } + default: + iNdEx = preIndex + skippy, err := skipCallbacks(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthCallbacks + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Rebalancing) 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 ErrIntOverflowCallbacks + } + 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: Rebalancing: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Rebalancing: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SrcValidator", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCallbacks + } + 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 ErrInvalidLengthCallbacks + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthCallbacks + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SrcValidator = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DstValidator", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCallbacks + } + 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 ErrInvalidLengthCallbacks + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthCallbacks + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.DstValidator = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Amt", wireType) + } + m.Amt = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCallbacks + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Amt |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipCallbacks(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthCallbacks + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *RebalanceCallback) 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 ErrIntOverflowCallbacks + } + 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: RebalanceCallback: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: RebalanceCallback: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field HostZoneId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCallbacks + } + 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 ErrInvalidLengthCallbacks + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthCallbacks + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.HostZoneId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Rebalancings", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCallbacks + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthCallbacks + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthCallbacks + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Rebalancings = append(m.Rebalancings, &Rebalancing{}) + if err := m.Rebalancings[len(m.Rebalancings)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipCallbacks(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthCallbacks + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipCallbacks(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, ErrIntOverflowCallbacks + } + 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, ErrIntOverflowCallbacks + } + 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, ErrIntOverflowCallbacks + } + 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, ErrInvalidLengthCallbacks + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupCallbacks + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthCallbacks + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthCallbacks = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowCallbacks = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupCallbacks = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/stakeibc/migrations/v2/types/host_zone.pb.go b/x/stakeibc/migrations/v2/types/host_zone.pb.go new file mode 100644 index 0000000000..c61faeb6ef --- /dev/null +++ b/x/stakeibc/migrations/v2/types/host_zone.pb.go @@ -0,0 +1,1193 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: stride/stakeibc/host_zone.proto + +package types + +import ( + fmt "fmt" + _ "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/gogo/protobuf/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// 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 + +// next id: 19 +type HostZone struct { + ChainId string `protobuf:"bytes,1,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` + ConnectionId string `protobuf:"bytes,2,opt,name=connection_id,json=connectionId,proto3" json:"connection_id,omitempty"` + Bech32Prefix string `protobuf:"bytes,17,opt,name=bech32prefix,proto3" json:"bech32prefix,omitempty"` + TransferChannelId string `protobuf:"bytes,12,opt,name=transfer_channel_id,json=transferChannelId,proto3" json:"transfer_channel_id,omitempty"` + Validators []*Validator `protobuf:"bytes,3,rep,name=validators,proto3" json:"validators,omitempty"` + BlacklistedValidators []*Validator `protobuf:"bytes,4,rep,name=blacklisted_validators,json=blacklistedValidators,proto3" json:"blacklisted_validators,omitempty"` + WithdrawalAccount *ICAAccount `protobuf:"bytes,5,opt,name=withdrawal_account,json=withdrawalAccount,proto3" json:"withdrawal_account,omitempty"` + FeeAccount *ICAAccount `protobuf:"bytes,6,opt,name=fee_account,json=feeAccount,proto3" json:"fee_account,omitempty"` + DelegationAccount *ICAAccount `protobuf:"bytes,7,opt,name=delegation_account,json=delegationAccount,proto3" json:"delegation_account,omitempty"` + RedemptionAccount *ICAAccount `protobuf:"bytes,16,opt,name=redemption_account,json=redemptionAccount,proto3" json:"redemption_account,omitempty"` + // ibc denom on stride + IbcDenom string `protobuf:"bytes,8,opt,name=ibc_denom,json=ibcDenom,proto3" json:"ibc_denom,omitempty"` + // native denom on host zone + HostDenom string `protobuf:"bytes,9,opt,name=host_denom,json=hostDenom,proto3" json:"host_denom,omitempty"` + // TODO(TEST-68): Should we make this an array and store the last n redemption + // rates then calculate a TWARR? + LastRedemptionRate github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,10,opt,name=last_redemption_rate,json=lastRedemptionRate,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"last_redemption_rate"` + RedemptionRate github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,11,opt,name=redemption_rate,json=redemptionRate,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"redemption_rate"` + // stores how many days we should wait before issuing unbondings + UnbondingFrequency uint64 `protobuf:"varint,14,opt,name=unbonding_frequency,json=unbondingFrequency,proto3" json:"unbonding_frequency,omitempty"` + // TODO(TEST-101) int to dec + StakedBal uint64 `protobuf:"varint,13,opt,name=staked_bal,json=stakedBal,proto3" json:"staked_bal,omitempty"` + Address string `protobuf:"bytes,18,opt,name=address,proto3" json:"address,omitempty" yaml:"address"` +} + +func (m *HostZone) Reset() { *m = HostZone{} } +func (m *HostZone) String() string { return proto.CompactTextString(m) } +func (*HostZone) ProtoMessage() {} +func (*HostZone) Descriptor() ([]byte, []int) { + return fileDescriptor_f81bf5b42c61245a, []int{0} +} +func (m *HostZone) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *HostZone) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_HostZone.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 *HostZone) XXX_Merge(src proto.Message) { + xxx_messageInfo_HostZone.Merge(m, src) +} +func (m *HostZone) XXX_Size() int { + return m.Size() +} +func (m *HostZone) XXX_DiscardUnknown() { + xxx_messageInfo_HostZone.DiscardUnknown(m) +} + +var xxx_messageInfo_HostZone proto.InternalMessageInfo + +func (m *HostZone) GetChainId() string { + if m != nil { + return m.ChainId + } + return "" +} + +func (m *HostZone) GetConnectionId() string { + if m != nil { + return m.ConnectionId + } + return "" +} + +func (m *HostZone) GetBech32Prefix() string { + if m != nil { + return m.Bech32Prefix + } + return "" +} + +func (m *HostZone) GetTransferChannelId() string { + if m != nil { + return m.TransferChannelId + } + return "" +} + +func (m *HostZone) GetValidators() []*Validator { + if m != nil { + return m.Validators + } + return nil +} + +func (m *HostZone) GetBlacklistedValidators() []*Validator { + if m != nil { + return m.BlacklistedValidators + } + return nil +} + +func (m *HostZone) GetWithdrawalAccount() *ICAAccount { + if m != nil { + return m.WithdrawalAccount + } + return nil +} + +func (m *HostZone) GetFeeAccount() *ICAAccount { + if m != nil { + return m.FeeAccount + } + return nil +} + +func (m *HostZone) GetDelegationAccount() *ICAAccount { + if m != nil { + return m.DelegationAccount + } + return nil +} + +func (m *HostZone) GetRedemptionAccount() *ICAAccount { + if m != nil { + return m.RedemptionAccount + } + return nil +} + +func (m *HostZone) GetIbcDenom() string { + if m != nil { + return m.IbcDenom + } + return "" +} + +func (m *HostZone) GetHostDenom() string { + if m != nil { + return m.HostDenom + } + return "" +} + +func (m *HostZone) GetUnbondingFrequency() uint64 { + if m != nil { + return m.UnbondingFrequency + } + return 0 +} + +func (m *HostZone) GetStakedBal() uint64 { + if m != nil { + return m.StakedBal + } + return 0 +} + +func (m *HostZone) GetAddress() string { + if m != nil { + return m.Address + } + return "" +} + +func init() { + proto.RegisterType((*HostZone)(nil), "stride.stakeibc.V2HostZone") +} + +func init() { proto.RegisterFile("stride/stakeibc/host_zone.proto", fileDescriptor_f81bf5b42c61245a) } + +var fileDescriptor_f81bf5b42c61245a = []byte{ + // 619 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x94, 0xcb, 0x4e, 0x1b, 0x3f, + 0x14, 0xc6, 0x33, 0x7f, 0xf8, 0x93, 0xc4, 0xe1, 0x6a, 0x68, 0x35, 0x80, 0x9a, 0xa4, 0xa9, 0x54, + 0x65, 0x51, 0x66, 0x54, 0xe8, 0x0a, 0xb1, 0xe1, 0xa2, 0xaa, 0xa1, 0xdd, 0x74, 0x2a, 0xb1, 0x60, + 0x33, 0xf2, 0xd8, 0x27, 0x89, 0xc5, 0xc4, 0x4e, 0xc7, 0x0e, 0x97, 0x3e, 0x45, 0x1f, 0xa6, 0x0f, + 0xc1, 0x12, 0x75, 0x55, 0x75, 0x81, 0x2a, 0x90, 0xfa, 0x00, 0x7d, 0x82, 0x6a, 0x3c, 0x33, 0x99, + 0x21, 0x2c, 0x60, 0xd1, 0x55, 0xc6, 0xe7, 0xfb, 0xbe, 0x9f, 0xed, 0x63, 0xc7, 0xa8, 0xa1, 0x74, + 0xc4, 0x19, 0xb8, 0x4a, 0x93, 0x13, 0xe0, 0x01, 0x75, 0xfb, 0x52, 0x69, 0xff, 0x8b, 0x14, 0xe0, + 0x0c, 0x23, 0xa9, 0x25, 0x5e, 0x48, 0x0c, 0x4e, 0x66, 0x58, 0xbb, 0x97, 0x38, 0x25, 0x21, 0x67, + 0x44, 0xcb, 0x28, 0x49, 0xac, 0x3d, 0x9f, 0x34, 0x70, 0x4a, 0x7c, 0x42, 0xa9, 0x1c, 0x09, 0x9d, + 0x5a, 0x56, 0x7a, 0xb2, 0x27, 0xcd, 0xa7, 0x1b, 0x7f, 0xa5, 0xd5, 0x55, 0x2a, 0xd5, 0x40, 0x2a, + 0x3f, 0x11, 0x92, 0x41, 0x22, 0xb5, 0x7e, 0x97, 0x51, 0xe5, 0x9d, 0x54, 0xfa, 0x58, 0x0a, 0xc0, + 0xab, 0xa8, 0x42, 0xfb, 0x84, 0x0b, 0x9f, 0x33, 0xdb, 0x6a, 0x5a, 0xed, 0xaa, 0x57, 0x36, 0xe3, + 0x0e, 0xc3, 0x2f, 0xd0, 0x1c, 0x95, 0x42, 0x00, 0xd5, 0x5c, 0x1a, 0xfd, 0x3f, 0xa3, 0xcf, 0xe6, + 0xc5, 0x0e, 0xc3, 0x2d, 0x34, 0x1b, 0x00, 0xed, 0x6f, 0x6d, 0x0e, 0x23, 0xe8, 0xf2, 0x73, 0x7b, + 0x29, 0xf1, 0x14, 0x6b, 0xd8, 0x41, 0xcb, 0x3a, 0x22, 0x42, 0x75, 0x21, 0xf2, 0x69, 0x9f, 0x08, + 0x01, 0x61, 0x8c, 0x9b, 0x35, 0xd6, 0xa5, 0x4c, 0xda, 0x4f, 0x94, 0x0e, 0xc3, 0xdb, 0x08, 0x8d, + 0xfb, 0xa0, 0xec, 0xa9, 0xe6, 0x54, 0xbb, 0xb6, 0xb9, 0xe6, 0x4c, 0xf4, 0xce, 0x39, 0xca, 0x2c, + 0x5e, 0xc1, 0x8d, 0x3f, 0xa2, 0xa7, 0x41, 0x48, 0xe8, 0x49, 0xc8, 0x95, 0x06, 0xe6, 0x17, 0x38, + 0xd3, 0x0f, 0x72, 0x9e, 0x14, 0x92, 0x47, 0x39, 0xf2, 0x10, 0xe1, 0x33, 0xae, 0xfb, 0x2c, 0x22, + 0x67, 0x24, 0xcc, 0x9a, 0x6f, 0xff, 0xdf, 0xb4, 0xda, 0xb5, 0xcd, 0xf5, 0x7b, 0xb8, 0xce, 0xfe, + 0xee, 0x6e, 0x62, 0xf1, 0x96, 0xf2, 0x58, 0x5a, 0xc2, 0x3b, 0xa8, 0xd6, 0x05, 0x18, 0x43, 0x66, + 0x1e, 0x86, 0xa0, 0x2e, 0x40, 0x96, 0x3e, 0x44, 0x98, 0x41, 0x08, 0x3d, 0x62, 0x4e, 0x24, 0x83, + 0x94, 0x1f, 0xb1, 0x92, 0x3c, 0x56, 0x60, 0x45, 0xc0, 0x60, 0x30, 0xbc, 0xc3, 0x5a, 0x7c, 0x04, + 0x2b, 0x8f, 0x65, 0xac, 0x75, 0x54, 0xe5, 0x01, 0xf5, 0x19, 0x08, 0x39, 0xb0, 0x2b, 0xe6, 0x58, + 0x2b, 0x3c, 0xa0, 0x07, 0xf1, 0x18, 0x3f, 0x43, 0xc8, 0xfc, 0x0f, 0x12, 0xb5, 0x6a, 0xd4, 0x6a, + 0x5c, 0x49, 0x64, 0x81, 0x56, 0x42, 0xa2, 0xb4, 0x5f, 0x58, 0x4c, 0x44, 0x34, 0xd8, 0x28, 0x36, + 0xee, 0xed, 0x5c, 0x5e, 0x37, 0x4a, 0x3f, 0xaf, 0x1b, 0x2f, 0x7b, 0x5c, 0xf7, 0x47, 0x81, 0x43, + 0xe5, 0x20, 0xbd, 0xcc, 0xe9, 0xcf, 0x86, 0x62, 0x27, 0xae, 0xbe, 0x18, 0x82, 0x72, 0x0e, 0x80, + 0x7e, 0xff, 0xb6, 0x81, 0xd2, 0xbb, 0x7e, 0x00, 0xd4, 0xc3, 0x31, 0xd9, 0x1b, 0x83, 0x3d, 0xa2, + 0x01, 0x03, 0x5a, 0x98, 0x9c, 0xaa, 0xf6, 0x0f, 0xa6, 0x9a, 0x8f, 0xee, 0x4e, 0xe3, 0xa2, 0xe5, + 0x91, 0x08, 0xa4, 0x60, 0x5c, 0xf4, 0xfc, 0x6e, 0x04, 0x9f, 0x47, 0x20, 0xe8, 0x85, 0x3d, 0xdf, + 0xb4, 0xda, 0xd3, 0x1e, 0x1e, 0x4b, 0x6f, 0x33, 0x25, 0x6e, 0x93, 0xe9, 0x36, 0xf3, 0x03, 0x12, + 0xda, 0x73, 0xc6, 0x57, 0x4d, 0x2a, 0x7b, 0x24, 0xc4, 0xaf, 0x50, 0x99, 0x30, 0x16, 0x81, 0x52, + 0x36, 0x36, 0xcb, 0xc5, 0x7f, 0xae, 0x1b, 0xf3, 0x17, 0x64, 0x10, 0x6e, 0xb7, 0x52, 0xa1, 0xe5, + 0x65, 0x96, 0xc3, 0xe9, 0xca, 0xc2, 0xe2, 0xe2, 0xde, 0xfb, 0xcb, 0x9b, 0xba, 0x75, 0x75, 0x53, + 0xb7, 0x7e, 0xdd, 0xd4, 0xad, 0xaf, 0xb7, 0xf5, 0xd2, 0xd5, 0x6d, 0xbd, 0xf4, 0xe3, 0xb6, 0x5e, + 0x3a, 0x7e, 0x5d, 0xd8, 0xe3, 0x27, 0x73, 0xd4, 0x1b, 0x1f, 0x48, 0xa0, 0xdc, 0xf4, 0xb5, 0x39, + 0x7d, 0xe3, 0x9e, 0xe7, 0x4f, 0x8e, 0xd9, 0x72, 0x30, 0x63, 0x1e, 0x8f, 0xad, 0xbf, 0x01, 0x00, + 0x00, 0xff, 0xff, 0x55, 0xf2, 0x88, 0xfa, 0xe5, 0x04, 0x00, 0x00, +} + +func (m *HostZone) 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 *HostZone) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *HostZone) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Address) > 0 { + i -= len(m.Address) + copy(dAtA[i:], m.Address) + i = encodeVarintHostZone(dAtA, i, uint64(len(m.Address))) + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0x92 + } + if len(m.Bech32Prefix) > 0 { + i -= len(m.Bech32Prefix) + copy(dAtA[i:], m.Bech32Prefix) + i = encodeVarintHostZone(dAtA, i, uint64(len(m.Bech32Prefix))) + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0x8a + } + if m.RedemptionAccount != nil { + { + size, err := m.RedemptionAccount.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintHostZone(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0x82 + } + if m.UnbondingFrequency != 0 { + i = encodeVarintHostZone(dAtA, i, uint64(m.UnbondingFrequency)) + i-- + dAtA[i] = 0x70 + } + if m.StakedBal != 0 { + i = encodeVarintHostZone(dAtA, i, uint64(m.StakedBal)) + i-- + dAtA[i] = 0x68 + } + if len(m.TransferChannelId) > 0 { + i -= len(m.TransferChannelId) + copy(dAtA[i:], m.TransferChannelId) + i = encodeVarintHostZone(dAtA, i, uint64(len(m.TransferChannelId))) + i-- + dAtA[i] = 0x62 + } + { + size := m.RedemptionRate.Size() + i -= size + if _, err := m.RedemptionRate.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintHostZone(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x5a + { + size := m.LastRedemptionRate.Size() + i -= size + if _, err := m.LastRedemptionRate.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintHostZone(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x52 + if len(m.HostDenom) > 0 { + i -= len(m.HostDenom) + copy(dAtA[i:], m.HostDenom) + i = encodeVarintHostZone(dAtA, i, uint64(len(m.HostDenom))) + i-- + dAtA[i] = 0x4a + } + if len(m.IbcDenom) > 0 { + i -= len(m.IbcDenom) + copy(dAtA[i:], m.IbcDenom) + i = encodeVarintHostZone(dAtA, i, uint64(len(m.IbcDenom))) + i-- + dAtA[i] = 0x42 + } + if m.DelegationAccount != nil { + { + size, err := m.DelegationAccount.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintHostZone(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x3a + } + if m.FeeAccount != nil { + { + size, err := m.FeeAccount.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintHostZone(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x32 + } + if m.WithdrawalAccount != nil { + { + size, err := m.WithdrawalAccount.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintHostZone(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a + } + if len(m.BlacklistedValidators) > 0 { + for iNdEx := len(m.BlacklistedValidators) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.BlacklistedValidators[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintHostZone(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + } + } + if len(m.Validators) > 0 { + for iNdEx := len(m.Validators) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Validators[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintHostZone(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + } + if len(m.ConnectionId) > 0 { + i -= len(m.ConnectionId) + copy(dAtA[i:], m.ConnectionId) + i = encodeVarintHostZone(dAtA, i, uint64(len(m.ConnectionId))) + i-- + dAtA[i] = 0x12 + } + if len(m.ChainId) > 0 { + i -= len(m.ChainId) + copy(dAtA[i:], m.ChainId) + i = encodeVarintHostZone(dAtA, i, uint64(len(m.ChainId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintHostZone(dAtA []byte, offset int, v uint64) int { + offset -= sovHostZone(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *HostZone) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ChainId) + if l > 0 { + n += 1 + l + sovHostZone(uint64(l)) + } + l = len(m.ConnectionId) + if l > 0 { + n += 1 + l + sovHostZone(uint64(l)) + } + if len(m.Validators) > 0 { + for _, e := range m.Validators { + l = e.Size() + n += 1 + l + sovHostZone(uint64(l)) + } + } + if len(m.BlacklistedValidators) > 0 { + for _, e := range m.BlacklistedValidators { + l = e.Size() + n += 1 + l + sovHostZone(uint64(l)) + } + } + if m.WithdrawalAccount != nil { + l = m.WithdrawalAccount.Size() + n += 1 + l + sovHostZone(uint64(l)) + } + if m.FeeAccount != nil { + l = m.FeeAccount.Size() + n += 1 + l + sovHostZone(uint64(l)) + } + if m.DelegationAccount != nil { + l = m.DelegationAccount.Size() + n += 1 + l + sovHostZone(uint64(l)) + } + l = len(m.IbcDenom) + if l > 0 { + n += 1 + l + sovHostZone(uint64(l)) + } + l = len(m.HostDenom) + if l > 0 { + n += 1 + l + sovHostZone(uint64(l)) + } + l = m.LastRedemptionRate.Size() + n += 1 + l + sovHostZone(uint64(l)) + l = m.RedemptionRate.Size() + n += 1 + l + sovHostZone(uint64(l)) + l = len(m.TransferChannelId) + if l > 0 { + n += 1 + l + sovHostZone(uint64(l)) + } + if m.StakedBal != 0 { + n += 1 + sovHostZone(uint64(m.StakedBal)) + } + if m.UnbondingFrequency != 0 { + n += 1 + sovHostZone(uint64(m.UnbondingFrequency)) + } + if m.RedemptionAccount != nil { + l = m.RedemptionAccount.Size() + n += 2 + l + sovHostZone(uint64(l)) + } + l = len(m.Bech32Prefix) + if l > 0 { + n += 2 + l + sovHostZone(uint64(l)) + } + l = len(m.Address) + if l > 0 { + n += 2 + l + sovHostZone(uint64(l)) + } + return n +} + +func sovHostZone(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozHostZone(x uint64) (n int) { + return sovHostZone(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *HostZone) 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 ErrIntOverflowHostZone + } + 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: HostZone: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: HostZone: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ChainId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHostZone + } + 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 ErrInvalidLengthHostZone + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthHostZone + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ChainId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ConnectionId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHostZone + } + 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 ErrInvalidLengthHostZone + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthHostZone + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ConnectionId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Validators", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHostZone + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthHostZone + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthHostZone + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Validators = append(m.Validators, &Validator{}) + if err := m.Validators[len(m.Validators)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BlacklistedValidators", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHostZone + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthHostZone + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthHostZone + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.BlacklistedValidators = append(m.BlacklistedValidators, &Validator{}) + if err := m.BlacklistedValidators[len(m.BlacklistedValidators)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field WithdrawalAccount", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHostZone + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthHostZone + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthHostZone + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.WithdrawalAccount == nil { + m.WithdrawalAccount = &ICAAccount{} + } + if err := m.WithdrawalAccount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field FeeAccount", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHostZone + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthHostZone + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthHostZone + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.FeeAccount == nil { + m.FeeAccount = &ICAAccount{} + } + if err := m.FeeAccount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DelegationAccount", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHostZone + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthHostZone + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthHostZone + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.DelegationAccount == nil { + m.DelegationAccount = &ICAAccount{} + } + if err := m.DelegationAccount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field IbcDenom", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHostZone + } + 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 ErrInvalidLengthHostZone + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthHostZone + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.IbcDenom = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 9: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field HostDenom", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHostZone + } + 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 ErrInvalidLengthHostZone + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthHostZone + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.HostDenom = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 10: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field LastRedemptionRate", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHostZone + } + 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 ErrInvalidLengthHostZone + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthHostZone + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.LastRedemptionRate.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 11: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RedemptionRate", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHostZone + } + 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 ErrInvalidLengthHostZone + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthHostZone + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.RedemptionRate.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 12: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TransferChannelId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHostZone + } + 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 ErrInvalidLengthHostZone + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthHostZone + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.TransferChannelId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 13: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field StakedBal", wireType) + } + m.StakedBal = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHostZone + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.StakedBal |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 14: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field UnbondingFrequency", wireType) + } + m.UnbondingFrequency = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHostZone + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.UnbondingFrequency |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 16: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RedemptionAccount", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHostZone + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthHostZone + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthHostZone + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.RedemptionAccount == nil { + m.RedemptionAccount = &ICAAccount{} + } + if err := m.RedemptionAccount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 17: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Bech32Prefix", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHostZone + } + 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 ErrInvalidLengthHostZone + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthHostZone + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Bech32Prefix = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 18: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHostZone + } + 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 ErrInvalidLengthHostZone + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthHostZone + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Address = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipHostZone(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthHostZone + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipHostZone(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, ErrIntOverflowHostZone + } + 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, ErrIntOverflowHostZone + } + 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, ErrIntOverflowHostZone + } + 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, ErrInvalidLengthHostZone + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupHostZone + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthHostZone + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthHostZone = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowHostZone = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupHostZone = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/stakeibc/migrations/v2/types/ica_account.pb.go b/x/stakeibc/migrations/v2/types/ica_account.pb.go new file mode 100644 index 0000000000..6619090e53 --- /dev/null +++ b/x/stakeibc/migrations/v2/types/ica_account.pb.go @@ -0,0 +1,392 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: stride/stakeibc/ica_account.proto + +package types + +import ( + fmt "fmt" + _ "github.com/cosmos/cosmos-proto" + proto "github.com/gogo/protobuf/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// 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 + +type ICAAccountType int32 + +const ( + ICAAccountType_DELEGATION ICAAccountType = 0 + ICAAccountType_FEE ICAAccountType = 1 + ICAAccountType_WITHDRAWAL ICAAccountType = 2 + ICAAccountType_REDEMPTION ICAAccountType = 3 +) + +var ICAAccountType_name = map[int32]string{ + 0: "DELEGATION", + 1: "FEE", + 2: "WITHDRAWAL", + 3: "REDEMPTION", +} + +var ICAAccountType_value = map[string]int32{ + "DELEGATION": 0, + "FEE": 1, + "WITHDRAWAL": 2, + "REDEMPTION": 3, +} + +func (x ICAAccountType) String() string { + return proto.EnumName(ICAAccountType_name, int32(x)) +} + +func (ICAAccountType) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_2976ae6e7f6ce824, []int{0} +} + +// TODO(TEST-XX): Update these fields to be more useful (e.g. balances should be +// coins, maybe store port name directly) +type ICAAccount struct { + Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` + Target ICAAccountType `protobuf:"varint,3,opt,name=target,proto3,enum=stride.stakeibc.ICAAccountType" json:"target,omitempty"` +} + +func (m *ICAAccount) Reset() { *m = ICAAccount{} } +func (m *ICAAccount) String() string { return proto.CompactTextString(m) } +func (*ICAAccount) ProtoMessage() {} +func (*ICAAccount) Descriptor() ([]byte, []int) { + return fileDescriptor_2976ae6e7f6ce824, []int{0} +} +func (m *ICAAccount) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ICAAccount) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ICAAccount.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 *ICAAccount) XXX_Merge(src proto.Message) { + xxx_messageInfo_ICAAccount.Merge(m, src) +} +func (m *ICAAccount) XXX_Size() int { + return m.Size() +} +func (m *ICAAccount) XXX_DiscardUnknown() { + xxx_messageInfo_ICAAccount.DiscardUnknown(m) +} + +var xxx_messageInfo_ICAAccount proto.InternalMessageInfo + +func (m *ICAAccount) GetAddress() string { + if m != nil { + return m.Address + } + return "" +} + +func (m *ICAAccount) GetTarget() ICAAccountType { + if m != nil { + return m.Target + } + return ICAAccountType_DELEGATION +} + +func init() { + proto.RegisterEnum("stride.stakeibc.V2ICAAccountType", ICAAccountType_name, ICAAccountType_value) + proto.RegisterType((*ICAAccount)(nil), "stride.stakeibc.V2ICAAccount") +} + +func init() { proto.RegisterFile("stride/stakeibc/ica_account.proto", fileDescriptor_2976ae6e7f6ce824) } + +var fileDescriptor_2976ae6e7f6ce824 = []byte{ + // 285 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x2c, 0x2e, 0x29, 0xca, + 0x4c, 0x49, 0xd5, 0x2f, 0x2e, 0x49, 0xcc, 0x4e, 0xcd, 0x4c, 0x4a, 0xd6, 0xcf, 0x4c, 0x4e, 0x8c, + 0x4f, 0x4c, 0x4e, 0xce, 0x2f, 0xcd, 0x2b, 0xd1, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x87, + 0x28, 0xd1, 0x83, 0x29, 0x91, 0x92, 0x4c, 0xce, 0x2f, 0xce, 0xcd, 0x2f, 0x8e, 0x07, 0x4b, 0xeb, + 0x43, 0x38, 0x10, 0xb5, 0x4a, 0x95, 0x5c, 0x5c, 0x9e, 0xce, 0x8e, 0x8e, 0x10, 0xfd, 0x42, 0x46, + 0x5c, 0xec, 0x89, 0x29, 0x29, 0x45, 0xa9, 0xc5, 0xc5, 0x12, 0x8c, 0x0a, 0x8c, 0x1a, 0x9c, 0x4e, + 0x12, 0x97, 0xb6, 0xe8, 0x8a, 0x40, 0x35, 0x38, 0x42, 0x64, 0x82, 0x4b, 0x8a, 0x32, 0xf3, 0xd2, + 0x83, 0x60, 0x0a, 0x85, 0xcc, 0xb9, 0xd8, 0x4a, 0x12, 0x8b, 0xd2, 0x53, 0x4b, 0x24, 0x98, 0x15, + 0x18, 0x35, 0xf8, 0x8c, 0xe4, 0xf5, 0xd0, 0xac, 0xd7, 0x43, 0x58, 0x10, 0x52, 0x59, 0x90, 0x1a, + 0x04, 0x55, 0xae, 0xe5, 0xc9, 0xc5, 0x87, 0x2a, 0x23, 0xc4, 0xc7, 0xc5, 0xe5, 0xe2, 0xea, 0xe3, + 0xea, 0xee, 0x18, 0xe2, 0xe9, 0xef, 0x27, 0xc0, 0x20, 0xc4, 0xce, 0xc5, 0xec, 0xe6, 0xea, 0x2a, + 0xc0, 0x08, 0x92, 0x08, 0xf7, 0x0c, 0xf1, 0x70, 0x09, 0x72, 0x0c, 0x77, 0xf4, 0x11, 0x60, 0x02, + 0xf1, 0x83, 0x5c, 0x5d, 0x5c, 0x7d, 0x03, 0xc0, 0x0a, 0x99, 0x9d, 0xbc, 0x4f, 0x3c, 0x92, 0x63, + 0xbc, 0xf0, 0x48, 0x8e, 0xf1, 0xc1, 0x23, 0x39, 0xc6, 0x09, 0x8f, 0xe5, 0x18, 0x2e, 0x3c, 0x96, + 0x63, 0xb8, 0xf1, 0x58, 0x8e, 0x21, 0xca, 0x30, 0x3d, 0xb3, 0x24, 0xa3, 0x34, 0x49, 0x2f, 0x39, + 0x3f, 0x57, 0x3f, 0x18, 0xec, 0x2e, 0x5d, 0x9f, 0xc4, 0xa4, 0x62, 0x7d, 0x68, 0x28, 0x96, 0x99, + 0xe8, 0x57, 0x20, 0x82, 0xb2, 0xa4, 0xb2, 0x20, 0xb5, 0x38, 0x89, 0x0d, 0x1c, 0x32, 0xc6, 0x80, + 0x00, 0x00, 0x00, 0xff, 0xff, 0xcd, 0x18, 0xc2, 0x7b, 0x6a, 0x01, 0x00, 0x00, +} + +func (m *ICAAccount) 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 *ICAAccount) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ICAAccount) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Target != 0 { + i = encodeVarintIcaAccount(dAtA, i, uint64(m.Target)) + i-- + dAtA[i] = 0x18 + } + if len(m.Address) > 0 { + i -= len(m.Address) + copy(dAtA[i:], m.Address) + i = encodeVarintIcaAccount(dAtA, i, uint64(len(m.Address))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintIcaAccount(dAtA []byte, offset int, v uint64) int { + offset -= sovIcaAccount(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *ICAAccount) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Address) + if l > 0 { + n += 1 + l + sovIcaAccount(uint64(l)) + } + if m.Target != 0 { + n += 1 + sovIcaAccount(uint64(m.Target)) + } + return n +} + +func sovIcaAccount(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozIcaAccount(x uint64) (n int) { + return sovIcaAccount(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *ICAAccount) 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 ErrIntOverflowIcaAccount + } + 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: ICAAccount: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ICAAccount: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowIcaAccount + } + 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 ErrInvalidLengthIcaAccount + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthIcaAccount + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Address = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Target", wireType) + } + m.Target = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowIcaAccount + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Target |= ICAAccountType(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipIcaAccount(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthIcaAccount + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipIcaAccount(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, ErrIntOverflowIcaAccount + } + 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, ErrIntOverflowIcaAccount + } + 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, ErrIntOverflowIcaAccount + } + 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, ErrInvalidLengthIcaAccount + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupIcaAccount + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthIcaAccount + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthIcaAccount = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowIcaAccount = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupIcaAccount = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/stakeibc/migrations/v2/types/validator.pb.go b/x/stakeibc/migrations/v2/types/validator.pb.go new file mode 100644 index 0000000000..8c282396e6 --- /dev/null +++ b/x/stakeibc/migrations/v2/types/validator.pb.go @@ -0,0 +1,816 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: stride/stakeibc/validator.proto + +package types + +import ( + fmt "fmt" + _ "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/gogo/protobuf/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// 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 + +type Validator_ValidatorStatus int32 + +const ( + Validator_ACTIVE Validator_ValidatorStatus = 0 + Validator_INACTIVE Validator_ValidatorStatus = 1 +) + +var Validator_ValidatorStatus_name = map[int32]string{ + 0: "ACTIVE", + 1: "INACTIVE", +} + +var Validator_ValidatorStatus_value = map[string]int32{ + "ACTIVE": 0, + "INACTIVE": 1, +} + +func (x Validator_ValidatorStatus) String() string { + return proto.EnumName(Validator_ValidatorStatus_name, int32(x)) +} + +func (Validator_ValidatorStatus) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_5d2f32e16bd6ab8f, []int{1, 0} +} + +type ValidatorExchangeRate struct { + InternalTokensToSharesRate github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,1,opt,name=internal_tokens_to_shares_rate,json=internalTokensToSharesRate,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"internal_tokens_to_shares_rate"` + EpochNumber uint64 `protobuf:"varint,2,opt,name=epoch_number,json=epochNumber,proto3" json:"epoch_number,omitempty"` +} + +func (m *ValidatorExchangeRate) Reset() { *m = ValidatorExchangeRate{} } +func (m *ValidatorExchangeRate) String() string { return proto.CompactTextString(m) } +func (*ValidatorExchangeRate) ProtoMessage() {} +func (*ValidatorExchangeRate) Descriptor() ([]byte, []int) { + return fileDescriptor_5d2f32e16bd6ab8f, []int{0} +} +func (m *ValidatorExchangeRate) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ValidatorExchangeRate) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ValidatorExchangeRate.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 *ValidatorExchangeRate) XXX_Merge(src proto.Message) { + xxx_messageInfo_ValidatorExchangeRate.Merge(m, src) +} +func (m *ValidatorExchangeRate) XXX_Size() int { + return m.Size() +} +func (m *ValidatorExchangeRate) XXX_DiscardUnknown() { + xxx_messageInfo_ValidatorExchangeRate.DiscardUnknown(m) +} + +var xxx_messageInfo_ValidatorExchangeRate proto.InternalMessageInfo + +func (m *ValidatorExchangeRate) GetEpochNumber() uint64 { + if m != nil { + return m.EpochNumber + } + return 0 +} + +type Validator struct { + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Address string `protobuf:"bytes,2,opt,name=address,proto3" json:"address,omitempty"` + Status Validator_ValidatorStatus `protobuf:"varint,3,opt,name=status,proto3,enum=stride.stakeibc.Validator_ValidatorStatus" json:"status,omitempty"` + CommissionRate uint64 `protobuf:"varint,4,opt,name=commission_rate,json=commissionRate,proto3" json:"commission_rate,omitempty"` + DelegationAmt uint64 `protobuf:"varint,5,opt,name=delegation_amt,json=delegationAmt,proto3" json:"delegation_amt,omitempty"` + Weight uint64 `protobuf:"varint,6,opt,name=weight,proto3" json:"weight,omitempty"` + InternalExchangeRate *ValidatorExchangeRate `protobuf:"bytes,7,opt,name=internal_exchange_rate,json=internalExchangeRate,proto3" json:"internal_exchange_rate,omitempty"` +} + +func (m *Validator) Reset() { *m = Validator{} } +func (m *Validator) String() string { return proto.CompactTextString(m) } +func (*Validator) ProtoMessage() {} +func (*Validator) Descriptor() ([]byte, []int) { + return fileDescriptor_5d2f32e16bd6ab8f, []int{1} +} +func (m *Validator) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Validator) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Validator.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 *Validator) XXX_Merge(src proto.Message) { + xxx_messageInfo_Validator.Merge(m, src) +} +func (m *Validator) XXX_Size() int { + return m.Size() +} +func (m *Validator) XXX_DiscardUnknown() { + xxx_messageInfo_Validator.DiscardUnknown(m) +} + +var xxx_messageInfo_Validator proto.InternalMessageInfo + +func (m *Validator) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +func (m *Validator) GetAddress() string { + if m != nil { + return m.Address + } + return "" +} + +func (m *Validator) GetStatus() Validator_ValidatorStatus { + if m != nil { + return m.Status + } + return Validator_ACTIVE +} + +func (m *Validator) GetCommissionRate() uint64 { + if m != nil { + return m.CommissionRate + } + return 0 +} + +func (m *Validator) GetDelegationAmt() uint64 { + if m != nil { + return m.DelegationAmt + } + return 0 +} + +func (m *Validator) GetWeight() uint64 { + if m != nil { + return m.Weight + } + return 0 +} + +func (m *Validator) GetInternalExchangeRate() *ValidatorExchangeRate { + if m != nil { + return m.InternalExchangeRate + } + return nil +} + +func init() { + proto.RegisterEnum("stride.stakeibc.V2Validator_ValidatorStatus", Validator_ValidatorStatus_name, Validator_ValidatorStatus_value) + proto.RegisterType((*ValidatorExchangeRate)(nil), "stride.stakeibc.V2ValidatorExchangeRate") + proto.RegisterType((*Validator)(nil), "stride.stakeibc.V2Validator") +} + +func init() { proto.RegisterFile("stride/stakeibc/validator.proto", fileDescriptor_5d2f32e16bd6ab8f) } + +var fileDescriptor_5d2f32e16bd6ab8f = []byte{ + // 486 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x52, 0x31, 0x6f, 0xd3, 0x40, + 0x14, 0xce, 0xd1, 0xe0, 0x92, 0x6b, 0x49, 0xd0, 0x29, 0x54, 0x26, 0x83, 0x13, 0x22, 0x51, 0x22, + 0x50, 0x6c, 0x11, 0x18, 0x59, 0x12, 0xda, 0xa1, 0x02, 0x75, 0x70, 0xa2, 0x0e, 0x08, 0xc9, 0x3a, + 0xdb, 0x4f, 0xb6, 0x95, 0xd8, 0x17, 0xf9, 0x5e, 0x4a, 0xd9, 0x98, 0x99, 0xf8, 0x31, 0x5d, 0xd9, + 0x3b, 0x56, 0x9d, 0x10, 0x43, 0x85, 0x92, 0x3f, 0x82, 0x7a, 0x3e, 0x27, 0x51, 0x25, 0xa6, 0x7b, + 0xef, 0x7b, 0xdf, 0xbb, 0xef, 0xbb, 0x7b, 0x8f, 0xb6, 0x25, 0xe6, 0x49, 0x08, 0x8e, 0x44, 0x3e, + 0x85, 0xc4, 0x0f, 0x9c, 0x73, 0x3e, 0x4b, 0x42, 0x8e, 0x22, 0xb7, 0xe7, 0xb9, 0x40, 0xc1, 0x1a, + 0x05, 0xc1, 0x2e, 0x09, 0xad, 0x67, 0x81, 0x90, 0xa9, 0x90, 0x9e, 0x2a, 0x3b, 0x45, 0x52, 0x70, + 0x5b, 0xcd, 0x48, 0x44, 0xa2, 0xc0, 0xef, 0xa2, 0x02, 0xed, 0xfe, 0x22, 0xf4, 0xe9, 0x59, 0x79, + 0xeb, 0xf1, 0x45, 0x10, 0xf3, 0x2c, 0x02, 0x97, 0x23, 0xb0, 0xef, 0x84, 0x5a, 0x49, 0x86, 0x90, + 0x67, 0x7c, 0xe6, 0xa1, 0x98, 0x42, 0x26, 0x3d, 0x14, 0x9e, 0x8c, 0x79, 0x0e, 0xd2, 0xcb, 0x39, + 0x82, 0x49, 0x3a, 0xa4, 0x57, 0x1b, 0xbd, 0xbf, 0xba, 0x6d, 0x57, 0xfe, 0xdc, 0xb6, 0x0f, 0xa3, + 0x04, 0xe3, 0x85, 0x6f, 0x07, 0x22, 0xd5, 0xca, 0xfa, 0xe8, 0xcb, 0x70, 0xea, 0xe0, 0xb7, 0x39, + 0x48, 0xfb, 0x08, 0x82, 0x9b, 0xcb, 0x3e, 0xd5, 0xc6, 0x8e, 0x20, 0x70, 0x5b, 0xa5, 0xc6, 0x44, + 0x49, 0x4c, 0xc4, 0x58, 0x09, 0x28, 0x0b, 0xcf, 0xe9, 0x3e, 0xcc, 0x45, 0x10, 0x7b, 0xd9, 0x22, + 0xf5, 0x21, 0x37, 0x1f, 0x74, 0x48, 0xaf, 0xea, 0xee, 0x29, 0xec, 0x54, 0x41, 0xdd, 0x1f, 0x3b, + 0xb4, 0xb6, 0xf6, 0xcf, 0x18, 0xad, 0x66, 0x3c, 0xd5, 0xc6, 0x5c, 0x15, 0xb3, 0x01, 0xdd, 0xe5, + 0x61, 0x98, 0x83, 0x94, 0xaa, 0xbf, 0x36, 0x32, 0x6f, 0x2e, 0xfb, 0x4d, 0xed, 0x60, 0x58, 0x54, + 0xc6, 0x98, 0x27, 0x59, 0xe4, 0x96, 0x44, 0x36, 0xa2, 0x86, 0x44, 0x8e, 0x0b, 0x69, 0xee, 0x74, + 0x48, 0xaf, 0x3e, 0x78, 0x65, 0xdf, 0xfb, 0x68, 0x7b, 0xad, 0xb9, 0x89, 0xc6, 0xaa, 0xc3, 0xd5, + 0x9d, 0xec, 0x25, 0x6d, 0x04, 0x22, 0x4d, 0x13, 0x29, 0x13, 0x91, 0x15, 0xff, 0x55, 0x55, 0xfe, + 0xeb, 0x1b, 0x58, 0xbd, 0xf2, 0x05, 0xad, 0x87, 0x30, 0x83, 0x88, 0xe3, 0x1d, 0x91, 0xa7, 0x68, + 0x3e, 0x54, 0xbc, 0xc7, 0x1b, 0x74, 0x98, 0x22, 0x3b, 0xa0, 0xc6, 0x57, 0x48, 0xa2, 0x18, 0x4d, + 0x43, 0x95, 0x75, 0xc6, 0xbe, 0xd0, 0x83, 0xf5, 0x98, 0x40, 0x0f, 0xb0, 0x90, 0xdb, 0xed, 0x90, + 0xde, 0xde, 0xe0, 0xf0, 0xff, 0xde, 0xb7, 0xe7, 0xed, 0x36, 0xcb, 0x5b, 0xb6, 0xd1, 0xee, 0x6b, + 0xda, 0xb8, 0xf7, 0x40, 0x46, 0xa9, 0x31, 0xfc, 0x30, 0x39, 0x39, 0x3b, 0x7e, 0x52, 0x61, 0xfb, + 0xf4, 0xd1, 0xc9, 0xa9, 0xce, 0xc8, 0xe8, 0xe3, 0xd5, 0xd2, 0x22, 0xd7, 0x4b, 0x8b, 0xfc, 0x5d, + 0x5a, 0xe4, 0xe7, 0xca, 0xaa, 0x5c, 0xaf, 0xac, 0xca, 0xef, 0x95, 0x55, 0xf9, 0xfc, 0x66, 0x6b, + 0x37, 0xc6, 0xca, 0x4e, 0xff, 0x13, 0xf7, 0xa5, 0xa3, 0x17, 0xfc, 0xfc, 0x9d, 0x73, 0xb1, 0xd9, + 0x72, 0xb5, 0x2a, 0xbe, 0xa1, 0x16, 0xf4, 0xed, 0xbf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x61, 0x12, + 0xd4, 0xa2, 0x05, 0x03, 0x00, 0x00, +} + +func (m *ValidatorExchangeRate) 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 *ValidatorExchangeRate) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ValidatorExchangeRate) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.EpochNumber != 0 { + i = encodeVarintValidator(dAtA, i, uint64(m.EpochNumber)) + i-- + dAtA[i] = 0x10 + } + { + size := m.InternalTokensToSharesRate.Size() + i -= size + if _, err := m.InternalTokensToSharesRate.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintValidator(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *Validator) 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 *Validator) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Validator) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.InternalExchangeRate != nil { + { + size, err := m.InternalExchangeRate.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintValidator(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x3a + } + if m.Weight != 0 { + i = encodeVarintValidator(dAtA, i, uint64(m.Weight)) + i-- + dAtA[i] = 0x30 + } + if m.DelegationAmt != 0 { + i = encodeVarintValidator(dAtA, i, uint64(m.DelegationAmt)) + i-- + dAtA[i] = 0x28 + } + if m.CommissionRate != 0 { + i = encodeVarintValidator(dAtA, i, uint64(m.CommissionRate)) + i-- + dAtA[i] = 0x20 + } + if m.Status != 0 { + i = encodeVarintValidator(dAtA, i, uint64(m.Status)) + i-- + dAtA[i] = 0x18 + } + if len(m.Address) > 0 { + i -= len(m.Address) + copy(dAtA[i:], m.Address) + i = encodeVarintValidator(dAtA, i, uint64(len(m.Address))) + i-- + dAtA[i] = 0x12 + } + if len(m.Name) > 0 { + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintValidator(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintValidator(dAtA []byte, offset int, v uint64) int { + offset -= sovValidator(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *ValidatorExchangeRate) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.InternalTokensToSharesRate.Size() + n += 1 + l + sovValidator(uint64(l)) + if m.EpochNumber != 0 { + n += 1 + sovValidator(uint64(m.EpochNumber)) + } + return n +} + +func (m *Validator) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Name) + if l > 0 { + n += 1 + l + sovValidator(uint64(l)) + } + l = len(m.Address) + if l > 0 { + n += 1 + l + sovValidator(uint64(l)) + } + if m.Status != 0 { + n += 1 + sovValidator(uint64(m.Status)) + } + if m.CommissionRate != 0 { + n += 1 + sovValidator(uint64(m.CommissionRate)) + } + if m.DelegationAmt != 0 { + n += 1 + sovValidator(uint64(m.DelegationAmt)) + } + if m.Weight != 0 { + n += 1 + sovValidator(uint64(m.Weight)) + } + if m.InternalExchangeRate != nil { + l = m.InternalExchangeRate.Size() + n += 1 + l + sovValidator(uint64(l)) + } + return n +} + +func sovValidator(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozValidator(x uint64) (n int) { + return sovValidator(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *ValidatorExchangeRate) 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 ErrIntOverflowValidator + } + 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: ValidatorExchangeRate: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ValidatorExchangeRate: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field InternalTokensToSharesRate", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowValidator + } + 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 ErrInvalidLengthValidator + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthValidator + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.InternalTokensToSharesRate.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field EpochNumber", wireType) + } + m.EpochNumber = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowValidator + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.EpochNumber |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipValidator(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthValidator + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Validator) 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 ErrIntOverflowValidator + } + 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: Validator: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Validator: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowValidator + } + 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 ErrInvalidLengthValidator + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthValidator + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowValidator + } + 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 ErrInvalidLengthValidator + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthValidator + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Address = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) + } + m.Status = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowValidator + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Status |= Validator_ValidatorStatus(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field CommissionRate", wireType) + } + m.CommissionRate = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowValidator + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.CommissionRate |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field DelegationAmt", wireType) + } + m.DelegationAmt = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowValidator + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.DelegationAmt |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Weight", wireType) + } + m.Weight = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowValidator + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Weight |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field InternalExchangeRate", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowValidator + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthValidator + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthValidator + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.InternalExchangeRate == nil { + m.InternalExchangeRate = &ValidatorExchangeRate{} + } + if err := m.InternalExchangeRate.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipValidator(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthValidator + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipValidator(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, ErrIntOverflowValidator + } + 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, ErrIntOverflowValidator + } + 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, ErrIntOverflowValidator + } + 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, ErrInvalidLengthValidator + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupValidator + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthValidator + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthValidator = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowValidator = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupValidator = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/stakeibc/module.go b/x/stakeibc/module.go index 0683afb03d..ff1a29834d 100644 --- a/x/stakeibc/module.go +++ b/x/stakeibc/module.go @@ -173,7 +173,7 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw } // ConsensusVersion implements ConsensusVersion. -func (AppModule) ConsensusVersion() uint64 { return 1 } +func (AppModule) ConsensusVersion() uint64 { return 2 } // BeginBlock executes all ABCI BeginBlock logic respective to the capability module. func (am AppModule) BeginBlock(ctx sdk.Context, _ abci.RequestBeginBlock) { diff --git a/x/stakeibc/types/ica_account.pb.go b/x/stakeibc/types/ica_account.pb.go index d53e334d9c..e275a9d80d 100644 --- a/x/stakeibc/types/ica_account.pb.go +++ b/x/stakeibc/types/ica_account.pb.go @@ -54,8 +54,6 @@ func (ICAAccountType) EnumDescriptor() ([]byte, []int) { return fileDescriptor_2976ae6e7f6ce824, []int{0} } -// TODO(TEST-XX): Update these fields to be more useful (e.g. balances should be -// coins, maybe store port name directly) type ICAAccount struct { Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` Target ICAAccountType `protobuf:"varint,3,opt,name=target,proto3,enum=stride.stakeibc.ICAAccountType" json:"target,omitempty"` @@ -116,25 +114,26 @@ func init() { func init() { proto.RegisterFile("stride/stakeibc/ica_account.proto", fileDescriptor_2976ae6e7f6ce824) } var fileDescriptor_2976ae6e7f6ce824 = []byte{ - // 285 bytes of a gzipped FileDescriptorProto + // 291 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x2c, 0x2e, 0x29, 0xca, 0x4c, 0x49, 0xd5, 0x2f, 0x2e, 0x49, 0xcc, 0x4e, 0xcd, 0x4c, 0x4a, 0xd6, 0xcf, 0x4c, 0x4e, 0x8c, 0x4f, 0x4c, 0x4e, 0xce, 0x2f, 0xcd, 0x2b, 0xd1, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x87, 0x28, 0xd1, 0x83, 0x29, 0x91, 0x92, 0x4c, 0xce, 0x2f, 0xce, 0xcd, 0x2f, 0x8e, 0x07, 0x4b, 0xeb, - 0x43, 0x38, 0x10, 0xb5, 0x4a, 0x95, 0x5c, 0x5c, 0x9e, 0xce, 0x8e, 0x8e, 0x10, 0xfd, 0x42, 0x46, + 0x43, 0x38, 0x10, 0xb5, 0x4a, 0xf5, 0x5c, 0x5c, 0x9e, 0xce, 0x8e, 0x8e, 0x10, 0xfd, 0x42, 0x46, 0x5c, 0xec, 0x89, 0x29, 0x29, 0x45, 0xa9, 0xc5, 0xc5, 0x12, 0x8c, 0x0a, 0x8c, 0x1a, 0x9c, 0x4e, 0x12, 0x97, 0xb6, 0xe8, 0x8a, 0x40, 0x35, 0x38, 0x42, 0x64, 0x82, 0x4b, 0x8a, 0x32, 0xf3, 0xd2, 0x83, 0x60, 0x0a, 0x85, 0xcc, 0xb9, 0xd8, 0x4a, 0x12, 0x8b, 0xd2, 0x53, 0x4b, 0x24, 0x98, 0x15, 0x18, 0x35, 0xf8, 0x8c, 0xe4, 0xf5, 0xd0, 0xac, 0xd7, 0x43, 0x58, 0x10, 0x52, 0x59, 0x90, 0x1a, - 0x04, 0x55, 0xae, 0xe5, 0xc9, 0xc5, 0x87, 0x2a, 0x23, 0xc4, 0xc7, 0xc5, 0xe5, 0xe2, 0xea, 0xe3, - 0xea, 0xee, 0x18, 0xe2, 0xe9, 0xef, 0x27, 0xc0, 0x20, 0xc4, 0xce, 0xc5, 0xec, 0xe6, 0xea, 0x2a, - 0xc0, 0x08, 0x92, 0x08, 0xf7, 0x0c, 0xf1, 0x70, 0x09, 0x72, 0x0c, 0x77, 0xf4, 0x11, 0x60, 0x02, - 0xf1, 0x83, 0x5c, 0x5d, 0x5c, 0x7d, 0x03, 0xc0, 0x0a, 0x99, 0x9d, 0xbc, 0x4f, 0x3c, 0x92, 0x63, - 0xbc, 0xf0, 0x48, 0x8e, 0xf1, 0xc1, 0x23, 0x39, 0xc6, 0x09, 0x8f, 0xe5, 0x18, 0x2e, 0x3c, 0x96, - 0x63, 0xb8, 0xf1, 0x58, 0x8e, 0x21, 0xca, 0x30, 0x3d, 0xb3, 0x24, 0xa3, 0x34, 0x49, 0x2f, 0x39, - 0x3f, 0x57, 0x3f, 0x18, 0xec, 0x2e, 0x5d, 0x9f, 0xc4, 0xa4, 0x62, 0x7d, 0x68, 0x28, 0x96, 0x99, - 0xe8, 0x57, 0x20, 0x82, 0xb2, 0xa4, 0xb2, 0x20, 0xb5, 0x38, 0x89, 0x0d, 0x1c, 0x32, 0xc6, 0x80, - 0x00, 0x00, 0x00, 0xff, 0xff, 0xcd, 0x18, 0xc2, 0x7b, 0x6a, 0x01, 0x00, 0x00, + 0x04, 0x55, 0xee, 0xc5, 0xc2, 0xc1, 0x24, 0xc0, 0xac, 0xe5, 0xc9, 0xc5, 0x87, 0x2a, 0x2f, 0xc4, + 0xc7, 0xc5, 0xe5, 0xe2, 0xea, 0xe3, 0xea, 0xee, 0x18, 0xe2, 0xe9, 0xef, 0x27, 0xc0, 0x20, 0xc4, + 0xce, 0xc5, 0xec, 0xe6, 0xea, 0x2a, 0xc0, 0x08, 0x92, 0x08, 0xf7, 0x0c, 0xf1, 0x70, 0x09, 0x72, + 0x0c, 0x77, 0xf4, 0x11, 0x60, 0x02, 0xf1, 0x83, 0x5c, 0x5d, 0x5c, 0x7d, 0x03, 0xc0, 0x0a, 0x99, + 0x9d, 0xbc, 0x4f, 0x3c, 0x92, 0x63, 0xbc, 0xf0, 0x48, 0x8e, 0xf1, 0xc1, 0x23, 0x39, 0xc6, 0x09, + 0x8f, 0xe5, 0x18, 0x2e, 0x3c, 0x96, 0x63, 0xb8, 0xf1, 0x58, 0x8e, 0x21, 0xca, 0x30, 0x3d, 0xb3, + 0x24, 0xa3, 0x34, 0x49, 0x2f, 0x39, 0x3f, 0x57, 0x3f, 0x18, 0xec, 0x3a, 0x5d, 0x9f, 0xc4, 0xa4, + 0x62, 0x7d, 0x68, 0x58, 0x96, 0x99, 0xe8, 0x57, 0x20, 0x02, 0xb4, 0xa4, 0xb2, 0x20, 0xb5, 0x38, + 0x89, 0x0d, 0x1c, 0x3e, 0xc6, 0x80, 0x00, 0x00, 0x00, 0xff, 0xff, 0x9a, 0x9d, 0x89, 0x4a, 0x70, + 0x01, 0x00, 0x00, } func (m *ICAAccount) Marshal() (dAtA []byte, err error) {