From 75eaec11a0bc4284c7fac5d4dbcd51fc3de2eb5a Mon Sep 17 00:00:00 2001 From: HuangYi Date: Mon, 26 Feb 2024 11:59:01 +0800 Subject: [PATCH 1/2] Problem: black list addresses are not logged Update app/app.go Signed-off-by: yihuang update log --- app/app.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/app/app.go b/app/app.go index ff2b1ec165..17ded3d99d 100644 --- a/app/app.go +++ b/app/app.go @@ -1,6 +1,8 @@ package app import ( + "crypto/sha256" + "encoding/hex" "errors" "fmt" "io" @@ -800,6 +802,22 @@ func New( // use Ethermint's custom AnteHandler func (app *App) setAnteHandler(txConfig client.TxConfig, maxGasWanted uint64, blacklist []string) { + if len(blacklist) > 0 { + // hash blacklist concatenated + h := sha256.New() + for _, addr := range blacklist { + _, err := h.Write([]byte(addr)) + if err != nil { + panic(err) + } + } + app.Logger().Info("Setting ante handler with blacklist", "size", len(blacklist), "hash", hex.EncodeToString(h.Sum(nil))) + for _, addr := range blacklist { + app.Logger().Info("Blacklisted address", "address", addr) + } + } else { + app.Logger().Info("Setting ante handler without blacklist") + } anteHandler, err := evmante.NewAnteHandler(evmante.HandlerOptions{ AccountKeeper: app.AccountKeeper, BankKeeper: app.BankKeeper, From 07bc0d111d21c418da01aae32234333e9f8b09af Mon Sep 17 00:00:00 2001 From: HuangYi Date: Mon, 26 Feb 2024 12:09:22 +0800 Subject: [PATCH 2/2] sort blacklist --- app/app.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/app.go b/app/app.go index 17ded3d99d..df525bb97b 100644 --- a/app/app.go +++ b/app/app.go @@ -9,6 +9,7 @@ import ( "net/http" "os" "path/filepath" + "sort" "github.com/crypto-org-chain/cronos/x/cronos/middleware" "golang.org/x/exp/slices" @@ -803,6 +804,7 @@ func New( // use Ethermint's custom AnteHandler func (app *App) setAnteHandler(txConfig client.TxConfig, maxGasWanted uint64, blacklist []string) { if len(blacklist) > 0 { + sort.Strings(blacklist) // hash blacklist concatenated h := sha256.New() for _, addr := range blacklist {