diff --git a/bsc/rlp/encode_test.go b/bsc/rlp/encode_test.go index b4b9e5128..f32a23964 100644 --- a/bsc/rlp/encode_test.go +++ b/bsc/rlp/encode_test.go @@ -21,7 +21,6 @@ import ( "errors" "fmt" "io" - "io/ioutil" "math/big" "sync" "testing" @@ -349,7 +348,7 @@ func TestEncodeToReader(t *testing.T) { if err != nil { return nil, err } - return ioutil.ReadAll(r) + return io.ReadAll(r) }) } @@ -390,7 +389,7 @@ func TestEncodeToReaderReturnToPool(t *testing.T) { go func() { for i := 0; i < 1000; i++ { _, r, _ := EncodeToReader("foo") - ioutil.ReadAll(r) + io.ReadAll(r) r.Read(buf) r.Read(buf) r.Read(buf) diff --git a/client/config.go b/client/config.go index a1d38a016..445abd843 100644 --- a/client/config.go +++ b/client/config.go @@ -7,7 +7,6 @@ import ( "github.com/mitchellh/go-homedir" "github.com/pelletier/go-toml" "github.com/spf13/cobra" - "io/ioutil" "os" "path" ) @@ -127,5 +126,5 @@ func createGaiaCLIConfig(cfg *cliConfig) error { } } - return ioutil.WriteFile(cfgFile, data, os.ModePerm) + return os.WriteFile(cfgFile, data, os.ModePerm) } diff --git a/client/keys/add.go b/client/keys/add.go index b6aa177e6..67b86f187 100644 --- a/client/keys/add.go +++ b/client/keys/add.go @@ -4,7 +4,7 @@ import ( "encoding/hex" "encoding/json" "fmt" - "io/ioutil" + "io" "net/http" "os" "path" @@ -225,7 +225,7 @@ func AddNewKeyRequestHandler(indent bool) http.HandlerFunc { return } - body, err := ioutil.ReadAll(r.Body) + body, err := io.ReadAll(r.Body) if err != nil { w.WriteHeader(http.StatusBadRequest) w.Write([]byte(err.Error())) @@ -323,7 +323,7 @@ func RecoverRequestHandler(indent bool) http.HandlerFunc { vars := mux.Vars(r) name := vars["name"] var m RecoverKeyBody - body, err := ioutil.ReadAll(r.Body) + body, err := io.ReadAll(r.Body) if err != nil { w.WriteHeader(http.StatusBadRequest) w.Write([]byte(err.Error())) diff --git a/client/keys/utils_test.go b/client/keys/utils_test.go index 6b65bb55a..53c3264a7 100644 --- a/client/keys/utils_test.go +++ b/client/keys/utils_test.go @@ -3,13 +3,12 @@ package keys import ( "github.com/cosmos/cosmos-sdk/crypto/keys" "github.com/stretchr/testify/require" - "io/ioutil" "os" "testing" ) func TestGetKeyBaseLocks(t *testing.T) { - dir, err := ioutil.TempDir("", "cosmos-sdk-keys") + dir, err := os.MkdirTemp("", "cosmos-sdk-keys") require.Nil(t, err) defer os.RemoveAll(dir) diff --git a/client/lcd/certificates.go b/client/lcd/certificates.go index 1516ed35a..b75b33831 100644 --- a/client/lcd/certificates.go +++ b/client/lcd/certificates.go @@ -11,7 +11,7 @@ import ( "encoding/pem" "errors" "fmt" - "io/ioutil" + "io" "math/big" "net" "os" @@ -76,7 +76,7 @@ func writeCertAndPrivKey(certBytes []byte, priv *ecdsa.PrivateKey) (certFile str } func writeCertificateFile(certBytes []byte) (filename string, err error) { - f, err := ioutil.TempFile("", "cert_") + f, err := os.CreateTemp("", "cert_") if err != nil { return } @@ -89,7 +89,7 @@ func writeCertificateFile(certBytes []byte) (filename string, err error) { } func writeKeyFile(priv *ecdsa.PrivateKey) (filename string, err error) { - f, err := ioutil.TempFile("", "key_") + f, err := os.CreateTemp("", "key_") if err != nil { return } @@ -162,7 +162,7 @@ func fingerprintFromFile(certFile string) (string, error) { return "", err } defer f.Close() - data, err := ioutil.ReadAll(f) + data, err := io.ReadAll(f) if err != nil { return "", err } diff --git a/client/lcd/certificates_test.go b/client/lcd/certificates_test.go index 14bddfa0f..b66aaccaa 100644 --- a/client/lcd/certificates_test.go +++ b/client/lcd/certificates_test.go @@ -3,7 +3,6 @@ package lcd import ( "crypto/ecdsa" "crypto/x509" - "io/ioutil" "os" "testing" @@ -71,7 +70,7 @@ zj0EAwIDSQAwRgIhAKnwbhX9FrGG1otCVLwhClQ3RaLxnNpCgIGTqSimb34cAiEA stMN+IqMCKWlZyGqxGIiyksMLMEU3lRqKNQn2EoAZJY= -----END CERTIFICATE-----` wantFingerprint := `SHA256 Fingerprint=0B:ED:9A:AA:A2:D1:7E:B2:53:56:F6:FC:C0:E6:1A:69:70:21:A2:B0:90:FC:AF:BB:EF:AE:2C:78:52:AB:68:40` - certFile, err := ioutil.TempFile("", "test_cert_") + certFile, err := os.CreateTemp("", "test_cert_") require.Nil(t, err) _, err = certFile.Write([]byte(cert)) require.Nil(t, err) @@ -83,7 +82,7 @@ stMN+IqMCKWlZyGqxGIiyksMLMEU3lRqKNQn2EoAZJY= require.Equal(t, wantFingerprint, fingerprint) // test failure - emptyFile, err := ioutil.TempFile("", "test_cert_") + emptyFile, err := os.CreateTemp("", "test_cert_") require.Nil(t, err) err = emptyFile.Close() require.Nil(t, err) diff --git a/client/lcd/test_helpers.go b/client/lcd/test_helpers.go index b4277f2a8..c2bf3e895 100644 --- a/client/lcd/test_helpers.go +++ b/client/lcd/test_helpers.go @@ -4,7 +4,7 @@ import ( "bytes" "encoding/json" "fmt" - "io/ioutil" + "io" "net" "net/http" "os" @@ -87,7 +87,7 @@ func GetConfig() *tmcfg.Config { // NOTE: memDB cannot be used because the request is expecting to interact with // the default location. func GetKeyBase(t *testing.T) crkeys.Keybase { - dir, err := ioutil.TempDir("", "lcd_test") + dir, err := os.MkdirTemp("", "lcd_test") require.NoError(t, err) viper.Set(cli.HomeFlag, dir) @@ -265,7 +265,7 @@ func InitializeTestLCD( viper.Set(client.FlagNode, config.RPC.ListenAddress) viper.Set(client.FlagChainID, genDoc.ChainID) viper.Set(client.FlagTrustNode, false) - dir, err := ioutil.TempDir("", "lcd_test") + dir, err := os.MkdirTemp("", "lcd_test") require.NoError(t, err) viper.Set(cli.HomeFlag, dir) @@ -358,7 +358,7 @@ func Request(t *testing.T, port, method, path string, payload []byte) (*http.Res res, err = http.DefaultClient.Do(req) require.Nil(t, err) - output, err := ioutil.ReadAll(res.Body) + output, err := io.ReadAll(res.Body) res.Body.Close() require.Nil(t, err) diff --git a/client/tx/broadcast.go b/client/tx/broadcast.go index 8346e1538..18ce48523 100644 --- a/client/tx/broadcast.go +++ b/client/tx/broadcast.go @@ -1,12 +1,12 @@ package tx import ( + "io" "net/http" "github.com/cosmos/cosmos-sdk/client/context" "github.com/cosmos/cosmos-sdk/client/utils" "github.com/cosmos/cosmos-sdk/codec" - "io/ioutil" ) const ( @@ -29,7 +29,7 @@ type BroadcastBody struct { func BroadcastTxRequest(cliCtx context.CLIContext, cdc *codec.Codec) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var m BroadcastBody - body, err := ioutil.ReadAll(r.Body) + body, err := io.ReadAll(r.Body) if err != nil { utils.WriteErrorResponse(w, http.StatusBadRequest, err.Error()) return diff --git a/client/utils/rest.go b/client/utils/rest.go index 8ee854c19..b3deace88 100644 --- a/client/utils/rest.go +++ b/client/utils/rest.go @@ -2,7 +2,7 @@ package utils import ( "fmt" - "io/ioutil" + "io" "net/http" "net/url" "strconv" @@ -135,7 +135,7 @@ unmarshals to the req interface. err := ReadRESTReq(w, r, cdc, req) */ func ReadRESTReq(w http.ResponseWriter, r *http.Request, cdc *codec.Codec, req interface{}) error { - body, err := ioutil.ReadAll(r.Body) + body, err := io.ReadAll(r.Body) if err != nil { WriteErrorResponse(w, http.StatusBadRequest, err.Error()) return err diff --git a/cmd/cosmos-sdk-cli/cmd/init.go b/cmd/cosmos-sdk-cli/cmd/init.go index e9e9cd8a9..0c7c2ddc9 100644 --- a/cmd/cosmos-sdk-cli/cmd/init.go +++ b/cmd/cosmos-sdk-cli/cmd/init.go @@ -3,7 +3,6 @@ package cmd import ( "fmt" "go/build" - "io/ioutil" "os" "strings" @@ -65,7 +64,7 @@ func copyBasecoinTemplate(projectName string, projectPath string, remoteProjectP basecoinProjectPath := resolveProjectPath(remoteBasecoinPath) filepath.Walk(basecoinProjectPath, func(path string, f os.FileInfo, err error) error { if !f.IsDir() { - data, err := ioutil.ReadFile(path) + data, err := os.ReadFile(path) if err != nil { return err } @@ -83,7 +82,7 @@ func copyBasecoinTemplate(projectName string, projectPath string, remoteProjectP fmt.Println("Creating " + projectFilePath) // Writing the contents to a file in the project folder contents = replacer.Replace(contents) - ioutil.WriteFile(projectFilePath, []byte(contents), os.ModePerm) + os.WriteFile(projectFilePath, []byte(contents), os.ModePerm) } return nil }) @@ -110,7 +109,7 @@ func createGopkg(projectPath string) { contents += "[[override]]\n\tname = \"" + dependency + "\"\n\tversion = \"=" + version + "\"\n\n" } contents += "[prune]\n\tgo-tests = true\n\tunused-packages = true" - ioutil.WriteFile(projectPath+"/Gopkg.toml", []byte(contents), os.ModePerm) + os.WriteFile(projectPath+"/Gopkg.toml", []byte(contents), os.ModePerm) } // nolint: errcheck @@ -142,7 +141,7 @@ benchmark: // Replacing instances of base* to project specific names makefileContents = replacer.Replace(makefileContents) - ioutil.WriteFile(projectPath+"/Makefile", []byte(makefileContents), os.ModePerm) + os.WriteFile(projectPath+"/Makefile", []byte(makefileContents), os.ModePerm) } diff --git a/cmd/gaia/app/genesis.go b/cmd/gaia/app/genesis.go index bd9b65e0d..7ded70ae4 100644 --- a/cmd/gaia/app/genesis.go +++ b/cmd/gaia/app/genesis.go @@ -4,7 +4,6 @@ import ( "encoding/json" "errors" "fmt" - "io/ioutil" "os" "path/filepath" "sort" @@ -189,8 +188,8 @@ func GaiaAppGenStateJSON(cdc *codec.Codec, appGenTxs []json.RawMessage) (appStat // appGenTxs, and persistent peers required to generate genesis.json. func CollectStdTxs(moniker string, genTxsDir string, cdc *codec.Codec) ( validators []tmtypes.GenesisValidator, appGenTxs []auth.StdTx, persistentPeers string, err error) { - var fos []os.FileInfo - fos, err = ioutil.ReadDir(genTxsDir) + var fos []os.DirEntry + fos, err = os.ReadDir(genTxsDir) if err != nil { return } @@ -204,7 +203,7 @@ func CollectStdTxs(moniker string, genTxsDir string, cdc *codec.Codec) ( // get the genStdTx var jsonRawTx []byte - jsonRawTx, err = ioutil.ReadFile(filename) + jsonRawTx, err = os.ReadFile(filename) if err != nil { return } diff --git a/cmd/gaia/cli_test/cli_test.go b/cmd/gaia/cli_test/cli_test.go index 1c196aae4..e6cebd968 100644 --- a/cmd/gaia/cli_test/cli_test.go +++ b/cmd/gaia/cli_test/cli_test.go @@ -1,3 +1,4 @@ +//go:build cli_test // +build cli_test package clitest @@ -5,7 +6,6 @@ package clitest import ( "encoding/json" "fmt" - "io/ioutil" "os" "path" "testing" @@ -391,7 +391,7 @@ func TestGaiaCLIConfig(t *testing.T) { node := fmt.Sprintf("%s:%s", servAddr, port) chainID := executeInit(t, fmt.Sprintf("gaiad init -o --name=foo --home=%s --home-client=%s", gaiadHome, gaiacliHome)) executeWrite(t, fmt.Sprintf("gaiacli --home=%s config", gaiadHome), gaiacliHome, node, "y") - config, err := ioutil.ReadFile(path.Join(gaiacliHome, "config", "config.toml")) + config, err := os.ReadFile(path.Join(gaiacliHome, "config", "config.toml")) require.NoError(t, err) expectedConfig := fmt.Sprintf(`chain_id = "%s" encoding = "btc" @@ -404,7 +404,7 @@ trust_node = true require.Equal(t, expectedConfig, string(config)) // ensure a backup gets created executeWrite(t, "gaiacli config", gaiacliHome, node, "y", "y") - configBackup, err := ioutil.ReadFile(path.Join(gaiacliHome, "config", "config.toml-old")) + configBackup, err := os.ReadFile(path.Join(gaiacliHome, "config", "config.toml-old")) require.NoError(t, err) require.Equal(t, expectedConfig, string(configBackup)) @@ -420,7 +420,7 @@ output = "text" trace = false trust_node = true `, gaiacliHome, node) - config, err = ioutil.ReadFile(path.Join(gaiacliHome, "config", "config.toml")) + config, err = os.ReadFile(path.Join(gaiacliHome, "config", "config.toml")) require.NoError(t, err) require.Equal(t, expectedConfig, string(config)) } @@ -456,7 +456,7 @@ func unmarshalStdTx(t *testing.T, s string) (stdTx auth.StdTx) { } func writeToNewTempFile(t *testing.T, s string) *os.File { - fp, err := ioutil.TempFile(os.TempDir(), "cosmos_cli_test_") + fp, err := os.TempFile(os.TempDir(), "cosmos_cli_test_") require.Nil(t, err) _, err = fp.WriteString(s) require.Nil(t, err) diff --git a/cmd/gaia/init/gentx.go b/cmd/gaia/init/gentx.go index 1b24a3576..c51208500 100644 --- a/cmd/gaia/init/gentx.go +++ b/cmd/gaia/init/gentx.go @@ -15,7 +15,6 @@ import ( "github.com/tendermint/tendermint/crypto" tmcli "github.com/tendermint/tendermint/libs/cli" "github.com/tendermint/tendermint/libs/common" - "io/ioutil" "os" "path/filepath" ) @@ -60,7 +59,7 @@ following delegation and commission default parameters: prepareFlagsForTxCreateValidator(config, nodeID, ip, valPubKey) createValidatorCmd := cli.GetCmdCreateValidator(cdc) - w, err := ioutil.TempFile("", "gentx") + w, err := os.CreateTemp("", "gentx") if err != nil { return err } diff --git a/cmd/gaia/init/init_test.go b/cmd/gaia/init/init_test.go index 48a5d9247..ea2878b12 100644 --- a/cmd/gaia/init/init_test.go +++ b/cmd/gaia/init/init_test.go @@ -6,7 +6,6 @@ import ( "github.com/cosmos/cosmos-sdk/cmd/gaia/app" "github.com/tendermint/tendermint/libs/cli" "io" - "io/ioutil" "os" "testing" "time" @@ -39,7 +38,7 @@ func TestInitCmd(t *testing.T) { } func setupClientHome(t *testing.T) func() { - clientDir, err := ioutil.TempDir("", "mock-sdk-cmd") + clientDir, err := os.MkdirTemp("", "mock-sdk-cmd") require.Nil(t, err) viper.Set(flagClientHome, clientDir) viper.Set(flagOverwriteKey, true) @@ -92,7 +91,7 @@ func TestEmptyState(t *testing.T) { } func TestStartStandAlone(t *testing.T) { - home, err := ioutil.TempDir("", "mock-sdk-cmd") + home, err := os.MkdirTemp("", "mock-sdk-cmd") require.Nil(t, err) defer func() { os.RemoveAll(home) @@ -130,7 +129,7 @@ func TestStartStandAlone(t *testing.T) { } func TestInitNodeValidatorFiles(t *testing.T) { - home, err := ioutil.TempDir("", "mock-sdk-cmd") + home, err := os.MkdirTemp("", "mock-sdk-cmd") require.Nil(t, err) defer func() { os.RemoveAll(home) diff --git a/go.mod b/go.mod index 60467baab..5a2a1ceaf 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/cosmos/cosmos-sdk -go 1.16 +go 1.17 require ( github.com/bartekn/go-bip39 v0.0.0-20171116152956-a05967ea095d @@ -32,10 +32,118 @@ require ( golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550 ) +require ( + github.com/beorn7/perks v1.0.1 // indirect + github.com/btcsuite/btcutil v0.0.0-20190425235716-9e5f4b9a998d // indirect + github.com/coreos/go-semver v0.3.0 // indirect + github.com/cosmos/ledger-go v0.9.2 // indirect + github.com/davecgh/go-spew v1.1.1 // indirect + github.com/etcd-io/bbolt v1.3.3 // indirect + github.com/fsnotify/fsnotify v1.4.7 // indirect + github.com/go-logfmt/logfmt v0.4.0 // indirect + github.com/gogo/protobuf v1.3.1 // indirect + github.com/golang/protobuf v1.3.2 // indirect + github.com/golang/snappy v0.0.1 // indirect + github.com/google/uuid v1.1.1 // indirect + github.com/gorilla/websocket v1.4.0 // indirect + github.com/hashicorp/errwrap v1.0.0 // indirect + github.com/hashicorp/go-multierror v1.0.0 // indirect + github.com/hashicorp/hcl v1.0.0 // indirect + github.com/huin/goupnp v1.0.0 // indirect + github.com/inconshreveable/mousetrap v1.0.0 // indirect + github.com/ipfs/go-cid v0.0.3 // indirect + github.com/ipfs/go-datastore v0.0.5 // indirect + github.com/ipfs/go-ipfs-util v0.0.1 // indirect + github.com/ipfs/go-todocounter v0.0.1 // indirect + github.com/jackpal/gateway v1.0.5 // indirect + github.com/jackpal/go-nat-pmp v1.0.1 // indirect + github.com/jbenet/go-temp-err-catcher v0.0.0-20150120210811-aac704a3f4f2 // indirect + github.com/jbenet/goprocess v0.1.3 // indirect + github.com/jmhodges/levigo v1.0.0 // indirect + github.com/koron/go-ssdp v0.0.0-20180514024734-4a0ed625a78b // indirect + github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515 // indirect + github.com/libp2p/go-addr-util v0.0.1 // indirect + github.com/libp2p/go-buffer-pool v0.0.2 // indirect + github.com/libp2p/go-conn-security-multistream v0.1.0 // indirect + github.com/libp2p/go-eventbus v0.1.0 // indirect + github.com/libp2p/go-flow-metrics v0.0.1 // indirect + github.com/libp2p/go-libp2p v0.3.0 // indirect + github.com/libp2p/go-libp2p-autonat v0.1.0 // indirect + github.com/libp2p/go-libp2p-circuit v0.1.1 // indirect + github.com/libp2p/go-libp2p-core v0.2.2 // indirect + github.com/libp2p/go-libp2p-discovery v0.1.0 // indirect + github.com/libp2p/go-libp2p-kad-dht v0.2.0 // indirect + github.com/libp2p/go-libp2p-kbucket v0.2.0 // indirect + github.com/libp2p/go-libp2p-loggables v0.1.0 // indirect + github.com/libp2p/go-libp2p-mplex v0.2.1 // indirect + github.com/libp2p/go-libp2p-nat v0.0.4 // indirect + github.com/libp2p/go-libp2p-peerstore v0.1.3 // indirect + github.com/libp2p/go-libp2p-record v0.1.1 // indirect + github.com/libp2p/go-libp2p-routing v0.1.0 // indirect + github.com/libp2p/go-libp2p-secio v0.2.0 // indirect + github.com/libp2p/go-libp2p-swarm v0.2.0 // indirect + github.com/libp2p/go-libp2p-transport-upgrader v0.1.1 // indirect + github.com/libp2p/go-libp2p-yamux v0.2.1 // indirect + github.com/libp2p/go-maddr-filter v0.0.5 // indirect + github.com/libp2p/go-mplex v0.1.0 // indirect + github.com/libp2p/go-msgio v0.0.4 // indirect + github.com/libp2p/go-nat v0.0.3 // indirect + github.com/libp2p/go-openssl v0.0.2 // indirect + github.com/libp2p/go-reuseport v0.0.1 // indirect + github.com/libp2p/go-reuseport-transport v0.0.2 // indirect + github.com/libp2p/go-stream-muxer-multistream v0.2.0 // indirect + github.com/libp2p/go-tcp-transport v0.1.0 // indirect + github.com/libp2p/go-ws-transport v0.1.0 // indirect + github.com/libp2p/go-yamux v1.2.3 // indirect + github.com/magiconair/properties v1.8.1 // indirect + github.com/mattn/go-colorable v0.1.4 // indirect + github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect + github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1 // indirect + github.com/minio/sha256-simd v0.1.0 // indirect + github.com/mitchellh/mapstructure v1.1.2 // indirect + github.com/mr-tron/base58 v1.1.2 // indirect + github.com/multiformats/go-base32 v0.0.3 // indirect + github.com/multiformats/go-multiaddr v0.0.4 // indirect + github.com/multiformats/go-multiaddr-dns v0.0.3 // indirect + github.com/multiformats/go-multiaddr-fmt v0.0.1 // indirect + github.com/multiformats/go-multiaddr-net v0.0.1 // indirect + github.com/multiformats/go-multibase v0.0.1 // indirect + github.com/multiformats/go-multihash v0.0.7 // indirect + github.com/multiformats/go-multistream v0.1.0 // indirect + github.com/opentracing/opentracing-go v1.1.0 // indirect + github.com/otiai10/primes v0.0.0-20180210170552-f6d2a1ba97c4 // indirect + github.com/pmezard/go-difflib v1.0.0 // indirect + github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90 // indirect + github.com/prometheus/common v0.6.0 // indirect + github.com/prometheus/procfs v0.0.3 // indirect + github.com/rcrowley/go-metrics v0.0.0-20180503174638-e2704e165165 // indirect + github.com/rs/cors v1.6.0 // indirect + github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572 // indirect + github.com/spaolacci/murmur3 v1.1.0 // indirect + github.com/spf13/afero v1.2.2 // indirect + github.com/spf13/cast v1.3.0 // indirect + github.com/spf13/jwalterweatherman v1.1.0 // indirect + github.com/whyrusleeping/base32 v0.0.0-20170828182744-c30ac30633cc // indirect + github.com/whyrusleeping/go-keyspace v0.0.0-20160322163242-5b898ac5add1 // indirect + github.com/whyrusleeping/go-logging v0.0.1 // indirect + github.com/whyrusleeping/go-notifier v0.0.0-20170827234753-097c5d47330f // indirect + github.com/whyrusleeping/mafmt v1.2.8 // indirect + github.com/whyrusleeping/multiaddr-filter v0.0.0-20160516205228-e903e4adabd7 // indirect + github.com/zondax/hid v0.9.0 // indirect + go.opencensus.io v0.22.0 // indirect + golang.org/x/net v0.0.0-20191021144547-ec77196f6094 // indirect + golang.org/x/sys v0.0.0-20191026070338-33540a1f6037 // indirect + golang.org/x/text v0.3.2 // indirect + golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898 // indirect + google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb // indirect + google.golang.org/grpc v1.23.0 // indirect + gopkg.in/yaml.v2 v2.2.4 // indirect +) + replace ( - github.com/tendermint/go-amino => github.com/binance-chain/bnc-go-amino v0.14.1-binance.2 - github.com/tendermint/iavl => github.com/binance-chain/bnc-tendermint-iavl v0.12.0-binance.4 - github.com/tendermint/tendermint => github.com/binance-chain/bnc-tendermint v0.32.3-binance.6 - github.com/zondax/ledger-cosmos-go => github.com/binance-chain/ledger-cosmos-go v0.9.9-binance.3 + github.com/tendermint/go-amino => github.com/bnb-chain/bnc-go-amino v0.14.1-binance.2 + github.com/tendermint/iavl => github.com/bnb-chain/bnc-tendermint-iavl v0.12.0-binance.4 + github.com/tendermint/tendermint => github.com/bnb-chain/bnc-tendermint v0.32.3-binance.6 + github.com/zondax/ledger-cosmos-go => github.com/bnb-chain/ledger-cosmos-go v0.9.9-binance.3 golang.org/x/crypto => github.com/tendermint/crypto v0.0.0-20190823183015-45b1026d81ae ) diff --git a/go.sum b/go.sum index 65336d116..f4ac57cd7 100644 --- a/go.sum +++ b/go.sum @@ -20,18 +20,18 @@ github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= github.com/bgentry/speakeasy v0.1.0 h1:ByYyxL9InA1OWqxJqqp2A5pYHUrCiAL6K3J+LKSsQkY= github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= -github.com/binance-chain/bnc-go-amino v0.14.1-binance.2 h1:XcbcfisVItk92UKoGbtNT8nbcfadj3H3ayuM2srAfVs= -github.com/binance-chain/bnc-go-amino v0.14.1-binance.2/go.mod h1:yaElUUxWtv/TC/ldGtlKAvS1vKwokxgJ1d97I+6is80= -github.com/binance-chain/bnc-tendermint v0.32.3-binance.6 h1:3Xt3IaH5zAGssK0ZxyGz5dQ7plxWdUCdtT4z7kS2M3U= -github.com/binance-chain/bnc-tendermint v0.32.3-binance.6/go.mod h1:+5NnQZbpAijzpby/yOYlBwJjzvkXZKr6MGWZ9oI0p4Y= -github.com/binance-chain/bnc-tendermint-iavl v0.12.0-binance.4 h1:BhaV2iiGWfRC6iB8HHOYJeUDwtQMB2pUA4ah+KCbBhI= -github.com/binance-chain/bnc-tendermint-iavl v0.12.0-binance.4/go.mod h1:Zmh8GRdNJB8DULIOBar3JCZp6tSpcvM1NGKfE9U2EzA= -github.com/binance-chain/ledger-cosmos-go v0.9.9-binance.3 h1:FFpFbkzlP2HUyxQCm0eoU6mkfgMNynfqZRbeWqlaLdQ= -github.com/binance-chain/ledger-cosmos-go v0.9.9-binance.3/go.mod h1:TULULYTvPuWBxFIZFy6KjJaxJzbHeUderYNB1YhD6N0= github.com/binance-chain/tss v0.1.2 h1:AyTedSG5HG/WAvM9PDPWjTXQ+dvNdHg3x1c+1a584PQ= github.com/binance-chain/tss v0.1.2/go.mod h1:p6u8c5+JQI46aytQFQY7qg2FPwVjcS6Dwaui0U6WrRw= github.com/binance-chain/tss-lib v1.0.0 h1:r6Yj8g8zwiVwOAdVBu2D36Nvbxeq9qPWdVi+pqGkqQI= github.com/binance-chain/tss-lib v1.0.0/go.mod h1:5mmPQOOkBIjHxyGVesSUB2AemcZj5YkMJ+HPZY4Jd38= +github.com/bnb-chain/bnc-go-amino v0.14.1-binance.2 h1:iAlp9gqG0f2LGAauf3ZiijWlT6NI+W2r9y70HH9LI3k= +github.com/bnb-chain/bnc-go-amino v0.14.1-binance.2/go.mod h1:LiCO7jev+3HwLGAiN9gpD0z+jTz95RqgSavbse55XOY= +github.com/bnb-chain/bnc-tendermint v0.32.3-binance.6 h1:6H6b/+Yk1hzfF4iHLe6ACv7eZ+vNZC8jk663O2gzkT8= +github.com/bnb-chain/bnc-tendermint v0.32.3-binance.6/go.mod h1:+5NnQZbpAijzpby/yOYlBwJjzvkXZKr6MGWZ9oI0p4Y= +github.com/bnb-chain/bnc-tendermint-iavl v0.12.0-binance.4 h1:w8pAAx1N0lmVf0Lxs1prYuDikXwirOb9T7y2yw8zOBw= +github.com/bnb-chain/bnc-tendermint-iavl v0.12.0-binance.4/go.mod h1:Zmh8GRdNJB8DULIOBar3JCZp6tSpcvM1NGKfE9U2EzA= +github.com/bnb-chain/ledger-cosmos-go v0.9.9-binance.3 h1:a+QLVLaP32v9gfRDKHH2AcRkzYLTWbC8UxYTJkXRSec= +github.com/bnb-chain/ledger-cosmos-go v0.9.9-binance.3/go.mod h1:TULULYTvPuWBxFIZFy6KjJaxJzbHeUderYNB1YhD6N0= github.com/btcsuite/btcd v0.0.0-20190115013929-ed77733ec07d/go.mod h1:d3C0AkH6BRcvO8T0UEPu53cnw4IbV63x1bEjildYhO0= github.com/btcsuite/btcd v0.0.0-20190213025234-306aecffea32/go.mod h1:DrZx5ec/dmnfpw9KyYoQyYo7d0KEvTkk/5M/vbZjAr8= github.com/btcsuite/btcd v0.0.0-20190523000118-16327141da8c/go.mod h1:3J08xEfcugPacsc34/LKRU2yO7YmuT8yt28J8k2+rrI= diff --git a/server/export.go b/server/export.go index c0c5e383e..1d35137d0 100644 --- a/server/export.go +++ b/server/export.go @@ -2,6 +2,7 @@ package server import ( "fmt" + "os" "github.com/pkg/errors" "github.com/spf13/cobra" @@ -9,7 +10,6 @@ import ( "github.com/cosmos/cosmos-sdk/codec" tmtypes "github.com/tendermint/tendermint/types" - "io/ioutil" "path" ) @@ -29,7 +29,7 @@ func ExportCmd(ctx *Context, cdc *codec.Codec, appExporter AppExporter) *cobra.C if emptyState { fmt.Println("WARNING: State is not initialized. Returning genesis file.") genesisFile := path.Join(home, "config", "genesis.json") - genesis, err := ioutil.ReadFile(genesisFile) + genesis, err := os.ReadFile(genesisFile) if err != nil { return err } @@ -70,7 +70,7 @@ func ExportCmd(ctx *Context, cdc *codec.Codec, appExporter AppExporter) *cobra.C } func isEmptyState(home string) (bool, error) { - files, err := ioutil.ReadDir(path.Join(home, "data")) + files, err := os.ReadDir(path.Join(home, "data")) if err != nil { return false, err } diff --git a/server/mock/helpers.go b/server/mock/helpers.go index 88aacb4d8..334a21d9f 100644 --- a/server/mock/helpers.go +++ b/server/mock/helpers.go @@ -2,7 +2,6 @@ package mock import ( "fmt" - "io/ioutil" "os" abci "github.com/tendermint/tendermint/abci/types" @@ -14,7 +13,7 @@ import ( func SetupApp() (abci.Application, func(), error) { logger := log.NewTMLogger(log.NewSyncWriter(os.Stdout)). With("module", "mock") - rootDir, err := ioutil.TempDir("", "mock-sdk") + rootDir, err := os.MkdirTemp("", "mock-sdk") if err != nil { return nil, nil, err } diff --git a/server/test_helpers.go b/server/test_helpers.go index 4347bad6c..5b8d76b56 100644 --- a/server/test_helpers.go +++ b/server/test_helpers.go @@ -3,7 +3,6 @@ package server import ( "fmt" "github.com/cosmos/cosmos-sdk/client" - "io/ioutil" "net" "os" "testing" @@ -40,7 +39,7 @@ func FreeTCPAddr() (addr, port string, err error) { // SetupViper creates a homedir to run inside, // and returns a cleanup function to defer func SetupViper(t *testing.T) func() { - rootDir, err := ioutil.TempDir("", "mock-sdk-cmd") + rootDir, err := os.MkdirTemp("", "mock-sdk-cmd") require.Nil(t, err) viper.Set(cli.HomeFlag, rootDir) viper.Set(client.FlagName, "moniker") diff --git a/tests/gobash.go b/tests/gobash.go index 87d56a297..9487af410 100644 --- a/tests/gobash.go +++ b/tests/gobash.go @@ -3,7 +3,6 @@ package tests import ( "fmt" "io" - "io/ioutil" "strings" "testing" @@ -93,7 +92,7 @@ func GoExecuteTWithStdout(t *testing.T, cmd string) (proc *Process) { // Without this, the test halts ?! go func() { - _, err := ioutil.ReadAll(proc.StdoutPipe) + _, err := io.ReadAll(proc.StdoutPipe) if err != nil { fmt.Println("-------------ERR-----------------------", err) return diff --git a/tests/process.go b/tests/process.go index 08f975cf8..eb19b552d 100644 --- a/tests/process.go +++ b/tests/process.go @@ -2,7 +2,6 @@ package tests import ( "io" - "io/ioutil" "os" "os/exec" "time" @@ -103,13 +102,13 @@ func (proc *Process) Wait() { proc.EndTime = time.Now() // TODO make this goroutine-safe } -// ReadAll calls ioutil.ReadAll on the StdoutPipe and StderrPipe. +// ReadAll calls io.ReadAll on the StdoutPipe and StderrPipe. func (proc *Process) ReadAll() (stdout []byte, stderr []byte, err error) { - outbz, err := ioutil.ReadAll(proc.StdoutPipe) + outbz, err := io.ReadAll(proc.StdoutPipe) if err != nil { return nil, nil, err } - errbz, err := ioutil.ReadAll(proc.StderrPipe) + errbz, err := io.ReadAll(proc.StderrPipe) if err != nil { return nil, nil, err } diff --git a/tests/util.go b/tests/util.go index 48649eaf7..f4b0185b8 100644 --- a/tests/util.go +++ b/tests/util.go @@ -2,7 +2,7 @@ package tests import ( "fmt" - "io/ioutil" + "io" "net/http" "time" @@ -97,7 +97,7 @@ func waitForHeight(height int64, url string) { panic(err) } - body, err := ioutil.ReadAll(res.Body) + body, err := io.ReadAll(res.Body) if err != nil { panic(err) } @@ -151,7 +151,7 @@ func WaitForStart(url string) { if err != nil || res == nil { continue } - // body, _ := ioutil.ReadAll(res.Body) + // body, _ := io.ReadAll(res.Body) // fmt.Println("BODY", string(body)) err = res.Body.Close() if err != nil { diff --git a/x/auth/client/cli/sign.go b/x/auth/client/cli/sign.go index 93408ae2b..8f73d83a1 100644 --- a/x/auth/client/cli/sign.go +++ b/x/auth/client/cli/sign.go @@ -2,9 +2,8 @@ package cli import ( "fmt" - "io/ioutil" - "github.com/spf13/viper" + "os" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/context" @@ -94,7 +93,7 @@ func printSignatures(stdTx auth.StdTx) { func readAndUnmarshalStdTx(cdc *amino.Codec, filename string) (stdTx auth.StdTx, err error) { var bytes []byte - if bytes, err = ioutil.ReadFile(filename); err != nil { + if bytes, err = os.ReadFile(filename); err != nil { return } if err = cdc.UnmarshalJSON(bytes, &stdTx); err != nil { diff --git a/x/auth/client/rest/sign.go b/x/auth/client/rest/sign.go index 13dd8d20c..b47bd2b8b 100644 --- a/x/auth/client/rest/sign.go +++ b/x/auth/client/rest/sign.go @@ -1,7 +1,7 @@ package rest import ( - "io/ioutil" + "io" "net/http" "github.com/cosmos/cosmos-sdk/client/context" @@ -30,7 +30,7 @@ func SignTxRequestHandlerFn(cdc *codec.Codec, cliCtx context.CLIContext) http.Ha return func(w http.ResponseWriter, r *http.Request) { var m SignBody - body, err := ioutil.ReadAll(r.Body) + body, err := io.ReadAll(r.Body) if err != nil { utils.WriteErrorResponse(w, http.StatusBadRequest, err.Error()) return diff --git a/x/bank/client/cli/broadcast.go b/x/bank/client/cli/broadcast.go index 9371062fd..598096b9c 100644 --- a/x/bank/client/cli/broadcast.go +++ b/x/bank/client/cli/broadcast.go @@ -1,7 +1,7 @@ package cli import ( - "io/ioutil" + "io" "os" "github.com/cosmos/cosmos-sdk/client/context" @@ -41,9 +41,9 @@ in place of an input filename, the command reads from standard input.`, func readAndUnmarshalStdTx(cdc *amino.Codec, filename string) (stdTx auth.StdTx, err error) { var bytes []byte if filename == "-" { - bytes, err = ioutil.ReadAll(os.Stdin) + bytes, err = io.ReadAll(os.Stdin) } else { - bytes, err = ioutil.ReadFile(filename) + bytes, err = os.ReadFile(filename) } if err != nil { return diff --git a/x/bank/client/rest/broadcast.go b/x/bank/client/rest/broadcast.go index 5c557a506..03372b80a 100644 --- a/x/bank/client/rest/broadcast.go +++ b/x/bank/client/rest/broadcast.go @@ -1,7 +1,7 @@ package rest import ( - "io/ioutil" + "io" "net/http" "github.com/cosmos/cosmos-sdk/client/context" @@ -38,7 +38,7 @@ func BroadcastTxRequestHandlerFn(cdc *codec.Codec, cliCtx context.CLIContext) ht } func unmarshalBodyOrReturnBadRequest(cliCtx context.CLIContext, w http.ResponseWriter, r *http.Request, m *broadcastBody) bool { - body, err := ioutil.ReadAll(r.Body) + body, err := io.ReadAll(r.Body) if err != nil { utils.WriteErrorResponse(w, http.StatusBadRequest, err.Error()) return false diff --git a/x/gov/client/cli/tx.go b/x/gov/client/cli/tx.go index ceeddcedc..4d6392b0e 100644 --- a/x/gov/client/cli/tx.go +++ b/x/gov/client/cli/tx.go @@ -3,7 +3,7 @@ package cli import ( "encoding/json" "fmt" - "io/ioutil" + "os" "strings" "time" @@ -187,7 +187,7 @@ func parseSubmitProposalFlags() (*proposal, error) { } } - contents, err := ioutil.ReadFile(proposalFile) + contents, err := os.ReadFile(proposalFile) if err != nil { return nil, err } diff --git a/x/gov/client/cli/tx_test.go b/x/gov/client/cli/tx_test.go index 73df8c290..41681ad1f 100644 --- a/x/gov/client/cli/tx_test.go +++ b/x/gov/client/cli/tx_test.go @@ -1,7 +1,7 @@ package cli import ( - "io/ioutil" + "os" "testing" "github.com/spf13/viper" @@ -9,7 +9,7 @@ import ( ) func TestParseSubmitProposalFlags(t *testing.T) { - okJSON, err := ioutil.TempFile("", "proposal") + okJSON, err := os.CreateTemp("", "proposal") require.Nil(t, err, "unexpected error") okJSON.WriteString(` { @@ -20,7 +20,7 @@ func TestParseSubmitProposalFlags(t *testing.T) { } `) - badJSON, err := ioutil.TempFile("", "proposal") + badJSON, err := os.CreateTemp("", "proposal") require.Nil(t, err, "unexpected error") badJSON.WriteString("bad json") diff --git a/x/paramHub/client/cli/fees.go b/x/paramHub/client/cli/fees.go index 0774a9221..7b0c917a5 100644 --- a/x/paramHub/client/cli/fees.go +++ b/x/paramHub/client/cli/fees.go @@ -4,7 +4,7 @@ import ( "encoding/json" "errors" "fmt" - "io/ioutil" + "os" "time" "github.com/spf13/cobra" @@ -47,7 +47,7 @@ func SubmitFeeChangeProposalCmd(cdc *codec.Codec) *cobra.Command { return errors.New("fee-param-file is missing") } - bz, err := ioutil.ReadFile(feeParamFile) + bz, err := os.ReadFile(feeParamFile) if err != nil { return err } diff --git a/x/paramHub/client/cli/scParams.go b/x/paramHub/client/cli/scParams.go index d38d85b9e..aa746d926 100644 --- a/x/paramHub/client/cli/scParams.go +++ b/x/paramHub/client/cli/scParams.go @@ -4,7 +4,7 @@ import ( "encoding/json" "errors" "fmt" - "io/ioutil" + "os" "time" "github.com/spf13/cobra" @@ -49,7 +49,7 @@ func SubmitSCParamChangeProposalCmd(cdc *codec.Codec) *cobra.Command { return errors.New("sc-param-file is missing") } - bz, err := ioutil.ReadFile(scParamFile) + bz, err := os.ReadFile(scParamFile) if err != nil { return err } diff --git a/x/slashing/client/cli/tx_sidechain.go b/x/slashing/client/cli/tx_sidechain.go index a5d10aa8c..573e86c40 100644 --- a/x/slashing/client/cli/tx_sidechain.go +++ b/x/slashing/client/cli/tx_sidechain.go @@ -4,8 +4,6 @@ import ( "encoding/json" "errors" "fmt" - "io/ioutil" - "github.com/cosmos/cosmos-sdk/bsc" "github.com/cosmos/cosmos-sdk/client/context" "github.com/cosmos/cosmos-sdk/client/utils" @@ -16,6 +14,7 @@ import ( "github.com/cosmos/cosmos-sdk/x/slashing" "github.com/spf13/cobra" "github.com/spf13/viper" + "os" ) const ( @@ -49,7 +48,7 @@ func GetCmdBscSubmitEvidence(cdc *codec.Codec) *cobra.Command { filePath := viper.GetString(flagEvidenceFile) evidenceBytes := make([]byte, 0) if filePath != "" { - evidenceBytes, err = ioutil.ReadFile(filePath) + evidenceBytes, err = os.ReadFile(filePath) if err != nil { return err } diff --git a/x/slashing/client/rest/tx.go b/x/slashing/client/rest/tx.go index d6db40f6d..9158ee209 100644 --- a/x/slashing/client/rest/tx.go +++ b/x/slashing/client/rest/tx.go @@ -3,7 +3,7 @@ package rest import ( "bytes" "encoding/json" - "io/ioutil" + "io" "net/http" "github.com/gorilla/mux" @@ -84,7 +84,7 @@ func bscEvidenceSubmitRequestHandlerFn(cdc *codec.Codec, kb keys.Keybase, cliCtx return func(w http.ResponseWriter, r *http.Request) { - body, err := ioutil.ReadAll(r.Body) + body, err := io.ReadAll(r.Body) if err != nil { utils.WriteErrorResponse(w, http.StatusBadRequest, err.Error()) return diff --git a/x/stake/client/rest/tx.go b/x/stake/client/rest/tx.go index 6acf3f660..a06347789 100644 --- a/x/stake/client/rest/tx.go +++ b/x/stake/client/rest/tx.go @@ -2,7 +2,7 @@ package rest import ( "bytes" - "io/ioutil" + "io" "net/http" "github.com/cosmos/cosmos-sdk/client/context" @@ -62,7 +62,7 @@ func delegationsRequestHandlerFn(cdc *codec.Codec, kb keys.Keybase, cliCtx conte return func(w http.ResponseWriter, r *http.Request) { var req EditDelegationsReq - body, err := ioutil.ReadAll(r.Body) + body, err := io.ReadAll(r.Body) if err != nil { utils.WriteErrorResponse(w, http.StatusBadRequest, err.Error()) return