From db3b86215468a7579fb418d66217267d10dd5d1d Mon Sep 17 00:00:00 2001 From: forcodedancing Date: Thu, 14 Apr 2022 19:50:13 +0800 Subject: [PATCH 1/4] use io and os to replace ioutil --- abci/example/kvstore/kvstore_test.go | 8 ++-- abci/types/protoreplace/protoreplace.go | 4 +- abci/types/snapshot.go | 11 +++--- cmd/tendermint/commands/root_test.go | 3 +- config/toml.go | 8 ++-- config/toml_test.go | 7 ++-- consensus/common_test.go | 2 +- consensus/reactor_test.go | 2 +- consensus/replay_test.go | 2 +- consensus/wal_test.go | 7 ++-- crypto/armor/armor.go | 4 +- go.mod | 49 +++++++++++++++---------- go.sum | 2 - libs/autofile/group_test.go | 5 +-- libs/cli/helper.go | 3 +- libs/cli/setup_test.go | 4 +- libs/common/cmap_test.go | 5 ++- libs/common/os.go | 7 ++-- libs/common/tempfile_test.go | 12 +++--- libs/db/backend_test.go | 3 +- libs/db/common_test.go | 4 +- libs/db/fsdb.go | 4 +- libs/log/tm_logger_test.go | 6 +-- libs/log/tmfmt_logger_test.go | 8 ++-- mempool/clist_mempool_test.go | 7 ++-- p2p/key.go | 7 ++-- p2p/pex/pex_reactor_test.go | 19 +++++----- p2p/switch_test.go | 3 +- p2p/trust/store_test.go | 3 +- p2p/upnp/upnp.go | 8 ++-- privval/file.go | 6 +-- privval/file_deprecated.go | 3 +- rpc/client/main_test.go | 3 +- rpc/lib/client/http_client.go | 8 ++-- rpc/lib/server/handlers.go | 4 +- rpc/lib/server/handlers_test.go | 10 ++--- rpc/lib/server/http_server_test.go | 5 +-- scripts/privValUpgrade_test.go | 2 +- state/blockindex/kv/kv_test.go | 3 +- state/export_test.go | 10 ++--- state/state.go | 4 +- state/txindex/kv/kv_bench_test.go | 4 +- state/txindex/kv/kv_test.go | 4 +- tools/tm-signer-harness/main.go | 3 +- types/genesis.go | 4 +- types/part_set_test.go | 4 +- types/vote_test.go | 6 +-- 47 files changed, 144 insertions(+), 156 deletions(-) diff --git a/abci/example/kvstore/kvstore_test.go b/abci/example/kvstore/kvstore_test.go index 80b07ff5a..f2e9ddf29 100644 --- a/abci/example/kvstore/kvstore_test.go +++ b/abci/example/kvstore/kvstore_test.go @@ -3,7 +3,7 @@ package kvstore import ( "bytes" "fmt" - "io/ioutil" + "os" "sort" "testing" @@ -57,7 +57,7 @@ func TestKVStoreKV(t *testing.T) { } func TestPersistentKVStoreKV(t *testing.T) { - dir, err := ioutil.TempDir("/tmp", "abci-kvstore-test") // TODO + dir, err := os.MkdirTemp("/tmp", "abci-kvstore-test") if err != nil { t.Fatal(err) } @@ -73,7 +73,7 @@ func TestPersistentKVStoreKV(t *testing.T) { } func TestPersistentKVStoreInfo(t *testing.T) { - dir, err := ioutil.TempDir("/tmp", "abci-kvstore-test") // TODO + dir, err := os.MkdirTemp("/tmp", "abci-kvstore-test") if err != nil { t.Fatal(err) } @@ -105,7 +105,7 @@ func TestPersistentKVStoreInfo(t *testing.T) { // add a validator, remove a validator, update a validator func TestValUpdates(t *testing.T) { - dir, err := ioutil.TempDir("/tmp", "abci-kvstore-test") // TODO + dir, err := os.MkdirTemp("/tmp", "abci-kvstore-test") if err != nil { t.Fatal(err) } diff --git a/abci/types/protoreplace/protoreplace.go b/abci/types/protoreplace/protoreplace.go index 7058a70fb..8790ebec9 100644 --- a/abci/types/protoreplace/protoreplace.go +++ b/abci/types/protoreplace/protoreplace.go @@ -1,3 +1,4 @@ +//go:build ignore // +build ignore package main @@ -5,7 +6,6 @@ package main import ( "bytes" "fmt" - "io/ioutil" "os" "os/exec" "regexp" @@ -21,7 +21,7 @@ func main() { bytePattern := regexp.MustCompile("[[][]]byte") const oldPath = "types/types.pb.go" const tmpPath = "types/types.pb.new" - content, err := ioutil.ReadFile(oldPath) + content, err := os.ReadFile(oldPath) if err != nil { panic("cannot read " + oldPath) os.Exit(1) diff --git a/abci/types/snapshot.go b/abci/types/snapshot.go index 548158257..9fa474148 100644 --- a/abci/types/snapshot.go +++ b/abci/types/snapshot.go @@ -3,7 +3,6 @@ package types import ( "crypto/sha256" "fmt" - "io/ioutil" "os" "path/filepath" "strconv" @@ -99,7 +98,7 @@ func (reader *SnapshotReader) LoadFromRestoration(hash SHA256Sum) ([]byte, error func (reader *SnapshotReader) loadImpl(hash SHA256Sum, category string) ([]byte, error) { toRead := filepath.Join(reader.DbDir, snapshotDir, strconv.FormatInt(reader.Height, 10), category, fmt.Sprintf("%x", hash)) - return ioutil.ReadFile(toRead) + return os.ReadFile(toRead) } func (reader *SnapshotReader) LoadManifest(height int64) (int64, []byte, error) { @@ -114,7 +113,7 @@ func (reader *SnapshotReader) LoadManifest(height int64) (int64, []byte, error) return 0, nil, fmt.Errorf("requested wrong height: %d, reader height: %d", height, reader.Height) } else { toRead := filepath.Join(reader.DbDir, snapshotDir, strconv.FormatInt(lookupHeight, 10), finalizedDir, manifestFileName) - manifest, err := ioutil.ReadFile(toRead) + manifest, err := os.ReadFile(toRead) return lookupHeight, manifest, err } } @@ -129,7 +128,7 @@ func (reader *SnapshotReader) InitSnapshotHeight() int64 { var latestHeight int64 toTraverse := filepath.Join(reader.DbDir, snapshotDir) - if files, err := ioutil.ReadDir(toTraverse); err == nil { + if files, err := os.ReadDir(toTraverse); err == nil { for _, f := range files { if f.IsDir() { if height, err := strconv.ParseInt(f.Name(), 10, 64); err == nil && height > latestHeight { @@ -157,7 +156,7 @@ func (writer *SnapshotWriter) Write(hash SHA256Sum, chunk []byte) error { return err } toWrite := filepath.Join(path, fmt.Sprintf("%x", hash)) - return ioutil.WriteFile(toWrite, chunk, 0644) + return os.WriteFile(toWrite, chunk, 0644) } func (writer *SnapshotWriter) WriteManifest(manifest []byte) error { @@ -166,7 +165,7 @@ func (writer *SnapshotWriter) WriteManifest(manifest []byte) error { return err } toWrite := filepath.Join(path, manifestFileName) - return ioutil.WriteFile(toWrite, manifest, 0644) + return os.WriteFile(toWrite, manifest, 0644) } func (writer *SnapshotWriter) Finalize() error { diff --git a/cmd/tendermint/commands/root_test.go b/cmd/tendermint/commands/root_test.go index 229385af9..fc02f5c28 100644 --- a/cmd/tendermint/commands/root_test.go +++ b/cmd/tendermint/commands/root_test.go @@ -2,7 +2,6 @@ package commands import ( "fmt" - "io/ioutil" "os" "path/filepath" "strconv" @@ -168,5 +167,5 @@ func WriteConfigVals(dir string, vals map[string]string) error { data += fmt.Sprintf("%s = \"%s\"\n", k, v) } cfile := filepath.Join(dir, "config.toml") - return ioutil.WriteFile(cfile, []byte(data), 0666) + return os.WriteFile(cfile, []byte(data), 0666) } diff --git a/config/toml.go b/config/toml.go index 65db774dd..ef0eb0752 100644 --- a/config/toml.go +++ b/config/toml.go @@ -3,7 +3,7 @@ package config import ( "bytes" "fmt" - "io/ioutil" + "os" "path/filepath" "text/template" @@ -211,7 +211,7 @@ disable_websocket = {{ .RPC.DisableWebsocket }} # 10 - default size. # Should be {WebsocketPoolSpawnSize} =< {WebsocketPoolMaxSize} websocket_pool_size = {{ .RPC.WebsocketPoolMaxSize }} - + # The queued buffer for workers to process requests. # 10 -default websocket_pool_queue_size = {{ .RPC.WebsocketPoolQueueSize }} @@ -354,7 +354,7 @@ recheck = {{ .Mempool.Recheck }} broadcast = {{ .Mempool.Broadcast }} wal_dir = "{{ js .Mempool.WalPath }}" -# If set true, will only broadcast transactions to persistent peers. +# If set true, will only broadcast transactions to persistent peers. only_to_persistent = {{ .Mempool.OnlyToPersistent }} # If set true, only the transaction from none persistent peer will broadcast. @@ -480,7 +480,7 @@ func ResetTestRoot(testName string) *Config { func ResetTestRootWithChainID(testName string, chainID string) *Config { // create a unique, concurrency-safe test directory under os.TempDir() - rootDir, err := ioutil.TempDir("", fmt.Sprintf("%s-%s_", chainID, testName)) + rootDir, err := os.MkdirTemp("", fmt.Sprintf("%s-%s_", chainID, testName)) if err != nil { panic(err) } diff --git a/config/toml_test.go b/config/toml_test.go index 5910f10c5..1eaa7133e 100644 --- a/config/toml_test.go +++ b/config/toml_test.go @@ -1,7 +1,6 @@ package config import ( - "io/ioutil" "os" "path/filepath" "strings" @@ -23,7 +22,7 @@ func TestEnsureRoot(t *testing.T) { require := require.New(t) // setup temp dir for test - tmpDir, err := ioutil.TempDir("", "config-test") + tmpDir, err := os.MkdirTemp("", "config-test") require.Nil(err) defer os.RemoveAll(tmpDir) // nolint: errcheck @@ -31,7 +30,7 @@ func TestEnsureRoot(t *testing.T) { EnsureRoot(tmpDir) // make sure config is set properly - data, err := ioutil.ReadFile(filepath.Join(tmpDir, defaultConfigFilePath)) + data, err := os.ReadFile(filepath.Join(tmpDir, defaultConfigFilePath)) require.Nil(err) if !checkConfig(string(data)) { @@ -52,7 +51,7 @@ func TestEnsureTestRoot(t *testing.T) { rootDir := cfg.RootDir // make sure config is set properly - data, err := ioutil.ReadFile(filepath.Join(rootDir, defaultConfigFilePath)) + data, err := os.ReadFile(filepath.Join(rootDir, defaultConfigFilePath)) require.Nil(err) if !checkConfig(string(data)) { diff --git a/consensus/common_test.go b/consensus/common_test.go index d1d692b17..ccd128ccd 100644 --- a/consensus/common_test.go +++ b/consensus/common_test.go @@ -740,7 +740,7 @@ func newCounter() abci.Application { } func newPersistentKVStore() abci.Application { - dir, err := ioutil.TempDir("", "persistent-kvstore") + dir, err := os.MkdirTemp("", "persistent-kvstore") if err != nil { panic(err) } diff --git a/consensus/reactor_test.go b/consensus/reactor_test.go index 231826e1c..bca0ee3eb 100644 --- a/consensus/reactor_test.go +++ b/consensus/reactor_test.go @@ -688,7 +688,7 @@ func TestNewValidBlockMessageValidateBasic(t *testing.T) { }, { func(msg *NewValidBlockMessage) { msg.BlockParts = cmn.NewBitArray(types.MaxBlockPartsCount + 1) }, - "BlockParts bit array size 1602 not equal to BlockPartsHeader.Total 1", + "BlockParts bit array size 102 not equal to BlockPartsHeader.Total 1", }, } diff --git a/consensus/replay_test.go b/consensus/replay_test.go index dedb530df..f48f9ac68 100644 --- a/consensus/replay_test.go +++ b/consensus/replay_test.go @@ -70,7 +70,7 @@ func startNewConsensusStateAndWaitForBlock(t *testing.T, consensusReplayConfig * cs := newConsensusStateWithConfigAndBlockStore(consensusReplayConfig, state, privValidator, kvstore.NewKVStoreApplication(), blockDB) cs.SetLogger(logger) - bytes, _ := ioutil.ReadFile(cs.config.WalFile()) + bytes, _ := os.ReadFile(cs.config.WalFile()) t.Logf("====== WAL: \n\r%X\n", bytes) err := cs.Start() diff --git a/consensus/wal_test.go b/consensus/wal_test.go index 47a208758..eac7ff877 100644 --- a/consensus/wal_test.go +++ b/consensus/wal_test.go @@ -3,7 +3,6 @@ package consensus import ( "bytes" "crypto/rand" - "io/ioutil" "os" "path/filepath" @@ -27,7 +26,7 @@ const ( ) func TestWALTruncate(t *testing.T) { - walDir, err := ioutil.TempDir("", "wal") + walDir, err := os.MkdirTemp("", "wal") require.NoError(t, err) defer os.RemoveAll(walDir) @@ -103,7 +102,7 @@ func TestWALEncoderDecoder(t *testing.T) { } func TestWALWrite(t *testing.T) { - walDir, err := ioutil.TempDir("", "wal") + walDir, err := os.MkdirTemp("", "wal") require.NoError(t, err) defer os.RemoveAll(walDir) walFile := filepath.Join(walDir, "wal") @@ -166,7 +165,7 @@ func TestWALSearchForEndHeight(t *testing.T) { } func TestWALPeriodicSync(t *testing.T) { - walDir, err := ioutil.TempDir("", "wal") + walDir, err := os.MkdirTemp("", "wal") require.NoError(t, err) defer os.RemoveAll(walDir) diff --git a/crypto/armor/armor.go b/crypto/armor/armor.go index c15d070e6..5549d08ce 100644 --- a/crypto/armor/armor.go +++ b/crypto/armor/armor.go @@ -3,7 +3,7 @@ package armor import ( "bytes" "fmt" - "io/ioutil" + "io" "golang.org/x/crypto/openpgp/armor" ) @@ -31,7 +31,7 @@ func DecodeArmor(armorStr string) (blockType string, headers map[string]string, if err != nil { return "", nil, nil, err } - data, err = ioutil.ReadAll(block.Body) + data, err = io.ReadAll(block.Body) if err != nil { return "", nil, nil, err } diff --git a/go.mod b/go.mod index ca2214bc1..374192734 100644 --- a/go.mod +++ b/go.mod @@ -1,51 +1,60 @@ module github.com/tendermint/tendermint -go 1.16 +go 1.17 require ( - github.com/VividCortex/gohistogram v1.0.0 // indirect - github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973 // indirect github.com/btcsuite/btcd v0.0.0-20190115013929-ed77733ec07d github.com/btcsuite/btcutil v0.0.0-20180706230648-ab6388e0c60a github.com/etcd-io/bbolt v1.3.3 github.com/fortytw2/leaktest v1.2.0 github.com/go-kit/kit v0.6.0 github.com/go-logfmt/logfmt v0.3.0 - github.com/go-stack/stack v1.8.0 // indirect github.com/gogo/protobuf v1.2.1 github.com/golang/protobuf v1.3.2 github.com/golang/snappy v0.0.1 - github.com/google/gofuzz v1.0.0 // indirect github.com/gorilla/websocket v1.2.0 - github.com/hashicorp/hcl v1.0.0 // indirect - github.com/inconshreveable/mousetrap v1.0.0 // indirect github.com/jmhodges/levigo v1.0.0 - github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515 // indirect github.com/libp2p/go-buffer-pool v0.0.2 github.com/magiconair/properties v1.8.0 - github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect - github.com/mitchellh/mapstructure v1.1.2 // indirect - github.com/pelletier/go-toml v1.2.0 // indirect github.com/pkg/errors v0.8.1 github.com/prometheus/client_golang v0.9.1 - github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910 // indirect - github.com/prometheus/common v0.0.0-20181020173914-7e9e6cabbd39 // indirect - github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d // indirect github.com/rcrowley/go-metrics v0.0.0-20180503174638-e2704e165165 github.com/rs/cors v1.6.0 github.com/snikch/goodman v0.0.0-20171125024755-10e37e294daa - github.com/spf13/afero v1.1.2 // indirect - github.com/spf13/cast v1.3.0 // indirect github.com/spf13/cobra v0.0.1 - github.com/spf13/jwalterweatherman v1.0.0 // indirect - github.com/spf13/pflag v1.0.3 // indirect github.com/spf13/viper v1.0.0 github.com/stretchr/testify v1.3.0 github.com/syndtr/goleveldb v1.0.1-0.20190318030020-c3a204f8e965 github.com/tendermint/go-amino v0.14.1 - go.etcd.io/bbolt v1.3.3 // indirect golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2 golang.org/x/net v0.0.0-20190909003024-a7b16738d86b - google.golang.org/genproto v0.0.0-20181029155118-b69ba1387ce2 // indirect google.golang.org/grpc v1.23.0 ) + +require ( + github.com/VividCortex/gohistogram v1.0.0 // indirect + github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973 // indirect + github.com/davecgh/go-spew v1.1.1 // indirect + github.com/fsnotify/fsnotify v1.4.7 // indirect + github.com/go-stack/stack v1.8.0 // indirect + github.com/google/gofuzz v1.0.0 // indirect + github.com/hashicorp/hcl v1.0.0 // indirect + github.com/inconshreveable/mousetrap v1.0.0 // indirect + github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515 // indirect + github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect + github.com/mitchellh/mapstructure v1.1.2 // indirect + github.com/pelletier/go-toml v1.2.0 // indirect + github.com/pmezard/go-difflib v1.0.0 // indirect + github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910 // indirect + github.com/prometheus/common v0.0.0-20181020173914-7e9e6cabbd39 // indirect + github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d // indirect + github.com/spf13/afero v1.1.2 // indirect + github.com/spf13/cast v1.3.0 // indirect + github.com/spf13/jwalterweatherman v1.0.0 // indirect + github.com/spf13/pflag v1.0.3 // indirect + go.etcd.io/bbolt v1.3.3 // indirect + golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a // indirect + golang.org/x/text v0.3.0 // indirect + google.golang.org/genproto v0.0.0-20181029155118-b69ba1387ce2 // indirect + gopkg.in/yaml.v2 v2.2.1 // indirect +) diff --git a/go.sum b/go.sum index 2bae0430d..b4d04a37e 100644 --- a/go.sum +++ b/go.sum @@ -123,7 +123,6 @@ golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2 h1:VklqNMn3ovrHsnt90Pveol golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190311183353-d8887717615a h1:oWX7TPOiFAMXLq8o0ikBYfCJVlRHBcsciT5bXOrH628= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190909003024-a7b16738d86b h1:XfVGCX+0T4WOStkaOsJRllbsiImhB2jgVBGc9L0lPGc= golang.org/x/net v0.0.0-20190909003024-a7b16738d86b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= @@ -139,7 +138,6 @@ golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGm golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= -google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8 h1:Nw54tB0rB7hY/N0NQvRW8DG4Yk3Q6T9cu9RcFQDu1tc= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20181029155118-b69ba1387ce2 h1:67iHsV9djwGdZpdZNbLuQj6FOzCaZe3w+vhLjn5AcFA= google.golang.org/genproto v0.0.0-20181029155118-b69ba1387ce2/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= diff --git a/libs/autofile/group_test.go b/libs/autofile/group_test.go index c300aba71..ecf38ad95 100644 --- a/libs/autofile/group_test.go +++ b/libs/autofile/group_test.go @@ -2,7 +2,6 @@ package autofile import ( "io" - "io/ioutil" "os" "testing" @@ -115,14 +114,14 @@ func TestRotateFile(t *testing.T) { g.FlushAndSync() // Read g.Head.Path+"000" - body1, err := ioutil.ReadFile(g.Head.Path + ".000") + body1, err := os.ReadFile(g.Head.Path + ".000") assert.NoError(t, err, "Failed to read first rolled file") if string(body1) != "Line 1\nLine 2\nLine 3\n" { t.Errorf("Got unexpected contents: [%v]", string(body1)) } // Read g.Head.Path - body2, err := ioutil.ReadFile(g.Head.Path) + body2, err := os.ReadFile(g.Head.Path) assert.NoError(t, err, "Failed to read first rolled file") if string(body2) != "Line 4\nLine 5\nLine 6\n" { t.Errorf("Got unexpected contents: [%v]", string(body2)) diff --git a/libs/cli/helper.go b/libs/cli/helper.go index 6bf23750c..0e35496b2 100644 --- a/libs/cli/helper.go +++ b/libs/cli/helper.go @@ -4,7 +4,6 @@ import ( "bytes" "fmt" "io" - "io/ioutil" "os" "path/filepath" ) @@ -17,7 +16,7 @@ func WriteConfigVals(dir string, vals map[string]string) error { data += fmt.Sprintf("%s = \"%s\"\n", k, v) } cfile := filepath.Join(dir, "config.toml") - return ioutil.WriteFile(cfile, []byte(data), 0666) + return os.WriteFile(cfile, []byte(data), 0666) } // RunWithArgs executes the given command with the specified command line args diff --git a/libs/cli/setup_test.go b/libs/cli/setup_test.go index 04209e493..91d355add 100644 --- a/libs/cli/setup_test.go +++ b/libs/cli/setup_test.go @@ -2,7 +2,7 @@ package cli import ( "fmt" - "io/ioutil" + "os" "strconv" "strings" "testing" @@ -56,7 +56,7 @@ func TestSetupEnv(t *testing.T) { } func tempDir() string { - cdir, err := ioutil.TempDir("", "test-cli") + cdir, err := os.MkdirTemp("", "test-cli") if err != nil { panic(err) } diff --git a/libs/common/cmap_test.go b/libs/common/cmap_test.go index 33d9f0477..9ac1c47de 100644 --- a/libs/common/cmap_test.go +++ b/libs/common/cmap_test.go @@ -2,6 +2,7 @@ package common import ( "fmt" + "strconv" "strings" "testing" @@ -55,10 +56,10 @@ func TestContains(t *testing.T) { func BenchmarkCMapHas(b *testing.B) { m := NewCMap() for i := 0; i < 1000; i++ { - m.Set(string(i), i) + m.Set(strconv.Itoa(i), i) } b.ResetTimer() for i := 0; i < b.N; i++ { - m.Has(string(i)) + m.Has(strconv.Itoa(i)) } } diff --git a/libs/common/os.go b/libs/common/os.go index 0e35524cf..4cb748dd8 100644 --- a/libs/common/os.go +++ b/libs/common/os.go @@ -2,7 +2,6 @@ package common import ( "fmt" - "io/ioutil" "os" "os/signal" "syscall" @@ -58,11 +57,11 @@ func FileExists(filePath string) bool { } func ReadFile(filePath string) ([]byte, error) { - return ioutil.ReadFile(filePath) + return os.ReadFile(filePath) } func MustReadFile(filePath string) []byte { - fileBytes, err := ioutil.ReadFile(filePath) + fileBytes, err := os.ReadFile(filePath) if err != nil { Exit(fmt.Sprintf("MustReadFile failed: %v", err)) return nil @@ -71,7 +70,7 @@ func MustReadFile(filePath string) []byte { } func WriteFile(filePath string, contents []byte, mode os.FileMode) error { - return ioutil.WriteFile(filePath, contents, mode) + return os.WriteFile(filePath, contents, mode) } func MustWriteFile(filePath string, contents []byte, mode os.FileMode) { diff --git a/libs/common/tempfile_test.go b/libs/common/tempfile_test.go index 51da90913..836a36f4f 100644 --- a/libs/common/tempfile_test.go +++ b/libs/common/tempfile_test.go @@ -25,7 +25,7 @@ func TestWriteFileAtomic(t *testing.T) { } defer os.Remove(f.Name()) - if err = ioutil.WriteFile(f.Name(), old, 0664); err != nil { + if err = os.WriteFile(f.Name(), old, 0664); err != nil { t.Fatal(err) } @@ -33,7 +33,7 @@ func TestWriteFileAtomic(t *testing.T) { t.Fatal(err) } - rData, err := ioutil.ReadFile(f.Name()) + rData, err := os.ReadFile(f.Name()) if err != nil { t.Fatal(err) } @@ -76,11 +76,11 @@ func TestWriteFileAtomicDuplicateFile(t *testing.T) { f.WriteString(testString) WriteFileAtomic(fileToWrite, []byte(expectedString), 0777) // Check that the first atomic file was untouched - firstAtomicFileBytes, err := ioutil.ReadFile(fname) + firstAtomicFileBytes, err := os.ReadFile(fname) require.Nil(t, err, "Error reading first atomic file") require.Equal(t, []byte(testString), firstAtomicFileBytes, "First atomic file was overwritten") // Check that the resultant file is correct - resultantFileBytes, err := ioutil.ReadFile(fileToWrite) + resultantFileBytes, err := os.ReadFile(fileToWrite) require.Nil(t, err, "Error reading resultant file") require.Equal(t, []byte(expectedString), resultantFileBytes, "Written file had incorrect bytes") @@ -125,14 +125,14 @@ func TestWriteFileAtomicManyDuplicates(t *testing.T) { for i := 0; i < atomicWriteFileMaxNumConflicts+2; i++ { fileRand := randWriteFileSuffix() fname := "/tmp/" + atomicWriteFilePrefix + fileRand - firstAtomicFileBytes, err := ioutil.ReadFile(fname) + firstAtomicFileBytes, err := os.ReadFile(fname) require.Nil(t, err, "Error reading first atomic file") require.Equal(t, []byte(fmt.Sprintf(testString, i)), firstAtomicFileBytes, "atomic write file %d was overwritten", i) } // Check that the resultant file is correct - resultantFileBytes, err := ioutil.ReadFile(fileToWrite) + resultantFileBytes, err := os.ReadFile(fileToWrite) require.Nil(t, err, "Error reading resultant file") require.Equal(t, []byte(expectedString), resultantFileBytes, "Written file had incorrect bytes") } diff --git a/libs/db/backend_test.go b/libs/db/backend_test.go index cfee77c26..4eebb42f8 100644 --- a/libs/db/backend_test.go +++ b/libs/db/backend_test.go @@ -2,7 +2,6 @@ package db import ( "fmt" - "io/ioutil" "os" "path/filepath" "testing" @@ -22,7 +21,7 @@ func cleanupDBDir(dir, name string) { func testBackendGetSetDelete(t *testing.T, backend DBBackendType) { // Default - dirname, err := ioutil.TempDir("", fmt.Sprintf("test_backend_%s_", backend)) + dirname, err := os.MkdirTemp("", fmt.Sprintf("test_backend_%s_", backend)) require.Nil(t, err) db := NewDB("testdb", backend, dirname) defer cleanupDBDir(dirname, "testdb") diff --git a/libs/db/common_test.go b/libs/db/common_test.go index 64a86979c..4ae25be41 100644 --- a/libs/db/common_test.go +++ b/libs/db/common_test.go @@ -4,7 +4,7 @@ import ( "bytes" "encoding/binary" "fmt" - "io/ioutil" + "os" "sync" "testing" @@ -64,7 +64,7 @@ func checkValuePanics(t *testing.T, itr Iterator) { } func newTempDB(t *testing.T, backend DBBackendType) (db DB, dbDir string) { - dirname, err := ioutil.TempDir("", "db_common_test") + dirname, err := os.MkdirTemp("", "db_common_test") require.Nil(t, err) return NewDB("testdb", backend, dirname), dirname } diff --git a/libs/db/fsdb.go b/libs/db/fsdb.go index 7b7f7c75f..72992b7f5 100644 --- a/libs/db/fsdb.go +++ b/libs/db/fsdb.go @@ -2,7 +2,7 @@ package db import ( "fmt" - "io/ioutil" + "io" "net/url" "os" "path/filepath" @@ -191,7 +191,7 @@ func read(path string) ([]byte, error) { } defer f.Close() - d, err := ioutil.ReadAll(f) + d, err := io.ReadAll(f) if err != nil { return nil, err } diff --git a/libs/log/tm_logger_test.go b/libs/log/tm_logger_test.go index 1f890cef1..fdd28e8ce 100644 --- a/libs/log/tm_logger_test.go +++ b/libs/log/tm_logger_test.go @@ -2,7 +2,7 @@ package log_test import ( "bytes" - "io/ioutil" + "io" "strings" "testing" @@ -22,11 +22,11 @@ func TestLoggerLogsItsErrors(t *testing.T) { } func BenchmarkTMLoggerSimple(b *testing.B) { - benchmarkRunner(b, log.NewTMLogger(ioutil.Discard), baseInfoMessage) + benchmarkRunner(b, log.NewTMLogger(io.Discard), baseInfoMessage) } func BenchmarkTMLoggerContextual(b *testing.B) { - benchmarkRunner(b, log.NewTMLogger(ioutil.Discard), withInfoMessage) + benchmarkRunner(b, log.NewTMLogger(io.Discard), withInfoMessage) } func benchmarkRunner(b *testing.B, logger log.Logger, f func(log.Logger)) { diff --git a/libs/log/tmfmt_logger_test.go b/libs/log/tmfmt_logger_test.go index d6f039ce4..cd5b999e5 100644 --- a/libs/log/tmfmt_logger_test.go +++ b/libs/log/tmfmt_logger_test.go @@ -3,7 +3,7 @@ package log_test import ( "bytes" "errors" - "io/ioutil" + "io" "math" "regexp" "testing" @@ -55,16 +55,16 @@ func TestTMFmtLogger(t *testing.T) { } func BenchmarkTMFmtLoggerSimple(b *testing.B) { - benchmarkRunnerKitlog(b, log.NewTMFmtLogger(ioutil.Discard), baseMessage) + benchmarkRunnerKitlog(b, log.NewTMFmtLogger(io.Discard), baseMessage) } func BenchmarkTMFmtLoggerContextual(b *testing.B) { - benchmarkRunnerKitlog(b, log.NewTMFmtLogger(ioutil.Discard), withMessage) + benchmarkRunnerKitlog(b, log.NewTMFmtLogger(io.Discard), withMessage) } func TestTMFmtLoggerConcurrency(t *testing.T) { t.Parallel() - testConcurrency(t, log.NewTMFmtLogger(ioutil.Discard), 10000) + testConcurrency(t, log.NewTMFmtLogger(io.Discard), 10000) } func benchmarkRunnerKitlog(b *testing.B, logger kitlog.Logger, f func(kitlog.Logger)) { diff --git a/mempool/clist_mempool_test.go b/mempool/clist_mempool_test.go index 1cc8d2a73..91573db1a 100644 --- a/mempool/clist_mempool_test.go +++ b/mempool/clist_mempool_test.go @@ -5,7 +5,6 @@ import ( "crypto/sha256" "encoding/binary" "fmt" - "io/ioutil" mrand "math/rand" "os" "path/filepath" @@ -309,7 +308,7 @@ func TestReapPriority(t *testing.T) { fmt.Printf("Priority reaping: %v <= %v\n", len(txs), threshold) } j += len(txs) - if err := mempool.Update(0, txs, abciResponses(len(txs), abci.CodeTypeOK),nil, nil); err != nil { + if err := mempool.Update(0, txs, abciResponses(len(txs), abci.CodeTypeOK), nil, nil); err != nil { testResult <- err.Error() } for _, txBytes := range txs { @@ -471,7 +470,7 @@ func TestSerialReap(t *testing.T) { func TestMempoolCloseWAL(t *testing.T) { // 1. Create the temporary directory for mempool and WAL testing. - rootDir, err := ioutil.TempDir("", "mempool-test") + rootDir, err := os.MkdirTemp("", "mempool-test") require.Nil(t, err, "expecting successful tmpdir creation") // 2. Ensure that it doesn't contain any elements -- Sanity check @@ -694,7 +693,7 @@ func checksumIt(data []byte) string { } func checksumFile(p string, t *testing.T) string { - data, err := ioutil.ReadFile(p) + data, err := os.ReadFile(p) require.Nil(t, err, "expecting successful read of %q", p) return checksumIt(data) } diff --git a/p2p/key.go b/p2p/key.go index 4e662f9f7..207bc9ba4 100644 --- a/p2p/key.go +++ b/p2p/key.go @@ -4,11 +4,10 @@ import ( "bytes" "encoding/hex" "fmt" - "io/ioutil" - "github.com/tendermint/tendermint/crypto" "github.com/tendermint/tendermint/crypto/ed25519" cmn "github.com/tendermint/tendermint/libs/common" + "os" ) // ID is a hex-encoded crypto.Address @@ -58,7 +57,7 @@ func LoadOrGenNodeKey(filePath string) (*NodeKey, error) { } func LoadNodeKey(filePath string) (*NodeKey, error) { - jsonBytes, err := ioutil.ReadFile(filePath) + jsonBytes, err := os.ReadFile(filePath) if err != nil { return nil, err } @@ -80,7 +79,7 @@ func genNodeKey(filePath string) (*NodeKey, error) { if err != nil { return nil, err } - err = ioutil.WriteFile(filePath, jsonBytes, 0600) + err = os.WriteFile(filePath, jsonBytes, 0600) if err != nil { return nil, err } diff --git a/p2p/pex/pex_reactor_test.go b/p2p/pex/pex_reactor_test.go index 4eca605d7..ace118cb2 100644 --- a/p2p/pex/pex_reactor_test.go +++ b/p2p/pex/pex_reactor_test.go @@ -2,7 +2,6 @@ package pex import ( "fmt" - "io/ioutil" "os" "path/filepath" "testing" @@ -70,7 +69,7 @@ func TestPEXReactorRunning(t *testing.T) { switches := make([]*p2p.Switch, N) // directory to store address books - dir, err := ioutil.TempDir("", "pex_reactor") + dir, err := os.MkdirTemp("", "pex_reactor") require.Nil(t, err) defer os.RemoveAll(dir) // nolint: errcheck @@ -200,7 +199,7 @@ func TestPEXReactorAddrsMessageAbuse(t *testing.T) { func TestCheckSeeds(t *testing.T) { // directory to store address books - dir, err := ioutil.TempDir("", "pex_reactor") + dir, err := os.MkdirTemp("", "pex_reactor") require.Nil(t, err) defer os.RemoveAll(dir) // nolint: errcheck @@ -239,7 +238,7 @@ func TestCheckSeeds(t *testing.T) { func TestPEXReactorUsesSeedsIfNeeded(t *testing.T) { // directory to store address books - dir, err := ioutil.TempDir("", "pex_reactor") + dir, err := os.MkdirTemp("", "pex_reactor") require.Nil(t, err) defer os.RemoveAll(dir) // nolint: errcheck @@ -259,7 +258,7 @@ func TestPEXReactorUsesSeedsIfNeeded(t *testing.T) { func TestConnectionSpeedForPeerReceivedFromSeed(t *testing.T) { // directory to store address books - dir, err := ioutil.TempDir("", "pex_reactor") + dir, err := os.MkdirTemp("", "pex_reactor") require.Nil(t, err) defer os.RemoveAll(dir) // nolint: errcheck @@ -288,7 +287,7 @@ func TestConnectionSpeedForPeerReceivedFromSeed(t *testing.T) { func TestPEXReactorSeedMode(t *testing.T) { // directory to store address books - dir, err := ioutil.TempDir("", "pex_reactor") + dir, err := os.MkdirTemp("", "pex_reactor") require.Nil(t, err) defer os.RemoveAll(dir) // nolint: errcheck @@ -327,7 +326,7 @@ func TestPEXReactorSeedMode(t *testing.T) { func TestPEXReactorDoesNotDisconnectFromPersistentPeerInSeedMode(t *testing.T) { // directory to store address books - dir, err := ioutil.TempDir("", "pex_reactor") + dir, err := os.MkdirTemp("", "pex_reactor") require.Nil(t, err) defer os.RemoveAll(dir) // nolint: errcheck @@ -365,7 +364,7 @@ func TestPEXReactorDoesNotDisconnectFromPersistentPeerInSeedMode(t *testing.T) { func TestPEXReactorDialsPeerUpToMaxAttemptsInSeedMode(t *testing.T) { // directory to store address books - dir, err := ioutil.TempDir("", "pex_reactor") + dir, err := os.MkdirTemp("", "pex_reactor") require.Nil(t, err) defer os.RemoveAll(dir) // nolint: errcheck @@ -401,7 +400,7 @@ func TestPEXReactorSeedModeFlushStop(t *testing.T) { switches := make([]*p2p.Switch, N) // directory to store address books - dir, err := ioutil.TempDir("", "pex_reactor") + dir, err := os.MkdirTemp("", "pex_reactor") require.Nil(t, err) defer os.RemoveAll(dir) // nolint: errcheck @@ -634,7 +633,7 @@ func testCreatePeerWithSeed(dir string, id int, seed *p2p.Switch) *p2p.Switch { func createReactor(conf *PEXReactorConfig) (r *PEXReactor, book *addrBook) { // directory to store address book - dir, err := ioutil.TempDir("", "pex_reactor") + dir, err := os.MkdirTemp("", "pex_reactor") if err != nil { panic(err) } diff --git a/p2p/switch_test.go b/p2p/switch_test.go index 000eed2e0..65b6be028 100644 --- a/p2p/switch_test.go +++ b/p2p/switch_test.go @@ -5,7 +5,6 @@ import ( "errors" "fmt" "io" - "io/ioutil" "net" "net/http" "net/http/httptest" @@ -352,7 +351,7 @@ func TestSwitchStopPeerForError(t *testing.T) { scrapeMetrics := func() string { resp, _ := http.Get(s.URL) - buf, _ := ioutil.ReadAll(resp.Body) + buf, _ := io.ReadAll(resp.Body) return string(buf) } diff --git a/p2p/trust/store_test.go b/p2p/trust/store_test.go index e1bea8636..e603e4860 100644 --- a/p2p/trust/store_test.go +++ b/p2p/trust/store_test.go @@ -5,7 +5,6 @@ package trust import ( "fmt" - "io/ioutil" "os" "testing" @@ -15,7 +14,7 @@ import ( ) func TestTrustMetricStoreSaveLoad(t *testing.T) { - dir, err := ioutil.TempDir("", "trust_test") + dir, err := os.MkdirTemp("", "trust_test") if err != nil { panic(err) } diff --git a/p2p/upnp/upnp.go b/p2p/upnp/upnp.go index 89f35c5df..0cde5df43 100644 --- a/p2p/upnp/upnp.go +++ b/p2p/upnp/upnp.go @@ -10,7 +10,7 @@ import ( "encoding/xml" "errors" "fmt" - "io/ioutil" + "io" "net" "net/http" "strconv" @@ -204,7 +204,7 @@ func getServiceURL(rootURL string) (url, urnDomain string, err error) { defer r.Body.Close() // nolint: errcheck if r.StatusCode >= 400 { - err = errors.New(string(r.StatusCode)) + err = errors.New(strconv.Itoa(r.StatusCode)) return } var root Root @@ -306,7 +306,7 @@ func (n *upnpNAT) getExternalIPAddress() (info statusInfo, err error) { return } var envelope Envelope - data, err := ioutil.ReadAll(response.Body) + data, err := io.ReadAll(response.Body) if err != nil { return } @@ -363,7 +363,7 @@ func (n *upnpNAT) AddPortMapping(protocol string, externalPort, internalPort int // TODO: check response to see if the port was forwarded // log.Println(message, response) // JAE: - // body, err := ioutil.ReadAll(response.Body) + // body, err := io.ReadAll(response.Body) // fmt.Println(string(body), err) mappedExternalPort = externalPort _ = response diff --git a/privval/file.go b/privval/file.go index 1cb88f7c0..d870e08d4 100644 --- a/privval/file.go +++ b/privval/file.go @@ -4,7 +4,7 @@ import ( "bytes" "errors" "fmt" - "io/ioutil" + "os" "time" "github.com/tendermint/tendermint/crypto" @@ -173,7 +173,7 @@ func LoadFilePVEmptyState(keyFilePath, stateFilePath string) *FilePV { // If loadState is true, we load from the stateFilePath. Otherwise, we use an empty LastSignState. func loadFilePV(keyFilePath, stateFilePath string, loadState bool) *FilePV { - keyJSONBytes, err := ioutil.ReadFile(keyFilePath) + keyJSONBytes, err := os.ReadFile(keyFilePath) if err != nil { cmn.Exit(err.Error()) } @@ -190,7 +190,7 @@ func loadFilePV(keyFilePath, stateFilePath string, loadState bool) *FilePV { pvState := FilePVLastSignState{} if loadState { - stateJSONBytes, err := ioutil.ReadFile(stateFilePath) + stateJSONBytes, err := os.ReadFile(stateFilePath) if err != nil { cmn.Exit(err.Error()) } diff --git a/privval/file_deprecated.go b/privval/file_deprecated.go index d010de763..641f06382 100644 --- a/privval/file_deprecated.go +++ b/privval/file_deprecated.go @@ -1,7 +1,6 @@ package privval import ( - "io/ioutil" "os" "github.com/tendermint/tendermint/crypto" @@ -26,7 +25,7 @@ type OldFilePV struct { // LoadOldFilePV loads an OldFilePV from the filePath. func LoadOldFilePV(filePath string) (*OldFilePV, error) { - pvJSONBytes, err := ioutil.ReadFile(filePath) + pvJSONBytes, err := os.ReadFile(filePath) if err != nil { return nil, err } diff --git a/rpc/client/main_test.go b/rpc/client/main_test.go index d600b32f8..fda4d9983 100644 --- a/rpc/client/main_test.go +++ b/rpc/client/main_test.go @@ -1,7 +1,6 @@ package client_test import ( - "io/ioutil" "os" "testing" @@ -14,7 +13,7 @@ var node *nm.Node func TestMain(m *testing.M) { // start a tendermint node (and kvstore) in the background to test against - dir, err := ioutil.TempDir("/tmp", "rpc-client-test") + dir, err := os.MkdirTemp("/tmp", "rpc-client-test") if err != nil { panic(err) } diff --git a/rpc/lib/client/http_client.go b/rpc/lib/client/http_client.go index db57c536e..cc02e7b00 100644 --- a/rpc/lib/client/http_client.go +++ b/rpc/lib/client/http_client.go @@ -4,7 +4,7 @@ import ( "bytes" "encoding/json" "fmt" - "io/ioutil" + "io" "net" "net/http" "net/url" @@ -151,7 +151,7 @@ func (c *JSONRPCClient) Call(method string, params map[string]interface{}, resul } defer httpResponse.Body.Close() // nolint: errcheck - responseBytes, err := ioutil.ReadAll(httpResponse.Body) + responseBytes, err := io.ReadAll(httpResponse.Body) if err != nil { return nil, err } @@ -184,7 +184,7 @@ func (c *JSONRPCClient) sendBatch(requests []*jsonRPCBufferedRequest) ([]interfa } defer httpResponse.Body.Close() // nolint: errcheck - responseBytes, err := ioutil.ReadAll(httpResponse.Body) + responseBytes, err := io.ReadAll(httpResponse.Body) if err != nil { return nil, err } @@ -280,7 +280,7 @@ func (c *URIClient) Call(method string, params map[string]interface{}, result in } defer resp.Body.Close() // nolint: errcheck - responseBytes, err := ioutil.ReadAll(resp.Body) + responseBytes, err := io.ReadAll(resp.Body) if err != nil { return nil, err } diff --git a/rpc/lib/server/handlers.go b/rpc/lib/server/handlers.go index 975b00d57..87bc5e5ff 100644 --- a/rpc/lib/server/handlers.go +++ b/rpc/lib/server/handlers.go @@ -6,7 +6,7 @@ import ( "encoding/hex" "encoding/json" "fmt" - "io/ioutil" + "io" "net/http" "reflect" "runtime/debug" @@ -102,7 +102,7 @@ func funcReturnTypes(f interface{}) []reflect.Type { // jsonrpc calls grab the given method's function info and runs reflect.Call func makeJSONRPCHandler(funcMap map[string]*RPCFunc, cdc *amino.Codec, logger log.Logger) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { - b, err := ioutil.ReadAll(r.Body) + b, err := io.ReadAll(r.Body) if err != nil { WriteRPCResponseHTTP(w, types.RPCInvalidRequestError(types.JSONRPCStringID(""), errors.Wrap(err, "error reading request body"))) return diff --git a/rpc/lib/server/handlers_test.go b/rpc/lib/server/handlers_test.go index 9cded2953..daae7b021 100644 --- a/rpc/lib/server/handlers_test.go +++ b/rpc/lib/server/handlers_test.go @@ -3,7 +3,7 @@ package rpcserver_test import ( "bytes" "encoding/json" - "io/ioutil" + "io" "net/http" "net/http/httptest" "strings" @@ -72,7 +72,7 @@ func TestRPCParams(t *testing.T) { res := rec.Result() // Always expecting back a JSONRPCResponse assert.True(t, statusOK(res.StatusCode), "#%d: should always return 2XX", i) - blob, err := ioutil.ReadAll(res.Body) + blob, err := io.ReadAll(res.Body) if err != nil { t.Errorf("#%d: err reading body: %v", i, err) continue @@ -120,7 +120,7 @@ func TestJSONRPCID(t *testing.T) { res := rec.Result() // Always expecting back a JSONRPCResponse assert.True(t, statusOK(res.StatusCode), "#%d: should always return 2XX", i) - blob, err := ioutil.ReadAll(res.Body) + blob, err := io.ReadAll(res.Body) if err != nil { t.Errorf("#%d: err reading body: %v", i, err) continue @@ -149,7 +149,7 @@ func TestRPCNotification(t *testing.T) { // Always expecting back a JSONRPCResponse require.True(t, statusOK(res.StatusCode), "should always return 2XX") - blob, err := ioutil.ReadAll(res.Body) + blob, err := io.ReadAll(res.Body) require.Nil(t, err, "reading from the body should not give back an error") require.Equal(t, len(blob), 0, "a notification SHOULD NOT be responded to by the server") } @@ -184,7 +184,7 @@ func TestRPCNotificationInBatch(t *testing.T) { res := rec.Result() // Always expecting back a JSONRPCResponse assert.True(t, statusOK(res.StatusCode), "#%d: should always return 2XX", i) - blob, err := ioutil.ReadAll(res.Body) + blob, err := io.ReadAll(res.Body) if err != nil { t.Errorf("#%d: err reading body: %v", i, err) continue diff --git a/rpc/lib/server/http_server_test.go b/rpc/lib/server/http_server_test.go index b463aa6a8..a03b473d6 100644 --- a/rpc/lib/server/http_server_test.go +++ b/rpc/lib/server/http_server_test.go @@ -4,7 +4,6 @@ import ( "crypto/tls" "fmt" "io" - "io/ioutil" "net" "net/http" "sync" @@ -55,7 +54,7 @@ func TestMaxOpenConnections(t *testing.T) { return } defer r.Body.Close() - io.Copy(ioutil.Discard, r.Body) + io.Copy(io.Discard, r.Body) }() } wg.Wait() @@ -88,7 +87,7 @@ func TestStartHTTPAndTLSServer(t *testing.T) { defer res.Body.Close() assert.Equal(t, http.StatusOK, res.StatusCode) - body, err := ioutil.ReadAll(res.Body) + body, err := io.ReadAll(res.Body) require.NoError(t, err) assert.Equal(t, []byte("some body"), body) } diff --git a/scripts/privValUpgrade_test.go b/scripts/privValUpgrade_test.go index bac4d315f..469413361 100644 --- a/scripts/privValUpgrade_test.go +++ b/scripts/privValUpgrade_test.go @@ -77,7 +77,7 @@ func TestLoadAndUpgrade(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { // need to re-write the file everytime because upgrading renames it - err := ioutil.WriteFile(oldFilePath, []byte(oldPrivvalContent), 0600) + err := os.WriteFile(oldFilePath, []byte(oldPrivvalContent), 0600) require.NoError(t, err) if tt.wantPanic { require.Panics(t, func() { loadAndUpgrade(tt.args.oldPVPath, tt.args.newPVKeyPath, tt.args.newPVStatePath) }) diff --git a/state/blockindex/kv/kv_test.go b/state/blockindex/kv/kv_test.go index 3c53d360b..f3605419a 100644 --- a/state/blockindex/kv/kv_test.go +++ b/state/blockindex/kv/kv_test.go @@ -1,7 +1,6 @@ package kv import ( - "io/ioutil" "os" "testing" @@ -44,7 +43,7 @@ func TestBlockIndex(t *testing.T) { } func BenchmarkBlockIndex(b *testing.B) { - dir, err := ioutil.TempDir("", "block_index_db") + dir, err := os.MkdirTemp("", "block_index_db") if err != nil { b.Fatal(err) } diff --git a/state/export_test.go b/state/export_test.go index 0b7da945f..c35d7e400 100644 --- a/state/export_test.go +++ b/state/export_test.go @@ -43,11 +43,11 @@ func CalcValidatorsKey(height int64) []byte { return calcValidatorsKey(height) } -// SaveABCIResponses is an alias for the private SaveABCIResponses method in -// store.go, exported exclusively and explicitly for testing. -func SaveABCIResponses(db dbm.DB, height int64, abciResponses *ABCIResponses) { - SaveABCIResponses(db, height, abciResponses) -} +//// SaveABCIResponses is an alias for the private SaveABCIResponses method in +//// store.go, exported exclusively and explicitly for testing. +//func SaveABCIResponses(db dbm.DB, height int64, abciResponses *ABCIResponses) { +// SaveABCIResponses(db, height, abciResponses) +//} // SaveConsensusParamsInfo is an alias for the private saveConsensusParamsInfo // method in store.go, exported exclusively and explicitly for testing. diff --git a/state/state.go b/state/state.go index 3e88fd11a..6b7ceab1d 100644 --- a/state/state.go +++ b/state/state.go @@ -3,7 +3,7 @@ package state import ( "bytes" "fmt" - "io/ioutil" + "os" "time" "github.com/tendermint/tendermint/types" @@ -198,7 +198,7 @@ func MakeGenesisStateFromFile(genDocFile string) (State, error) { // MakeGenesisDocFromFile reads and unmarshals genesis doc from the given file. func MakeGenesisDocFromFile(genDocFile string) (*types.GenesisDoc, error) { - genDocJSON, err := ioutil.ReadFile(genDocFile) + genDocJSON, err := os.ReadFile(genDocFile) if err != nil { return nil, fmt.Errorf("Couldn't read GenesisDoc file: %v", err) } diff --git a/state/txindex/kv/kv_bench_test.go b/state/txindex/kv/kv_bench_test.go index 60685e949..04d1254ac 100644 --- a/state/txindex/kv/kv_bench_test.go +++ b/state/txindex/kv/kv_bench_test.go @@ -3,7 +3,7 @@ package kv import ( "crypto/rand" "fmt" - "io/ioutil" + "os" "testing" abci "github.com/tendermint/tendermint/abci/types" @@ -13,7 +13,7 @@ import ( ) func BenchmarkTxSearch(b *testing.B) { - dbDir, err := ioutil.TempDir("", "benchmark_tx_search_test") + dbDir, err := os.MkdirTemp("", "benchmark_tx_search_test") if err != nil { b.Errorf("failed to create temporary directory: %s", err) } diff --git a/state/txindex/kv/kv_test.go b/state/txindex/kv/kv_test.go index 3ecd374c0..7d457c530 100644 --- a/state/txindex/kv/kv_test.go +++ b/state/txindex/kv/kv_test.go @@ -2,7 +2,6 @@ package kv import ( "fmt" - "io/ioutil" "os" "testing" @@ -291,7 +290,6 @@ func TestIndexAllTags(t *testing.T) { assert.Equal(t, []*types.TxResult{txResult}, results) } - func TestDisableRangeQuery(t *testing.T) { indexer := NewTxIndex(db.NewMemDB(), IndexAllTags()) @@ -317,7 +315,7 @@ func txResultWithEvents(events []abci.Event) *types.TxResult { } func benchmarkTxIndex(txsCount int64, b *testing.B) { - dir, err := ioutil.TempDir("", "tx_index_db") + dir, err := os.MkdirTemp("", "tx_index_db") if err != nil { b.Fatal(err) } diff --git a/tools/tm-signer-harness/main.go b/tools/tm-signer-harness/main.go index 13aaf03a1..281b0b08d 100644 --- a/tools/tm-signer-harness/main.go +++ b/tools/tm-signer-harness/main.go @@ -3,7 +3,6 @@ package main import ( "flag" "fmt" - "io/ioutil" "os" "path/filepath" "time" @@ -130,7 +129,7 @@ func extractKey(tmhome, outputPath string) { stateFile := filepath.Join(internal.ExpandPath(tmhome), "data", "priv_validator_state.json") fpv := privval.LoadFilePV(keyFile, stateFile) pkb := [64]byte(fpv.Key.PrivKey.(ed25519.PrivKeyEd25519)) - if err := ioutil.WriteFile(internal.ExpandPath(outputPath), pkb[:32], 0644); err != nil { + if err := os.WriteFile(internal.ExpandPath(outputPath), pkb[:32], 0644); err != nil { logger.Info("Failed to write private key", "output", outputPath, "err", err) os.Exit(1) } diff --git a/types/genesis.go b/types/genesis.go index 94680bca8..89b4e5f69 100644 --- a/types/genesis.go +++ b/types/genesis.go @@ -4,7 +4,7 @@ import ( "bytes" "encoding/json" "fmt" - "io/ioutil" + "os" "time" "github.com/pkg/errors" @@ -117,7 +117,7 @@ func GenesisDocFromJSON(jsonBlob []byte) (*GenesisDoc, error) { // GenesisDocFromFile reads JSON data from a file and unmarshalls it into a GenesisDoc. func GenesisDocFromFile(genDocFile string) (*GenesisDoc, error) { - jsonBlob, err := ioutil.ReadFile(genDocFile) + jsonBlob, err := os.ReadFile(genDocFile) if err != nil { return nil, errors.Wrap(err, "Couldn't read GenesisDoc file") } diff --git a/types/part_set_test.go b/types/part_set_test.go index 5c0edaffd..dd20d69a9 100644 --- a/types/part_set_test.go +++ b/types/part_set_test.go @@ -1,7 +1,7 @@ package types import ( - "io/ioutil" + "io" "testing" "github.com/stretchr/testify/assert" @@ -54,7 +54,7 @@ func TestBasicPartSet(t *testing.T) { // Reconstruct data, assert that they are equal. data2Reader := partSet2.GetReader() - data2, err := ioutil.ReadAll(data2Reader) + data2, err := io.ReadAll(data2Reader) require.NoError(t, err) assert.Equal(t, data, data2) diff --git a/types/vote_test.go b/types/vote_test.go index 46373d61f..25bc0d116 100644 --- a/types/vote_test.go +++ b/types/vote_test.go @@ -134,7 +134,7 @@ func TestVoteSignBytesTestVectors(t *testing.T) { // remaining fields: 0x2a, // (field_number << 3) | wire_type 0xb, 0x8, 0x80, 0x92, 0xb8, 0xc3, 0x98, 0xfe, 0xff, 0xff, 0xff, 0x1, // timestamp - 0x32, // (field_number << 3) | wire_type + 0x32, // (field_number << 3) | wire_type 0xd, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x5f, 0x69, 0x64}, // chainID }, } @@ -255,13 +255,13 @@ func TestMaxVoteBytes(t *testing.T) { func TestVoteString(t *testing.T) { str := examplePrecommit().String() - expected := `Vote{56789:6AF1F4111082 12345/02/precommit(Precommit) 8B01023386C3 000000000000 @ 2017-12-25T03:00:01.234Z}` + expected := `Vote{56789:6AF1F4111082 12345/02/2(Precommit) 8B01023386C3 000000000000 @ 2017-12-25T03:00:01.234Z}` if str != expected { t.Errorf("Got unexpected string for Vote. Expected:\n%v\nGot:\n%v", expected, str) } str2 := examplePrevote().String() - expected = `Vote{56789:6AF1F4111082 12345/02/prevote(Prevote) 8B01023386C3 000000000000 @ 2017-12-25T03:00:01.234Z}` + expected = `Vote{56789:6AF1F4111082 12345/02/1(Prevote) 8B01023386C3 000000000000 @ 2017-12-25T03:00:01.234Z}` if str2 != expected { t.Errorf("Got unexpected string for Vote. Expected:\n%v\nGot:\n%v", expected, str2) } From efc53be0863a8b5f624d39ef3a2fa811525efa0a Mon Sep 17 00:00:00 2001 From: forcodedancing Date: Thu, 14 Apr 2022 19:58:02 +0800 Subject: [PATCH 2/4] use io and os to replace ioutil --- blockchain/v1/reactor_test.go | 2 +- libs/pubsub/pubsub_test.go | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/blockchain/v1/reactor_test.go b/blockchain/v1/reactor_test.go index a7e47b4c4..cd9d36879 100644 --- a/blockchain/v1/reactor_test.go +++ b/blockchain/v1/reactor_test.go @@ -12,6 +12,7 @@ import ( "github.com/stretchr/testify/assert" abci "github.com/tendermint/tendermint/abci/types" cfg "github.com/tendermint/tendermint/config" + dbm "github.com/tendermint/tendermint/libs/db" "github.com/tendermint/tendermint/libs/log" "github.com/tendermint/tendermint/mock" "github.com/tendermint/tendermint/p2p" @@ -20,7 +21,6 @@ import ( "github.com/tendermint/tendermint/store" "github.com/tendermint/tendermint/types" tmtime "github.com/tendermint/tendermint/types/time" - dbm "github.com/tendermint/tendermint/libs/db" ) var config *cfg.Config diff --git a/libs/pubsub/pubsub_test.go b/libs/pubsub/pubsub_test.go index 5a2baa14f..9f68f4790 100644 --- a/libs/pubsub/pubsub_test.go +++ b/libs/pubsub/pubsub_test.go @@ -4,6 +4,7 @@ import ( "context" "fmt" "runtime/debug" + "strconv" "testing" "time" @@ -363,7 +364,7 @@ func benchmarkNClients(n int, b *testing.B) { b.ReportAllocs() b.ResetTimer() for i := 0; i < b.N; i++ { - s.PublishWithEvents(ctx, "Gamora", map[string][]string{"abci.Account.Owner": {"Ivan"}, "abci.Invoices.Number": {string(i)}}) + s.PublishWithEvents(ctx, "Gamora", map[string][]string{"abci.Account.Owner": {"Ivan"}, "abci.Invoices.Number": {strconv.Itoa(i)}}) } } From d6e0f76737d5449e9b40e8e959e0bdcc71ab8c54 Mon Sep 17 00:00:00 2001 From: forcodedancing Date: Thu, 14 Apr 2022 20:44:03 +0800 Subject: [PATCH 3/4] static analysis changes --- abci/types/snapshot.go | 4 ++-- cmd/tendermint/commands/root_test.go | 2 +- config/toml.go | 12 ++++++------ libs/cli/helper.go | 2 +- p2p/conn/secret_connection_test.go | 2 +- p2p/pex/file.go | 2 +- scripts/json2wal/main.go | 14 +++++++++++--- tools/tm-signer-harness/main.go | 2 +- types/genesis.go | 2 +- 9 files changed, 25 insertions(+), 17 deletions(-) diff --git a/abci/types/snapshot.go b/abci/types/snapshot.go index 548158257..16dc50f71 100644 --- a/abci/types/snapshot.go +++ b/abci/types/snapshot.go @@ -157,7 +157,7 @@ func (writer *SnapshotWriter) Write(hash SHA256Sum, chunk []byte) error { return err } toWrite := filepath.Join(path, fmt.Sprintf("%x", hash)) - return ioutil.WriteFile(toWrite, chunk, 0644) + return ioutil.WriteFile(toWrite, chunk, 0600) } func (writer *SnapshotWriter) WriteManifest(manifest []byte) error { @@ -166,7 +166,7 @@ func (writer *SnapshotWriter) WriteManifest(manifest []byte) error { return err } toWrite := filepath.Join(path, manifestFileName) - return ioutil.WriteFile(toWrite, manifest, 0644) + return ioutil.WriteFile(toWrite, manifest, 0600) } func (writer *SnapshotWriter) Finalize() error { diff --git a/cmd/tendermint/commands/root_test.go b/cmd/tendermint/commands/root_test.go index 229385af9..50488ae10 100644 --- a/cmd/tendermint/commands/root_test.go +++ b/cmd/tendermint/commands/root_test.go @@ -168,5 +168,5 @@ func WriteConfigVals(dir string, vals map[string]string) error { data += fmt.Sprintf("%s = \"%s\"\n", k, v) } cfile := filepath.Join(dir, "config.toml") - return ioutil.WriteFile(cfile, []byte(data), 0666) + return ioutil.WriteFile(cfile, []byte(data), 0600) } diff --git a/config/toml.go b/config/toml.go index 65db774dd..7d66dda2d 100644 --- a/config/toml.go +++ b/config/toml.go @@ -59,7 +59,7 @@ func WriteConfigFile(configFilePath string, config *Config) { panic(err) } - cmn.MustWriteFile(configFilePath, buffer.Bytes(), 0644) + cmn.MustWriteFile(configFilePath, buffer.Bytes(), 0600) } // Note: any changes to the comments/variables/mapstructure @@ -211,7 +211,7 @@ disable_websocket = {{ .RPC.DisableWebsocket }} # 10 - default size. # Should be {WebsocketPoolSpawnSize} =< {WebsocketPoolMaxSize} websocket_pool_size = {{ .RPC.WebsocketPoolMaxSize }} - + # The queued buffer for workers to process requests. # 10 -default websocket_pool_queue_size = {{ .RPC.WebsocketPoolQueueSize }} @@ -354,7 +354,7 @@ recheck = {{ .Mempool.Recheck }} broadcast = {{ .Mempool.Broadcast }} wal_dir = "{{ js .Mempool.WalPath }}" -# If set true, will only broadcast transactions to persistent peers. +# If set true, will only broadcast transactions to persistent peers. only_to_persistent = {{ .Mempool.OnlyToPersistent }} # If set true, only the transaction from none persistent peer will broadcast. @@ -507,11 +507,11 @@ func ResetTestRootWithChainID(testName string, chainID string) *Config { chainID = "tendermint_test" } testGenesis := fmt.Sprintf(testGenesisFmt, chainID) - cmn.MustWriteFile(genesisFilePath, []byte(testGenesis), 0644) + cmn.MustWriteFile(genesisFilePath, []byte(testGenesis), 0600) } // we always overwrite the priv val - cmn.MustWriteFile(privKeyFilePath, []byte(testPrivValidatorKey), 0644) - cmn.MustWriteFile(privStateFilePath, []byte(testPrivValidatorState), 0644) + cmn.MustWriteFile(privKeyFilePath, []byte(testPrivValidatorKey), 0600) + cmn.MustWriteFile(privStateFilePath, []byte(testPrivValidatorState), 0600) config := TestConfig().SetRoot(rootDir) return config diff --git a/libs/cli/helper.go b/libs/cli/helper.go index 6bf23750c..4d0bfa63a 100644 --- a/libs/cli/helper.go +++ b/libs/cli/helper.go @@ -17,7 +17,7 @@ func WriteConfigVals(dir string, vals map[string]string) error { data += fmt.Sprintf("%s = \"%s\"\n", k, v) } cfile := filepath.Join(dir, "config.toml") - return ioutil.WriteFile(cfile, []byte(data), 0666) + return ioutil.WriteFile(cfile, []byte(data), 0600) } // RunWithArgs executes the given command with the specified command line args diff --git a/p2p/conn/secret_connection_test.go b/p2p/conn/secret_connection_test.go index daa1e98a7..83003713b 100644 --- a/p2p/conn/secret_connection_test.go +++ b/p2p/conn/secret_connection_test.go @@ -335,7 +335,7 @@ func TestDeriveSecretsAndChallengeGolden(t *testing.T) { if *update { t.Logf("Updating golden test vector file %s", goldenFilepath) data := createGoldenTestVectors(t) - cmn.WriteFile(goldenFilepath, []byte(data), 0644) + cmn.WriteFile(goldenFilepath, []byte(data), 0600) } f, err := os.Open(goldenFilepath) if err != nil { diff --git a/p2p/pex/file.go b/p2p/pex/file.go index a42eddaf9..2aeb93a6a 100644 --- a/p2p/pex/file.go +++ b/p2p/pex/file.go @@ -35,7 +35,7 @@ func (a *addrBook) saveToFile(filePath string) { a.Logger.Error("Failed to save AddrBook to file", "err", err) return } - err = cmn.WriteFileAtomic(filePath, jsonBytes, 0644) + err = cmn.WriteFileAtomic(filePath, jsonBytes, 0600) if err != nil { a.Logger.Error("Failed to save AddrBook to file", "file", filePath, "err", err) } diff --git a/scripts/json2wal/main.go b/scripts/json2wal/main.go index dd3e29d0f..abb35e3cd 100644 --- a/scripts/json2wal/main.go +++ b/scripts/json2wal/main.go @@ -37,13 +37,21 @@ func main() { if err != nil { panic(fmt.Errorf("failed to open WAL file: %v", err)) } - defer f.Close() + defer func() { + if err := f.Close(); err != nil { + fmt.Printf("Error closing file: %s\n", f.Name()) + } + }() - walFile, err := os.OpenFile(os.Args[2], os.O_EXCL|os.O_WRONLY|os.O_CREATE, 0666) + walFile, err := os.OpenFile(os.Args[2], os.O_EXCL|os.O_WRONLY|os.O_CREATE, 0600) if err != nil { panic(fmt.Errorf("failed to open WAL file: %v", err)) } - defer walFile.Close() + defer func() { + if err := walFile.Close(); err != nil { + fmt.Printf("Error closing file: %s\n", walFile.Name()) + } + }() // the length of tendermint/wal/MsgInfo in the wal.json may exceed the defaultBufSize(4096) of bufio // because of the byte array in BlockPart diff --git a/tools/tm-signer-harness/main.go b/tools/tm-signer-harness/main.go index 13aaf03a1..fed5c965a 100644 --- a/tools/tm-signer-harness/main.go +++ b/tools/tm-signer-harness/main.go @@ -130,7 +130,7 @@ func extractKey(tmhome, outputPath string) { stateFile := filepath.Join(internal.ExpandPath(tmhome), "data", "priv_validator_state.json") fpv := privval.LoadFilePV(keyFile, stateFile) pkb := [64]byte(fpv.Key.PrivKey.(ed25519.PrivKeyEd25519)) - if err := ioutil.WriteFile(internal.ExpandPath(outputPath), pkb[:32], 0644); err != nil { + if err := ioutil.WriteFile(internal.ExpandPath(outputPath), pkb[:32], 0600); err != nil { logger.Info("Failed to write private key", "output", outputPath, "err", err) os.Exit(1) } diff --git a/types/genesis.go b/types/genesis.go index 94680bca8..003784674 100644 --- a/types/genesis.go +++ b/types/genesis.go @@ -49,7 +49,7 @@ func (genDoc *GenesisDoc) SaveAs(file string) error { if err != nil { return err } - return cmn.WriteFile(file, genDocBytes, 0644) + return cmn.WriteFile(file, genDocBytes, 0600) } // ValidatorHash returns the hash of the validator set contained in the GenesisDoc From 49c8c3e776ae57b0de59f49cf7a20c8a37a17130 Mon Sep 17 00:00:00 2001 From: forcodedancing Date: Tue, 26 Apr 2022 16:29:01 +0800 Subject: [PATCH 4/4] update changelog --- CHANGELOG.md | 46 +++++++++++++++++++++++++--------------------- 1 file changed, 25 insertions(+), 21 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4dc277656..739a586d1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,37 +1,41 @@ # Changelog +## v0.32.3-binance.7 +- [bug-fix] [\#167](https://github.com/bnb-chain/bnc-tendermint/pull/167) change file permission and add error handling +- [go] [\#168](https://github.com/bnb-chain/bnc-tendermint/pull/168) upgrade go version to 1.17 and replace ioutil with io/os + ## v0.32.3-binance.6 -- [go] [\#163](https://github.com/binance-chain/bnc-tendermint/pull/163) update go version to 1.16 -- [crypto] [\#164](https://github.com/binance-chain/bnc-tendermint/pull/164) fix infinite recursion in Secp256k1 String() method +- [go] [\#163](https://github.com/bnb-chain/bnc-tendermint/pull/163) update go version to 1.16 +- [crypto] [\#164](https://github.com/bnb-chain/bnc-tendermint/pull/164) fix infinite recursion in Secp256k1 String() method ## v0.32.3-binance.5 -- [api] [\#150](https://github.com/binance-chain/bnc-tendermint/pull/150) relax tx querying -- [p2p] [\#151](https://github.com/binance-chain/bnc-tendermint/pull/151) return masked IP (not the actual IP) in addrbook#groupKey -- [consensus] [\#152](https://github.com/binance-chain/bnc-tendermint/pull/152) validate incoming messages -- [consensus] [\#153](https://github.com/binance-chain/bnc-tendermint/pull/153) Fix consensus failure when remote signer drops -- [bug-fix] [\#155](https://github.com/binance-chain/bnc-tendermint/pull/155) Bugfix post v0.32 +- [api] [\#150](https://github.com/bnb-chain/bnc-tendermint/pull/150) relax tx querying +- [p2p] [\#151](https://github.com/bnb-chain/bnc-tendermint/pull/151) return masked IP (not the actual IP) in addrbook#groupKey +- [consensus] [\#152](https://github.com/bnb-chain/bnc-tendermint/pull/152) validate incoming messages +- [consensus] [\#153](https://github.com/bnb-chain/bnc-tendermint/pull/153) Fix consensus failure when remote signer drops +- [bug-fix] [\#155](https://github.com/bnb-chain/bnc-tendermint/pull/155) Bugfix post v0.32 ## v0.32.3-binance.4 -- [sync] [\#157](https://github.com/binance-chain/bnc-tendermint/pull/157) fix goroutine/memory leak under hotsync when receive consensus message -- [api] [\#148](https://github.com/binance-chain/bnc-tendermint/pull/148) fix `validators` api does now show correct height issue +- [sync] [\#157](https://github.com/bnb-chain/bnc-tendermint/pull/157) fix goroutine/memory leak under hotsync when receive consensus message +- [api] [\#148](https://github.com/bnb-chain/bnc-tendermint/pull/148) fix `validators` api does now show correct height issue ## v0.32.3-binance.3 -- [sync] [\#147](https://github.com/binance-chain/bnc-tendermint/pull/147) fix not panic when do not have block under state sync +- [sync] [\#147](https://github.com/bnb-chain/bnc-tendermint/pull/147) fix not panic when do not have block under state sync ## v0.32.3-binance.2 ### BUG FIXES: -- [status] [\#140](https://github.com/binance-chain/bnc-tendermint/pull/140) fix hot sync not a catched up status -- [consensus] [\#141](https://github.com/binance-chain/bnc-tendermint/pull/141) fix bug in load last validator set -- [index] [\#142](https://github.com/binance-chain/bnc-tendermint/pull/142) fix index height can not set after state sync +- [status] [\#140](https://github.com/bnb-chain/bnc-tendermint/pull/140) fix hot sync not a catched up status +- [consensus] [\#141](https://github.com/bnb-chain/bnc-tendermint/pull/141) fix bug in load last validator set +- [index] [\#142](https://github.com/bnb-chain/bnc-tendermint/pull/142) fix index height can not set after state sync ## v0.32.3-binance.1 ### IMPROVEMENTS: -- [Performance] [\#110](https://github.com/binance-chain/bnc-tendermint/pull/110) Improve performance +- [Performance] [\#110](https://github.com/bnb-chain/bnc-tendermint/pull/110) Improve performance ### BUG FIXES: -- [index] [\#129](https://github.com/binance-chain/bnc-tendermint/pull/129) fix tx indexer lag behind block +- [index] [\#129](https://github.com/bnb-chain/bnc-tendermint/pull/129) fix tx indexer lag behind block ## v0.32.3 @@ -296,20 +300,20 @@ accepting new peers and only allowing `ed25519` pubkeys. ## v0.31.5-binance.2 *Sep 6th, 2019* ### FEATURES: -- [config] [\#115](https://github.com/binance-chain/bnc-tendermint/pull/115) add option to enable range query for tx indexer;add option to disable websocket -- [sync] [\#97](https://github.com/binance-chain/bnc-tendermint/pull/97) supoort hot sync reactor +- [config] [\#115](https://github.com/bnb-chain/bnc-tendermint/pull/115) add option to enable range query for tx indexer;add option to disable websocket +- [sync] [\#97](https://github.com/bnb-chain/bnc-tendermint/pull/97) supoort hot sync reactor ### IMPROVEMENTS: -- [index] [\#106](https://github.com/binance-chain/bnc-tendermint/pull/106) index service recover from data lost -- [P2P] [\#106](https://github.com/binance-chain/bnc-tendermint/pull/107) introduce skip_tx_from_persistent config and other basic p2p improvement +- [index] [\#106](https://github.com/bnb-chain/bnc-tendermint/pull/106) index service recover from data lost +- [P2P] [\#106](https://github.com/bnb-chain/bnc-tendermint/pull/107) introduce skip_tx_from_persistent config and other basic p2p improvement ## v0.31.5-binance.1 *July 17th, 2019* ### IMPROVEMENTS: -- [mempool] [\#100](https://github.com/binance-chain/bnc-tendermint/pull/100) add OnlyPersistent to config of mempool -- [metrics] [\#96](https://github.com/binance-chain/bnc-tendermint/pull/96) monitor: add more metrics about p2p +- [mempool] [\#100](https://github.com/bnb-chain/bnc-tendermint/pull/100) add OnlyPersistent to config of mempool +- [metrics] [\#96](https://github.com/bnb-chain/bnc-tendermint/pull/96) monitor: add more metrics about p2p ## v0.31.5