From e6bca1701460d7729c3d41791b265eaa44573814 Mon Sep 17 00:00:00 2001 From: Paul Berg Date: Wed, 24 Oct 2018 03:16:35 +0100 Subject: [PATCH] Temporarily switched to using common.Address in tests --- signer/core/signed_data.go | 10 +++++----- signer/core/signed_data_test.go | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/signer/core/signed_data.go b/signer/core/signed_data.go index 2b74cb62ec..9795a8d3c6 100644 --- a/signer/core/signed_data.go +++ b/signer/core/signed_data.go @@ -61,7 +61,7 @@ type EIP712Domain struct { Name string `json:"name"` Version string `json:"version"` ChainId *big.Int `json:"chainId"` - VerifyingContract string `json:"verifyingContract"` + VerifyingContract common.Address `json:"verifyingContract"` Salt hexutil.Bytes `json:"salt"` } @@ -358,14 +358,14 @@ func (typedData *TypedData) EncodeData(primaryType string, data map[string]inter switch encType { case "address": - primitiveEncType = "address" + primitiveEncType = "uint160" bytesValue := []byte{} for i := 0; i < 12; i++ { bytesValue = append(bytesValue, 0) } - foo := common.BytesToAddress([]byte(encValue.(string))) - fmt.Println(foo) - for _, _byte := range common.BytesToAddress([]byte(encValue.(string))) { + //foo := common.BytesToAddress([]byte(encValue.(string))) + //fmt.Println(foo) + for _, _byte := range encValue.(common.Address) { bytesValue = append(bytesValue, _byte) } primitiveEncValue = bytesValue diff --git a/signer/core/signed_data_test.go b/signer/core/signed_data_test.go index 80e59872b1..1f2f0ce17a 100644 --- a/signer/core/signed_data_test.go +++ b/signer/core/signed_data_test.go @@ -76,18 +76,18 @@ var domainStandard = EIP712Domain{ "Ether Mail", "1", big.NewInt(1), - "0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC", + common.HexToAddress("0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC"), nil, } var dataStandard = map[string]interface{}{ "from": map[string]interface{}{ "name": "Cow", - "wallet": "0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826", + "wallet": common.HexToAddress("0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826"), }, "to": map[string]interface{}{ "name": "Bob", - "wallet": "0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB", + "wallet": common.HexToAddress("0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB"), }, "contents": "Hello, Bob!", }