From a623d751a804ee37cc9ea9ec31bde08387657a1f Mon Sep 17 00:00:00 2001 From: Paul Berg Date: Fri, 7 Dec 2018 17:08:40 +0000 Subject: [PATCH] Fixed failing test, formatted files --- signer/core/signed_data.go | 8 ++++---- signer/core/signed_data_test.go | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/signer/core/signed_data.go b/signer/core/signed_data.go index ff0ad157d9..8e7e97ea73 100644 --- a/signer/core/signed_data.go +++ b/signer/core/signed_data.go @@ -21,16 +21,16 @@ import ( "context" "errors" "fmt" - "github.com/ethereum/go-ethereum/common/math" "math/big" "mime" - "reflect" "regexp" "sort" "strconv" "strings" "unicode" + "github.com/ethereum/go-ethereum/common/math" + "github.com/ethereum/go-ethereum/accounts" "github.com/ethereum/go-ethereum/accounts/abi" "github.com/ethereum/go-ethereum/common" @@ -508,10 +508,10 @@ func (typedData *TypedData) EncodePrimitiveValue(encType string, encValue interf if size < 0 || size > 32 { return nil, fmt.Errorf("invalid size on bytes: %d", size) } - if byteval, ok := encValue.(hexutil.Bytes); !ok { + if byteValue, ok := encValue.(hexutil.Bytes); !ok { return nil, dataMismatchError(encType, encValue) } else { - return math.PaddedBigBytes(new(big.Int).SetBytes(byteval), 32), nil + return math.PaddedBigBytes(new(big.Int).SetBytes(byteValue), 32), nil } } if strings.HasPrefix(encType, "uint") || strings.HasPrefix(encType, "int") { diff --git a/signer/core/signed_data_test.go b/signer/core/signed_data_test.go index 48e5b06e1d..b424f05f0b 100644 --- a/signer/core/signed_data_test.go +++ b/signer/core/signed_data_test.go @@ -683,7 +683,7 @@ func TestMalformedData5(t *testing.T) { }, "primaryType": "Mail", "domain": { - "name": "Ether Mail", + "name": "Ether Mail", "version": "1", "chainId": 1, "verifyingContract": "0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC" @@ -709,7 +709,7 @@ func TestMalformedData5(t *testing.T) { t.Fatalf("Expected no error, got %v", err) } _, err = malformedTypedData.HashStruct("EIP712Domain", malformedTypedData.Domain.Map()) - if err == nil { - t.Errorf("Expected an error, got %v", err) + if err != nil { + t.Errorf("Expected no error, got %v", err) } }