-
Notifications
You must be signed in to change notification settings - Fork 0
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
feat: configurable fee collector for DeductFeeDecorator #407
Conversation
Lint failure expected. |
Should be cherry-picked onto a "release" branch. Following past precedent, which it's unnecessary to improve upon, we'll branch |
x/auth/ante/fee.go
Outdated
return NewDeductFeeDecoratorWithName(ak, bk, fk, tfc, types.FeeCollectorName) | ||
} | ||
|
||
// NewDeductFeeDecorator returns a DeductFeeDecorator using a custom fee collector module account. |
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.
// NewDeductFeeDecorator returns a DeductFeeDecorator using a custom fee collector module account. | |
// NewDeductFeeDecoratorWithName returns a DeductFeeDecorator using a custom fee collector module account. |
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.
Oops, done.
x/auth/ante/fee_test.go
Outdated
tx, err := s.CreateTestTx(privs, accNums, accSeqs, s.ctx.ChainID()) | ||
s.Require().NoError(err) | ||
|
||
// Set account with sufficient funds |
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.
// Set account with sufficient funds | |
// Set transacting account with sufficient funds |
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.
Done.
x/auth/ante/fee_test.go
Outdated
dfd := ante.NewDeductFeeDecoratorWithName(s.app.AccountKeeper, s.app.BankKeeper, nil, nil, altCollectorName) | ||
antehandler := sdk.ChainAnteDecorators(dfd) | ||
|
||
_, err = antehandler(s.ctx, tx, false) | ||
s.Require().NoError(err) |
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.
dfd := ante.NewDeductFeeDecoratorWithName(s.app.AccountKeeper, s.app.BankKeeper, nil, nil, altCollectorName) | |
antehandler := sdk.ChainAnteDecorators(dfd) | |
_, err = antehandler(s.ctx, tx, false) | |
s.Require().NoError(err) | |
// Run the transaction through a handler chain that deducts fees into altCollectorAcc. | |
dfd := ante.NewDeductFeeDecoratorWithName(s.app.AccountKeeper, s.app.BankKeeper, nil, nil, altCollectorName) | |
antehandler := sdk.ChainAnteDecorators(dfd) | |
_, err = antehandler(s.ctx, tx, false) | |
s.Require().NoError(err) |
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.
Done.
s.Require().True(s.app.BankKeeper.GetAllBalances(s.ctx, feeCollectorAcc.GetAddress()).Empty()) | ||
newAltBalance := s.app.BankKeeper.GetAllBalances(s.ctx, altCollectorAcc.GetAddress()) | ||
s.Require().True(newAltBalance.IsAllGTE(altBalance)) |
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.
s.Require().True(s.app.BankKeeper.GetAllBalances(s.ctx, feeCollectorAcc.GetAddress()).Empty()) | |
newAltBalance := s.app.BankKeeper.GetAllBalances(s.ctx, altCollectorAcc.GetAddress()) | |
s.Require().True(newAltBalance.IsAllGTE(altBalance)) | |
// Assert that feeCollectorAcc is still empty but the altCollectorAcc balance has increased. | |
newFeeCollectorBalance := s.app.BankKeeper.GetAllBalances(s.ctx, feeCollectorAcc.GetAddress()) | |
s.Require().True(newFeeCollectorBalance.Empty()) | |
newAltBalance := s.app.BankKeeper.GetAllBalances(s.ctx, altCollectorAcc.GetAddress()) | |
s.Require().True(newAltBalance.IsAllGTE(altBalance)) | |
s.Require().False(newAltBalance.IsEqual(altBalance)) |
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.
Done.
* feat: configurable fee collector for DeductFeeDecorator * docs: update changelog with PR number * test: ensure increment of alt account, comments
Functionality "upstreamed" in agoric-labs/cosmos-sdk#407.
Functionality "upstreamed" in agoric-labs/cosmos-sdk#407.
Functionality "upstreamed" in agoric-labs/cosmos-sdk#407.
Functionality "upstreamed" in agoric-labs/cosmos-sdk#407.
* feat: configurable fee collector for DeductFeeDecorator * docs: update changelog with PR number * test: ensure increment of alt account, comments
* feat: configurable fee collector for DeductFeeDecorator * docs: update changelog with PR number * test: ensure increment of alt account, comments
Description
Refs: Agoric/agoric-sdk#9036
Make the fee collector module name in
DeductFeeDecorator
configurable.Pulls a customization from Agoric/agoric-sdk into agoric-labs/cosmos-sdk so it can evolve along with cosmos-sdk.
Author Checklist
All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.
I have...
!
to the type prefix if API or client breaking changeCHANGELOG.md
Reviewers Checklist
All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.
I have...
!
in the type prefix if API or client breaking change