forked from cerc-io/laconicd-deprecated
Refactor EIP-712 signature verification (#1397)
* [WIP] EIP-712 Signature Refactor * Debug and add ante tests * Add tests for failure cases * Add changelog entry * Code cleanup * Add tests for MsgDelegate and MsgWithdrawDelegationReward * Update ethereum/eip712/encoding.go Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com> * Update ethereum/eip712/encoding.go Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com> * Update ethereum/eip712/encoding.go Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com> * Update ethereum/eip712/encoding.go Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com> * Update ethereum/eip712/encoding.go Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com> * Update ethereum/eip712/encoding.go Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com> * Code cleanup * Update ethereum/eip712/encoding.go Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com> * Minor codefix * Update ethereum/eip712/encoding.go * Minor code revision updates * Refactor EIP712 unit tests to use test suite * Address import cycle and implement minor refactors * Fix lint issues * Add EIP712 unit suite test function * Update ethereum/eip712/encoding.go Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com> * Update ethereum/eip712/encoding.go Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com> * Update ethereum/eip712/encoding.go Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com> * Add minor refactors; increase test coverage * Correct ante_test for change in payload * Add single-signer util and tests * Update ethereum/eip712/encoding.go * Update ethereum/eip712/encoding.go * fix build Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com> Co-authored-by: Freddy Caceres <facs95@gmail.com>
This commit is contained in:
co-authored by
Federico Kunze Küllmer
Freddy Caceres
parent
41425fc6d4
commit
cb632c6bef
@@ -1,10 +1,11 @@
|
||||
package types
|
||||
package types_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/evmos/ethermint/tests"
|
||||
"github.com/evmos/ethermint/types"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
@@ -27,7 +28,7 @@ func TestIsEmptyHash(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
require.Equal(t, tc.expEmpty, IsEmptyHash(tc.hash), tc.name)
|
||||
require.Equal(t, tc.expEmpty, types.IsEmptyHash(tc.hash), tc.name)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,7 +51,7 @@ func TestIsZeroAddress(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
require.Equal(t, tc.expEmpty, IsZeroAddress(tc.address), tc.name)
|
||||
require.Equal(t, tc.expEmpty, types.IsZeroAddress(tc.address), tc.name)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -75,7 +76,7 @@ func TestValidateAddress(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
err := ValidateAddress(tc.address)
|
||||
err := types.ValidateAddress(tc.address)
|
||||
|
||||
if tc.expError {
|
||||
require.Error(t, err, tc.name)
|
||||
@@ -106,7 +107,7 @@ func TestValidateNonZeroAddress(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
err := ValidateNonZeroAddress(tc.address)
|
||||
err := types.ValidateNonZeroAddress(tc.address)
|
||||
|
||||
if tc.expError {
|
||||
require.Error(t, err, tc.name)
|
||||
@@ -131,7 +132,7 @@ func TestSafeInt64(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
value, err := SafeInt64(tc.value)
|
||||
value, err := types.SafeInt64(tc.value)
|
||||
if tc.expError {
|
||||
require.Error(t, err, tc.name)
|
||||
continue
|
||||
|
||||
Reference in New Issue
Block a user