Skip to content

Commit

Permalink
blocked feegranter should be blocked
Browse files Browse the repository at this point in the history
  • Loading branch information
lizhi authored and aofengli committed Jul 18, 2023
1 parent 4d983a4 commit ae859a0
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions modules/perm/keeper/ante.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,20 @@ func NewAuthDecorator(k Keeper) AuthDecorator {

// AnteHandle returns an AnteHandler that checks the auth to send msg
func (ad AuthDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, next sdk.AnteHandler) (newCtx sdk.Context, err error) {
feeTx := tx.(sdk.FeeTx)
granter := feeTx.FeeGranter()
if granter != nil {
if ad.k.GetBlockAccount(ctx, granter) {
return ctx, sdkerrors.Wrapf(types.ErrUnauthorizedOperation, "The granter %s has been blocked", granter)
}
}

feePayer := feeTx.FeePayer()
if feePayer != nil {
if ad.k.GetBlockAccount(ctx, feePayer) {
return ctx, sdkerrors.Wrapf(types.ErrUnauthorizedOperation, "The feePayer %s has been blocked", feePayer)
}
}
for _, msg := range tx.GetMsgs() {
for _, signer := range msg.GetSigners() {
if ad.k.GetBlockAccount(ctx, signer) {
Expand Down

0 comments on commit ae859a0

Please sign in to comment.