stargate: migrate types (#670)

* changelog v0.4.0

* stargate: types changes

* msg and handler changes

* validation

* fixes

* more fixes

* more test fixes

* changelog

* changelog

* lint

* rm comment

* lint

* redundant if condition
This commit is contained in:
Federico Kunze
2021-01-06 17:56:40 -03:00
committed by GitHub
parent 64ada18b01
commit 9cbb4dcf6d
33 changed files with 540 additions and 586 deletions
+55
View File
@@ -0,0 +1,55 @@
package types
import (
"testing"
"github.com/stretchr/testify/require"
ethcmn "github.com/ethereum/go-ethereum/common"
)
func TestIsEmptyHash(t *testing.T) {
testCases := []struct {
name string
hash string
expEmpty bool
}{
{
"empty string", "", true,
},
{
"zero hash", ethcmn.Hash{}.String(), true,
},
{
"non-empty hash", ethcmn.BytesToHash([]byte{1, 2, 3, 4}).String(), false,
},
}
for _, tc := range testCases {
require.Equal(t, tc.expEmpty, IsEmptyHash(tc.hash), tc.name)
}
}
func TestIsZeroAddress(t *testing.T) {
testCases := []struct {
name string
address string
expEmpty bool
}{
{
"empty string", "", true,
},
{
"zero address", ethcmn.Address{}.String(), true,
},
{
"non-empty address", ethcmn.BytesToAddress([]byte{1, 2, 3, 4}).String(), false,
},
}
for _, tc := range testCases {
require.Equal(t, tc.expEmpty, IsZeroAddress(tc.address), tc.name)
}
}