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

Create Force Unlock Messages #2733

Merged
merged 10 commits into from
Oct 10, 2022
Merged

Create Force Unlock Messages #2733

merged 10 commits into from
Oct 10, 2022

Conversation

mattverse
Copy link
Member

@mattverse mattverse commented Sep 14, 2022

Closes: #2727

What is the purpose of the change

This PR creates a msg for force unlocking for the addresses that has been passed via governance and registered as params in the lockup keeper.

This PR also includes adding additional logic to the lockup keeper since we did not support partial unlockings for locks that are already unlocking. ForceUnlock allows force unlocking of locks that are currently being unlocked.

Brief Changelog

  • Create ForceUnlock message for lockup keeper

Testing and Verifying

Testing WIP: Planning to do PR it separately as test cases are getting big, would prefer separate review for the test cases / edge cases dealt within the test cases

Some of the tests being worked on:

  • Test that is assets being superfluid delegated, undelegated
  • Test partial force unlocking

Documentation and Release Note

  • Does this pull request introduce a new feature or user-facing behavior changes? (yes / no)
  • Is a relevant changelog entry added to the Unreleased section in CHANGELOG.md? (yes / no)
  • How is the feature or change documented? (not applicable / specification (x/<module>/spec/) / Osmosis docs repo / not documented)

@mattverse mattverse requested a review from a team September 14, 2022 09:23
@github-actions github-actions bot added C:app-wiring Changes to the app folder C:x/gamm Changes, features and bugs related to the gamm module. C:x/lockup labels Sep 14, 2022
@github-actions github-actions bot removed the C:x/gamm Changes, features and bugs related to the gamm module. label Sep 14, 2022
Copy link
Contributor

@alexanderbez alexanderbez left a comment

Choose a reason for hiding this comment

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

LGTM! I can't speak much to the splitLock implementation, but the utilization looks sound.

proto/osmosis/lockup/tx.proto Show resolved Hide resolved
@@ -71,3 +72,15 @@ message MsgExtendLockup {
}

message MsgExtendLockupResponse { bool success = 1; }

message MsgForceUnlock {
string owner = 1 [ (gogoproto.moretags) = "yaml:\"owner\"" ];
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this an SDK address? If so, shouldn't we add (cosmos_proto.scalar) = "cosmos.AddressString"? Maybe our proto tooling doesn't support this yet?

Copy link
Contributor

Choose a reason for hiding this comment

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

Also, option (cosmos.msg.v1.signer) = "from_address";

Copy link
Member Author

Choose a reason for hiding this comment

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

what does (cosmos_proto.scalar) = "cosmos.AddressString" and option (cosmos.msg.v1.signer) = "from_address"; do?

Orignial intention was to recieve it as string and then convert it to address

return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, err.Error())
}

return &types.MsgForceUnlockResponse{Success: true}, nil
Copy link
Contributor

Choose a reason for hiding this comment

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

When would we ever return false? Is it worth having the Success field? Are there other fields we might want?

Copy link
Member Author

Choose a reason for hiding this comment

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

would return false on the response whenever the transaction fails due to error in msg server, I think this one field would suffice for the field of this response!

app/upgrades/v12/upgrades.go Outdated Show resolved Hide resolved
x/lockup/types/params.go Outdated Show resolved Hide resolved
x/lockup/types/msgs.go Show resolved Hide resolved
Comment on lines +55 to +58
func (k Keeper) GetForceUnlockAllowedAddresses(ctx sdk.Context) (forceUnlockAllowedAddresses []string) {
return k.GetParams(ctx).ForceUnlockAllowedAddresses
}

Copy link
Member

Choose a reason for hiding this comment

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

non-blocking nit: I'm generally unsure if this method is needed if we can get the addresses from params

Copy link
Member Author

Choose a reason for hiding this comment

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

I originally thought this looked messy(having to call params to call get the addresses), but on the second thought I tink that way makes everything more intuitive, reverting this part so that we call from params directly

x/lockup/keeper/msg_server.go Outdated Show resolved Hide resolved
x/lockup/keeper/msg_server.go Outdated Show resolved Hide resolved
@mattverse mattverse requested a review from p0mvn September 20, 2022 06:06
@mattverse mattverse added this to the V13 milestone Sep 22, 2022
@github-actions
Copy link
Contributor

github-actions bot commented Oct 7, 2022

This pull request has been automatically marked as stale because it has not had any recent activity. It will be closed if no further activity occurs. Thank you!

@github-actions github-actions bot added the Stale label Oct 7, 2022
@apollo-sturdy
Copy link

apollo-sturdy commented Oct 7, 2022

Hi. Wondering what the status of this issue is? Mainly curious if the API is finalized so that we (Apollo DAO) can implement this in our vault contract.

@mattverse mattverse added the V:state/breaking State machine breaking PR label Oct 10, 2022
@mattverse mattverse merged commit 83c9d22 into main Oct 10, 2022
@mattverse mattverse deleted the mattverse/force-unlock branch October 10, 2022 23:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C:app-wiring Changes to the app folder C:x/lockup C:x/superfluid V:state/breaking State machine breaking PR
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Force unlock message
5 participants