Fixed failing test, formatted files

This commit is contained in:
Paul Berg 2018-12-07 17:08:40 +00:00 committed by Martin Holst Swende
parent 2f33a65abd
commit a623d751a8
No known key found for this signature in database
GPG key ID: 683B438C05A5DDF0
2 changed files with 7 additions and 7 deletions

View file

@ -21,16 +21,16 @@ import (
"context" "context"
"errors" "errors"
"fmt" "fmt"
"github.com/ethereum/go-ethereum/common/math"
"math/big" "math/big"
"mime" "mime"
"reflect"
"regexp" "regexp"
"sort" "sort"
"strconv" "strconv"
"strings" "strings"
"unicode" "unicode"
"github.com/ethereum/go-ethereum/common/math"
"github.com/ethereum/go-ethereum/accounts" "github.com/ethereum/go-ethereum/accounts"
"github.com/ethereum/go-ethereum/accounts/abi" "github.com/ethereum/go-ethereum/accounts/abi"
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"
@ -508,10 +508,10 @@ func (typedData *TypedData) EncodePrimitiveValue(encType string, encValue interf
if size < 0 || size > 32 { if size < 0 || size > 32 {
return nil, fmt.Errorf("invalid size on bytes: %d", size) 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) return nil, dataMismatchError(encType, encValue)
} else { } 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") { if strings.HasPrefix(encType, "uint") || strings.HasPrefix(encType, "int") {

View file

@ -709,7 +709,7 @@ func TestMalformedData5(t *testing.T) {
t.Fatalf("Expected no error, got %v", err) t.Fatalf("Expected no error, got %v", err)
} }
_, err = malformedTypedData.HashStruct("EIP712Domain", malformedTypedData.Domain.Map()) _, err = malformedTypedData.HashStruct("EIP712Domain", malformedTypedData.Domain.Map())
if err == nil { if err != nil {
t.Errorf("Expected an error, got %v", err) t.Errorf("Expected no error, got %v", err)
} }
} }