Skip to content

Commit

Permalink
Problem: black list addresses are not logged (crypto-org-chain#1328)
Browse files Browse the repository at this point in the history
Update app/app.go

Signed-off-by: yihuang <[email protected]>

update log

Problem: blacklist logging visibilty to low (crypto-org-chain#1334)

Solution: raised logging severity to 'error'

Signed-off-by: Bladerox <[email protected]>
Co-authored-by: Bladerox <[email protected]>
  • Loading branch information
yihuang and Bladerox committed Mar 26, 2024
1 parent 148b61b commit d1127a7
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

*March 26, 2024*

## v1.1.1

### Improvements

- [#]() Log blacklist addresses.

*March 19, 2024*

## v1.1.0
Expand Down
24 changes: 24 additions & 0 deletions app/app.go
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
package app

import (
<<<<<<< HEAD
stderrors "errors"
=======
"crypto/sha256"
"encoding/hex"
"errors"
>>>>>>> c007e115 (Problem: black list addresses are not logged (#1328))
"fmt"
"io"
"io/fs"
"math"
"net/http"
"os"
"path/filepath"
"sort"

autocliv1 "cosmossdk.io/api/cosmos/autocli/v1"
reflectionv1 "cosmossdk.io/api/cosmos/reflection/v1"
Expand Down Expand Up @@ -918,6 +925,23 @@ func New(

// use Ethermint's custom AnteHandler
func (app *App) setAnteHandler(txConfig client.TxConfig, maxGasWanted uint64, blacklist []string) error {
if len(blacklist) > 0 {
sort.Strings(blacklist)
// hash blacklist concatenated
h := sha256.New()
for _, addr := range blacklist {
_, err := h.Write([]byte(addr))
if err != nil {
panic(err)
}
}
app.Logger().Error("Setting ante handler with blacklist", "size", len(blacklist), "hash", hex.EncodeToString(h.Sum(nil)))
for _, addr := range blacklist {
app.Logger().Error("Blacklisted address", "address", addr)
}
} else {
app.Logger().Error("Setting ante handler without blacklist")
}
blockedMap := make(map[string]struct{}, len(blacklist))
for _, str := range blacklist {
addr, err := sdk.AccAddressFromBech32(str)
Expand Down

0 comments on commit d1127a7

Please sign in to comment.