-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Separate vesting from auth, add custom vesting schedules #5040
Conversation
…dekunze/ADR-11-generalize-gen-accs
Co-Authored-By: Alexander Bezobchuk <alexanderbez@users.noreply.github.com>
….com/cosmos/cosmos-sdk into fedekunze/ADR-11-generalize-gen-accs
This is R4R, but currently blocked by #5017 |
Codecov Report
@@ Coverage Diff @@
## master #5040 +/- ##
==========================================
- Coverage 54.94% 54.87% -0.08%
==========================================
Files 302 300 -2
Lines 18357 18362 +5
==========================================
- Hits 10087 10076 -11
- Misses 7517 7546 +29
+ Partials 753 740 -13 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good @karzak, left some more feedback ⚡️
x/auth/module.go
Outdated
@@ -36,6 +37,7 @@ func (AppModuleBasic) Name() string { | |||
// RegisterCodec registers the auth module's types for the given codec. | |||
func (AppModuleBasic) RegisterCodec(cdc *codec.Codec) { | |||
types.RegisterCodec(cdc) | |||
vestingtypes.RegisterCodec(cdc) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we avoid requiring auth to register anything related to vesting? Vesting should be completely opt-in if possible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how'd would you make it opt-in then. By defining a module.go
in vesting?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The two options I see are
- Define a
module.go
, which was rejected previously in e905853#r325162521 - Require
vesting
to callRegisterCodec
outside the normal module manager pattern, as in ab06e07#r329289047
IMO, registering vesting types in auth
doesn't makes sense, as a downstream consumer could build an app that doesn't want vesting, and would find the inclusion of vesting an anti-pattern. The tradeoff is that it needs to be clearly communicated that submodules have to be manually registered.
require.Equal(t, origCoins, vacc.GetCoins()) | ||
} | ||
|
||
func TestPeriodicVestingAccountSend(t *testing.T) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why should these move to auth/vesting? These tests are testing banking functionality with relation to vesting contraints.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM @karzak. Final piece missing is a changelog entries.
Under Features
:
* [\#4486](https://github.com/cosmos/cosmos-sdk/issues/4486) Introduce new `PeriodicVestingAccount` vesting account type
that allows for arbitrary vesting periods.
Under API Breaking
:
* [\#4486](https://github.com/cosmos/cosmos-sdk/issues/4486) Vesting account types decoupled from the `x/auth` module and
now live under `x/auth/vesting`. Applications wishing to use vesting account types must be sure to register types via
`RegisterCodec` under the new vesting package.
* [\#4486](https://github.com/cosmos/cosmos-sdk/issues/4486) The `NewBaseVestingAccount` constructor returns an error
if the provided arguments are invalid.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK 🎉
Fixes #4486
Features
PeriodicVestingAccount
, which allows for arbitrary vesting schedules.Targeted PR against correct branch (see CONTRIBUTING.md)
Linked to github-issue with discussion and accepted design OR link to spec that describes this work.
Wrote tests
Updated relevant documentation (
docs/
)Added a relevant changelog entry to the
Unreleased
section inCHANGELOG.md
Re-reviewed
Files changed
in the github PR explorerFor Admin Use: