Skip to content

Commit

Permalink
fix: avoid cyclic import
Browse files Browse the repository at this point in the history
  • Loading branch information
JulianToledano committed May 16, 2024
1 parent 726d5fc commit 8ca5ad1
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions codec/address/bech32_codec_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package address

import (
"crypto/rand"
"encoding/binary"
"testing"
"time"
Expand All @@ -10,14 +11,15 @@ import (

"cosmossdk.io/core/address"

"github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1"
"github.com/cosmos/cosmos-sdk/internal/conv"
)

func generateAddresses(totalKeys int) [][]byte {
keys := make([][]byte, totalKeys)
for i := 0; i < totalKeys; i++ {
keys[i] = secp256k1.GenPrivKey().PubKey().Address()
func generateAddresses(totalAddresses int) [][]byte {
keys := make([][]byte, totalAddresses)
addr := make([]byte, 32)
for i := 0; i < totalAddresses; i++ {
rand.Read(addr)

Check failure on line 21 in codec/address/bech32_codec_test.go

View workflow job for this annotation

GitHub Actions / golangci-lint

Error return value of `rand.Read` is not checked (errcheck)
keys[i] = addr
}

return keys
Expand Down Expand Up @@ -83,7 +85,10 @@ func TestMultipleBech32Codec(t *testing.T) {
assert.Assert(t, ok)
assert.Equal(t, cosmosAc.cache, stakeAc.cache)

addr := secp256k1.GenPrivKey().PubKey().Address()
addr := make([]byte, 32)
_, err := rand.Read(addr)
assert.NilError(t, err)

cosmosAddr, err := cosmosAc.BytesToString(addr)
assert.NilError(t, err)
stakeAddr, err := stakeAc.BytesToString(addr)
Expand Down

0 comments on commit 8ca5ad1

Please sign in to comment.