Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
Geth-Modification
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张蕾
Geth-Modification
Commits
619a3e70
Unverified
Commit
619a3e70
authored
Dec 05, 2021
by
Martin Holst Swende
Committed by
GitHub
Dec 05, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
signer/core: move EIP-712 types to package apitypes (#24029)
Fixes #23972
parent
93f196c4
Changes
9
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
776 additions
and
771 deletions
+776
-771
main.go
cmd/clef/main.go
+2
-2
api.go
signer/core/api.go
+2
-2
signed_data_internal_test.go
signer/core/apitypes/signed_data_internal_test.go
+1
-1
types.go
signer/core/apitypes/types.go
+718
-0
auditlog.go
signer/core/auditlog.go
+1
-1
gnosis_safe.go
signer/core/gnosis_safe.go
+7
-7
signed_data.go
signer/core/signed_data.go
+19
-733
signed_data_test.go
signer/core/signed_data_test.go
+25
-24
rules_test.go
signer/rules/rules_test.go
+1
-1
No files found.
cmd/clef/main.go
View file @
619a3e70
...
@@ -898,7 +898,7 @@ func testExternalUI(api *core.SignerAPI) {
...
@@ -898,7 +898,7 @@ func testExternalUI(api *core.SignerAPI) {
addr
,
_
:=
common
.
NewMixedcaseAddressFromString
(
"0x0011223344556677889900112233445566778899"
)
addr
,
_
:=
common
.
NewMixedcaseAddressFromString
(
"0x0011223344556677889900112233445566778899"
)
data
:=
`{"types":{"EIP712Domain":[{"name":"name","type":"string"},{"name":"version","type":"string"},{"name":"chainId","type":"uint256"},{"name":"verifyingContract","type":"address"}],"Person":[{"name":"name","type":"string"},{"name":"test","type":"uint8"},{"name":"wallet","type":"address"}],"Mail":[{"name":"from","type":"Person"},{"name":"to","type":"Person"},{"name":"contents","type":"string"}]},"primaryType":"Mail","domain":{"name":"Ether Mail","version":"1","chainId":"1","verifyingContract":"0xCCCcccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC"},"message":{"from":{"name":"Cow","test":"3","wallet":"0xcD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826"},"to":{"name":"Bob","wallet":"0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB","test":"2"},"contents":"Hello, Bob!"}}`
data
:=
`{"types":{"EIP712Domain":[{"name":"name","type":"string"},{"name":"version","type":"string"},{"name":"chainId","type":"uint256"},{"name":"verifyingContract","type":"address"}],"Person":[{"name":"name","type":"string"},{"name":"test","type":"uint8"},{"name":"wallet","type":"address"}],"Mail":[{"name":"from","type":"Person"},{"name":"to","type":"Person"},{"name":"contents","type":"string"}]},"primaryType":"Mail","domain":{"name":"Ether Mail","version":"1","chainId":"1","verifyingContract":"0xCCCcccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC"},"message":{"from":{"name":"Cow","test":"3","wallet":"0xcD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826"},"to":{"name":"Bob","wallet":"0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB","test":"2"},"contents":"Hello, Bob!"}}`
//_, err := api.SignData(ctx, accounts.MimetypeTypedData, *addr, hexutil.Encode([]byte(data)))
//_, err := api.SignData(ctx, accounts.MimetypeTypedData, *addr, hexutil.Encode([]byte(data)))
var
typedData
core
.
TypedData
var
typedData
apitypes
.
TypedData
json
.
Unmarshal
([]
byte
(
data
),
&
typedData
)
json
.
Unmarshal
([]
byte
(
data
),
&
typedData
)
_
,
err
:=
api
.
SignTypedData
(
ctx
,
*
addr
,
typedData
)
_
,
err
:=
api
.
SignTypedData
(
ctx
,
*
addr
,
typedData
)
expectApprove
(
"sign 712 typed data"
,
err
)
expectApprove
(
"sign 712 typed data"
,
err
)
...
@@ -1025,7 +1025,7 @@ func GenDoc(ctx *cli.Context) {
...
@@ -1025,7 +1025,7 @@ func GenDoc(ctx *cli.Context) {
"of the work in canonicalizing and making sense of the data, and it's up to the UI to present"
+
"of the work in canonicalizing and making sense of the data, and it's up to the UI to present"
+
"the user with the contents of the `message`"
"the user with the contents of the `message`"
sighash
,
msg
:=
accounts
.
TextAndHash
([]
byte
(
"hello world"
))
sighash
,
msg
:=
accounts
.
TextAndHash
([]
byte
(
"hello world"
))
messages
:=
[]
*
core
.
NameValueType
{{
Name
:
"message"
,
Value
:
msg
,
Typ
:
accounts
.
MimetypeTextPlain
}}
messages
:=
[]
*
apitypes
.
NameValueType
{{
Name
:
"message"
,
Value
:
msg
,
Typ
:
accounts
.
MimetypeTextPlain
}}
add
(
"SignDataRequest"
,
desc
,
&
core
.
SignDataRequest
{
add
(
"SignDataRequest"
,
desc
,
&
core
.
SignDataRequest
{
Address
:
common
.
NewMixedcaseAddress
(
a
),
Address
:
common
.
NewMixedcaseAddress
(
a
),
...
...
signer/core/api.go
View file @
619a3e70
...
@@ -57,7 +57,7 @@ type ExternalAPI interface {
...
@@ -57,7 +57,7 @@ type ExternalAPI interface {
// SignData - request to sign the given data (plus prefix)
// SignData - request to sign the given data (plus prefix)
SignData
(
ctx
context
.
Context
,
contentType
string
,
addr
common
.
MixedcaseAddress
,
data
interface
{})
(
hexutil
.
Bytes
,
error
)
SignData
(
ctx
context
.
Context
,
contentType
string
,
addr
common
.
MixedcaseAddress
,
data
interface
{})
(
hexutil
.
Bytes
,
error
)
// SignTypedData - request to sign the given structured data (plus prefix)
// SignTypedData - request to sign the given structured data (plus prefix)
SignTypedData
(
ctx
context
.
Context
,
addr
common
.
MixedcaseAddress
,
data
TypedData
)
(
hexutil
.
Bytes
,
error
)
SignTypedData
(
ctx
context
.
Context
,
addr
common
.
MixedcaseAddress
,
data
apitypes
.
TypedData
)
(
hexutil
.
Bytes
,
error
)
// EcRecover - recover public key from given message and signature
// EcRecover - recover public key from given message and signature
EcRecover
(
ctx
context
.
Context
,
data
hexutil
.
Bytes
,
sig
hexutil
.
Bytes
)
(
common
.
Address
,
error
)
EcRecover
(
ctx
context
.
Context
,
data
hexutil
.
Bytes
,
sig
hexutil
.
Bytes
)
(
common
.
Address
,
error
)
// Version info about the APIs
// Version info about the APIs
...
@@ -235,7 +235,7 @@ type (
...
@@ -235,7 +235,7 @@ type (
ContentType
string
`json:"content_type"`
ContentType
string
`json:"content_type"`
Address
common
.
MixedcaseAddress
`json:"address"`
Address
common
.
MixedcaseAddress
`json:"address"`
Rawdata
[]
byte
`json:"raw_data"`
Rawdata
[]
byte
`json:"raw_data"`
Messages
[]
*
NameValueType
`json:"messages"`
Messages
[]
*
apitypes
.
NameValueType
`json:"messages"`
Callinfo
[]
apitypes
.
ValidationInfo
`json:"call_info"`
Callinfo
[]
apitypes
.
ValidationInfo
`json:"call_info"`
Hash
hexutil
.
Bytes
`json:"hash"`
Hash
hexutil
.
Bytes
`json:"hash"`
Meta
Metadata
`json:"meta"`
Meta
Metadata
`json:"meta"`
...
...
signer/core/signed_data_internal_test.go
→
signer/core/
apitypes/
signed_data_internal_test.go
View file @
619a3e70
...
@@ -14,7 +14,7 @@
...
@@ -14,7 +14,7 @@
// You should have received a copy of the GNU Lesser General Public License
// You should have received a copy of the GNU Lesser General Public License
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
package
core
package
apitypes
import
(
import
(
"bytes"
"bytes"
...
...
signer/core/apitypes/types.go
View file @
619a3e70
This diff is collapsed.
Click to expand it.
signer/core/auditlog.go
View file @
619a3e70
...
@@ -89,7 +89,7 @@ func (l *AuditLogger) SignGnosisSafeTx(ctx context.Context, addr common.Mixedcas
...
@@ -89,7 +89,7 @@ func (l *AuditLogger) SignGnosisSafeTx(ctx context.Context, addr common.Mixedcas
return
res
,
e
return
res
,
e
}
}
func
(
l
*
AuditLogger
)
SignTypedData
(
ctx
context
.
Context
,
addr
common
.
MixedcaseAddress
,
data
TypedData
)
(
hexutil
.
Bytes
,
error
)
{
func
(
l
*
AuditLogger
)
SignTypedData
(
ctx
context
.
Context
,
addr
common
.
MixedcaseAddress
,
data
apitypes
.
TypedData
)
(
hexutil
.
Bytes
,
error
)
{
l
.
log
.
Info
(
"SignTypedData"
,
"type"
,
"request"
,
"metadata"
,
MetadataFromContext
(
ctx
)
.
String
(),
l
.
log
.
Info
(
"SignTypedData"
,
"type"
,
"request"
,
"metadata"
,
MetadataFromContext
(
ctx
)
.
String
(),
"addr"
,
addr
.
String
(),
"data"
,
data
)
"addr"
,
addr
.
String
(),
"data"
,
data
)
b
,
e
:=
l
.
api
.
SignTypedData
(
ctx
,
addr
,
data
)
b
,
e
:=
l
.
api
.
SignTypedData
(
ctx
,
addr
,
data
)
...
...
signer/core/gnosis_safe.go
View file @
619a3e70
...
@@ -34,15 +34,15 @@ type GnosisSafeTx struct {
...
@@ -34,15 +34,15 @@ type GnosisSafeTx struct {
}
}
// ToTypedData converts the tx to a EIP-712 Typed Data structure for signing
// ToTypedData converts the tx to a EIP-712 Typed Data structure for signing
func
(
tx
*
GnosisSafeTx
)
ToTypedData
()
TypedData
{
func
(
tx
*
GnosisSafeTx
)
ToTypedData
()
apitypes
.
TypedData
{
var
data
hexutil
.
Bytes
var
data
hexutil
.
Bytes
if
tx
.
Data
!=
nil
{
if
tx
.
Data
!=
nil
{
data
=
*
tx
.
Data
data
=
*
tx
.
Data
}
}
gnosisTypedData
:=
TypedData
{
gnosisTypedData
:=
apitypes
.
TypedData
{
Types
:
Types
{
Types
:
apitypes
.
Types
{
"EIP712Domain"
:
[]
Type
{{
Name
:
"verifyingContract"
,
Type
:
"address"
}},
"EIP712Domain"
:
[]
apitypes
.
Type
{{
Name
:
"verifyingContract"
,
Type
:
"address"
}},
"SafeTx"
:
[]
Type
{
"SafeTx"
:
[]
apitypes
.
Type
{
{
Name
:
"to"
,
Type
:
"address"
},
{
Name
:
"to"
,
Type
:
"address"
},
{
Name
:
"value"
,
Type
:
"uint256"
},
{
Name
:
"value"
,
Type
:
"uint256"
},
{
Name
:
"data"
,
Type
:
"bytes"
},
{
Name
:
"data"
,
Type
:
"bytes"
},
...
@@ -55,11 +55,11 @@ func (tx *GnosisSafeTx) ToTypedData() TypedData {
...
@@ -55,11 +55,11 @@ func (tx *GnosisSafeTx) ToTypedData() TypedData {
{
Name
:
"nonce"
,
Type
:
"uint256"
},
{
Name
:
"nonce"
,
Type
:
"uint256"
},
},
},
},
},
Domain
:
TypedDataDomain
{
Domain
:
apitypes
.
TypedDataDomain
{
VerifyingContract
:
tx
.
Safe
.
Address
()
.
Hex
(),
VerifyingContract
:
tx
.
Safe
.
Address
()
.
Hex
(),
},
},
PrimaryType
:
"SafeTx"
,
PrimaryType
:
"SafeTx"
,
Message
:
TypedDataMessage
{
Message
:
apitypes
.
TypedDataMessage
{
"to"
:
tx
.
To
.
Address
()
.
Hex
(),
"to"
:
tx
.
To
.
Address
()
.
Hex
(),
"value"
:
tx
.
Value
.
String
(),
"value"
:
tx
.
Value
.
String
(),
"data"
:
data
,
"data"
:
data
,
...
...
signer/core/signed_data.go
View file @
619a3e70
This diff is collapsed.
Click to expand it.
signer/core/signed_data_test.go
View file @
619a3e70
...
@@ -32,9 +32,10 @@ import (
...
@@ -32,9 +32,10 @@ import (
"github.com/ethereum/go-ethereum/common/math"
"github.com/ethereum/go-ethereum/common/math"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/signer/core"
"github.com/ethereum/go-ethereum/signer/core"
"github.com/ethereum/go-ethereum/signer/core/apitypes"
)
)
var
typesStandard
=
core
.
Types
{
var
typesStandard
=
apitypes
.
Types
{
"EIP712Domain"
:
{
"EIP712Domain"
:
{
{
{
Name
:
"name"
,
Name
:
"name"
,
...
@@ -153,12 +154,12 @@ var jsonTypedData = `
...
@@ -153,12 +154,12 @@ var jsonTypedData = `
const
primaryType
=
"Mail"
const
primaryType
=
"Mail"
var
domainStandard
=
core
.
TypedDataDomain
{
var
domainStandard
=
apitypes
.
TypedDataDomain
{
"Ether Mail"
,
Name
:
"Ether Mail"
,
"1"
,
Version
:
"1"
,
math
.
NewHexOrDecimal256
(
1
),
ChainId
:
math
.
NewHexOrDecimal256
(
1
),
"0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC"
,
VerifyingContract
:
"0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC"
,
""
,
Salt
:
""
,
}
}
var
messageStandard
=
map
[
string
]
interface
{}{
var
messageStandard
=
map
[
string
]
interface
{}{
...
@@ -173,7 +174,7 @@ var messageStandard = map[string]interface{}{
...
@@ -173,7 +174,7 @@ var messageStandard = map[string]interface{}{
"contents"
:
"Hello, Bob!"
,
"contents"
:
"Hello, Bob!"
,
}
}
var
typedData
=
core
.
TypedData
{
var
typedData
=
apitypes
.
TypedData
{
Types
:
typesStandard
,
Types
:
typesStandard
,
PrimaryType
:
primaryType
,
PrimaryType
:
primaryType
,
Domain
:
domainStandard
,
Domain
:
domainStandard
,
...
@@ -194,7 +195,7 @@ func TestSignData(t *testing.T) {
...
@@ -194,7 +195,7 @@ func TestSignData(t *testing.T) {
control
.
approveCh
<-
"Y"
control
.
approveCh
<-
"Y"
control
.
inputCh
<-
"wrongpassword"
control
.
inputCh
<-
"wrongpassword"
signature
,
err
:=
api
.
SignData
(
context
.
Background
(),
core
.
TextPlain
.
Mime
,
a
,
hexutil
.
Encode
([]
byte
(
"EHLO world"
)))
signature
,
err
:=
api
.
SignData
(
context
.
Background
(),
apitypes
.
TextPlain
.
Mime
,
a
,
hexutil
.
Encode
([]
byte
(
"EHLO world"
)))
if
signature
!=
nil
{
if
signature
!=
nil
{
t
.
Errorf
(
"Expected nil-data, got %x"
,
signature
)
t
.
Errorf
(
"Expected nil-data, got %x"
,
signature
)
}
}
...
@@ -202,7 +203,7 @@ func TestSignData(t *testing.T) {
...
@@ -202,7 +203,7 @@ func TestSignData(t *testing.T) {
t
.
Errorf
(
"Expected ErrLocked! '%v'"
,
err
)
t
.
Errorf
(
"Expected ErrLocked! '%v'"
,
err
)
}
}
control
.
approveCh
<-
"No way"
control
.
approveCh
<-
"No way"
signature
,
err
=
api
.
SignData
(
context
.
Background
(),
core
.
TextPlain
.
Mime
,
a
,
hexutil
.
Encode
([]
byte
(
"EHLO world"
)))
signature
,
err
=
api
.
SignData
(
context
.
Background
(),
apitypes
.
TextPlain
.
Mime
,
a
,
hexutil
.
Encode
([]
byte
(
"EHLO world"
)))
if
signature
!=
nil
{
if
signature
!=
nil
{
t
.
Errorf
(
"Expected nil-data, got %x"
,
signature
)
t
.
Errorf
(
"Expected nil-data, got %x"
,
signature
)
}
}
...
@@ -212,7 +213,7 @@ func TestSignData(t *testing.T) {
...
@@ -212,7 +213,7 @@ func TestSignData(t *testing.T) {
// text/plain
// text/plain
control
.
approveCh
<-
"Y"
control
.
approveCh
<-
"Y"
control
.
inputCh
<-
"a_long_password"
control
.
inputCh
<-
"a_long_password"
signature
,
err
=
api
.
SignData
(
context
.
Background
(),
core
.
TextPlain
.
Mime
,
a
,
hexutil
.
Encode
([]
byte
(
"EHLO world"
)))
signature
,
err
=
api
.
SignData
(
context
.
Background
(),
apitypes
.
TextPlain
.
Mime
,
a
,
hexutil
.
Encode
([]
byte
(
"EHLO world"
)))
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Fatal
(
err
)
t
.
Fatal
(
err
)
}
}
...
@@ -232,13 +233,13 @@ func TestSignData(t *testing.T) {
...
@@ -232,13 +233,13 @@ func TestSignData(t *testing.T) {
}
}
func
TestDomainChainId
(
t
*
testing
.
T
)
{
func
TestDomainChainId
(
t
*
testing
.
T
)
{
withoutChainID
:=
core
.
TypedData
{
withoutChainID
:=
apitypes
.
TypedData
{
Types
:
core
.
Types
{
Types
:
apitypes
.
Types
{
"EIP712Domain"
:
[]
core
.
Type
{
"EIP712Domain"
:
[]
apitypes
.
Type
{
{
Name
:
"name"
,
Type
:
"string"
},
{
Name
:
"name"
,
Type
:
"string"
},
},
},
},
},
Domain
:
core
.
TypedDataDomain
{
Domain
:
apitypes
.
TypedDataDomain
{
Name
:
"test"
,
Name
:
"test"
,
},
},
}
}
...
@@ -250,14 +251,14 @@ func TestDomainChainId(t *testing.T) {
...
@@ -250,14 +251,14 @@ func TestDomainChainId(t *testing.T) {
if
_
,
err
:=
withoutChainID
.
HashStruct
(
"EIP712Domain"
,
withoutChainID
.
Domain
.
Map
());
err
!=
nil
{
if
_
,
err
:=
withoutChainID
.
HashStruct
(
"EIP712Domain"
,
withoutChainID
.
Domain
.
Map
());
err
!=
nil
{
t
.
Errorf
(
"Expected the typedData to encode the domain successfully, got %v"
,
err
)
t
.
Errorf
(
"Expected the typedData to encode the domain successfully, got %v"
,
err
)
}
}
withChainID
:=
core
.
TypedData
{
withChainID
:=
apitypes
.
TypedData
{
Types
:
core
.
Types
{
Types
:
apitypes
.
Types
{
"EIP712Domain"
:
[]
core
.
Type
{
"EIP712Domain"
:
[]
apitypes
.
Type
{
{
Name
:
"name"
,
Type
:
"string"
},
{
Name
:
"name"
,
Type
:
"string"
},
{
Name
:
"chainId"
,
Type
:
"uint256"
},
{
Name
:
"chainId"
,
Type
:
"uint256"
},
},
},
},
},
Domain
:
core
.
TypedDataDomain
{
Domain
:
apitypes
.
TypedDataDomain
{
Name
:
"test"
,
Name
:
"test"
,
ChainId
:
math
.
NewHexOrDecimal256
(
1
),
ChainId
:
math
.
NewHexOrDecimal256
(
1
),
},
},
...
@@ -323,7 +324,7 @@ func TestEncodeData(t *testing.T) {
...
@@ -323,7 +324,7 @@ func TestEncodeData(t *testing.T) {
}
}
func
TestFormatter
(
t
*
testing
.
T
)
{
func
TestFormatter
(
t
*
testing
.
T
)
{
var
d
core
.
TypedData
var
d
apitypes
.
TypedData
err
:=
json
.
Unmarshal
([]
byte
(
jsonTypedData
),
&
d
)
err
:=
json
.
Unmarshal
([]
byte
(
jsonTypedData
),
&
d
)
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Fatalf
(
"unmarshalling failed '%v'"
,
err
)
t
.
Fatalf
(
"unmarshalling failed '%v'"
,
err
)
...
@@ -337,7 +338,7 @@ func TestFormatter(t *testing.T) {
...
@@ -337,7 +338,7 @@ func TestFormatter(t *testing.T) {
t
.
Logf
(
"'%v'
\n
"
,
string
(
j
))
t
.
Logf
(
"'%v'
\n
"
,
string
(
j
))
}
}
func
sign
(
typedData
core
.
TypedData
)
([]
byte
,
[]
byte
,
error
)
{
func
sign
(
typedData
apitypes
.
TypedData
)
([]
byte
,
[]
byte
,
error
)
{
domainSeparator
,
err
:=
typedData
.
HashStruct
(
"EIP712Domain"
,
typedData
.
Domain
.
Map
())
domainSeparator
,
err
:=
typedData
.
HashStruct
(
"EIP712Domain"
,
typedData
.
Domain
.
Map
())
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
nil
,
err
return
nil
,
nil
,
err
...
@@ -366,7 +367,7 @@ func TestJsonFiles(t *testing.T) {
...
@@ -366,7 +367,7 @@ func TestJsonFiles(t *testing.T) {
t
.
Errorf
(
"Failed to read file %v: %v"
,
fInfo
.
Name
(),
err
)
t
.
Errorf
(
"Failed to read file %v: %v"
,
fInfo
.
Name
(),
err
)
continue
continue
}
}
var
typedData
core
.
TypedData
var
typedData
apitypes
.
TypedData
err
=
json
.
Unmarshal
(
data
,
&
typedData
)
err
=
json
.
Unmarshal
(
data
,
&
typedData
)
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Errorf
(
"Test %d, file %v, json unmarshalling failed: %v"
,
i
,
fInfo
.
Name
(),
err
)
t
.
Errorf
(
"Test %d, file %v, json unmarshalling failed: %v"
,
i
,
fInfo
.
Name
(),
err
)
...
@@ -398,7 +399,7 @@ func TestFuzzerFiles(t *testing.T) {
...
@@ -398,7 +399,7 @@ func TestFuzzerFiles(t *testing.T) {
t
.
Errorf
(
"Failed to read file %v: %v"
,
fInfo
.
Name
(),
err
)
t
.
Errorf
(
"Failed to read file %v: %v"
,
fInfo
.
Name
(),
err
)
continue
continue
}
}
var
typedData
core
.
TypedData
var
typedData
apitypes
.
TypedData
err
=
json
.
Unmarshal
(
data
,
&
typedData
)
err
=
json
.
Unmarshal
(
data
,
&
typedData
)
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Errorf
(
"Test %d, file %v, json unmarshalling failed: %v"
,
i
,
fInfo
.
Name
(),
err
)
t
.
Errorf
(
"Test %d, file %v, json unmarshalling failed: %v"
,
i
,
fInfo
.
Name
(),
err
)
...
@@ -498,7 +499,7 @@ var gnosisTx = `
...
@@ -498,7 +499,7 @@ var gnosisTx = `
// TestGnosisTypedData tests the scenario where a user submits a full EIP-712
// TestGnosisTypedData tests the scenario where a user submits a full EIP-712
// struct without using the gnosis-specific endpoint
// struct without using the gnosis-specific endpoint
func
TestGnosisTypedData
(
t
*
testing
.
T
)
{
func
TestGnosisTypedData
(
t
*
testing
.
T
)
{
var
td
core
.
TypedData
var
td
apitypes
.
TypedData
err
:=
json
.
Unmarshal
([]
byte
(
gnosisTypedData
),
&
td
)
err
:=
json
.
Unmarshal
([]
byte
(
gnosisTypedData
),
&
td
)
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Fatalf
(
"unmarshalling failed '%v'"
,
err
)
t
.
Fatalf
(
"unmarshalling failed '%v'"
,
err
)
...
...
signer/rules/rules_test.go
View file @
619a3e70
...
@@ -605,7 +605,7 @@ function ApproveSignData(r){
...
@@ -605,7 +605,7 @@ function ApproveSignData(r){
t
.
Logf
(
"address %v %v
\n
"
,
addr
.
String
(),
addr
.
Original
())
t
.
Logf
(
"address %v %v
\n
"
,
addr
.
String
(),
addr
.
Original
())
nvt
:=
[]
*
core
.
NameValueType
{
nvt
:=
[]
*
apitypes
.
NameValueType
{
{
{
Name
:
"message"
,
Name
:
"message"
,
Typ
:
"text/plain"
,
Typ
:
"text/plain"
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment