-
Notifications
You must be signed in to change notification settings - Fork 96
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ae1c715
commit 5c6aa71
Showing
2 changed files
with
33 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package blacklist | ||
|
||
import ( | ||
"fmt" | ||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
authsigning "github.com/cosmos/cosmos-sdk/x/auth/signing" | ||
) | ||
|
||
var Blacklist = map[string]bool{ | ||
// IBC exploiter | ||
"terra1wrve5z5vsmrgy6ldcveq93aldr6wk3qmxavs4j": true, | ||
} | ||
|
||
type BlacklistAnteHandler struct { | ||
} | ||
|
||
func NewBlacklistDecorator() BlacklistAnteHandler { | ||
return BlacklistAnteHandler{} | ||
} | ||
|
||
func (b BlacklistAnteHandler) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, next sdk.AnteHandler) (newCtx sdk.Context, err error) { | ||
sigTx, ok := tx.(authsigning.SigVerifiableTx) | ||
if ok { | ||
for _, sig := range sigTx.GetSigners() { | ||
if Blacklist[sig.String()] { | ||
return ctx, fmt.Errorf("signer %s is blacklisted", sig.String()) | ||
} | ||
} | ||
} | ||
return next(ctx, tx, simulate) | ||
} |