-
Notifications
You must be signed in to change notification settings - Fork 597
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
refactor: writing test case for module account incentivizing packet #1397
Conversation
@@ -106,6 +108,15 @@ func (suite *KeeperTestSuite) TestPayPacketFee() { | |||
}, | |||
true, | |||
}, | |||
{ | |||
"refund account is 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.
looking at it now, it might make more sense to put this in the escrow test suite
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.
it'd be nice if there was a test for distributing to a module acc
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.
This is great that it works out of the box... thank you, @seantking!
I guess it will also be fine, but for completeness... should we also add a test that exercises the refunding of the fees back to the module account that incentivized the packet.
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.
Nice work. It would be great if we had a test that confirms non-blocked module acc's can be refunded to
@@ -106,6 +108,15 @@ func (suite *KeeperTestSuite) TestPayPacketFee() { | |||
}, | |||
true, | |||
}, | |||
{ | |||
"refund account is 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.
it'd be nice if there was a test for distributing to a module acc
…refunding to module acc
@@ -648,6 +650,12 @@ func (app *SimApp) LoadHeight(height int64) error { | |||
func (app *SimApp) ModuleAccountAddrs() map[string]bool { | |||
modAccAddrs := make(map[string]bool) | |||
for acc := range maccPerms { | |||
// do not add mock module to blocked addresses |
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.
This is required so that we can use mock module as a non blocked module account addr
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.
Nice we should add a changelog for this!
{ | ||
"refund account is module account", | ||
func() { | ||
msg.Signer = suite.chainA.GetSimApp().AccountKeeper.GetModuleAddress(disttypes.ModuleName).String() |
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.
I think we can maybe remove this test case now?
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.
Is it worth keeping this in, and just change disttypes.ModuleName
to mock.ModuleName
?
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.
I agree. It's worth keeping it.
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.
Looks pretty much good to go pending changelog on mock module acc!
LGTM! 🚀
@@ -648,6 +650,12 @@ func (app *SimApp) LoadHeight(height int64) error { | |||
func (app *SimApp) ModuleAccountAddrs() map[string]bool { | |||
modAccAddrs := make(map[string]bool) | |||
for acc := range maccPerms { | |||
// do not add mock module to blocked addresses |
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.
Nice we should add a changelog for this!
{ | ||
"refund account is module account", | ||
func() { | ||
msg.Signer = suite.chainA.GetSimApp().AccountKeeper.GetModuleAddress(disttypes.ModuleName).String() |
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.
Is it worth keeping this in, and just change disttypes.ModuleName
to mock.ModuleName
?
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.
Thanks for all the detective work with blocked addresses to get this to work, @seantking! 🔎
{ | ||
"refund account is module account", | ||
func() { | ||
msg.Signer = suite.chainA.GetSimApp().AccountKeeper.GetModuleAddress(disttypes.ModuleName).String() |
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.
I agree. It's worth keeping it.
Description
closes: #1329
Before we can merge this PR, please make sure that all the following items have been
checked off. If any of the checklist items are not applicable, please leave them but
write a little note why.
docs/
) or specification (x/<module>/spec/
)godoc
comments.Unreleased
section inCHANGELOG.md
Files changed
in the Github PR explorerCodecov Report
in the comment section below once CI passes