Skip to content

Commit

Permalink
fix: use a constant for badAddress in tx_test.go (#1533)
Browse files Browse the repository at this point in the history
* use a constant

* use a constant for badAddress
  • Loading branch information
faddat authored Jul 24, 2023
1 parent 89cca2d commit 2d54a1d
Showing 1 changed file with 4 additions and 14 deletions.
18 changes: 4 additions & 14 deletions x/wasm/types/tx_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@ import (
"github.com/stretchr/testify/require"
)

const firstCodeID = 1
const (
firstCodeID = 1
badAddress = "abcd"
)

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

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

func TestInstantiateContract2Validation(t *testing.T) {
badAddress := "abcd"
// proper address size
goodAddress := sdk.AccAddress(make([]byte, 20)).String()
sdk.GetConfig().SetAddressVerifier(VerifyAddressLen())
Expand Down Expand Up @@ -316,7 +316,6 @@ func TestInstantiateContract2Validation(t *testing.T) {
}

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

Expand Down Expand Up @@ -423,7 +422,6 @@ func TestExecuteContractValidation(t *testing.T) {
}

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

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

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

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

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

Expand Down Expand Up @@ -828,7 +822,6 @@ func TestMsgAddCodeUploadParamsAddressesValidation(t *testing.T) {
}

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

Expand Down Expand Up @@ -889,7 +882,6 @@ func TestMsgRemoveCodeUploadParamsAddressesValidation(t *testing.T) {
}

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

Expand Down Expand Up @@ -936,7 +928,6 @@ func TestMsgPinCodesValidation(t *testing.T) {
}

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

Expand Down Expand Up @@ -1058,7 +1049,6 @@ func TestMsgSudoContractValidation(t *testing.T) {
}

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

0 comments on commit 2d54a1d

Please sign in to comment.