feat(x/bank): Replace regex parsing of denom validation to generated parsing (#19511)

This commit is contained in:
Matt, Park
2024-03-07 09:34:49 +00:00
committed by GitHub
parent 4edf6b2a85
commit a1e3a85ae1
10 changed files with 301 additions and 32 deletions
@@ -33,7 +33,7 @@ import (
)
var (
denomRegex = sdk.DefaultCoinDenomRegex()
denomRegex = `[a-zA-Z][a-zA-Z0-9/:._-]{2,127}`
addr1 = sdk.MustAccAddressFromBech32("cosmos139f7kncmglres2nf3h4hc4tade85ekfr8sulz5")
coin1 = sdk.NewCoin("denom", math.NewInt(10))
metadataAtom = banktypes.Metadata{
@@ -859,9 +859,10 @@ func TestGRPCRedelegations(t *testing.T) {
func TestGRPCParams(t *testing.T) {
t.Parallel()
f := initDeterministicFixture(t)
coinDenomRegex := `[a-zA-Z][a-zA-Z0-9/:._-]{2,127}`
rapid.Check(t, func(rt *rapid.T) {
bondDenom := rapid.StringMatching(sdk.DefaultCoinDenomRegex()).Draw(rt, "bond-denom")
bondDenom := rapid.StringMatching(coinDenomRegex).Draw(rt, "bond-denom")
params := stakingtypes.Params{
BondDenom: bondDenom,
UnbondingTime: durationGenerator().Draw(rt, "duration"),