feat: x/auth determinism tests for Account query (#13255)

* WIP: rapid tests

* remove commented code

* review changes

* review changes

* review changes

* review changes

* review changes

* review changes

* review changes

* review changes

* review changes

* review changes

* `go mod tidy`
This commit is contained in:
atheeshp
2022-09-16 09:22:09 +02:00
committed by GitHub
parent 340c01bf5a
commit ceffc5e01c
6 changed files with 133 additions and 0 deletions
+9
View File
@@ -4,6 +4,7 @@ import (
"encoding/json"
"github.com/stretchr/testify/require"
"pgregory.net/rapid"
"github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1"
"github.com/cosmos/cosmos-sdk/crypto/keys/secp256r1"
@@ -12,6 +13,14 @@ import (
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
)
// AddressGenerator creates and returns a random address generator using rapid.
func AddressGenerator(t *rapid.T) *rapid.Generator[sdk.AccAddress] {
return rapid.Custom(func(t *rapid.T) sdk.AccAddress {
pkBz := rapid.SliceOfN(rapid.Byte(), 20, 20).Draw(t, "hex")
return sdk.AccAddress(pkBz)
})
}
// KeyTestPubAddr generates a new secp256k1 keypair.
func KeyTestPubAddr() (cryptotypes.PrivKey, cryptotypes.PubKey, sdk.AccAddress) {
key := secp256k1.GenPrivKey()