forked from ObolNetwork/charon
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdefinition.go
636 lines (545 loc) · 22 KB
/
definition.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
// Copyright © 2022 Obol Labs Inc.
//
// This program is free software: you can redistribute it and/or modify it
// under the terms of the GNU General Public License as published by the Free
// Software Foundation, either version 3 of the License, or (at your option)
// any later version.
//
// This program is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
// more details.
//
// You should have received a copy of the GNU General Public License along with
// this program. If not, see <http://www.gnu.org/licenses/>.
package cluster
import (
"bytes"
"encoding/json"
"io"
"time"
"github.com/libp2p/go-libp2p/core/peer"
"github.com/obolnetwork/charon/app/errors"
"github.com/obolnetwork/charon/app/z"
"github.com/obolnetwork/charon/p2p"
)
const (
forkVersionLen = 4
addressLen = 20
)
// NodeIdx represents the index of a node/peer/share in the cluster as operator order in cluster definition.
type NodeIdx struct {
// PeerIdx is the index of a peer in the peer list (it 0-indexed).
PeerIdx int
// ShareIdx is the tbls share identifier (it is 1-indexed).
ShareIdx int
}
func WithVersion(version string) func(*Definition) {
return func(d *Definition) {
d.Version = version
}
}
// NewDefinition returns a new definition populated with the latest version, timestamp and UUID.
// The hashes are also populated accordingly. Note that the hashes need to be recalculated when any field is modified.
func NewDefinition(name string, numVals int, threshold int, feeRecipientAddress string, withdrawalAddress string,
forkVersionHex string, creator Creator, operators []Operator, random io.Reader, opts ...func(*Definition),
) (Definition, error) {
def := Definition{
Version: currentVersion,
Name: name,
UUID: uuid(random),
Timestamp: time.Now().Format(time.RFC3339),
NumValidators: numVals,
Threshold: threshold,
DKGAlgorithm: dkgAlgo,
WithdrawalAddress: withdrawalAddress,
FeeRecipientAddress: feeRecipientAddress,
Operators: operators,
Creator: creator,
}
var err error
def.ForkVersion, err = from0xHex(forkVersionHex, forkVersionLen)
if err != nil {
return Definition{}, err
}
for _, opt := range opts {
opt(&def)
}
return def.SetDefinitionHashes()
}
// Definition defines an intended charon cluster configuration excluding validators.
// Note the following struct tag meanings:
// - json: json field name. Suffix 0xhex indicates bytes are formatted as 0x prefixed hex strings.
// - ssz: ssz equivalent. Either uint64 for numbers, BytesN for fixed length bytes, ByteList[MaxN]
// for variable length strings, or CompositeList[MaxN] for nested object arrays.
// - config_hash: field ordering when calculating config hash. Some fields are excluded indicated by `-`.
// - definition_hash: field ordering when calculating definition hash. Some fields are excluded indicated by `-`.
type Definition struct {
// UUID is a human-readable random unique identifier. Max 64 chars.
UUID string `json:"uuid" ssz:"ByteList[64]" config_hash:"0" definition_hash:"0"`
// Name is a human-readable cosmetic identifier. Max 256 chars.
Name string `json:"name" ssz:"ByteList[256]" config_hash:"1" definition_hash:"1"`
// Version is the schema version of this definition. Max 16 chars.
Version string `json:"version" ssz:"ByteList[16]" config_hash:"2" definition_hash:"2"`
// Timestamp is the human-readable timestamp of this definition. Max 32 chars.
// Note that this was added in v1.1.0, so may be empty for older versions.
Timestamp string `json:"timestamp" ssz:"ByteList[32]" config_hash:"3" definition_hash:"3"`
// NumValidators is the number of DVs (n*32ETH) to be created in the cluster lock file.
NumValidators int `json:"num_validators" ssz:"uint64" config_hash:"4" definition_hash:"4"`
// Threshold required for signature reconstruction. Defaults to safe value for number of nodes/peers.
Threshold int `json:"threshold" ssz:"uint64" config_hash:"5" definition_hash:"5"`
// FeeRecipientAddress 20 byte Ethereum address.
FeeRecipientAddress string `json:"fee_recipient_address,0xhex" ssz:"Bytes20" config_hash:"6" definition_hash:"6"`
// WithdrawalAddress 20 byte Ethereum address.
WithdrawalAddress string `json:"withdrawal_address,0xhex" ssz:"Bytes20" config_hash:"7" definition_hash:"7"`
// DKGAlgorithm to use for key generation. Max 32 chars.
DKGAlgorithm string `json:"dkg_algorithm" ssz:"ByteList[32]" config_hash:"8" definition_hash:"8"`
// ForkVersion defines the cluster's 4 byte beacon chain fork version (network/chain identifier).
ForkVersion []byte `json:"fork_version,0xhex" ssz:"Bytes4" config_hash:"9" definition_hash:"9"`
// Operators define the charon nodes in the cluster and their operators. Max 256 operators.
Operators []Operator `json:"operators" ssz:"CompositeList[256]" config_hash:"10" definition_hash:"10"`
// Creator identifies the creator of a cluster definition. They may also be an operator.
Creator Creator `json:"creator" ssz:"Composite" config_hash:"11" definition_hash:"11"`
// ConfigHash uniquely identifies a cluster definition excluding operator ENRs and signatures.
ConfigHash []byte `json:"config_hash,0xhex" ssz:"Bytes32" config_hash:"-" definition_hash:"12"`
// DefinitionHash uniquely identifies a cluster definition including operator ENRs and signatures.
DefinitionHash []byte `json:"definition_hash,0xhex" ssz:"Bytes32" config_hash:"-" definition_hash:"-"`
}
// NodeIdx returns the node index for the peer.
func (d Definition) NodeIdx(pID peer.ID) (NodeIdx, error) {
peers, err := d.Peers()
if err != nil {
return NodeIdx{}, err
}
for i, p := range peers {
if p.ID != pID {
continue
}
return NodeIdx{
PeerIdx: i, // 0-indexed
ShareIdx: i + 1, // 1-indexed
}, nil
}
return NodeIdx{}, errors.New("peer not in definition")
}
// VerifySignatures returns true if all config signatures are fully populated and valid. A verified definition is ready for use in DKG.
//
//nolint:nestif,gocognit // We should try and break this into functions.
func (d Definition) VerifySignatures() error {
// Skip signature verification for definition versions earlier than v1.3 since there are no EIP712 signatures before v1.3.0.
if !supportEIP712Sigs(d.Version) && !eip712SigsPresent(d.Operators) {
return nil
}
// For definition versions earlier than v1.3.0, error if either config signature or enr signature for any operator is present.
if !supportEIP712Sigs(d.Version) && eip712SigsPresent(d.Operators) {
return errors.New("older version signatures not supported")
}
// Check valid operator config signature for each operator.
operatorConfigHashDigest, err := digestEIP712(getOperatorEIP712Type(d.Version), d, Operator{})
if err != nil {
return err
}
var noOpSigs int
for _, o := range d.Operators {
// Completely unsigned operators are also fine, assuming a single cluster-wide operator.
if o.Address == "" && len(o.ENRSignature) == 0 && len(o.ConfigSignature) == 0 {
noOpSigs++
continue
}
if len(o.ENRSignature) == 0 {
return errors.New("empty operator enr signature", z.Any("operator_address", o.Address))
}
if len(o.ConfigSignature) == 0 {
return errors.New("empty operator config signature", z.Any("operator_address", o.Address))
}
if ok, err := verifySig(o.Address, operatorConfigHashDigest, o.ConfigSignature); err != nil {
return err
} else if !ok {
return errors.New("invalid operator config signature", z.Any("operator_address", o.Address))
}
// Check that we have a valid enr signature for each operator.
enrDigest, err := digestEIP712(eip712ENR, d, o)
if err != nil {
return err
}
if ok, err := verifySig(o.Address, enrDigest, o.ENRSignature); err != nil {
return err
} else if !ok {
return errors.New("invalid operator enr signature", z.Any("operator_address", o.Address))
}
}
if noOpSigs > 0 && noOpSigs != len(d.Operators) {
return errors.New("some operators signed while others didn't")
}
// Verify creator signature
if isAnyVersion(d.Version, v1_3) {
if len(d.Creator.ConfigSignature) > 0 {
return errors.New("unexpected creator config signature in old version")
}
} else if d.Creator.Address == "" && len(d.Creator.ConfigSignature) == 0 {
// Empty creator is fine if also not operator signatures either.
if noOpSigs == 0 {
return errors.New("some operators signed while creator didn't")
}
} else {
if len(d.Creator.ConfigSignature) == 0 {
return errors.New("empty creator config signature")
}
// Creator config signature is
creatorConfigHashDigest, err := digestEIP712(eip712CreatorConfigHash, d, Operator{})
if err != nil {
return err
}
if ok, err := verifySig(d.Creator.Address, creatorConfigHashDigest, d.Creator.ConfigSignature); err != nil {
return err
} else if !ok {
return errors.New("invalid creator config signature")
}
if noOpSigs > 0 {
return errors.New("creator signed while operators didn't")
}
}
return nil
}
// Peers returns the operators as a slice of p2p peers.
func (d Definition) Peers() ([]p2p.Peer, error) {
var resp []p2p.Peer
for i, operator := range d.Operators {
record, err := p2p.DecodeENR(operator.ENR)
if err != nil {
return nil, errors.Wrap(err, "decode enr", z.Str("enr", operator.ENR))
}
p, err := p2p.NewPeer(record, i)
if err != nil {
return nil, err
}
resp = append(resp, p)
}
return resp, nil
}
// PeerIDs is a convenience function that returns the operators p2p peer IDs.
func (d Definition) PeerIDs() ([]peer.ID, error) {
peers, err := d.Peers()
if err != nil {
return nil, err
}
var resp []peer.ID
for _, p := range peers {
resp = append(resp, p.ID)
}
return resp, nil
}
// SetDefinitionHashes returns a copy of the definition with the config hash and definition hash populated.
func (d Definition) SetDefinitionHashes() (Definition, error) {
// Marshal config hash
configHash, err := hashDefinition(d, true)
if err != nil {
return Definition{}, errors.Wrap(err, "config hash")
}
d.ConfigHash = configHash[:]
// Marshal definition hashDefinition
defHash, err := hashDefinition(d, false)
if err != nil {
return Definition{}, errors.Wrap(err, "definition hashDefinition")
}
d.DefinitionHash = defHash[:]
return d, nil
}
func (d Definition) MarshalJSON() ([]byte, error) {
d, err := d.SetDefinitionHashes()
if err != nil {
return nil, err
}
switch {
case isV1x0(d.Version) || isV1x1(d.Version):
return marshalDefinitionV1x0or1(d)
case isV1x2(d.Version) || isV1x3(d.Version):
// v1.2 and v1.3 has the same json format.
return marshalDefinitionV1x2or3(d)
case isV1x4(d.Version):
return marshalDefinitionV1x4(d)
default:
return nil, errors.New("unsupported version")
}
}
func (d *Definition) UnmarshalJSON(data []byte) error {
// Get the version directly
version := struct {
Version string `json:"version"`
}{}
if err := json.Unmarshal(data, &version); err != nil {
return errors.Wrap(err, "unmarshal version")
} else if !supportedVersions[version.Version] {
return errors.New("unsupported definition version",
z.Str("version", version.Version),
z.Any("supported", supportedVersions),
)
}
var (
def Definition
err error
)
switch {
case isV1x0(version.Version) || isV1x1(version.Version):
def, err = unmarshalDefinitionV1x0or1(data)
if err != nil {
return err
}
case isV1x2(version.Version) || isV1x3(version.Version):
def, err = unmarshalDefinitionV1x2or3(data)
if err != nil {
return err
}
case isV1x4(version.Version):
def, err = unmarshalDefinitionV1x4(data)
if err != nil {
return err
}
default:
return errors.New("unsupported version")
}
*d = def
return nil
}
// VerifyHashes returns an error if hashes populated from json object doesn't matches actual hashes.
func (d Definition) VerifyHashes() error {
configHash, err := hashDefinition(d, true)
if err != nil {
return errors.Wrap(err, "config hash")
}
if !bytes.Equal(d.ConfigHash, configHash[:]) {
return errors.New("invalid config hash")
}
// Verify definition_hash
defHash, err := hashDefinition(d, false)
if err != nil {
return errors.Wrap(err, "definition hash")
}
if !bytes.Equal(d.DefinitionHash, defHash[:]) {
return errors.New("invalid definition hash")
}
return nil
}
func marshalDefinitionV1x0or1(def Definition) ([]byte, error) {
resp, err := json.Marshal(definitionJSONv1x0or1{
Name: def.Name,
UUID: def.UUID,
Version: def.Version,
Timestamp: def.Timestamp,
NumValidators: def.NumValidators,
Threshold: def.Threshold,
FeeRecipientAddress: def.FeeRecipientAddress,
WithdrawalAddress: def.WithdrawalAddress,
DKGAlgorithm: def.DKGAlgorithm,
ForkVersion: to0xHex(def.ForkVersion),
Operators: operatorsToV1x1(def.Operators),
ConfigHash: def.ConfigHash,
DefinitionHash: def.DefinitionHash,
})
if err != nil {
return nil, errors.Wrap(err, "marshal definition")
}
return resp, nil
}
func marshalDefinitionV1x2or3(def Definition) ([]byte, error) {
resp, err := json.Marshal(definitionJSONv1x2or3{
Name: def.Name,
UUID: def.UUID,
Version: def.Version,
Timestamp: def.Timestamp,
NumValidators: def.NumValidators,
Threshold: def.Threshold,
FeeRecipientAddress: def.FeeRecipientAddress,
WithdrawalAddress: def.WithdrawalAddress,
DKGAlgorithm: def.DKGAlgorithm,
ForkVersion: def.ForkVersion,
Operators: operatorsToV1x2orLater(def.Operators),
ConfigHash: def.ConfigHash,
DefinitionHash: def.DefinitionHash,
})
if err != nil {
return nil, errors.Wrap(err, "marshal definition")
}
return resp, nil
}
func marshalDefinitionV1x4(def Definition) ([]byte, error) {
resp, err := json.Marshal(definitionJSONv1x4{
Name: def.Name,
UUID: def.UUID,
Version: def.Version,
Timestamp: def.Timestamp,
NumValidators: def.NumValidators,
Threshold: def.Threshold,
FeeRecipientAddress: def.FeeRecipientAddress,
WithdrawalAddress: def.WithdrawalAddress,
DKGAlgorithm: def.DKGAlgorithm,
ForkVersion: def.ForkVersion,
ConfigHash: def.ConfigHash,
DefinitionHash: def.DefinitionHash,
Operators: operatorsToV1x2orLater(def.Operators),
Creator: creatorJSON{
Address: def.Creator.Address,
ConfigSignature: def.Creator.ConfigSignature,
},
})
if err != nil {
return nil, errors.Wrap(err, "marshal definition")
}
return resp, nil
}
func unmarshalDefinitionV1x0or1(data []byte) (def Definition, err error) {
var defJSON definitionJSONv1x0or1
if err := json.Unmarshal(data, &defJSON); err != nil {
return Definition{}, errors.Wrap(err, "unmarshal definition v1_1")
}
operators, err := operatorsFromV1x1(defJSON.Operators)
if err != nil {
return Definition{}, err
}
def = Definition{
Name: defJSON.Name,
UUID: defJSON.UUID,
Version: defJSON.Version,
Timestamp: defJSON.Timestamp,
NumValidators: defJSON.NumValidators,
Threshold: defJSON.Threshold,
DKGAlgorithm: defJSON.DKGAlgorithm,
ConfigHash: defJSON.ConfigHash,
DefinitionHash: defJSON.DefinitionHash,
Operators: operators,
FeeRecipientAddress: defJSON.FeeRecipientAddress,
WithdrawalAddress: defJSON.WithdrawalAddress,
}
def.ForkVersion, err = from0xHex(defJSON.ForkVersion, forkVersionLen)
if err != nil {
return Definition{}, err
}
return def, nil
}
func unmarshalDefinitionV1x2or3(data []byte) (def Definition, err error) {
var defJSON definitionJSONv1x2or3
if err := json.Unmarshal(data, &defJSON); err != nil {
return Definition{}, errors.Wrap(err, "unmarshal definition v1v2")
}
def = Definition{
Name: defJSON.Name,
UUID: defJSON.UUID,
Version: defJSON.Version,
Timestamp: defJSON.Timestamp,
NumValidators: defJSON.NumValidators,
Threshold: defJSON.Threshold,
FeeRecipientAddress: defJSON.FeeRecipientAddress,
WithdrawalAddress: defJSON.WithdrawalAddress,
DKGAlgorithm: defJSON.DKGAlgorithm,
ForkVersion: defJSON.ForkVersion,
ConfigHash: defJSON.ConfigHash,
DefinitionHash: defJSON.DefinitionHash,
Operators: operatorsFromV1x2orLater(defJSON.Operators),
}
return def, nil
}
func unmarshalDefinitionV1x4(data []byte) (def Definition, err error) {
var defJSON definitionJSONv1x4
if err := json.Unmarshal(data, &defJSON); err != nil {
return Definition{}, errors.Wrap(err, "unmarshal definition v1v2")
}
return Definition{
Name: defJSON.Name,
UUID: defJSON.UUID,
Version: defJSON.Version,
Timestamp: defJSON.Timestamp,
NumValidators: defJSON.NumValidators,
Threshold: defJSON.Threshold,
FeeRecipientAddress: defJSON.FeeRecipientAddress,
WithdrawalAddress: defJSON.WithdrawalAddress,
DKGAlgorithm: defJSON.DKGAlgorithm,
ForkVersion: defJSON.ForkVersion,
ConfigHash: defJSON.ConfigHash,
DefinitionHash: defJSON.DefinitionHash,
Operators: operatorsFromV1x2orLater(defJSON.Operators),
Creator: Creator{
Address: defJSON.Creator.Address,
ConfigSignature: defJSON.Creator.ConfigSignature,
},
}, nil
}
// supportEIP712Sigs returns true if the provided definition version supports EIP712 signatures.
// Note that Definition versions prior to v1.3.0 don't support EIP712 signatures.
func supportEIP712Sigs(version string) bool {
return !(isV1x0(version) || isV1x1(version) || isV1x2(version))
}
func eip712SigsPresent(operators []Operator) bool {
for _, o := range operators {
if len(o.ENRSignature) > 0 || len(o.ConfigSignature) > 0 {
return true
}
}
return false
}
// definitionJSONv1x0or1 is the json formatter of Definition for versions v1.0.0 and v1.1.1.
type definitionJSONv1x0or1 struct {
Name string `json:"name,omitempty"`
Operators []operatorJSONv1x1 `json:"operators"`
UUID string `json:"uuid"`
Version string `json:"version"`
Timestamp string `json:"timestamp,omitempty"`
NumValidators int `json:"num_validators"`
Threshold int `json:"threshold"`
FeeRecipientAddress string `json:"fee_recipient_address,omitempty"`
WithdrawalAddress string `json:"withdrawal_address,omitempty"`
DKGAlgorithm string `json:"dkg_algorithm"`
ForkVersion string `json:"fork_version"`
ConfigHash []byte `json:"config_hash"`
DefinitionHash []byte `json:"definition_hash"`
}
// definitionJSONv1x2or3 is the json formatter of Definition for versions v1.2.0 and later.
type definitionJSONv1x2or3 struct {
Name string `json:"name,omitempty"`
Operators []operatorJSONv1x2orLater `json:"operators"`
UUID string `json:"uuid"`
Version string `json:"version"`
Timestamp string `json:"timestamp,omitempty"`
NumValidators int `json:"num_validators"`
Threshold int `json:"threshold"`
FeeRecipientAddress string `json:"fee_recipient_address,omitempty"`
WithdrawalAddress string `json:"withdrawal_address,omitempty"`
DKGAlgorithm string `json:"dkg_algorithm"`
ForkVersion ethHex `json:"fork_version"`
ConfigHash ethHex `json:"config_hash"`
DefinitionHash ethHex `json:"definition_hash"`
}
// definitionJSONv1x4 is the json formatter of Definition for versions v1.4.
type definitionJSONv1x4 struct {
Name string `json:"name,omitempty"`
Creator creatorJSON `json:"creator"`
Operators []operatorJSONv1x2orLater `json:"operators"`
UUID string `json:"uuid"`
Version string `json:"version"`
Timestamp string `json:"timestamp,omitempty"`
NumValidators int `json:"num_validators"`
Threshold int `json:"threshold"`
FeeRecipientAddress string `json:"fee_recipient_address,omitempty"`
WithdrawalAddress string `json:"withdrawal_address,omitempty"`
DKGAlgorithm string `json:"dkg_algorithm"`
ForkVersion ethHex `json:"fork_version"`
ConfigHash ethHex `json:"config_hash"`
DefinitionHash ethHex `json:"definition_hash"`
}
// Creator identifies the creator of a cluster definition.
// Note the following struct tag meanings:
// - json: json field name. Suffix 0xhex indicates bytes are formatted as 0x prefixed hex strings.
// - ssz: ssz equivalent. Either uint64 for numbers, BytesN for fixed length bytes, ByteList[MaxN]
// for variable length strings, or CompositeList[MaxN] for nested object arrays.
// - config_hash: field ordering when calculating config hash. Some fields are excluded indicated by `-`.
// - definition_hash: field ordering when calculating definition hash. Some fields are excluded indicated by `-`.
type Creator struct {
// The 20 byte Ethereum address of the creator
Address string `json:"address,0xhex" ssz:"Bytes20" config_hash:"0" definition_hash:"0"`
// ConfigSignature is an EIP712 signature of the config_hash using privkey corresponding to creator Ethereum Address.
ConfigSignature []byte `json:"config_signature,0xhex" ssz:"Bytes65" config_hash:"-" definition_hash:"1"`
}
// creatorJSON is the json formatter of Creator.
type creatorJSON struct {
Address string `json:"address"`
ConfigSignature ethHex `json:"config_signature"`
}