-
Notifications
You must be signed in to change notification settings - Fork 749
fix: adding check for blocked addresses before escrowing fees #1890
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
Changes from 1 commit
8525e4e
42d6666
808ee69
337df64
e9248c4
8a6b1f1
e3115f5
6309549
ffb9e33
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -78,6 +78,15 @@ func (k Keeper) PayPacketFee(goCtx context.Context, msg *types.MsgPayPacketFee) | |
| return nil, types.ErrFeeModuleLocked | ||
| } | ||
|
|
||
| refundAcc, err := sdk.AccAddressFromBech32(msg.Signer) | ||
| if err != nil { | ||
| return nil, err | ||
| } | ||
|
|
||
| if k.bankKeeper.BlockedAddr(refundAcc) { | ||
| return nil, sdkerrors.Wrapf(types.ErrBlockedAddress, "%s", refundAcc) | ||
| } | ||
|
|
||
| // get the next sequence | ||
| sequence, found := k.GetNextSequenceSend(ctx, msg.SourcePortId, msg.SourceChannelId) | ||
| if !found { | ||
|
|
@@ -106,6 +115,15 @@ func (k Keeper) PayPacketFeeAsync(goCtx context.Context, msg *types.MsgPayPacket | |
| return nil, types.ErrFeeNotEnabled | ||
| } | ||
|
|
||
| refundAcc, err := sdk.AccAddressFromBech32(msg.PacketFee.RefundAddress) | ||
| if err != nil { | ||
| return nil, err | ||
| } | ||
|
|
||
| if k.bankKeeper.BlockedAddr(refundAcc) { | ||
| return nil, sdkerrors.Wrapf(types.ErrBlockedAddress, "%s", refundAcc) | ||
| } | ||
|
|
||
| if k.IsLocked(ctx) { | ||
| return nil, types.ErrFeeModuleLocked | ||
| } | ||
|
Comment on lines
118
to
138
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we move the check to below
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Agreed |
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -672,9 +672,9 @@ 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 | ||
| // do not add the following modules to blocked addresses | ||
| // this is only used for testing | ||
| if acc == ibcmock.ModuleName { | ||
| if acc == ibcmock.ModuleName || acc == distrtypes.ModuleName { | ||
|
||
| continue | ||
| } | ||
|
|
||
|
|
||
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.
Maybe instead of adding a new error, do something like?
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