Fixed failing test, formatted files

This commit is contained in:
Paul Berg 2018-12-07 17:08:40 +00:00
parent 6b30617820
commit d70a98d4b4
2 changed files with 7 additions and 7 deletions

View file

@ -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") {

View file

@ -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)
}
}