Skip to content

Commit

Permalink
Problem: black list addresses are not logged (#1328) (#1362)
Browse files Browse the repository at this point in the history
* Problem: black list addresses are not logged (#1328)

Update app/app.go

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

update log

Problem: blacklist logging visibilty to low (#1334)

Solution: raised logging severity to 'error'

Signed-off-by: Bladerox <[email protected]>
Co-authored-by: Bladerox <[email protected]>

* Update CHANGELOG.md

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

* bump version

* fix conflict

* fix build

---------

Signed-off-by: Bladerox <[email protected]>
Signed-off-by: yihuang <[email protected]>
Co-authored-by: Bladerox <[email protected]>
  • Loading branch information
yihuang and Bladerox authored Mar 26, 2024
1 parent 148b61b commit 10b8eeb
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 1 deletion.
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

- [#1362](https://github.com/crypto-org-chain/cronos/pull/1362) Log blacklist addresses.

*March 19, 2024*

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

import (
"crypto/sha256"
"encoding/hex"
stderrors "errors"
"fmt"
"io"
Expand All @@ -9,6 +11,7 @@ import (
"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 +921,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
2 changes: 1 addition & 1 deletion default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
, nativeByteOrder ? true # nativeByteOrder mode will panic on big endian machines
}:
let
version = "v1.1.0";
version = "v1.1.1";
pname = "cronosd";
tags = [ "ledger" "netgo" network "rocksdb" "grocksdb_no_link" ] ++ lib.optionals nativeByteOrder [ "nativebyteorder" ];
ldflags = lib.concatStringsSep "\n" ([
Expand Down

0 comments on commit 10b8eeb

Please sign in to comment.