-
Notifications
You must be signed in to change notification settings - Fork 69
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
Move allow list logic to msg server #550
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #550 +/- ##
==========================================
- Coverage 54.89% 54.87% -0.03%
==========================================
Files 631 631
Lines 54954 54926 -28
==========================================
- Hits 30169 30138 -31
- Misses 22628 22633 +5
+ Partials 2157 2155 -2
|
x/bank/keeper/send.go
Outdated
@@ -533,6 +534,19 @@ func (k BaseSendKeeper) IsAllowedToSendCoins(ctx sdk.Context, addr sdk.AccAddres | |||
return true | |||
} | |||
|
|||
func (k BaseSendKeeper) getAllModuleAddresses(ctx sdk.Context) []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.
Not the most efficient way to retrieve all module addresses and we may also want to cache it. So, I will look over the weekend how to improve this. I have also found we are passing some module addresses via blockedAddrs map[string]bool
, that is being used for blocking some transactions though. And there is also module.Manager that may return them. @philipsu522 @codchen let me know what would the most efficient way.
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.
yea i agree this might be too expensive. What about iterating through all modules (maybe app.go could expose this because we register all modules) and then calling
sei-cosmos/x/auth/keeper/keeper.go
Line 160 in 63ac1b2
func (ak AccountKeeper) GetModuleAddress(moduleName string) sdk.AccAddress { |
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.
Refactored, to avoid module checks altogether.
I think for this feature we should only be in business of controlling transfers for regular account/addresses, not modules, with transfers to modules implicitly not allowed via send
. And we should not interfere with module->module, account->module and module->account flows.
The way to do this would be to move the allowlist logic to the message server and only do the checks in send
and multisend
.
Describe your changes and provide context
Move allow list logic to msg server
Testing performed to validate your change