Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add lockup duration edit method #1253

Merged
merged 23 commits into from
May 4, 2022
Merged

Conversation

mconcat
Copy link
Collaborator

@mconcat mconcat commented Apr 14, 2022

Description

Closes: #164


For contributor use:

  • Targeted PR against correct branch (see CONTRIBUTING.md)
  • Updated relevant documentation (docs/) or specification (x/<module>/spec/)
  • Added a relevant changelog entry to the Unreleased section in CHANGELOG.md
  • Re-reviewed Files changed in the Github PR explorer

remove gw file

fdsa
@ValarDragon
Copy link
Member

Ah sweet! Lets add a hook for this?

Also thoughts on renaming EditLockup to ExtendLockup?

@mconcat
Copy link
Collaborator Author

mconcat commented Apr 14, 2022

Ah sweet! Lets add a hook for this?

Also thoughts on renaming EditLockup to ExtendLockup?

I was thinking about using this method for editing other part of the lockups in the future(e.g. cancelling unlock) so we can reduce the total number of messages. If you think they should be in different message, I agree ExtendLockup is a better name!

@ValarDragon
Copy link
Member

I think they should be different messages!

(It is an interesting API question if CancelUnlock should be expected behavior of extend lockup on an unbonding lockup, but I think thats a future question)

proto/osmosis/lockup/tx.proto Outdated Show resolved Hide resolved
x/lockup/keeper/lock.go Outdated Show resolved Hide resolved
x/lockup/keeper/lock.go Outdated Show resolved Hide resolved
x/lockup/keeper/lock.go Outdated Show resolved Hide resolved
x/lockup/keeper/msg_server.go Outdated Show resolved Hide resolved
x/lockup/types/msgs.go Show resolved Hide resolved
Copy link
Member

@mattverse mattverse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we also add tests for EditLockup to check if the method has changed the lock as expected apart from the accumulation store check?

x/lockup/keeper/lock.go Outdated Show resolved Hide resolved
@codecov-commenter
Copy link

codecov-commenter commented Apr 18, 2022

Codecov Report

Merging #1253 (dba0383) into main (f56fbe5) will decrease coverage by 1.37%.
The diff coverage is 28.57%.

@@            Coverage Diff             @@
##             main    #1253      +/-   ##
==========================================
- Coverage   19.82%   18.45%   -1.38%     
==========================================
  Files         202      213      +11     
  Lines       27685    30216    +2531     
==========================================
+ Hits         5489     5575      +86     
- Misses      21175    23609    +2434     
- Partials     1021     1032      +11     
Impacted Files Coverage Δ
x/gamm/pool-models/stableswap/amm.go 43.28% <0.00%> (-12.49%) ⬇️
x/gamm/pool-models/stableswap/pool.go 0.00% <0.00%> (ø)
x/lockup/client/cli/query.go 51.99% <0.00%> (-3.00%) ⬇️
x/lockup/keeper/grpc_query.go 50.40% <0.00%> (-4.47%) ⬇️
x/lockup/keeper/store.go 84.95% <0.00%> (-2.32%) ⬇️
x/lockup/keeper/iterator.go 82.92% <33.33%> (-2.08%) ⬇️
x/lockup/keeper/lock.go 56.20% <65.21%> (+0.88%) ⬆️
x/lockup/keeper/msg_server.go 81.44% <76.47%> (-1.06%) ⬇️
x/gamm/pool-models/balancer/amm.go 25.12% <87.50%> (+7.53%) ⬆️
x/gamm/client/cli/tx.go 59.50% <100.00%> (-0.69%) ⬇️
... and 19 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e9b9804...dba0383. Read the comment docs.

x/lockup/keeper/lock.go Outdated Show resolved Hide resolved
x/lockup/keeper/lock.go Outdated Show resolved Hide resolved
x/lockup/keeper/lock.go Outdated Show resolved Hide resolved
x/lockup/keeper/lock.go Outdated Show resolved Hide resolved
x/lockup/keeper/lock.go Outdated Show resolved Hide resolved
@stackman27
Copy link
Contributor

Closes #164 ?

@alexanderbez
Copy link
Contributor

@mattverse wanna give this another look?

Copy link
Member

@mattverse mattverse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't want to block this PR for so long being picky 😅

Went through final review, should be good to merge after fix!

x/lockup/keeper/msg_server.go Show resolved Hide resolved
x/lockup/keeper/lock_test.go Show resolved Hide resolved
x/lockup/keeper/lock_test.go Show resolved Hide resolved
Copy link
Member

@mattverse mattverse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🌮

@alexanderbez alexanderbez requested a review from a team May 3, 2022 21:33
Comment on lines +583 to +584
k.hooks.OnTokenUnlocked(ctx, lock.OwnerAddress(), lock.ID, lock.Coins, oldLock.Duration, lock.EndTime)
k.hooks.OnTokenLocked(ctx, lock.OwnerAddress(), lock.ID, lock.Coins, lock.Duration, lock.EndTime)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets re-assess these hook calls in a follow-up issue

@@ -261,3 +262,78 @@ func (suite *KeeperTestSuite) TestMsgBeginUnlockingAll() {
}
}
}

func (suite *KeeperTestSuite) TestMsgEditLockup() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great job on this test!

Copy link
Member

@ValarDragon ValarDragon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work on this!

@ValarDragon ValarDragon merged commit 6e1f93a into main May 4, 2022
@ValarDragon ValarDragon deleted the mconcat/lockup-increase-duration branch May 4, 2022 03:42
@github-actions github-actions bot mentioned this pull request Apr 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

x/lockup: Enable users to elongate the lockup period for locked tokens
6 participants