diff --git a/proto/dymensionxyz/dymension/sequencer/sequencer.proto b/proto/dymensionxyz/dymension/sequencer/sequencer.proto index bae19246e..1e1fdf9f1 100644 --- a/proto/dymensionxyz/dymension/sequencer/sequencer.proto +++ b/proto/dymensionxyz/dymension/sequencer/sequencer.proto @@ -38,3 +38,13 @@ message Sequencer { // unbond_time defines, if unbonding, the min time for the sequencer to complete unbonding. google.protobuf.Timestamp unbond_time = 10 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; } + +// BondReduction defines an object which holds the information about the sequencer and its queued unbonding amount +message BondReduction { + // sequencerAddress is the bech32-encoded address of the sequencer account which is the account that the message was sent from. + string sequencer_address = 1; + // unbondAmount is the amount of tokens to be unbonded. + cosmos.base.v1beta1.Coin unbond_amount = 2 [(gogoproto.nullable) = false]; + // unbond_time defines, if unbonding, the min time for the sequencer to complete unbonding. + google.protobuf.Timestamp unbond_time = 3 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; +} diff --git a/proto/dymensionxyz/dymension/sequencer/tx.proto b/proto/dymensionxyz/dymension/sequencer/tx.proto index 23116f85d..fba0bead3 100644 --- a/proto/dymensionxyz/dymension/sequencer/tx.proto +++ b/proto/dymensionxyz/dymension/sequencer/tx.proto @@ -23,6 +23,9 @@ service Msg { // IncreaseBond defines a method for increasing a sequencer's bond amount rpc IncreaseBond (MsgIncreaseBond) returns (MsgIncreaseBondResponse); + + // DecreaseBond defines a method for decreasing the bond of a sequencer. + rpc DecreaseBond (MsgDecreaseBond) returns (MsgDecreaseBondResponse); } message MsgCreateSequencer { @@ -77,4 +80,19 @@ message MsgIncreaseBond { } // MsgIncreaseBondResponse defines the Msg/IncreaseBond response type. -message MsgIncreaseBondResponse {} \ No newline at end of file +message MsgIncreaseBondResponse {} + +// MsgDecreaseBond defines a SDK message for decreasing the bond of a sequencer. +message MsgDecreaseBond { + option (cosmos.msg.v1.signer) = "creator"; + // creator is the bech32-encoded address of the sequencer account which is the account that the message was sent from. + string creator = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + + // decrease_amount is the amount of coins to decrease the bond by. + cosmos.base.v1beta1.Coin decrease_amount = 2 [(gogoproto.nullable) = false]; +} + +// MsgDecreaseBondResponse defines the Msg/DecreaseBond response type. +message MsgDecreaseBondResponse { + google.protobuf.Timestamp completion_time = 1 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; +} diff --git a/x/sequencer/handler.go b/x/sequencer/handler.go index 0b23a857f..2cf9fdc03 100644 --- a/x/sequencer/handler.go +++ b/x/sequencer/handler.go @@ -30,6 +30,9 @@ func NewHandler(k keeper.Keeper) sdk.Handler { case *types.MsgIncreaseBond: res, err := msgServer.IncreaseBond(sdk.WrapSDKContext(ctx), msg) return sdk.WrapServiceResult(ctx, res, err) + case *types.MsgDecreaseBond: + res, err := msgServer.DecreaseBond(sdk.WrapSDKContext(ctx), msg) + return sdk.WrapServiceResult(ctx, res, err) default: errMsg := fmt.Sprintf("unrecognized %s message type: %T", types.ModuleName, msg) return nil, errorsmod.Wrap(types.ErrUnknownRequest, errMsg) diff --git a/x/sequencer/keeper/hooks_test.go b/x/sequencer/keeper/hooks_test.go index d1c952ac1..2d73242b9 100644 --- a/x/sequencer/keeper/hooks_test.go +++ b/x/sequencer/keeper/hooks_test.go @@ -4,6 +4,7 @@ import ( "time" "github.com/cosmos/cosmos-sdk/crypto/keys/ed25519" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/dymensionxyz/dymension/v3/x/sequencer/types" ) @@ -21,7 +22,7 @@ func (suite *SequencerTestSuite) TestFraudSubmittedHook() { // create 5 sequencers for rollapp1 seqAddrs := make([]string, numOfSequencers) - seqAddrs[0] = suite.CreateDefaultSequencer(suite.Ctx, rollappId, pk) + seqAddrs[0] = suite.CreateSequencerWithBond(suite.Ctx, rollappId, bond.AddAmount(sdk.NewInt(20)), pk) for i := 1; i < numOfSequencers; i++ { pki := ed25519.GenPrivKey().PubKey() @@ -29,7 +30,14 @@ func (suite *SequencerTestSuite) TestFraudSubmittedHook() { } proposer := seqAddrs[0] - err := keeper.RollappHooks().FraudSubmitted(suite.Ctx, rollappId, 0, proposer) + // queue the third sequencer to reduce bond + unbondMsg := types.MsgDecreaseBond{Creator: seqAddrs[0], DecreaseAmount: sdk.NewInt64Coin(bond.Denom, 10)} + resp, err := suite.msgServer.DecreaseBond(suite.Ctx, &unbondMsg) + suite.Require().NoError(err) + bds := keeper.GetMatureDecreasingBondSequencers(suite.Ctx, resp.GetCompletionTime()) + suite.Require().Len(bds, 1) + + err = keeper.RollappHooks().FraudSubmitted(suite.Ctx, rollappId, 0, proposer) suite.Require().NoError(err) // check if proposer is slashed @@ -45,4 +53,8 @@ func (suite *SequencerTestSuite) TestFraudSubmittedHook() { suite.Require().False(sequencer.Proposer) suite.Require().Equal(sequencer.Status, types.Unbonded) } + + // check if bond reduction queue is pruned + bds = keeper.GetMatureDecreasingBondSequencers(suite.Ctx, resp.GetCompletionTime()) + suite.Require().Len(bds, 0) } diff --git a/x/sequencer/keeper/msg_server_decrease_bond.go b/x/sequencer/keeper/msg_server_decrease_bond.go new file mode 100644 index 000000000..5ecb807b0 --- /dev/null +++ b/x/sequencer/keeper/msg_server_decrease_bond.go @@ -0,0 +1,49 @@ +package keeper + +import ( + "context" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/dymensionxyz/dymension/v3/x/sequencer/types" +) + +// DecreaseBond implements types.MsgServer. +func (k msgServer) DecreaseBond(goCtx context.Context, msg *types.MsgDecreaseBond) (*types.MsgDecreaseBondResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + + sequencer, err := k.bondUpdateAllowed(ctx, msg.GetCreator()) + if err != nil { + return nil, err + } + + effectiveBond := sequencer.Tokens + if bds := k.getSequencerDecreasingBonds(ctx, msg.Creator); len(bds) > 0 { + for _, bd := range bds { + effectiveBond = effectiveBond.Sub(bd.UnbondAmount) + } + } + + // Check if the sequencer has enough bond to decrease + if !effectiveBond.IsZero() && effectiveBond.IsAllLTE(sdk.NewCoins(msg.DecreaseAmount)) { + return nil, types.ErrInsufficientBond + } + + // Check if the bond reduction will make the sequencer's bond less than the minimum bond value + minBondValue := k.GetParams(ctx).MinBond + if !minBondValue.IsNil() && !minBondValue.IsZero() { + decreasedBondValue := effectiveBond.Sub(msg.DecreaseAmount) + if decreasedBondValue.IsAllLT(sdk.NewCoins(minBondValue)) { + return nil, types.ErrInsufficientBond + } + } + completionTime := ctx.BlockHeader().Time.Add(k.UnbondingTime(ctx)) + k.setDecreasingBondQueue(ctx, types.BondReduction{ + SequencerAddress: msg.Creator, + UnbondAmount: msg.DecreaseAmount, + UnbondTime: completionTime, + }) + + return &types.MsgDecreaseBondResponse{ + CompletionTime: completionTime, + }, nil +} diff --git a/x/sequencer/keeper/msg_server_decrease_bond_test.go b/x/sequencer/keeper/msg_server_decrease_bond_test.go new file mode 100644 index 000000000..554cf7c7a --- /dev/null +++ b/x/sequencer/keeper/msg_server_decrease_bond_test.go @@ -0,0 +1,128 @@ +package keeper_test + +import ( + "github.com/cosmos/cosmos-sdk/crypto/keys/ed25519" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/dymensionxyz/dymension/v3/x/sequencer/types" +) + +func (suite *SequencerTestSuite) TestDecreaseBond() { + suite.SetupTest() + bondDenom := types.DefaultParams().MinBond.Denom + rollappId, pk := suite.CreateDefaultRollapp() + // setup a default sequencer with has minBond + 20token + defaultSequencerAddress := suite.CreateSequencerWithBond(suite.Ctx, rollappId, bond.AddAmount(sdk.NewInt(20)), pk) + // setup an unbonded sequencer + unbondedPk := ed25519.GenPrivKey().PubKey() + unbondedSequencerAddress := suite.CreateDefaultSequencer(suite.Ctx, rollappId, unbondedPk) + unbondedSequencer, _ := suite.App.SequencerKeeper.GetSequencer(suite.Ctx, unbondedSequencerAddress) + unbondedSequencer.Status = types.Unbonded + suite.App.SequencerKeeper.UpdateSequencer(suite.Ctx, unbondedSequencer, unbondedSequencer.Status) + // setup a jailed sequencer + jailedPk := ed25519.GenPrivKey().PubKey() + jailedSequencerAddress := suite.CreateDefaultSequencer(suite.Ctx, rollappId, jailedPk) + jailedSequencer, _ := suite.App.SequencerKeeper.GetSequencer(suite.Ctx, jailedSequencerAddress) + jailedSequencer.Jailed = true + suite.App.SequencerKeeper.UpdateSequencer(suite.Ctx, jailedSequencer, jailedSequencer.Status) + + testCase := []struct { + name string + msg types.MsgDecreaseBond + expectedErr error + }{ + { + name: "invalid sequencer", + msg: types.MsgDecreaseBond{ + Creator: "invalid_address", + DecreaseAmount: sdk.NewInt64Coin(bondDenom, 10), + }, + expectedErr: types.ErrUnknownSequencer, + }, + { + name: "sequencer is not bonded", + msg: types.MsgDecreaseBond{ + Creator: unbondedSequencerAddress, + DecreaseAmount: sdk.NewInt64Coin(bondDenom, 10), + }, + expectedErr: types.ErrInvalidSequencerStatus, + }, + { + name: "sequencer is jailed", + msg: types.MsgDecreaseBond{ + Creator: jailedSequencerAddress, + DecreaseAmount: sdk.NewInt64Coin(bondDenom, 10), + }, + expectedErr: types.ErrSequencerJailed, + }, + { + name: "decreased bond value to less than minimum bond value", + msg: types.MsgDecreaseBond{ + Creator: defaultSequencerAddress, + DecreaseAmount: sdk.NewInt64Coin(bondDenom, 100), + }, + expectedErr: types.ErrInsufficientBond, + }, + { + name: "trying to decrease more bond than they have tokens bonded", + msg: types.MsgDecreaseBond{ + Creator: defaultSequencerAddress, + DecreaseAmount: bond.AddAmount(sdk.NewInt(30)), + }, + expectedErr: types.ErrInsufficientBond, + }, + { + name: "valid decrease bond", + msg: types.MsgDecreaseBond{ + Creator: defaultSequencerAddress, + DecreaseAmount: sdk.NewInt64Coin(bondDenom, 10), + }, + }, + } + + for _, tc := range testCase { + suite.Run(tc.name, func() { + resp, err := suite.msgServer.DecreaseBond(suite.Ctx, &tc.msg) + if tc.expectedErr != nil { + suite.Require().ErrorIs(err, tc.expectedErr) + } else { + suite.Require().NoError(err) + suite.Require().NotNil(resp) + expectedCompletionTime := suite.Ctx.BlockHeader().Time.Add(suite.App.SequencerKeeper.UnbondingTime(suite.Ctx)) + suite.Require().Equal(expectedCompletionTime, resp.CompletionTime) + // check if the unbonding is set correctly + unbondings := suite.App.SequencerKeeper.GetMatureDecreasingBondSequencers(suite.Ctx, expectedCompletionTime) + suite.Require().Len(unbondings, 1) + suite.Require().Equal(tc.msg.Creator, unbondings[0].SequencerAddress) + suite.Require().Equal(tc.msg.DecreaseAmount, unbondings[0].UnbondAmount) + } + }) + } +} + +func (suite *SequencerTestSuite) TestDecreaseBond_BondDecreaseInProgress() { + suite.SetupTest() + bondDenom := types.DefaultParams().MinBond.Denom + rollappId, pk := suite.CreateDefaultRollapp() + // setup a default sequencer with has minBond + 20token + defaultSequencerAddress := suite.CreateSequencerWithBond(suite.Ctx, rollappId, bond.AddAmount(sdk.NewInt(20)), pk) + // decrease the bond of the sequencer + _, err := suite.msgServer.DecreaseBond(suite.Ctx, &types.MsgDecreaseBond{ + Creator: defaultSequencerAddress, + DecreaseAmount: sdk.NewInt64Coin(bondDenom, 10), + }) + suite.Require().NoError(err) + // try to decrease the bond again - should be fine as still not below minbond + suite.Ctx = suite.Ctx.WithBlockHeight(suite.Ctx.BlockHeight() + 1).WithBlockTime(suite.Ctx.BlockTime().Add(10)) + _, err = suite.msgServer.DecreaseBond(suite.Ctx, &types.MsgDecreaseBond{ + Creator: defaultSequencerAddress, + DecreaseAmount: sdk.NewInt64Coin(bondDenom, 10), + }) + suite.Require().NoError(err) + // try to decrease the bond again - should err as below minbond + suite.Ctx = suite.Ctx.WithBlockHeight(suite.Ctx.BlockHeight() + 1).WithBlockTime(suite.Ctx.BlockTime().Add(10)) + _, err = suite.msgServer.DecreaseBond(suite.Ctx, &types.MsgDecreaseBond{ + Creator: defaultSequencerAddress, + DecreaseAmount: sdk.NewInt64Coin(bondDenom, 10), + }) + suite.Require().ErrorIs(err, types.ErrInsufficientBond) +} diff --git a/x/sequencer/keeper/msg_server_increase_bond.go b/x/sequencer/keeper/msg_server_increase_bond.go index d2af9fac5..149934d0b 100644 --- a/x/sequencer/keeper/msg_server_increase_bond.go +++ b/x/sequencer/keeper/msg_server_increase_bond.go @@ -11,7 +11,7 @@ import ( func (k msgServer) IncreaseBond(goCtx context.Context, msg *types.MsgIncreaseBond) (*types.MsgIncreaseBondResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) - sequencer, err := k.bondUpdateAllowed(ctx, msg) + sequencer, err := k.bondUpdateAllowed(ctx, msg.GetCreator()) if err != nil { return nil, err } @@ -39,9 +39,9 @@ func (k msgServer) IncreaseBond(goCtx context.Context, msg *types.MsgIncreaseBon return &types.MsgIncreaseBondResponse{}, err } -func (k msgServer) bondUpdateAllowed(ctx sdk.Context, msg *types.MsgIncreaseBond) (types.Sequencer, error) { +func (k msgServer) bondUpdateAllowed(ctx sdk.Context, senderAddress string) (types.Sequencer, error) { // check if the sequencer already exists - sequencer, found := k.GetSequencer(ctx, msg.Creator) + sequencer, found := k.GetSequencer(ctx, senderAddress) if !found { return types.Sequencer{}, types.ErrUnknownSequencer } diff --git a/x/sequencer/keeper/sequencer.go b/x/sequencer/keeper/sequencer.go index 74c81bb8b..8ba853482 100644 --- a/x/sequencer/keeper/sequencer.go +++ b/x/sequencer/keeper/sequencer.go @@ -172,3 +172,55 @@ func (k Keeper) removeUnbondingSequencer(ctx sdk.Context, sequencer types.Sequen unbondingQueueKey := types.UnbondingSequencerKey(sequencer.Address, sequencer.UnbondTime) store.Delete(unbondingQueueKey) } + +/* -------------------------------------------------------------------------- */ +/* Decreasing Bond Queue */ +/* -------------------------------------------------------------------------- */ + +// GetMatureDecreasingBondSequencers returns all decreasing bond items for the given time +func (k Keeper) GetMatureDecreasingBondSequencers(ctx sdk.Context, endTime time.Time) (unbondings []types.BondReduction) { + store := ctx.KVStore(k.storeKey) + iterator := store.Iterator(types.DecreasingBondQueueKey, sdk.PrefixEndBytes(types.DecreasingBondQueueByTimeKey(endTime))) + defer iterator.Close() // nolint: errcheck + for ; iterator.Valid(); iterator.Next() { + var b types.BondReduction + k.cdc.MustUnmarshal(iterator.Value(), &b) + unbondings = append(unbondings, b) + } + return +} + +// setDecreasingBondQueue sets the bond reduction item in the decreasing bond queue +func (k Keeper) setDecreasingBondQueue(ctx sdk.Context, bondReduction types.BondReduction) { + store := ctx.KVStore(k.storeKey) + b := k.cdc.MustMarshal(&bondReduction) + + unbondingQueueKey := types.GetDecreasingBondQueueKey(bondReduction.SequencerAddress, bondReduction.GetUnbondTime()) + store.Set(unbondingQueueKey, b) +} + +// removeDecreasingBondQueue removes the bond reduction item from the decreasing bond queue +func (k Keeper) removeDecreasingBondQueue(ctx sdk.Context, bondReduction types.BondReduction) { + store := ctx.KVStore(k.storeKey) + unbondingQueueKey := types.GetDecreasingBondQueueKey(bondReduction.SequencerAddress, bondReduction.GetUnbondTime()) + store.Delete(unbondingQueueKey) +} + +// getSequencerDecreasingBonds returns the bond reduction item given sequencer address +func (k Keeper) getSequencerDecreasingBonds(ctx sdk.Context, sequencerAddr string) (bds []types.BondReduction) { + prefixKey := types.DecreasingBondQueueKey + store := prefix.NewStore(ctx.KVStore(k.storeKey), prefixKey) + iterator := sdk.KVStorePrefixIterator(store, []byte{}) + + defer iterator.Close() // nolint: errcheck + + for ; iterator.Valid(); iterator.Next() { + var bd types.BondReduction + k.cdc.MustUnmarshal(iterator.Value(), &bd) + if bd.SequencerAddress == sequencerAddr { + bds = append(bds, bd) + } + } + + return +} diff --git a/x/sequencer/keeper/slashing.go b/x/sequencer/keeper/slashing.go index f245e1423..4c499e125 100644 --- a/x/sequencer/keeper/slashing.go +++ b/x/sequencer/keeper/slashing.go @@ -86,6 +86,14 @@ func (k Keeper) Jail(ctx sdk.Context, seq types.Sequencer) error { // in case we are slashing an unbonding sequencer, we need to remove it from the unbonding queue if oldStatus == types.Unbonding { k.removeUnbondingSequencer(ctx, seq) + } else { + // in case the sequencer is currently reducing its bond, then we need to remove it from the decreasing bond queue + // all the tokens are burned, so we don't need to reduce the bond anymore + if bondReductions := k.getSequencerDecreasingBonds(ctx, seq.Address); len(bondReductions) > 0 { + for _, bondReduce := range bondReductions { + k.removeDecreasingBondQueue(ctx, bondReduce) + } + } } // set the status to unbonded diff --git a/x/sequencer/keeper/slashing_test.go b/x/sequencer/keeper/slashing_test.go index d90635aa9..29ee619ef 100644 --- a/x/sequencer/keeper/slashing_test.go +++ b/x/sequencer/keeper/slashing_test.go @@ -14,3 +14,27 @@ func (s *SequencerTestSuite) TestSlashBasic() { s.Require().NoError(err) }) } + +func (suite *SequencerTestSuite) TestSlashingBondReducingSequencer() { + suite.SetupTest() + keeper := suite.App.SequencerKeeper + + rollappId, pk := suite.CreateDefaultRollapp() + seqAddr := suite.CreateSequencerWithBond(suite.Ctx, rollappId, bond.AddAmount(sdk.NewInt(20)), pk) + + suite.Ctx = suite.Ctx.WithBlockHeight(20) + suite.Ctx = suite.Ctx.WithBlockTime(time.Now()) + + reduceBondMsg := types.MsgDecreaseBond{Creator: seqAddr, DecreaseAmount: sdk.NewInt64Coin(bond.Denom, 10)} + resp, err := suite.msgServer.DecreaseBond(suite.Ctx, &reduceBondMsg) + suite.Require().NoError(err) + bondReductions := keeper.GetMatureDecreasingBondSequencers(suite.Ctx, resp.GetCompletionTime()) + suite.Require().Len(bondReductions, 1) + + err = keeper.Slashing(suite.Ctx, seqAddr) + suite.NoError(err) + + bondReductions = keeper.GetMatureDecreasingBondSequencers(suite.Ctx, resp.GetCompletionTime()) + suite.Require().Len(bondReductions, 0) + suite.assertSlashed(seqAddr) +} diff --git a/x/sequencer/keeper/unbond.go b/x/sequencer/keeper/unbond.go index 64bb13868..6637d152a 100644 --- a/x/sequencer/keeper/unbond.go +++ b/x/sequencer/keeper/unbond.go @@ -26,6 +26,20 @@ func (k Keeper) UnbondAllMatureSequencers(ctx sdk.Context, currTime time.Time) { } } +func (k Keeper) HandleBondReduction(ctx sdk.Context, currTime time.Time) { + unbondings := k.GetMatureDecreasingBondSequencers(ctx, currTime) + for _, unbonding := range unbondings { + wrapFn := func(ctx sdk.Context) error { + return k.completeBondReduction(ctx, unbonding) + } + err := osmoutils.ApplyFuncIfNoError(ctx, wrapFn) + if err != nil { + k.Logger(ctx).Error("reducing sequencer bond", "error", err, "sequencer", unbonding.SequencerAddress) + continue + } + } +} + func (k Keeper) forceUnbondSequencer(ctx sdk.Context, seqAddr string) error { seq, found := k.GetSequencer(ctx, seqAddr) if !found { @@ -65,6 +79,14 @@ func (k Keeper) forceUnbondSequencer(ctx sdk.Context, seqAddr string) error { if oldStatus == types.Unbonding { k.removeUnbondingSequencer(ctx, seq) + } else { + // in case the sequencer is currently reducing its bond, then we need to remove it from the decreasing bond queue + // all the tokens are returned, so we don't need to reduce the bond anymore + if bondReductions := k.getSequencerDecreasingBonds(ctx, seq.Address); len(bondReductions) > 0 { + for _, bondReduce := range bondReductions { + k.removeDecreasingBondQueue(ctx, bondReduce) + } + } } ctx.EventManager().EmitEvent( @@ -124,3 +146,38 @@ func (k Keeper) unbondUnbondingSequencer(ctx sdk.Context, seqAddr string) error return nil } + +func (k Keeper) completeBondReduction(ctx sdk.Context, reduction types.BondReduction) error { + seq, found := k.GetSequencer(ctx, reduction.SequencerAddress) + if !found { + return types.ErrUnknownSequencer + } + + if seq.Tokens.IsAllLT(sdk.NewCoins(reduction.UnbondAmount)) { + return errorsmod.Wrapf( + types.ErrInsufficientBond, + "sequencer does not have enough bond to reduce insufficient bond: got %s, reducing by %s", + seq.Tokens.String(), + reduction.UnbondAmount.String(), + ) + } + newBalance := seq.Tokens.Sub(reduction.UnbondAmount) + // in case between unbonding queue and now, the minbond value is increased, + // handle it by only returning upto minBond amount and not all + minBond := k.GetParams(ctx).MinBond + if newBalance.IsAllLT(sdk.NewCoins(minBond)) { + diff := minBond.SubAmount(newBalance.AmountOf(minBond.Denom)) + reduction.UnbondAmount = reduction.UnbondAmount.Sub(diff) + } + seqAddr := sdk.MustAccAddressFromBech32(reduction.SequencerAddress) + err := k.bankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, seqAddr, sdk.NewCoins(reduction.UnbondAmount)) + if err != nil { + return err + } + + seq.Tokens = seq.Tokens.Sub(reduction.UnbondAmount) + k.SetSequencer(ctx, seq) + k.removeDecreasingBondQueue(ctx, reduction) + + return nil +} diff --git a/x/sequencer/keeper/unbond_test.go b/x/sequencer/keeper/unbond_test.go index 3c8406ea2..7874203d4 100644 --- a/x/sequencer/keeper/unbond_test.go +++ b/x/sequencer/keeper/unbond_test.go @@ -125,3 +125,62 @@ func (suite *SequencerTestSuite) TestTokensRefundOnUnbond() { suite.Equal(types.Unbonding, sequencer2.Status) suite.False(sequencer2.Tokens.IsZero()) } + +func (suite *SequencerTestSuite) TestHandleBondReduction() { + suite.SetupTest() + bondDenom := types.DefaultParams().MinBond.Denom + rollappId, pk := suite.CreateDefaultRollapp() + // Create a sequencer with bond amount of minBond + 100 + defaultSequencerAddress := suite.CreateSequencerWithBond(suite.Ctx, rollappId, bond.AddAmount(sdk.NewInt(100)), pk) + resp, err := suite.msgServer.DecreaseBond(suite.Ctx, &types.MsgDecreaseBond{ + Creator: defaultSequencerAddress, + DecreaseAmount: sdk.NewInt64Coin(bondDenom, 50), + }) + suite.Require().NoError(err) + expectedCompletionTime := suite.Ctx.BlockHeader().Time.Add(suite.App.SequencerKeeper.UnbondingTime(suite.Ctx)) + suite.Require().Equal(expectedCompletionTime, resp.CompletionTime) + // Execute HandleBondReduction + suite.Ctx = suite.Ctx.WithBlockTime(expectedCompletionTime) + suite.App.SequencerKeeper.HandleBondReduction(suite.Ctx, suite.Ctx.BlockHeader().Time) + // Check if the bond has been reduced + sequencer, _ := suite.App.SequencerKeeper.GetSequencer(suite.Ctx, defaultSequencerAddress) + suite.Require().Equal(bond.AddAmount(sdk.NewInt(50)), sequencer.Tokens[0]) + // ensure the bond decresing queue is empty + reds := suite.App.SequencerKeeper.GetMatureDecreasingBondSequencers(suite.Ctx, expectedCompletionTime) + suite.Require().Len(reds, 0) +} + +func (suite *SequencerTestSuite) TestHandleBondReduction_MinBondIncrease() { + suite.SetupTest() + bondDenom := types.DefaultParams().MinBond.Denom + rollappId, pk := suite.CreateDefaultRollapp() + // Create a sequencer with bond amount of minBond + 100 + defaultSequencerAddress := suite.CreateSequencerWithBond(suite.Ctx, rollappId, bond.AddAmount(sdk.NewInt(100)), pk) + resp, err := suite.msgServer.DecreaseBond(suite.Ctx, &types.MsgDecreaseBond{ + Creator: defaultSequencerAddress, + DecreaseAmount: sdk.NewInt64Coin(bondDenom, 50), + }) + suite.Require().NoError(err) + expectedCompletionTime := suite.Ctx.BlockHeader().Time.Add(suite.App.SequencerKeeper.UnbondingTime(suite.Ctx)) + suite.Require().Equal(expectedCompletionTime, resp.CompletionTime) + curBalance := suite.App.BankKeeper.GetBalance(suite.Ctx, sdk.MustAccAddressFromBech32(defaultSequencerAddress), bondDenom) + suite.Require().Equal(sdk.ZeroInt(), curBalance.Amount) + + // Increase the minBond param + params := suite.App.SequencerKeeper.GetParams(suite.Ctx) + params.MinBond = bond.AddAmount(sdk.NewInt(60)) + suite.App.SequencerKeeper.SetParams(suite.Ctx, params) + + // Execute HandleBondReduction + suite.Ctx = suite.Ctx.WithBlockTime(expectedCompletionTime) + suite.App.SequencerKeeper.HandleBondReduction(suite.Ctx, suite.Ctx.BlockHeader().Time) + // Check if the bond has been reduced - but is the same as new min bond value + sequencer, _ := suite.App.SequencerKeeper.GetSequencer(suite.Ctx, defaultSequencerAddress) + suite.Require().Equal(bond.AddAmount(sdk.NewInt(60)), sequencer.Tokens[0]) + // ensure the bond decresing queue is empty + reds := suite.App.SequencerKeeper.GetMatureDecreasingBondSequencers(suite.Ctx, expectedCompletionTime) + suite.Require().Len(reds, 0) + // Ensure the bond has been refunded + curBalance = suite.App.BankKeeper.GetBalance(suite.Ctx, sdk.MustAccAddressFromBech32(defaultSequencerAddress), bondDenom) + suite.Require().Equal(sdk.NewInt(40), curBalance.Amount) +} diff --git a/x/sequencer/module.go b/x/sequencer/module.go index b5e350ed9..8e234913c 100644 --- a/x/sequencer/module.go +++ b/x/sequencer/module.go @@ -162,5 +162,6 @@ func (am AppModule) BeginBlock(_ sdk.Context, _ abci.RequestBeginBlock) {} // returns no validator updates. func (am AppModule) EndBlock(ctx sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate { am.keeper.UnbondAllMatureSequencers(ctx, ctx.BlockHeader().Time) + am.keeper.HandleBondReduction(ctx, ctx.BlockHeader().Time) return []abci.ValidatorUpdate{} } diff --git a/x/sequencer/types/codec.go b/x/sequencer/types/codec.go index 795f46d34..dae39e575 100644 --- a/x/sequencer/types/codec.go +++ b/x/sequencer/types/codec.go @@ -11,11 +11,13 @@ func RegisterCodec(cdc *codec.LegacyAmino) { cdc.RegisterConcrete(&MsgCreateSequencer{}, "sequencer/CreateSequencer", nil) cdc.RegisterConcrete(&MsgUnbond{}, "sequencer/Unbond", nil) cdc.RegisterConcrete(&MsgIncreaseBond{}, "sequencer/IncreaseBond", nil) + cdc.RegisterConcrete(&MsgDecreaseBond{}, "sequencer/DecreaseBond", nil) } func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { registry.RegisterImplementations((*sdk.Msg)(nil), &MsgCreateSequencer{}, + &MsgDecreaseBond{}, &MsgUnbond{}, &MsgIncreaseBond{}, ) diff --git a/x/sequencer/types/keys.go b/x/sequencer/types/keys.go index 80310719d..2331c84f3 100644 --- a/x/sequencer/types/keys.go +++ b/x/sequencer/types/keys.go @@ -40,7 +40,8 @@ var ( UnbondedSequencersKeyPrefix = []byte{0xa2} UnbondingSequencersKeyPrefix = []byte{0xa3} - UnbondingQueueKey = []byte{0x41} // prefix for the timestamps in unbonding queue + UnbondingQueueKey = []byte{0x41} // prefix for the timestamps in unbonding queue + DecreasingBondQueueKey = []byte{0x42} // prefix for the timestamps in decreasing bond queue ) /* --------------------- specific sequencer address keys -------------------- */ @@ -102,3 +103,25 @@ func UnbondingSequencerKey(sequencerAddress string, endTime time.Time) []byte { key = append(key, []byte(sequencerAddress)...) return key } + +/* -------------------------- decreasing bond queue keys -------------------------- */ +func DecreasingBondQueueByTimeKey(endTime time.Time) []byte { + timeBz := sdk.FormatTimeBytes(endTime) + prefixL := len(DecreasingBondQueueKey) + + bz := make([]byte, prefixL+len(timeBz)) + + // copy the prefix + copy(bz[:prefixL], DecreasingBondQueueKey) + // copy the encoded time bytes + copy(bz[prefixL:prefixL+len(timeBz)], timeBz) + + return bz +} + +func GetDecreasingBondQueueKey(sequencerAddress string, endTime time.Time) []byte { + key := DecreasingBondQueueByTimeKey(endTime) + key = append(key, KeySeparator...) + key = append(key, []byte(sequencerAddress)...) + return key +} diff --git a/x/sequencer/types/msg_create_sequencer.go b/x/sequencer/types/msg_create_sequencer.go index 05f35c22f..f3499fe60 100644 --- a/x/sequencer/types/msg_create_sequencer.go +++ b/x/sequencer/types/msg_create_sequencer.go @@ -13,13 +13,13 @@ import ( const ( TypeMsgCreateSequencer = "create_sequencer" TypeMsgUnbond = "unbond" - TypeMsgIncreaseBond = "increase_bond" ) var ( _ sdk.Msg = &MsgCreateSequencer{} _ sdk.Msg = &MsgUnbond{} _ sdk.Msg = &MsgIncreaseBond{} + _ sdk.Msg = &MsgDecreaseBond{} _ codectypes.UnpackInterfacesMessage = (*MsgCreateSequencer)(nil) ) @@ -148,3 +148,32 @@ func (msg *MsgIncreaseBond) GetSigners() []sdk.AccAddress { } return []sdk.AccAddress{creator} } + +/* ---------------------------- MsgDecreaseBond ---------------------------- */ +func NewMsgDecreaseBond(creator string, decreaseBond sdk.Coin) *MsgDecreaseBond { + return &MsgDecreaseBond{ + Creator: creator, + DecreaseAmount: decreaseBond, + } +} + +func (msg *MsgDecreaseBond) ValidateBasic() error { + _, err := sdk.AccAddressFromBech32(msg.Creator) + if err != nil { + return errorsmod.Wrapf(ErrInvalidAddress, "invalid creator address (%s)", err) + } + + if !(msg.DecreaseAmount.IsValid() && msg.DecreaseAmount.IsPositive()) { + return errorsmod.Wrapf(ErrInvalidCoins, "invalid bond amount: %s", msg.DecreaseAmount.String()) + } + + return nil +} + +func (msg *MsgDecreaseBond) GetSigners() []sdk.AccAddress { + creator, err := sdk.AccAddressFromBech32(msg.Creator) + if err != nil { + panic(err) + } + return []sdk.AccAddress{creator} +} diff --git a/x/sequencer/types/msg_create_sequencer_test.go b/x/sequencer/types/msg_create_sequencer_test.go index 5aa3b83cf..28c62520b 100644 --- a/x/sequencer/types/msg_create_sequencer_test.go +++ b/x/sequencer/types/msg_create_sequencer_test.go @@ -224,3 +224,45 @@ func TestNewMsgIncreaseBond_ValidateBasic(t *testing.T) { }) } } + +func TestNewMsgDecreaseBond_ValidateBasic(t *testing.T) { + tests := []struct { + name string + msg MsgDecreaseBond + err error + }{ + { + name: "invalid address", + msg: MsgDecreaseBond{ + Creator: "invalid_address", + DecreaseAmount: sdk.NewInt64Coin("stake", 100), + }, + err: ErrInvalidAddress, + }, + { + name: "invalid bond amount", + msg: MsgDecreaseBond{ + Creator: sample.AccAddress(), + DecreaseAmount: sdk.NewInt64Coin("stake", 0), + }, + err: ErrInvalidCoins, + }, + { + name: "valid", + msg: MsgDecreaseBond{ + Creator: sample.AccAddress(), + DecreaseAmount: sdk.NewInt64Coin("stake", 100), + }, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + err := tt.msg.ValidateBasic() + if tt.err != nil { + require.ErrorIs(t, err, tt.err) + return + } + require.NoError(t, err) + }) + } +} diff --git a/x/sequencer/types/sequencer.pb.go b/x/sequencer/types/sequencer.pb.go index 072cff537..66c176741 100644 --- a/x/sequencer/types/sequencer.pb.go +++ b/x/sequencer/types/sequencer.pb.go @@ -160,8 +160,73 @@ func (m *Sequencer) GetUnbondTime() time.Time { return time.Time{} } +// BondReduction defines an object which holds the information about the sequencer and its queued unbonding amount +type BondReduction struct { + // sequencerAddress is the bech32-encoded address of the sequencer account which is the account that the message was sent from. + SequencerAddress string `protobuf:"bytes,1,opt,name=sequencer_address,json=sequencerAddress,proto3" json:"sequencer_address,omitempty"` + // unbondAmount is the amount of tokens to be unbonded. + UnbondAmount types1.Coin `protobuf:"bytes,2,opt,name=unbond_amount,json=unbondAmount,proto3" json:"unbond_amount"` + // unbond_time defines, if unbonding, the min time for the sequencer to complete unbonding. + UnbondTime time.Time `protobuf:"bytes,3,opt,name=unbond_time,json=unbondTime,proto3,stdtime" json:"unbond_time"` +} + +func (m *BondReduction) Reset() { *m = BondReduction{} } +func (m *BondReduction) String() string { return proto.CompactTextString(m) } +func (*BondReduction) ProtoMessage() {} +func (*BondReduction) Descriptor() ([]byte, []int) { + return fileDescriptor_997b8663a5fc0f58, []int{1} +} +func (m *BondReduction) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *BondReduction) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_BondReduction.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 *BondReduction) XXX_Merge(src proto.Message) { + xxx_messageInfo_BondReduction.Merge(m, src) +} +func (m *BondReduction) XXX_Size() int { + return m.Size() +} +func (m *BondReduction) XXX_DiscardUnknown() { + xxx_messageInfo_BondReduction.DiscardUnknown(m) +} + +var xxx_messageInfo_BondReduction proto.InternalMessageInfo + +func (m *BondReduction) GetSequencerAddress() string { + if m != nil { + return m.SequencerAddress + } + return "" +} + +func (m *BondReduction) GetUnbondAmount() types1.Coin { + if m != nil { + return m.UnbondAmount + } + return types1.Coin{} +} + +func (m *BondReduction) GetUnbondTime() time.Time { + if m != nil { + return m.UnbondTime + } + return time.Time{} +} + func init() { proto.RegisterType((*Sequencer)(nil), "dymensionxyz.dymension.sequencer.Sequencer") + proto.RegisterType((*BondReduction)(nil), "dymensionxyz.dymension.sequencer.BondReduction") } func init() { @@ -169,41 +234,45 @@ func init() { } var fileDescriptor_997b8663a5fc0f58 = []byte{ - // 543 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x52, 0xc1, 0x8e, 0xd3, 0x3c, - 0x10, 0x6e, 0xfe, 0xdd, 0xbf, 0xdb, 0xba, 0x08, 0x90, 0x55, 0x81, 0x5b, 0xa1, 0x34, 0xe2, 0x14, - 0x0e, 0x6b, 0x6f, 0x5b, 0x09, 0xce, 0x14, 0x21, 0xb1, 0x42, 0x88, 0x55, 0x16, 0x2e, 0x5c, 0x2a, - 0x27, 0x31, 0x69, 0xd8, 0xc6, 0x0e, 0xb1, 0x53, 0x6d, 0x78, 0x8a, 0x7d, 0x0e, 0xce, 0x3c, 0x02, - 0x87, 0x15, 0xa7, 0x3d, 0x72, 0x62, 0x51, 0xfb, 0x22, 0x28, 0x8e, 0x93, 0x2d, 0x20, 0xd4, 0x93, - 0xfd, 0xcd, 0xcc, 0x37, 0x9e, 0xf9, 0xfc, 0x81, 0xa3, 0xb0, 0x48, 0x18, 0x97, 0xb1, 0xe0, 0xe7, - 0xc5, 0x27, 0xd2, 0x00, 0x22, 0xd9, 0xc7, 0x9c, 0xf1, 0x80, 0x65, 0x37, 0x37, 0x9c, 0x66, 0x42, - 0x09, 0xe8, 0x6c, 0x33, 0x70, 0x03, 0x70, 0x53, 0x37, 0x1c, 0x04, 0x42, 0x26, 0x42, 0xce, 0x75, - 0x3d, 0xa9, 0x40, 0x45, 0x1e, 0x0e, 0x22, 0x21, 0xa2, 0x25, 0x23, 0x1a, 0xf9, 0xf9, 0x7b, 0x42, - 0x79, 0x61, 0x52, 0xfd, 0x48, 0x44, 0xa2, 0xa2, 0x94, 0x37, 0x13, 0x1d, 0xfd, 0x49, 0x50, 0x71, - 0xc2, 0xa4, 0xa2, 0x49, 0x6a, 0x0a, 0xec, 0xaa, 0x3f, 0xf1, 0xa9, 0x64, 0x64, 0x35, 0xf6, 0x99, - 0xa2, 0x63, 0x12, 0x88, 0x98, 0x9b, 0xfc, 0x7d, 0x93, 0x4f, 0x64, 0x44, 0x56, 0xe3, 0xf2, 0x30, - 0x09, 0xb2, 0x73, 0xf3, 0x84, 0x29, 0x1a, 0x52, 0x45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, - 0x75, 0x9c, 0x3d, 0xb7, 0x37, 0x19, 0x60, 0x23, 0x54, 0xe9, 0x11, 0x6c, 0x3c, 0x82, 0x9f, 0x89, - 0x98, 0xcf, 0x8e, 0xca, 0xc9, 0x3f, 0x5f, 0x8f, 0xdc, 0x28, 0x56, 0x8b, 0xdc, 0xc7, 0x81, 0x48, - 0x8c, 0x61, 0xcd, 0x71, 0x28, 0xc3, 0x33, 0xa2, 0x8a, 0x94, 0x49, 0x4d, 0x90, 0x9e, 0x69, 0x0d, - 0x1f, 0x81, 0xbb, 0x39, 0xf7, 0x05, 0x0f, 0xcb, 0xef, 0x5e, 0xb0, 0x38, 0x5a, 0x28, 0xd4, 0x75, - 0x2c, 0x77, 0xcf, 0xbb, 0xd3, 0xc4, 0x5f, 0xe8, 0x30, 0x7c, 0x0e, 0x7a, 0x55, 0x68, 0x5e, 0x9a, - 0x17, 0x01, 0x2d, 0xf4, 0xf0, 0xaf, 0x6f, 0x7d, 0x53, 0x3b, 0x7b, 0xd6, 0x29, 0xa7, 0xba, 0xb8, - 0x1e, 0x59, 0x1e, 0xa8, 0x88, 0x65, 0x6a, 0x76, 0x72, 0xb9, 0xb6, 0xad, 0xab, 0xb5, 0x6d, 0xfd, - 0x5c, 0xdb, 0xd6, 0xc5, 0xc6, 0x6e, 0x5d, 0x6d, 0xec, 0xd6, 0xf7, 0x8d, 0xdd, 0x7a, 0xf7, 0x78, - 0x6b, 0xfa, 0x7f, 0x98, 0x74, 0x35, 0x25, 0xe7, 0x5b, 0x4e, 0xd5, 0x1b, 0xf9, 0x6d, 0xfd, 0xf6, - 0xf4, 0x57, 0x00, 0x00, 0x00, 0xff, 0xff, 0x30, 0xdb, 0x10, 0x02, 0x05, 0x04, 0x00, 0x00, + // 601 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x53, 0xcd, 0x6e, 0xd4, 0x3c, + 0x14, 0x9d, 0x7c, 0xd3, 0x6f, 0x3a, 0xe3, 0xb6, 0x50, 0xac, 0x0a, 0xdc, 0x11, 0xca, 0x44, 0x5d, + 0x05, 0xa1, 0xda, 0x9d, 0x56, 0x82, 0x75, 0x03, 0x48, 0x54, 0x08, 0x51, 0xa5, 0xb0, 0x61, 0x33, + 0x72, 0x12, 0x93, 0x86, 0x4e, 0xec, 0x10, 0x3b, 0x55, 0xc3, 0x53, 0xf4, 0x39, 0x58, 0xf3, 0x08, + 0x2c, 0x0a, 0xab, 0x2e, 0x59, 0x51, 0xd4, 0xbe, 0x08, 0x8a, 0xe3, 0xa4, 0x3f, 0x08, 0x46, 0x62, + 0x65, 0xdf, 0x9f, 0x73, 0x7d, 0xef, 0xb9, 0xc7, 0x60, 0x23, 0x2a, 0x53, 0xc6, 0x65, 0x22, 0xf8, + 0x51, 0xf9, 0x91, 0xb4, 0x06, 0x91, 0xec, 0x43, 0xc1, 0x78, 0xc8, 0xf2, 0xcb, 0x1b, 0xce, 0x72, + 0xa1, 0x04, 0x74, 0xae, 0x22, 0x70, 0x6b, 0xe0, 0x36, 0x6f, 0xb8, 0x1a, 0x0a, 0x99, 0x0a, 0x39, + 0xd1, 0xf9, 0xa4, 0x36, 0x6a, 0xf0, 0x70, 0x35, 0x16, 0x22, 0x9e, 0x32, 0xa2, 0xad, 0xa0, 0x78, + 0x47, 0x28, 0x2f, 0x4d, 0x68, 0x25, 0x16, 0xb1, 0xa8, 0x21, 0xd5, 0xcd, 0x78, 0x47, 0x37, 0x01, + 0x2a, 0x49, 0x99, 0x54, 0x34, 0xcd, 0x4c, 0x82, 0x5d, 0xd7, 0x27, 0x01, 0x95, 0x8c, 0x1c, 0x8e, + 0x03, 0xa6, 0xe8, 0x98, 0x84, 0x22, 0xe1, 0x26, 0x7e, 0xcf, 0xc4, 0x53, 0x19, 0x93, 0xc3, 0x71, + 0x75, 0x98, 0x00, 0x99, 0x39, 0x79, 0xca, 0x14, 0x8d, 0xa8, 0xa2, 0x06, 0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, 0xf3, 0xf6, 0xd1, 0x95, 0x4d, 0xfc, 0xe1, 0xc3, 0x1d, 0x6e, + 0x91, 0xa3, 0x2b, 0xbf, 0x4e, 0x6f, 0x27, 0xe8, 0xe9, 0xb7, 0xb7, 0x7e, 0x05, 0x00, 0x00, 0xff, + 0xff, 0x09, 0x02, 0x7a, 0xf3, 0xd1, 0x04, 0x00, 0x00, } func (m *Sequencer) Marshal() (dAtA []byte, err error) { @@ -317,6 +386,54 @@ func (m *Sequencer) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *BondReduction) 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 *BondReduction) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *BondReduction) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + n4, err4 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(m.UnbondTime, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(m.UnbondTime):]) + if err4 != nil { + return 0, err4 + } + i -= n4 + i = encodeVarintSequencer(dAtA, i, uint64(n4)) + i-- + dAtA[i] = 0x1a + { + size, err := m.UnbondAmount.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintSequencer(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if len(m.SequencerAddress) > 0 { + i -= len(m.SequencerAddress) + copy(dAtA[i:], m.SequencerAddress) + i = encodeVarintSequencer(dAtA, i, uint64(len(m.SequencerAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + func encodeVarintSequencer(dAtA []byte, offset int, v uint64) int { offset -= sovSequencer(v) base := offset @@ -371,6 +488,23 @@ func (m *Sequencer) Size() (n int) { return n } +func (m *BondReduction) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.SequencerAddress) + if l > 0 { + n += 1 + l + sovSequencer(uint64(l)) + } + l = m.UnbondAmount.Size() + n += 1 + l + sovSequencer(uint64(l)) + l = github_com_cosmos_gogoproto_types.SizeOfStdTime(m.UnbondTime) + n += 1 + l + sovSequencer(uint64(l)) + return n +} + func sovSequencer(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -705,6 +839,154 @@ func (m *Sequencer) Unmarshal(dAtA []byte) error { } return nil } +func (m *BondReduction) 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 ErrIntOverflowSequencer + } + 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: BondReduction: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: BondReduction: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SequencerAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSequencer + } + 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 ErrInvalidLengthSequencer + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthSequencer + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SequencerAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field UnbondAmount", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSequencer + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthSequencer + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthSequencer + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.UnbondAmount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field UnbondTime", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSequencer + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthSequencer + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthSequencer + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_cosmos_gogoproto_types.StdTimeUnmarshal(&m.UnbondTime, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipSequencer(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthSequencer + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipSequencer(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/sequencer/types/tx.pb.go b/x/sequencer/types/tx.pb.go index 943eeb5d5..b1b1806f8 100644 --- a/x/sequencer/types/tx.pb.go +++ b/x/sequencer/types/tx.pb.go @@ -435,6 +435,106 @@ func (m *MsgIncreaseBondResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgIncreaseBondResponse proto.InternalMessageInfo +// MsgDecreaseBond defines a SDK message for decreasing the bond of a sequencer. +type MsgDecreaseBond struct { + // creator is the bech32-encoded address of the sequencer account which is the account that the message was sent from. + Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"` + // decrease_amount is the amount of coins to decrease the bond by. + DecreaseAmount types1.Coin `protobuf:"bytes,2,opt,name=decrease_amount,json=decreaseAmount,proto3" json:"decrease_amount"` +} + +func (m *MsgDecreaseBond) Reset() { *m = MsgDecreaseBond{} } +func (m *MsgDecreaseBond) String() string { return proto.CompactTextString(m) } +func (*MsgDecreaseBond) ProtoMessage() {} +func (*MsgDecreaseBond) Descriptor() ([]byte, []int) { + return fileDescriptor_02cdd6b9ffa005b4, []int{8} +} +func (m *MsgDecreaseBond) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgDecreaseBond) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgDecreaseBond.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 *MsgDecreaseBond) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgDecreaseBond.Merge(m, src) +} +func (m *MsgDecreaseBond) XXX_Size() int { + return m.Size() +} +func (m *MsgDecreaseBond) XXX_DiscardUnknown() { + xxx_messageInfo_MsgDecreaseBond.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgDecreaseBond proto.InternalMessageInfo + +func (m *MsgDecreaseBond) GetCreator() string { + if m != nil { + return m.Creator + } + return "" +} + +func (m *MsgDecreaseBond) GetDecreaseAmount() types1.Coin { + if m != nil { + return m.DecreaseAmount + } + return types1.Coin{} +} + +// MsgDecreaseBondResponse defines the Msg/DecreaseBond response type. +type MsgDecreaseBondResponse struct { + CompletionTime time.Time `protobuf:"bytes,1,opt,name=completion_time,json=completionTime,proto3,stdtime" json:"completion_time"` +} + +func (m *MsgDecreaseBondResponse) Reset() { *m = MsgDecreaseBondResponse{} } +func (m *MsgDecreaseBondResponse) String() string { return proto.CompactTextString(m) } +func (*MsgDecreaseBondResponse) ProtoMessage() {} +func (*MsgDecreaseBondResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_02cdd6b9ffa005b4, []int{9} +} +func (m *MsgDecreaseBondResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgDecreaseBondResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgDecreaseBondResponse.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 *MsgDecreaseBondResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgDecreaseBondResponse.Merge(m, src) +} +func (m *MsgDecreaseBondResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgDecreaseBondResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgDecreaseBondResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgDecreaseBondResponse proto.InternalMessageInfo + +func (m *MsgDecreaseBondResponse) GetCompletionTime() time.Time { + if m != nil { + return m.CompletionTime + } + return time.Time{} +} + func init() { proto.RegisterType((*MsgCreateSequencer)(nil), "dymensionxyz.dymension.sequencer.MsgCreateSequencer") proto.RegisterType((*MsgCreateSequencerResponse)(nil), "dymensionxyz.dymension.sequencer.MsgCreateSequencerResponse") @@ -444,6 +544,8 @@ func init() { proto.RegisterType((*MsgUnbondResponse)(nil), "dymensionxyz.dymension.sequencer.MsgUnbondResponse") proto.RegisterType((*MsgIncreaseBond)(nil), "dymensionxyz.dymension.sequencer.MsgIncreaseBond") proto.RegisterType((*MsgIncreaseBondResponse)(nil), "dymensionxyz.dymension.sequencer.MsgIncreaseBondResponse") + proto.RegisterType((*MsgDecreaseBond)(nil), "dymensionxyz.dymension.sequencer.MsgDecreaseBond") + proto.RegisterType((*MsgDecreaseBondResponse)(nil), "dymensionxyz.dymension.sequencer.MsgDecreaseBondResponse") } func init() { @@ -451,50 +553,53 @@ func init() { } var fileDescriptor_02cdd6b9ffa005b4 = []byte{ - // 680 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x55, 0x4d, 0x6b, 0x13, 0x4d, - 0x1c, 0xcf, 0xb6, 0x79, 0xfa, 0x34, 0xd3, 0x62, 0x75, 0x29, 0x74, 0xb3, 0xd8, 0x4d, 0x09, 0x88, - 0x55, 0x71, 0x96, 0x24, 0x22, 0x58, 0x44, 0x69, 0x7a, 0x90, 0x22, 0x81, 0x9a, 0xda, 0x8b, 0x97, - 0x30, 0xbb, 0x33, 0x5d, 0x57, 0xb2, 0x33, 0xeb, 0xce, 0xa4, 0x74, 0xc5, 0x93, 0xe0, 0xbd, 0xe0, - 0x17, 0xe8, 0xc9, 0xb3, 0x07, 0x6f, 0xe2, 0xbd, 0x78, 0x2a, 0x9e, 0x3c, 0xa9, 0xb4, 0x07, 0xfd, - 0x18, 0xb2, 0xbb, 0xb3, 0xdb, 0x64, 0x4b, 0x93, 0xb4, 0x7a, 0x4a, 0x66, 0xe6, 0xf7, 0xf2, 0x7f, - 0x65, 0xc1, 0x0d, 0x1c, 0x7a, 0x84, 0x72, 0x97, 0xd1, 0xdd, 0xf0, 0x95, 0x99, 0x1d, 0x4c, 0x4e, - 0x5e, 0xf6, 0x08, 0xb5, 0x49, 0x60, 0x8a, 0x5d, 0xe8, 0x07, 0x4c, 0x30, 0x75, 0xa9, 0x1f, 0x0a, - 0xb3, 0x03, 0xcc, 0xa0, 0x7a, 0xd9, 0x61, 0xcc, 0xe9, 0x12, 0x33, 0xc6, 0x5b, 0xbd, 0x6d, 0x13, - 0xd1, 0x30, 0x21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 0x7d, 0x00, 0x00, 0xc2, 0xb8, 0x83, 0x3c, 0xd6, 0xa3, 0x42, 0x2e, 0xc4, 0xc8, 0x71, 0x2a, 0x21, - 0x8c, 0x57, 0x63, 0x46, 0xae, 0xea, 0x65, 0xb0, 0x90, 0x0b, 0x2a, 0xcd, 0xbf, 0xbe, 0x5f, 0x04, - 0x93, 0x2d, 0xee, 0xa8, 0x6f, 0x15, 0x30, 0x97, 0xdf, 0xd8, 0x3b, 0xa3, 0xfb, 0x7f, 0x7a, 0x54, - 0xf5, 0xfb, 0x17, 0x61, 0x65, 0xfd, 0x78, 0xaf, 0x00, 0x7d, 0xc8, 0x74, 0x3f, 0x1c, 0x4b, 0xfc, - 0x6c, 0x01, 0xfd, 0xd1, 0x5f, 0x0a, 0x64, 0x81, 0xbe, 0x00, 0x53, 0x72, 0x3a, 0x6f, 0x8d, 0x27, - 0x19, 0x83, 0xf5, 0xc6, 0x39, 0xc0, 0x99, 0xd7, 0x6b, 0x30, 0x3b, 0x30, 0x51, 0xb5, 0xb1, 0x44, - 0xfa, 0x29, 0xfa, 0xbd, 0x73, 0x53, 0x52, 0xf7, 0xe6, 0xc6, 0xc1, 0x91, 0xa1, 0x1c, 0x1e, 0x19, - 0xca, 0xcf, 0x23, 0x43, 0xd9, 0x3b, 0x36, 0x0a, 0x87, 0xc7, 0x46, 0xe1, 0xdb, 0xb1, 0x51, 0x78, - 0x76, 0xd7, 0x71, 0xc5, 0xf3, 0x9e, 0x05, 0x6d, 0xe6, 0x9d, 0xf5, 0x95, 0xd8, 0x69, 0x98, 0xbb, - 0xfd, 0x5f, 0xc7, 0xd0, 0x27, 0xdc, 0x9a, 0x8a, 0x77, 0xaa, 0xf1, 0x27, 0x00, 0x00, 0xff, 0xff, - 0x75, 0x31, 0x66, 0xe5, 0x4e, 0x07, 0x00, 0x00, + // 728 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb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0xa0, 0x80, 0x04, + 0xc7, 0x19, 0x5d, 0xcf, 0x24, 0xb8, 0x13, 0xad, 0x6f, 0x45, 0xd6, 0xb3, 0xf6, 0xfe, 0xd0, 0xd5, + 0x55, 0x5f, 0x8f, 0x83, 0xd1, 0x06, 0xb3, 0xe5, 0x17, 0x12, 0x28, 0xf4, 0x7e, 0x76, 0x5d, 0x1b, + 0x9c, 0x84, 0xe3, 0xa1, 0x55, 0x6f, 0x9e, 0x07, 0x95, 0xb6, 0xf7, 0x56, 0x02, 0x6a, 0x9f, 0x9c, + 0xdf, 0x1e, 0x8a, 0xfc, 0x74, 0x02, 0xf5, 0xee, 0x05, 0x09, 0x52, 0xa3, 0x8f, 0xc1, 0x84, 0xc8, + 0xe9, 0x95, 0xe1, 0x28, 0xa3, 0x62, 0xb5, 0x76, 0x86, 0xe2, 0x54, 0xeb, 0x19, 0x98, 0xee, 0xca, + 0x56, 0x65, 0x28, 0x92, 0x2c, 0x44, 0xbd, 0x71, 0x66, 0x48, 0x56, 0xbd, 0x2b, 0x28, 0xc3, 0xa9, + 0x67, 0x21, 0x43, 0xaa, 0x9f, 0xf4, 0xde, 0xeb, 0x6b, 0x7b, 0x07, 0x9a, 0xb4, 0x7f, 0xa0, 0x49, + 0xdf, 0x0f, 0x34, 0x69, 0xf7, 0x50, 0xcb, 0xed, 0x1f, 0x6a, 0xb9, 0x2f, 0x87, 0x5a, 0xee, 0xd1, + 0x75, 0xdb, 0xe1, 0x5b, 0x1d, 0x53, 0xb7, 0xa8, 0x7b, 0xda, 0xb7, 0xf5, 0x76, 0xcd, 0xd8, 0xc9, + 0xfe, 0x4a, 0x09, 0x3c, 0xcc, 0xcc, 0x89, 0x28, 0x20, 0xb5, 0x5f, 0x01, 0x00, 0x00, 0xff, 0xff, + 0x07, 0xd3, 0x20, 0xe4, 0xd6, 0x08, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -517,6 +622,8 @@ type MsgClient interface { Unbond(ctx context.Context, in *MsgUnbond, opts ...grpc.CallOption) (*MsgUnbondResponse, error) // IncreaseBond defines a method for increasing a sequencer's bond amount IncreaseBond(ctx context.Context, in *MsgIncreaseBond, opts ...grpc.CallOption) (*MsgIncreaseBondResponse, error) + // DecreaseBond defines a method for decreasing the bond of a sequencer. + DecreaseBond(ctx context.Context, in *MsgDecreaseBond, opts ...grpc.CallOption) (*MsgDecreaseBondResponse, error) } type msgClient struct { @@ -563,6 +670,15 @@ func (c *msgClient) IncreaseBond(ctx context.Context, in *MsgIncreaseBond, opts return out, nil } +func (c *msgClient) DecreaseBond(ctx context.Context, in *MsgDecreaseBond, opts ...grpc.CallOption) (*MsgDecreaseBondResponse, error) { + out := new(MsgDecreaseBondResponse) + err := c.cc.Invoke(ctx, "/dymensionxyz.dymension.sequencer.Msg/DecreaseBond", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // MsgServer is the server API for Msg service. type MsgServer interface { // CreateSequencer defines a method for creating a new sequencer. @@ -573,6 +689,8 @@ type MsgServer interface { Unbond(context.Context, *MsgUnbond) (*MsgUnbondResponse, error) // IncreaseBond defines a method for increasing a sequencer's bond amount IncreaseBond(context.Context, *MsgIncreaseBond) (*MsgIncreaseBondResponse, error) + // DecreaseBond defines a method for decreasing the bond of a sequencer. + DecreaseBond(context.Context, *MsgDecreaseBond) (*MsgDecreaseBondResponse, error) } // UnimplementedMsgServer can be embedded to have forward compatible implementations. @@ -591,6 +709,9 @@ func (*UnimplementedMsgServer) Unbond(ctx context.Context, req *MsgUnbond) (*Msg func (*UnimplementedMsgServer) IncreaseBond(ctx context.Context, req *MsgIncreaseBond) (*MsgIncreaseBondResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method IncreaseBond not implemented") } +func (*UnimplementedMsgServer) DecreaseBond(ctx context.Context, req *MsgDecreaseBond) (*MsgDecreaseBondResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method DecreaseBond not implemented") +} func RegisterMsgServer(s grpc1.Server, srv MsgServer) { s.RegisterService(&_Msg_serviceDesc, srv) @@ -668,6 +789,24 @@ func _Msg_IncreaseBond_Handler(srv interface{}, ctx context.Context, dec func(in return interceptor(ctx, in, info, handler) } +func _Msg_DecreaseBond_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgDecreaseBond) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).DecreaseBond(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/dymensionxyz.dymension.sequencer.Msg/DecreaseBond", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).DecreaseBond(ctx, req.(*MsgDecreaseBond)) + } + return interceptor(ctx, in, info, handler) +} + var _Msg_serviceDesc = grpc.ServiceDesc{ ServiceName: "dymensionxyz.dymension.sequencer.Msg", HandlerType: (*MsgServer)(nil), @@ -688,6 +827,10 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ MethodName: "IncreaseBond", Handler: _Msg_IncreaseBond_Handler, }, + { + MethodName: "DecreaseBond", + Handler: _Msg_DecreaseBond_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "dymensionxyz/dymension/sequencer/tx.proto", @@ -979,6 +1122,77 @@ func (m *MsgIncreaseBondResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) return len(dAtA) - i, nil } +func (m *MsgDecreaseBond) 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 *MsgDecreaseBond) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgDecreaseBond) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.DecreaseAmount.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if len(m.Creator) > 0 { + i -= len(m.Creator) + copy(dAtA[i:], m.Creator) + i = encodeVarintTx(dAtA, i, uint64(len(m.Creator))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgDecreaseBondResponse) 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 *MsgDecreaseBondResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgDecreaseBondResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + n8, err8 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(m.CompletionTime, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(m.CompletionTime):]) + if err8 != nil { + return 0, err8 + } + i -= n8 + i = encodeVarintTx(dAtA, i, uint64(n8)) + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + func encodeVarintTx(dAtA []byte, offset int, v uint64) int { offset -= sovTx(v) base := offset @@ -1100,6 +1314,32 @@ func (m *MsgIncreaseBondResponse) Size() (n int) { return n } +func (m *MsgDecreaseBond) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Creator) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = m.DecreaseAmount.Size() + n += 1 + l + sovTx(uint64(l)) + return n +} + +func (m *MsgDecreaseBondResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = github_com_cosmos_gogoproto_types.SizeOfStdTime(m.CompletionTime) + n += 1 + l + sovTx(uint64(l)) + return n +} + func sovTx(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -1899,6 +2139,204 @@ func (m *MsgIncreaseBondResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *MsgDecreaseBond) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgDecreaseBond: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgDecreaseBond: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Creator", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Creator = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DecreaseAmount", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.DecreaseAmount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgDecreaseBondResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgDecreaseBondResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgDecreaseBondResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CompletionTime", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_cosmos_gogoproto_types.StdTimeUnmarshal(&m.CompletionTime, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipTx(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0