fix: use a constant for badAddress in tx_test.go (#1533)
* use a constant * use a constant for badAddress
This commit is contained in:
@@ -11,10 +11,12 @@ import (
|
|||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
)
|
)
|
||||||
|
|
||||||
const firstCodeID = 1
|
const (
|
||||||
|
firstCodeID = 1
|
||||||
|
badAddress = "abcd"
|
||||||
|
)
|
||||||
|
|
||||||
func TestStoreCodeValidation(t *testing.T) {
|
func TestStoreCodeValidation(t *testing.T) {
|
||||||
badAddress := "abcd"
|
|
||||||
// proper address size
|
// proper address size
|
||||||
goodAddress := sdk.AccAddress(make([]byte, ContractAddrLen)).String()
|
goodAddress := sdk.AccAddress(make([]byte, ContractAddrLen)).String()
|
||||||
sdk.GetConfig().SetAddressVerifier(VerifyAddressLen())
|
sdk.GetConfig().SetAddressVerifier(VerifyAddressLen())
|
||||||
@@ -76,7 +78,6 @@ func TestStoreCodeValidation(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestInstantiateContractValidation(t *testing.T) {
|
func TestInstantiateContractValidation(t *testing.T) {
|
||||||
badAddress := "abcd"
|
|
||||||
// proper address size
|
// proper address size
|
||||||
goodAddress := sdk.AccAddress(make([]byte, 20)).String()
|
goodAddress := sdk.AccAddress(make([]byte, 20)).String()
|
||||||
sdk.GetConfig().SetAddressVerifier(VerifyAddressLen())
|
sdk.GetConfig().SetAddressVerifier(VerifyAddressLen())
|
||||||
@@ -182,7 +183,6 @@ func TestInstantiateContractValidation(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestInstantiateContract2Validation(t *testing.T) {
|
func TestInstantiateContract2Validation(t *testing.T) {
|
||||||
badAddress := "abcd"
|
|
||||||
// proper address size
|
// proper address size
|
||||||
goodAddress := sdk.AccAddress(make([]byte, 20)).String()
|
goodAddress := sdk.AccAddress(make([]byte, 20)).String()
|
||||||
sdk.GetConfig().SetAddressVerifier(VerifyAddressLen())
|
sdk.GetConfig().SetAddressVerifier(VerifyAddressLen())
|
||||||
@@ -316,7 +316,6 @@ func TestInstantiateContract2Validation(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestExecuteContractValidation(t *testing.T) {
|
func TestExecuteContractValidation(t *testing.T) {
|
||||||
badAddress := "abcd"
|
|
||||||
// proper address size
|
// proper address size
|
||||||
goodAddress := sdk.AccAddress(make([]byte, 20)).String()
|
goodAddress := sdk.AccAddress(make([]byte, 20)).String()
|
||||||
|
|
||||||
@@ -423,7 +422,6 @@ func TestExecuteContractValidation(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestMsgUpdateAdministrator(t *testing.T) {
|
func TestMsgUpdateAdministrator(t *testing.T) {
|
||||||
badAddress := "abcd"
|
|
||||||
// proper address size
|
// proper address size
|
||||||
goodAddress := sdk.AccAddress(make([]byte, 20)).String()
|
goodAddress := sdk.AccAddress(make([]byte, 20)).String()
|
||||||
otherGoodAddress := sdk.AccAddress(bytes.Repeat([]byte{0x1}, 20)).String()
|
otherGoodAddress := sdk.AccAddress(bytes.Repeat([]byte{0x1}, 20)).String()
|
||||||
@@ -493,7 +491,6 @@ func TestMsgUpdateAdministrator(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestMsgClearAdministrator(t *testing.T) {
|
func TestMsgClearAdministrator(t *testing.T) {
|
||||||
badAddress := "abcd"
|
|
||||||
// proper address size
|
// proper address size
|
||||||
goodAddress := sdk.AccAddress(make([]byte, 20)).String()
|
goodAddress := sdk.AccAddress(make([]byte, 20)).String()
|
||||||
anotherGoodAddress := sdk.AccAddress(bytes.Repeat([]byte{0x2}, 20)).String()
|
anotherGoodAddress := sdk.AccAddress(bytes.Repeat([]byte{0x2}, 20)).String()
|
||||||
@@ -542,7 +539,6 @@ func TestMsgClearAdministrator(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestMsgMigrateContract(t *testing.T) {
|
func TestMsgMigrateContract(t *testing.T) {
|
||||||
badAddress := "abcd"
|
|
||||||
// proper address size
|
// proper address size
|
||||||
goodAddress := sdk.AccAddress(make([]byte, 20)).String()
|
goodAddress := sdk.AccAddress(make([]byte, 20)).String()
|
||||||
anotherGoodAddress := sdk.AccAddress(bytes.Repeat([]byte{0x2}, 20)).String()
|
anotherGoodAddress := sdk.AccAddress(bytes.Repeat([]byte{0x2}, 20)).String()
|
||||||
@@ -666,7 +662,6 @@ func TestMsgJsonSignBytes(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestMsgUpdateInstantiateConfig(t *testing.T) {
|
func TestMsgUpdateInstantiateConfig(t *testing.T) {
|
||||||
badAddress := "abcd"
|
|
||||||
// proper address size
|
// proper address size
|
||||||
goodAddress := sdk.AccAddress(make([]byte, 20)).String()
|
goodAddress := sdk.AccAddress(make([]byte, 20)).String()
|
||||||
anotherGoodAddress := sdk.AccAddress(bytes.Repeat([]byte{0x2}, 20)).String()
|
anotherGoodAddress := sdk.AccAddress(bytes.Repeat([]byte{0x2}, 20)).String()
|
||||||
@@ -726,7 +721,6 @@ func TestMsgUpdateInstantiateConfig(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestMsgUpdateParamsValidation(t *testing.T) {
|
func TestMsgUpdateParamsValidation(t *testing.T) {
|
||||||
badAddress := "abcd"
|
|
||||||
// proper address size
|
// proper address size
|
||||||
goodAddress := sdk.AccAddress(make([]byte, 20)).String()
|
goodAddress := sdk.AccAddress(make([]byte, 20)).String()
|
||||||
|
|
||||||
@@ -828,7 +822,6 @@ func TestMsgAddCodeUploadParamsAddressesValidation(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestMsgRemoveCodeUploadParamsAddressesValidation(t *testing.T) {
|
func TestMsgRemoveCodeUploadParamsAddressesValidation(t *testing.T) {
|
||||||
badAddress := "abcd"
|
|
||||||
// proper address size
|
// proper address size
|
||||||
goodAddress := sdk.AccAddress(make([]byte, 20)).String()
|
goodAddress := sdk.AccAddress(make([]byte, 20)).String()
|
||||||
|
|
||||||
@@ -889,7 +882,6 @@ func TestMsgRemoveCodeUploadParamsAddressesValidation(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestMsgPinCodesValidation(t *testing.T) {
|
func TestMsgPinCodesValidation(t *testing.T) {
|
||||||
badAddress := "abcd"
|
|
||||||
// proper address size
|
// proper address size
|
||||||
goodAddress := sdk.AccAddress(make([]byte, 20)).String()
|
goodAddress := sdk.AccAddress(make([]byte, 20)).String()
|
||||||
|
|
||||||
@@ -936,7 +928,6 @@ func TestMsgPinCodesValidation(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestMsgUnpinCodesValidation(t *testing.T) {
|
func TestMsgUnpinCodesValidation(t *testing.T) {
|
||||||
badAddress := "abcd"
|
|
||||||
// proper address size
|
// proper address size
|
||||||
goodAddress := sdk.AccAddress(make([]byte, 20)).String()
|
goodAddress := sdk.AccAddress(make([]byte, 20)).String()
|
||||||
|
|
||||||
@@ -1058,7 +1049,6 @@ func TestMsgSudoContractValidation(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestMsgStoreAndInstantiateContractValidation(t *testing.T) {
|
func TestMsgStoreAndInstantiateContractValidation(t *testing.T) {
|
||||||
badAddress := "abcd"
|
|
||||||
// proper address size
|
// proper address size
|
||||||
goodAddress := sdk.AccAddress(make([]byte, 20)).String()
|
goodAddress := sdk.AccAddress(make([]byte, 20)).String()
|
||||||
sdk.GetConfig().SetAddressVerifier(VerifyAddressLen())
|
sdk.GetConfig().SetAddressVerifier(VerifyAddressLen())
|
||||||
|
|||||||
Reference in New Issue
Block a user