diff --git a/CHANGELOG.md b/CHANGELOG.md index d05b143a962..1ad61462506 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -69,6 +69,7 @@ This release containts the following new modules: * [#3905](https://github.com/osmosis-labs/osmosis/pull/3905) Deprecate gamm queries `NumPools`, `EstimateSwapExactAmountIn` and `EstimateSwapExactAmountOut`. * [#3907](https://github.com/osmosis-labs/osmosis/pull/3907) Add `NumPools`, `EstimateSwapExactAmountIn` and `EstimateSwapExactAmountOut` query in poolmanager module to stargate whitelist. * [#3880](https://github.com/osmosis-labs/osmosis/pull/3880) Switch usage of proto-generated SwapAmountInRoute and SwapAmountOutRoute in x/gamm to import the structs from x/poolmanager module. + * [#4489](https://github.com/osmosis-labs/osmosis/pull/4489) Add unlockingLockId to BeginUnlocking response ### Bug Fix diff --git a/proto/osmosis/lockup/tx.proto b/proto/osmosis/lockup/tx.proto index e50b682bfef..17dad239763 100644 --- a/proto/osmosis/lockup/tx.proto +++ b/proto/osmosis/lockup/tx.proto @@ -51,7 +51,10 @@ message MsgBeginUnlocking { (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" ]; } -message MsgBeginUnlockingResponse { bool success = 1; } +message MsgBeginUnlockingResponse { + bool success = 1; + uint64 unlockingLockID = 2; +} // MsgExtendLockup extends the existing lockup's duration. // The new duration is longer than the original. diff --git a/x/lockup/keeper/iterator.go b/x/lockup/keeper/iterator.go index bde6c6f6891..31a22088b2d 100644 --- a/x/lockup/keeper/iterator.go +++ b/x/lockup/keeper/iterator.go @@ -218,7 +218,7 @@ func (k Keeper) beginUnlockFromIterator(ctx sdk.Context, iterator db.Iterator) ( locks := k.getLocksFromIterator(ctx, iterator) for _, lock := range locks { - err := k.BeginUnlock(ctx, lock.ID, nil) + _, err := k.BeginUnlock(ctx, lock.ID, nil) if err != nil { return locks, err } diff --git a/x/lockup/keeper/lock.go b/x/lockup/keeper/lock.go index f95df27170e..77ecf69a39b 100644 --- a/x/lockup/keeper/lock.go +++ b/x/lockup/keeper/lock.go @@ -161,19 +161,19 @@ func (k Keeper) lock(ctx sdk.Context, lock types.PeriodLock, tokensToLock sdk.Co // BeginUnlock is a utility to start unlocking coins from NotUnlocking queue. // Returns an error if the lock has a synthetic lock. -func (k Keeper) BeginUnlock(ctx sdk.Context, lockID uint64, coins sdk.Coins) error { +func (k Keeper) BeginUnlock(ctx sdk.Context, lockID uint64, coins sdk.Coins) (uint64, error) { // prohibit BeginUnlock if synthetic locks are referring to this // TODO: In the future, make synthetic locks only get partial restrictions on the main lock. lock, err := k.GetLockByID(ctx, lockID) if err != nil { - return err + return 0, err } if k.HasAnySyntheticLockups(ctx, lock.ID) { - return fmt.Errorf("cannot BeginUnlocking a lock with synthetic lockup") + return 0, fmt.Errorf("cannot BeginUnlocking a lock with synthetic lockup") } - _, err = k.beginUnlock(ctx, *lock, coins) - return err + unlockingLock, err := k.beginUnlock(ctx, *lock, coins) + return unlockingLock, err } // BeginForceUnlock begins force unlock of the given lock. @@ -356,7 +356,7 @@ func (k Keeper) ForceUnlock(ctx sdk.Context, lock types.PeriodLock) error { } if !lock.IsUnlocking() { - err := k.BeginUnlock(ctx, lock.ID, nil) + _, err := k.BeginUnlock(ctx, lock.ID, nil) if err != nil { return err } diff --git a/x/lockup/keeper/lock_test.go b/x/lockup/keeper/lock_test.go index c427d4879f5..1bfc37ba817 100644 --- a/x/lockup/keeper/lock_test.go +++ b/x/lockup/keeper/lock_test.go @@ -97,7 +97,7 @@ func (suite *KeeperTestSuite) TestBeginForceUnlock() { if tc.expectSameLockID { suite.Require().Equal(lockID, lock.ID) } else { - suite.Require().Equal(lockID, lock.ID + 1) + suite.Require().Equal(lockID, lock.ID+1) } // new or updated lock @@ -139,6 +139,7 @@ func (suite *KeeperTestSuite) TestUnlock() { passedTime time.Duration expectedUnlockMaturedLockPass bool balanceAfterUnlock sdk.Coins + isPartial bool }{ { name: "normal unlocking case", @@ -177,6 +178,7 @@ func (suite *KeeperTestSuite) TestUnlock() { passedTime: time.Second, expectedUnlockMaturedLockPass: true, balanceAfterUnlock: sdk.Coins{sdk.NewInt64Coin("stake", 5)}, + isPartial: true, }, { name: "partial unlocking unknown tokens", @@ -213,11 +215,15 @@ func (suite *KeeperTestSuite) TestUnlock() { partialUnlocking := tc.unlockingCoins.IsAllLT(initialLockCoins) && tc.unlockingCoins != nil // begin unlocking - err = lockupKeeper.BeginUnlock(ctx, lock.ID, tc.unlockingCoins) + unlockingLock, err := lockupKeeper.BeginUnlock(ctx, lock.ID, tc.unlockingCoins) if tc.expectedBeginUnlockPass { suite.Require().NoError(err) + if tc.isPartial { + suite.Require().Equal(unlockingLock, lock.ID+1) + } + // check unlocking coins. When a lock is a partial lock // (i.e. tc.unlockingCoins is not nit and less than initialLockCoins), // we only unlock the partial amount of tc.unlockingCoins diff --git a/x/lockup/keeper/msg_server.go b/x/lockup/keeper/msg_server.go index 97104bbfc8d..c9ef08f1f07 100644 --- a/x/lockup/keeper/msg_server.go +++ b/x/lockup/keeper/msg_server.go @@ -91,14 +91,14 @@ func (server msgServer) BeginUnlocking(goCtx context.Context, msg *types.MsgBegi return nil, sdkerrors.Wrap(types.ErrNotLockOwner, fmt.Sprintf("msg sender (%s) and lock owner (%s) does not match", msg.Owner, lock.Owner)) } - err = server.keeper.BeginUnlock(ctx, lock.ID, msg.Coins) + unlockingLock, err := server.keeper.BeginUnlock(ctx, lock.ID, msg.Coins) if err != nil { return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, err.Error()) } // N.B. begin unlock event is emitted downstream in the keeper method. - return &types.MsgBeginUnlockingResponse{}, nil + return &types.MsgBeginUnlockingResponse{Success: true, UnlockingLockID: unlockingLock}, nil } // BeginUnlockingAll begins unlocking for all the locks that the account has by iterating all the not-unlocking locks the account holds. diff --git a/x/lockup/keeper/msg_server_test.go b/x/lockup/keeper/msg_server_test.go index c0a311876d7..a8331e52bad 100644 --- a/x/lockup/keeper/msg_server_test.go +++ b/x/lockup/keeper/msg_server_test.go @@ -115,6 +115,7 @@ func (suite *KeeperTestSuite) TestMsgBeginUnlocking() { name string param param expectPass bool + isPartial bool }{ { name: "unlock full amount of tokens via begin unlock", @@ -138,6 +139,7 @@ func (suite *KeeperTestSuite) TestMsgBeginUnlocking() { duration: time.Second, coinsInOwnerAddress: sdk.Coins{sdk.NewInt64Coin("stake", 10)}, }, + isPartial: true, expectPass: true, }, { @@ -163,6 +165,7 @@ func (suite *KeeperTestSuite) TestMsgBeginUnlocking() { coinsInOwnerAddress: sdk.Coins{sdk.NewInt64Coin("stake", 10)}, }, expectPass: false, + isPartial: true, }, } @@ -181,11 +184,17 @@ func (suite *KeeperTestSuite) TestMsgBeginUnlocking() { suite.Require().NoError(err) } - _, err = msgServer.BeginUnlocking(goCtx, types.NewMsgBeginUnlocking(test.param.lockOwner, resp.ID, test.param.coinsToUnlock)) + unlockingResponse, err := msgServer.BeginUnlocking(goCtx, types.NewMsgBeginUnlocking(test.param.lockOwner, resp.ID, test.param.coinsToUnlock)) if test.expectPass { suite.Require().NoError(err) suite.AssertEventEmitted(suite.Ctx, types.TypeEvtBeginUnlock, 1) + suite.Require().True(unlockingResponse.Success) + if test.isPartial { + suite.Require().Equal(unlockingResponse.UnlockingLockID, resp.ID+1) + } else { + suite.Require().Equal(unlockingResponse.UnlockingLockID, resp.ID) + } } else { suite.Require().Error(err) suite.AssertEventEmitted(suite.Ctx, types.TypeEvtBeginUnlock, 0) diff --git a/x/lockup/types/tx.pb.go b/x/lockup/types/tx.pb.go index 6371921928e..9cc91856655 100644 --- a/x/lockup/types/tx.pb.go +++ b/x/lockup/types/tx.pb.go @@ -288,7 +288,8 @@ func (m *MsgBeginUnlocking) GetCoins() github_com_cosmos_cosmos_sdk_types.Coins } type MsgBeginUnlockingResponse struct { - Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + UnlockingLockID uint64 `protobuf:"varint,2,opt,name=unlockingLockID,proto3" json:"unlockingLockID,omitempty"` } func (m *MsgBeginUnlockingResponse) Reset() { *m = MsgBeginUnlockingResponse{} } @@ -331,6 +332,13 @@ func (m *MsgBeginUnlockingResponse) GetSuccess() bool { return false } +func (m *MsgBeginUnlockingResponse) GetUnlockingLockID() uint64 { + if m != nil { + return m.UnlockingLockID + } + return 0 +} + // MsgExtendLockup extends the existing lockup's duration. // The new duration is longer than the original. type MsgExtendLockup struct { @@ -562,47 +570,48 @@ func init() { func init() { proto.RegisterFile("osmosis/lockup/tx.proto", fileDescriptor_bcdad5af0d24735f) } var fileDescriptor_bcdad5af0d24735f = []byte{ - // 632 bytes of a gzipped FileDescriptorProto + // 645 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x55, 0xcf, 0x6e, 0xd3, 0x4e, - 0x10, 0x8e, 0x93, 0x5f, 0x7f, 0x2d, 0xd3, 0x92, 0x52, 0xab, 0xd0, 0xd4, 0x02, 0x3b, 0x58, 0xd0, - 0x06, 0xa9, 0xf5, 0x92, 0x94, 0x5e, 0x38, 0x20, 0x11, 0x02, 0x52, 0xa5, 0x46, 0x42, 0x56, 0x2b, - 0x21, 0x0e, 0x48, 0xb6, 0xb3, 0x6c, 0xad, 0x38, 0x5e, 0x2b, 0x6b, 0x97, 0xe4, 0xce, 0x03, 0x70, - 0xe4, 0x19, 0x40, 0xe2, 0xc2, 0x4b, 0xf4, 0x58, 0x89, 0x0b, 0xa7, 0x14, 0x25, 0x37, 0x8e, 0x7d, - 0x02, 0xe4, 0x75, 0x6c, 0x39, 0x7f, 0xd4, 0x44, 0x48, 0x20, 0x4e, 0xce, 0xfa, 0x9b, 0xf9, 0x66, - 0xbe, 0x6f, 0x67, 0x62, 0xd8, 0xa0, 0xac, 0x45, 0x99, 0xcd, 0x90, 0x43, 0xad, 0x66, 0xe0, 0x21, - 0xbf, 0xa3, 0x79, 0x6d, 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d4, 0xdc, 0x59, 0x4f, 0xcd, 0x7d, 0xef, 0xa9, 0xb9, 0x57, 0xd5, 0xcc, 0x50, + 0xf5, 0xb9, 0xb6, 0x3c, 0xcb, 0x66, 0xe2, 0x80, 0x8e, 0x2b, 0x0f, 0xd1, 0x49, 0xfa, 0x31, 0x8d, + 0x87, 0xcc, 0xfe, 0x9f, 0xaf, 0xe2, 0xf6, 0xaf, 0x00, 0x00, 0x00, 0xff, 0xff, 0xc7, 0xb7, 0x60, + 0xef, 0x6b, 0x07, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1053,6 +1062,11 @@ func (m *MsgBeginUnlockingResponse) MarshalToSizedBuffer(dAtA []byte) (int, erro _ = i var l int _ = l + if m.UnlockingLockID != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.UnlockingLockID)) + i-- + dAtA[i] = 0x10 + } if m.Success { i-- if m.Success { @@ -1327,6 +1341,9 @@ func (m *MsgBeginUnlockingResponse) Size() (n int) { if m.Success { n += 2 } + if m.UnlockingLockID != 0 { + n += 1 + sovTx(uint64(m.UnlockingLockID)) + } return n } @@ -1968,6 +1985,25 @@ func (m *MsgBeginUnlockingResponse) Unmarshal(dAtA []byte) error { } } m.Success = bool(v != 0) + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field UnlockingLockID", wireType) + } + m.UnlockingLockID = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.UnlockingLockID |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } default: iNdEx = preIndex skippy, err := skipTx(dAtA[iNdEx:]) diff --git a/x/superfluid/keeper/edge_case_test.go b/x/superfluid/keeper/edge_case_test.go index 3c04f84c66c..06aa03d53a7 100644 --- a/x/superfluid/keeper/edge_case_test.go +++ b/x/superfluid/keeper/edge_case_test.go @@ -136,7 +136,7 @@ func (suite *KeeperTestSuite) TestTryUnbondingSuperfluidLockupDirectly() { _, _, locks := suite.setupSuperfluidDelegations(valAddrs, tc.superDelegations, denoms) for _, lock := range locks { - err := suite.App.LockupKeeper.BeginUnlock(suite.Ctx, lock.ID, sdk.Coins{}) + _, err := suite.App.LockupKeeper.BeginUnlock(suite.Ctx, lock.ID, sdk.Coins{}) suite.Require().Error(err) } }) diff --git a/x/superfluid/keeper/unpool_test.go b/x/superfluid/keeper/unpool_test.go index dcab10d934a..ca2aa0b25de 100644 --- a/x/superfluid/keeper/unpool_test.go +++ b/x/superfluid/keeper/unpool_test.go @@ -176,7 +176,7 @@ func (suite *KeeperTestSuite) TestUnpool() { } else { lock, err := lockupKeeper.GetLockByID(ctx, lockID) suite.Require().NoError(err) - err = lockupKeeper.BeginUnlock(ctx, lockID, lock.Coins) + _, err = lockupKeeper.BeginUnlock(ctx, lockID, lock.Coins) suite.Require().NoError(err) // add time to current time to test lock end time diff --git a/x/valset-pref/keeper_test.go b/x/valset-pref/keeper_test.go index 203a5736eb6..cd666f5f594 100644 --- a/x/valset-pref/keeper_test.go +++ b/x/valset-pref/keeper_test.go @@ -246,7 +246,7 @@ func (suite *KeeperTestSuite) SetupLocks(delegator sdk.AccAddress) []lockuptypes unbondingLocks, err := suite.App.LockupKeeper.CreateLock(suite.Ctx, delegator, osmoToLock, twoWeekDuration) suite.Require().NoError(err) - err = suite.App.LockupKeeper.BeginUnlock(suite.Ctx, unbondingLocks.ID, nil) + _, err = suite.App.LockupKeeper.BeginUnlock(suite.Ctx, unbondingLocks.ID, nil) suite.Require().NoError(err) locks = append(locks, unbondingLocks) diff --git a/x/valset-pref/types/expected_interfaces.go b/x/valset-pref/types/expected_interfaces.go index 4d7e7a5a716..7eb585b4c31 100644 --- a/x/valset-pref/types/expected_interfaces.go +++ b/x/valset-pref/types/expected_interfaces.go @@ -35,6 +35,6 @@ type LockupKeeper interface { GetLockByID(ctx sdk.Context, lockID uint64) (*lockuptypes.PeriodLock, error) GetAllSyntheticLockupsByLockup(ctx sdk.Context, lockID uint64) []lockuptypes.SyntheticLock ForceUnlock(ctx sdk.Context, lock lockuptypes.PeriodLock) error - BeginUnlock(ctx sdk.Context, lockID uint64, coins sdk.Coins) error + BeginUnlock(ctx sdk.Context, lockID uint64, coins sdk.Coins) (uint64, error) GetPeriodLocks(ctx sdk.Context) ([]lockuptypes.PeriodLock, error) }