Skip to content

Commit 2d54a1d

Browse files
authored
fix: use a constant for badAddress in tx_test.go (#1533)
* use a constant * use a constant for badAddress
1 parent 89cca2d commit 2d54a1d

File tree

1 file changed

+4
-14
lines changed

1 file changed

+4
-14
lines changed

x/wasm/types/tx_test.go

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,12 @@ import (
1111
"github.com/stretchr/testify/require"
1212
)
1313

14-
const firstCodeID = 1
14+
const (
15+
firstCodeID = 1
16+
badAddress = "abcd"
17+
)
1518

1619
func TestStoreCodeValidation(t *testing.T) {
17-
badAddress := "abcd"
1820
// proper address size
1921
goodAddress := sdk.AccAddress(make([]byte, ContractAddrLen)).String()
2022
sdk.GetConfig().SetAddressVerifier(VerifyAddressLen())
@@ -76,7 +78,6 @@ func TestStoreCodeValidation(t *testing.T) {
7678
}
7779

7880
func TestInstantiateContractValidation(t *testing.T) {
79-
badAddress := "abcd"
8081
// proper address size
8182
goodAddress := sdk.AccAddress(make([]byte, 20)).String()
8283
sdk.GetConfig().SetAddressVerifier(VerifyAddressLen())
@@ -182,7 +183,6 @@ func TestInstantiateContractValidation(t *testing.T) {
182183
}
183184

184185
func TestInstantiateContract2Validation(t *testing.T) {
185-
badAddress := "abcd"
186186
// proper address size
187187
goodAddress := sdk.AccAddress(make([]byte, 20)).String()
188188
sdk.GetConfig().SetAddressVerifier(VerifyAddressLen())
@@ -316,7 +316,6 @@ func TestInstantiateContract2Validation(t *testing.T) {
316316
}
317317

318318
func TestExecuteContractValidation(t *testing.T) {
319-
badAddress := "abcd"
320319
// proper address size
321320
goodAddress := sdk.AccAddress(make([]byte, 20)).String()
322321

@@ -423,7 +422,6 @@ func TestExecuteContractValidation(t *testing.T) {
423422
}
424423

425424
func TestMsgUpdateAdministrator(t *testing.T) {
426-
badAddress := "abcd"
427425
// proper address size
428426
goodAddress := sdk.AccAddress(make([]byte, 20)).String()
429427
otherGoodAddress := sdk.AccAddress(bytes.Repeat([]byte{0x1}, 20)).String()
@@ -493,7 +491,6 @@ func TestMsgUpdateAdministrator(t *testing.T) {
493491
}
494492

495493
func TestMsgClearAdministrator(t *testing.T) {
496-
badAddress := "abcd"
497494
// proper address size
498495
goodAddress := sdk.AccAddress(make([]byte, 20)).String()
499496
anotherGoodAddress := sdk.AccAddress(bytes.Repeat([]byte{0x2}, 20)).String()
@@ -542,7 +539,6 @@ func TestMsgClearAdministrator(t *testing.T) {
542539
}
543540

544541
func TestMsgMigrateContract(t *testing.T) {
545-
badAddress := "abcd"
546542
// proper address size
547543
goodAddress := sdk.AccAddress(make([]byte, 20)).String()
548544
anotherGoodAddress := sdk.AccAddress(bytes.Repeat([]byte{0x2}, 20)).String()
@@ -666,7 +662,6 @@ func TestMsgJsonSignBytes(t *testing.T) {
666662
}
667663

668664
func TestMsgUpdateInstantiateConfig(t *testing.T) {
669-
badAddress := "abcd"
670665
// proper address size
671666
goodAddress := sdk.AccAddress(make([]byte, 20)).String()
672667
anotherGoodAddress := sdk.AccAddress(bytes.Repeat([]byte{0x2}, 20)).String()
@@ -726,7 +721,6 @@ func TestMsgUpdateInstantiateConfig(t *testing.T) {
726721
}
727722

728723
func TestMsgUpdateParamsValidation(t *testing.T) {
729-
badAddress := "abcd"
730724
// proper address size
731725
goodAddress := sdk.AccAddress(make([]byte, 20)).String()
732726

@@ -828,7 +822,6 @@ func TestMsgAddCodeUploadParamsAddressesValidation(t *testing.T) {
828822
}
829823

830824
func TestMsgRemoveCodeUploadParamsAddressesValidation(t *testing.T) {
831-
badAddress := "abcd"
832825
// proper address size
833826
goodAddress := sdk.AccAddress(make([]byte, 20)).String()
834827

@@ -889,7 +882,6 @@ func TestMsgRemoveCodeUploadParamsAddressesValidation(t *testing.T) {
889882
}
890883

891884
func TestMsgPinCodesValidation(t *testing.T) {
892-
badAddress := "abcd"
893885
// proper address size
894886
goodAddress := sdk.AccAddress(make([]byte, 20)).String()
895887

@@ -936,7 +928,6 @@ func TestMsgPinCodesValidation(t *testing.T) {
936928
}
937929

938930
func TestMsgUnpinCodesValidation(t *testing.T) {
939-
badAddress := "abcd"
940931
// proper address size
941932
goodAddress := sdk.AccAddress(make([]byte, 20)).String()
942933

@@ -1058,7 +1049,6 @@ func TestMsgSudoContractValidation(t *testing.T) {
10581049
}
10591050

10601051
func TestMsgStoreAndInstantiateContractValidation(t *testing.T) {
1061-
badAddress := "abcd"
10621052
// proper address size
10631053
goodAddress := sdk.AccAddress(make([]byte, 20)).String()
10641054
sdk.GetConfig().SetAddressVerifier(VerifyAddressLen())

0 commit comments

Comments
 (0)