Skip to content

Commit fa4730c

Browse files
authored
feat: sign now prints the keyfile used by SSV UI (#19)
- store the user config on DKG - print the keyfile json after the successful DKG - added a command to print the keyfile
1 parent e753121 commit fa4730c

File tree

14 files changed

+238
-45
lines changed

14 files changed

+238
-45
lines changed

cli/internal/cmd/print.go

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
package cmd
2+
3+
import (
4+
"encoding/json"
5+
"fmt"
6+
7+
"github.com/randa-mu/ssv-dkg/cli/internal/state"
8+
"github.com/randa-mu/ssv-dkg/shared"
9+
"github.com/spf13/cobra"
10+
)
11+
12+
var (
13+
dkgStateFlag string
14+
printCmd = &cobra.Command{
15+
Use: "print",
16+
Short: "prints out the key file required for registering a cluster",
17+
Long: "prints out the key file required for registering a cluster in the SSV web UI",
18+
Run: Print,
19+
}
20+
)
21+
22+
func init() {
23+
printCmd.PersistentFlags().StringVarP(
24+
&dkgStateFlag,
25+
"input",
26+
"i",
27+
"",
28+
"The filepath of the DKG output data to print",
29+
)
30+
}
31+
32+
func Print(_ *cobra.Command, _ []string) {
33+
if dkgStateFlag == "" {
34+
shared.Exit("you must pass the input flag with the output of the DKG you wish to create a keyfile for")
35+
}
36+
37+
s, err := state.LoadState(dkgStateFlag)
38+
if err != nil {
39+
shared.Exit(fmt.Sprintf("error loading state: %v", err))
40+
}
41+
42+
keyshareFile := state.CreateKeyshareFile(s.OwnerConfig, s.SigningOutput)
43+
j, err := json.Marshal(keyshareFile)
44+
if err != nil {
45+
shared.Exit(fmt.Sprintf("couldn't turn the keyshare into json: %v", err))
46+
}
47+
48+
fmt.Println(string(j))
49+
}

cli/internal/cmd/reshare.go

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package cmd
33
import (
44
"fmt"
55

6+
"github.com/randa-mu/ssv-dkg/cli/internal/state"
67
"github.com/spf13/cobra"
78

89
"github.com/randa-mu/ssv-dkg/cli"
@@ -47,17 +48,21 @@ func Reshare(cmd *cobra.Command, _ []string) {
4748
shared.Exit("you must pass your new set of operators either via the operator flag or from stdin")
4849
}
4950

50-
state, err := cli.LoadState(stateFilePath)
51+
s, err := state.LoadState(stateFilePath)
5152
if err != nil {
5253
shared.Exit(fmt.Sprintf("❌ tried to load state from %s but it failed: %v", stateFilePath, err))
5354
}
5455

55-
nextState, err := cli.Reshare(operators, state, log)
56+
output, err := cli.Reshare(operators, s.SigningOutput, log)
5657
if err != nil {
5758
shared.Exit(fmt.Sprintf("❌ resharing failed: %v", err))
5859
}
5960

60-
bytes, err := cli.StoreState(stateFilePath, nextState)
61+
nextState := state.StoredState{
62+
OwnerConfig: s.OwnerConfig,
63+
SigningOutput: output,
64+
}
65+
bytes, err := state.StoreState(stateFilePath, nextState)
6166
if err != nil {
6267
fmt.Printf("⚠️ there was an error storing your state; printing it to the console so you can save it in a flat file. Err: %v\n", err)
6368
fmt.Println(string(bytes))

cli/internal/cmd/root.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ var rootCmd = &cobra.Command{
1313
}
1414

1515
func init() {
16-
rootCmd.AddCommand(versionCmd, operatorsCmd, signCmd, reshareCmd)
16+
rootCmd.AddCommand(versionCmd, operatorsCmd, signCmd, reshareCmd, printCmd)
1717
}
1818

1919
func Execute() error {

cli/internal/cmd/sign.go

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package cmd
22

33
import (
4-
"encoding/base64"
54
"encoding/hex"
65
"encoding/json"
76
"errors"
@@ -10,6 +9,7 @@ import (
109
"os"
1110
"strings"
1211

12+
"github.com/randa-mu/ssv-dkg/cli/internal/state"
1313
"github.com/spf13/cobra"
1414

1515
"github.com/randa-mu/ssv-dkg/cli"
@@ -84,22 +84,34 @@ func Sign(cmd *cobra.Command, _ []string) {
8484
shared.Exit(fmt.Sprintf("%v", err))
8585
}
8686

87+
// run a DKG and get the signed output
8788
log := shared.QuietLogger{Quiet: shortFlag}
8889
signingOutput, err := cli.Sign(signingConfig, log)
8990
if err != nil {
9091
shared.Exit(fmt.Sprintf("%v", err))
9192
}
9293

93-
path := cli.CreateFilename(stateDirectoryFlag, signingOutput)
94+
path := state.CreateFilename(stateDirectoryFlag, signingOutput)
9495

95-
log.MaybeLog(fmt.Sprintf("✅ received signed deposit data! stored state in %s", path))
96-
log.Log(base64.StdEncoding.EncodeToString(signingOutput.DepositDataSignature))
97-
98-
bytes, err := cli.StoreStateIfNotExists(path, signingOutput)
96+
nextState := state.StoredState{
97+
OwnerConfig: signingConfig.Owner,
98+
SigningOutput: signingOutput,
99+
}
100+
bytes, err := state.StoreStateIfNotExists(path, nextState)
99101
if err != nil {
100-
log.Log(fmt.Sprintf("⚠️ there was an error storing the state; you should store it somewhere for resharing. Error: %v", err))
102+
log.Log(fmt.Sprintf("⚠️ DKG was successful but there was an error storing the state; you should store it somewhere for resharing. Error: %v", err))
101103
log.Log(string(bytes))
104+
} else {
105+
log.MaybeLog(fmt.Sprintf("✅ received signed deposit data! stored state in %s", path))
106+
}
107+
108+
keyshareFile := state.CreateKeyshareFile(nextState.OwnerConfig, nextState.SigningOutput)
109+
j, err := json.Marshal(keyshareFile)
110+
if err != nil {
111+
shared.Exit(fmt.Sprintf("couldn't turn the keyshare into json: %v", err))
102112
}
113+
log.MaybeLog("keyfile JSON for use with the SSV UI:")
114+
log.Log(string(j))
103115
}
104116

105117
func parseArgs(cmd *cobra.Command) (cli.SignatureConfig, error) {
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
{
2+
"version": "v1.0.10",
3+
"createdAt": "2024-01-30T16:39:04.028Z",
4+
"shares": [
5+
{
6+
"data": {
7+
"ownerNonce": 22,
8+
"ownerAddress": "0xaA184b86B4cdb747F4A3BF6e6FCd5e27c1d92c5c",
9+
"publicKey": "0xa6f245cab776aa282e268fc1e8c2896f149985bb1851846a37c7d0d001374905551c2871d4504fe88b5b0adc68db6a8f",
10+
"operators": [
11+
{
12+
"id": 1,
13+
"operatorKey": "LS0tLS1CRUdJTiBSU0EgUFVCTElDIEtFWS0tLS0tCk1JSUJJakFOQmdrcWhraUc5dzBCQVFFRkFBT0NBUThBTUlJQkNnS0NBUUVBMVg2MUFXY001QUNLaGN5MTlUaEIKby9HMWlhN1ByOVUralJ5aWY5ZjAyRG9sd091V2ZLLzdSVUlhOEhEbHBvQlVERDkwRTVQUGdJSy9sTXB4RytXbwpwQ2N5bTBpWk9UT0JzNDE5bEh3TzA4bXFja1JsZEg5WExmbmY2UThqWFR5Ym1yYzdWNmwyNVprcTl4U0owbHR1CndmTnVTSzNCZnFtNkQxOUY0aTVCbmVaSWhjRVJTYlFLWDFxbWNqYnZFL2cyQko4TzhaZUgrd0RzTHJiNnZXQVIKY3BYWG1uelE3Vlp6ZklHTGVLVU1CTTh6SW0rcXI4RGZ4SEhSeVU1QTE3cFU4cy9MNUp5RXE1RGJjc2Q2dHlnbQp5UE9BYUNzWldVREI3UGhLOHpUWU9WYi9MM1lnSTU4bjFXek5IM0s5cmFreUppTmUxTE9GVVZzQTFDUnhtQ2YzCmlRSURBUUFCCi0tLS0tRU5EIFJTQSBQVUJMSUMgS0VZLS0tLS0K"
14+
},
15+
{
16+
"id": 2,
17+
"operatorKey": "LS0tLS1CRUdJTiBSU0EgUFVCTElDIEtFWS0tLS0tCk1JSUJJakFOQmdrcWhraUc5dzBCQVFFRkFBT0NBUThBTUlJQkNnS0NBUUVBeUtVWTVEUmZZREljengzcjhVY0UKTlpFMFdIQXFuV2FIRjZYRlUydVdObjVOVE94Zkt4ZmZaLzkyeVE1citQVkJPRmQrcHhILzI2QXJVT3dNL1lBRQpRbDZ0VzBtc1FqdUtIU1Q4aUtvTDRTNUt0aDNoeTBqeFRHR1ZZaWdjWG1vRURjd2YxaG8wdWRxRmlEN3dFWXN1CmZHa2E2U1ZQNnBab1NMaU9HZFRKUWVzVDI5WEVCdDZnblhMaFB1MER2K0xsQUJJQ1pqWEFTZWtpSFVKUHRjYlgKRjZFL0lScGpkWHVNSmUyOXZDcmZudXhWWk93a1ptdzJXdGljYlNDOVJpSFRYWUQ1dnVGakZXRHNZMERHUDhzOAoyc1haVHdsNWl4dEhlUWM2N1lLRFN6YU1MNnY1VUVZblhUTzZzNHFVSWVnTXJwZjd3S0xGVWxqRTMwbnNIaVBUCjBRSURBUUFCCi0tLS0tRU5EIFJTQSBQVUJMSUMgS0VZLS0tLS0K"
18+
},
19+
{
20+
"id": 3,
21+
"operatorKey": "LS0tLS1CRUdJTiBSU0EgUFVCTElDIEtFWS0tLS0tCk1JSUJJakFOQmdrcWhraUc5dzBCQVFFRkFBT0NBUThBTUlJQkNnS0NBUUVBNWVUNUwwV0h6ZTdyTWZPb2xtVHMKdWtIQ2E4K3dtbUw2OTFJQ1RpREE1UkJ1TkxqSVQ2WkE0YzMxcVRIY3FBVHl5eVkwLzk3R3lKZ2doYnlFR2RoZQovalh6aWVTOXJ2RytJVGF1QjhMVlhkekxGYVQxWEZWeFlnN2x2TlB4OURPL1ZoRkhkWWxnT3I2d0RtV3FjRGo3ClhWUWFOWEFtRng3NjVQNTlXNXZzVGRXVWFHRWxXSm93SkZKdnc2UlRISkZ1TVhjSzZVaWJ0cUZMSmJwOW5kdUgKQjlLSzNWcmYrZmtJOWRBZ2txRDFHOElxQ0tKMVl3bjUyeGxxbTRCNitOOGZUZE1MS1JucWpFZmRzV1dwMFVzMQpLTW9vSXcyc3BoaXAzUFpNYnJaaU0wNjJ2ZUo0U3ovYjBObWdPTnhTd0JJTnNxcG54QjhFUVQxSTNjNklqNXhhCm5RSURBUUFCCi0tLS0tRU5EIFJTQSBQVUJMSUMgS0VZLS0tLS0K"
22+
},
23+
{
24+
"id": 4,
25+
"operatorKey": "LS0tLS1CRUdJTiBSU0EgUFVCTElDIEtFWS0tLS0tCk1JSUJJakFOQmdrcWhraUc5dzBCQVFFRkFBT0NBUThBTUlJQkNnS0NBUUVBdXZleUpUMURwM21mQ3FRTUora2YKZHdhV0d1bkRURUFaWmNTOHdtUTJBcjU1bE5venl5cHRwb1lGSTgxaW1RSmpwdVV0akR2am15RDRQSmt1SzFXRQovZG9TSzFraWlTSEYvZFBaeE5ZT2swMlRiTGIvTXBjMG12VE1nZmRsVDBoTlVOWDZIMnJzZzNlc2NEOStENEdDCmxtZGpCdmdxUDQydXdDbFlQUVhuN3Z6OWlOOEpXdEFtd1JkQ25USkZ6M2tYSEFPVGMyMjJGYXp4ZGJVNEVPYkIKVmJNejd2UXRmMWtNSGtacEh5UXNpL3F0WmhQaThtTlNQTWpMTDBtcmc4Ly9xVjIyeEVPNENmSHFKZkZOWEhKVwpEbU85M2h2QXE2dDFZOGN5UVZkSGZ2WEp5VzRxR29MY25HZzV1S2ZSYWVCSSt1aXFSeExOL2dtTnA2RzdpZVNkCkl3SURBUUFCCi0tLS0tRU5EIFJTQSBQVUJMSUMgS0VZLS0tLS0K"
26+
}
27+
]
28+
},
29+
"payload": {
30+
"publicKey": "0xa6f245cab776aa282e268fc1e8c2896f149985bb1851846a37c7d0d001374905551c2871d4504fe88b5b0adc68db6a8f",
31+
"operatorIds": [
32+
1,
33+
2,
34+
3,
35+
4
36+
],
37+
"sharesData": "0xb944a6e76addfc72c583b0e316393f5079b1269396a72060d22f20a4400aaedbfaa1da6e0fdd5539d03e64cd68d28c430ec51ae54b8de26e6540dbee26b01eafb2697850d96f2399412c089bcb1f24a45aafb113c33ebfdbb32fcd9126851bee9386547c45be98927e9155d1fdb6f254118c332b1e7839b30c35dddb4c77c9433ca72a6a1ad09694a83ed5844b25d00c97005af7d8b2b8afb3c11e14f338e5e4f94112e85eda0c25f933371a830862103bd7a3e51d300e0937420499cea5727f873d3d52f91600535d41e34c01fae731151a6ddf67b5d1c3d2844a5a0a98bbebd76203270246bb043502dc0888bf7b3aa8e8c484df59ea72d8784b9d51e457c9c6547b02709b9dbb81bfeb04c5d2258973c34d013aa4c6aa24f4d6e8c2f6cf0a6224badb008cd0947787a5c2bdd139dcf47776724a63ca7be02e0d2dd0c9ade1ebeb3e8760ecb3afb054880438c66f201b85d3902d1c2fc02e3a455aae29d84cc219985716a312723b1cebfa6b358050af6061d19f94e4f33fbf269bd1a2920e3aed0c52886eb3c3dd8571116d5eddc2361e3f99e52eb8a3314027c8831e39064c41fb2aa470485242626daefc4746286d514092bcc0662418cb3914727e2d47b51884bde882523b0018c0d32f621dcf5659912bdda154f7f73d346538a40350b9e83e010043ac2c60f9c6a6adfc2e0c38cb74e0cd9b074d3633ab55f79e8e2291267101c4a1f3cfccae66138aa4798460dc8e25b792baed869d857b95fb741542c26d5a6b3cd803746b5e9169cd3ec75ab591c5da34251f09d429489371946922b3d3a8123f4c161204ab127d78d53cb939fc2542c0b22d530989f7daba7304e3aa65ffcd547df38091b0d63314476995eb4cdc351db4ac2aff9b75199f45e2827a1fad43a0db73e2a5abf2b147c01e063449e6b17d3c0bc9e704b5ad5ddb66f8c0ac56785c0cf9494e28bed1abe3ccd07af4adbf62ac8473437449a133f618945607f1afbfc4eed50974e47106c89001aa66a51a4cca0cacac3bd789e9304cd65204d2e8d5ff4b75fd606fbfb2aac37244f2f76fd8296220731c6ca743285492559ed45630578d6d07ae584b1a066e46ed4b42b1a83dd6fc6c697ccb545d8726665f19343b8b3a220711e8a2ebd7e2eb8c48ab5d8a1f20ea2296864738e9504506ada904f5c4cb4f92acb9ae0296e3a5391570e277d994662099699f0c34db7cee740f5b552b47e27121db36bf2d3362f4df49d41285522285aab5704623a1165f71c9a5bfc6f4d0275c174784d6c557301749bc06388b29c0e705e585eab5f30d0d28c9da0d8f1ad1ee0ddf27c11c86f5292c9fe417a52802aba8a36bd54f017452d65ca0046b53aa50f7406b462d90b74b37381dd349a0296d96615fd29c63e107637da48233de3437b0927137855ecb4a99e882de4482f8dea233c3dd5382a877dcfb14be890c785fa1161e273910215c4c8c16ea907367418995bd141d23ab2949fffe2bfaed2b1bb056b14532ac83ba6a095f6aa915c430b7321177eac75459e6d0e1cbf34b337fbf8b2ca29033d248837769d984dcba9497a8477f0fc886695f0ec76d0f2350db9aa8751a7db2b0e86bd02ff2aaf5d5d39a9e1c0a3963694db4b6a711a5a006bb3ece185eca921234f2e0a0bf9745fa3e67fdcce8ca6e04489397897405802be15a6c76d76e3648b298220b46e1aaef610f9818dc0f5911a8b21741d9e2c95d451449c87218b4392654ff8a300c699222b1ec31ba1b44ae1a07157f13dffc0a6f875786ac1df8e2ff6ad2c0a25002bf5ae3ceb52229e2fa9bba95c06d7a88ae35f0bd8963d9bd543fb37da6dd18c6d9bc27d0837c09"
38+
}
39+
}
40+
]
41+
}

cli/internal/state/share.go

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
package state
2+
3+
import (
4+
"encoding/base64"
5+
"encoding/hex"
6+
"time"
7+
8+
"github.com/randa-mu/ssv-dkg/shared/api"
9+
)
10+
11+
const KeyshareFileVersion = "v0.0.1"
12+
13+
type KeyshareFile struct {
14+
Version string `json:"version"`
15+
CreatedAt string `json:"createdAt"`
16+
Shares []keyShare `json:"shares"`
17+
}
18+
19+
type keyShare struct {
20+
Data data `json:"data"`
21+
Payload payload `json:"payload"`
22+
}
23+
24+
type data struct {
25+
OwnerNonce uint32 `json:"ownerNonce"`
26+
OwnerAddress string `json:"ownerAddress"`
27+
PublicKey string `json:"publicKey"`
28+
Operators []operator `json:"operators"`
29+
}
30+
31+
type operator struct {
32+
Id uint32 `json:"id"`
33+
OperatorKey []byte `json:"operatorKey"`
34+
}
35+
36+
type payload struct {
37+
PublicKey string `json:"publicKey"`
38+
OperatorIDs []uint32 `json:"operatorIds"`
39+
SharesData string `json:"sharesData"`
40+
}
41+
42+
// CreateKeyshareFile takes output from the DKG/signing and creates the keyshare file required
43+
// to register a validator cluster using the SSV portal
44+
func CreateKeyshareFile(ownerConfig api.OwnerConfig, signingOutput api.SigningOutput) KeyshareFile {
45+
publicKey := hex.EncodeToString(signingOutput.GroupPublicKey)
46+
47+
operators := make([]operator, len(signingOutput.OperatorShares))
48+
operatorIDs := make([]uint32, len(signingOutput.OperatorShares))
49+
50+
for i, share := range signingOutput.OperatorShares {
51+
operatorKey := make([]byte, base64.StdEncoding.EncodedLen(len(share.Identity.Public)))
52+
base64.StdEncoding.Encode(operatorKey, share.Identity.Public)
53+
operators[i] = operator{
54+
Id: uint32(i),
55+
OperatorKey: operatorKey,
56+
}
57+
operatorIDs[i] = uint32(i)
58+
}
59+
60+
return KeyshareFile{
61+
Version: KeyshareFileVersion,
62+
CreatedAt: time.Now().UTC().String(),
63+
Shares: []keyShare{
64+
{
65+
Data: data{
66+
OwnerNonce: ownerConfig.ValidatorNonce,
67+
OwnerAddress: hex.EncodeToString(ownerConfig.Address),
68+
PublicKey: publicKey,
69+
Operators: operators,
70+
},
71+
Payload: payload{
72+
PublicKey: publicKey,
73+
OperatorIDs: operatorIDs,
74+
// TODO: work out how this is actually encoded from the encrypted sahres
75+
SharesData: "0xdeadbeefdeadbeef",
76+
},
77+
},
78+
},
79+
}
80+
}
Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package cli
1+
package state
22

33
import (
44
"encoding/hex"
@@ -10,28 +10,33 @@ import (
1010
"github.com/randa-mu/ssv-dkg/shared/api"
1111
)
1212

13+
type StoredState struct {
14+
OwnerConfig api.OwnerConfig
15+
SigningOutput api.SigningOutput
16+
}
17+
1318
func CreateFilename(stateDirectory string, output api.SigningOutput) string {
1419
return path.Join(stateDirectory, fmt.Sprintf("%s.json", hex.EncodeToString(output.SessionID)))
1520
}
1621

17-
// StoreState stores the JSON encoded `api.SigningOutput` in a flat file.
22+
// StoreState stores the JSON encoded `StoredState` in a flat file.
1823
// it will overwrite any file that is presently there
1924
// it returns the json bytes on file write failure, so they can be printed to console
2025
// so users don't just lose their DKG state completely if e.g. they write somewhere without perms
21-
func StoreState(filepath string, output api.SigningOutput) ([]byte, error) {
22-
return storeWithFlags(filepath, output, os.O_WRONLY)
26+
func StoreState(filepath string, state StoredState) ([]byte, error) {
27+
return storeWithFlags(filepath, state, os.O_WRONLY)
2328
}
2429

25-
// StoreStateIfNotExists stores the JSON encoded `api.SigningOutput` in a flat file.
30+
// StoreStateIfNotExists stores the JSON encoded `StoredState` in a flat file.
2631
// it will fail if a file with the given name already exists
2732
// it returns the json bytes on file write failure, so they can be printed to console
2833
// so users don't just lose their DKG state completely if e.g. they write somewhere without perms
29-
func StoreStateIfNotExists(filepath string, output api.SigningOutput) ([]byte, error) {
30-
return storeWithFlags(filepath, output, os.O_WRONLY|os.O_CREATE|os.O_EXCL)
34+
func StoreStateIfNotExists(filepath string, state StoredState) ([]byte, error) {
35+
return storeWithFlags(filepath, state, os.O_WRONLY|os.O_CREATE|os.O_EXCL)
3136
}
3237

33-
func storeWithFlags(filepath string, output api.SigningOutput, flag int) ([]byte, error) {
34-
bytes, err := json.Marshal(output)
38+
func storeWithFlags(filepath string, state StoredState, flag int) ([]byte, error) {
39+
bytes, err := json.Marshal(state)
3540
if err != nil {
3641
return nil, err
3742
}
@@ -45,14 +50,14 @@ func storeWithFlags(filepath string, output api.SigningOutput, flag int) ([]byte
4550
return bytes, err
4651
}
4752

48-
// LoadState loads and unmarshalls the JSON encoded `api.SigningOutput` from a flat file.
49-
func LoadState(filepath string) (api.SigningOutput, error) {
53+
// LoadState loads and unmarshals the JSON encoded `StoredState` from a flat file.
54+
func LoadState(filepath string) (StoredState, error) {
5055
bytes, err := os.ReadFile(filepath)
5156
if err != nil {
52-
return api.SigningOutput{}, err
57+
return StoredState{}, err
5358
}
5459

55-
var s api.SigningOutput
60+
var s StoredState
5661
err = json.Unmarshal(bytes, &s)
5762
return s, err
5863
}

cli/reshare.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ func Reshare(operators []string, state api.SigningOutput, log shared.QuietLogger
5050
if err != nil {
5151
return api.SigningOutput{}, err
5252
}
53-
oldGroupPK, err := extractGroupPublicKey(suite, state.PolynomialCommitments)
53+
oldGroupPK, err := extractGroupPublicKey(suite, state.GroupPublicKey)
5454
if err != nil {
5555
return api.SigningOutput{}, err
5656
}
@@ -68,10 +68,10 @@ func Reshare(operators []string, state api.SigningOutput, log shared.QuietLogger
6868
}
6969

7070
return api.SigningOutput{
71-
SessionID: state.SessionID,
72-
DepositDataSignature: state.DepositDataSignature,
73-
PolynomialCommitments: polynomialCommitments,
74-
OperatorShares: operatorShares,
71+
SessionID: state.SessionID,
72+
DepositDataSignature: state.DepositDataSignature,
73+
GroupPublicKey: polynomialCommitments,
74+
OperatorShares: operatorShares,
7575
}, nil
7676
}
7777

@@ -111,7 +111,7 @@ func runReshare(state api.SigningOutput, identities []crypto.Identity) ([]operat
111111
PreviousState: api.PreviousDKGState{
112112
SessionID: hex.EncodeToString(state.SessionID),
113113
Nodes: oldNodes,
114-
PublicPolynomialCommitments: state.PolynomialCommitments,
114+
PublicPolynomialCommitments: state.GroupPublicKey,
115115
},
116116
PreviousEncryptedShareHash: hashedShares[identity.Address],
117117
})

cli/sign.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,13 +78,15 @@ func Sign(config SignatureConfig, log shared.QuietLogger) (api.SigningOutput, er
7878
return api.SigningOutput{}, fmt.Errorf("error aggregating validator nonce signature: %v", err)
7979
}
8080

81-
return api.SigningOutput{
81+
output := api.SigningOutput{
8282
SessionID: sessionID,
83-
PolynomialCommitments: groupPublicKey,
83+
GroupPublicKey: groupPublicKey,
8484
OperatorShares: extractEncryptedShares(responses),
8585
DepositDataSignature: depositDataSignature,
8686
ValidatorNonceSignature: validatorNonceSignature,
87-
}, nil
87+
}
88+
89+
return output, nil
8890
}
8991

9092
func fetchIdentities(suite crypto.ThresholdScheme, operators []string) ([]crypto.Identity, error) {

0 commit comments

Comments
 (0)