This repository has been archived by the owner on Jun 22, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 12
/
dkg_proposal.go
80 lines (69 loc) · 1.92 KB
/
dkg_proposal.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
package requests
import (
"encoding/json"
"time"
)
// States: "state_dkg_commits_sending_await_confirmations"
// Events: "event_dkg_commit_confirm_received"
type DKGProposalCommitConfirmationRequest struct {
ParticipantId int
Commit []byte
CreatedAt time.Time
}
// States: "state_dkg_deals_await_confirmations"
// Events: "event_dkg_deal_confirm_received"
type DKGProposalDealConfirmationRequest struct {
ParticipantId int
Deal []byte
CreatedAt time.Time
}
// States: "state_dkg_responses_await_confirmations"
// Events: "event_dkg_response_confirm_received"
type DKGProposalResponseConfirmationRequest struct {
ParticipantId int
Response []byte
CreatedAt time.Time
}
// States: "state_dkg_master_key_await_confirmations"
// Events: "event_dkg_master_key_confirm_received"
type DKGProposalMasterKeyConfirmationRequest struct {
ParticipantId int
MasterKey []byte
CreatedAt time.Time
PubPolyBz []byte
}
// States: "state_dkg_pub_keys_await_confirmations"
//
// "state_dkg_commits_sending_await_confirmations"
// "state_dkg_deals_await_confirmations"
// "state_dkg_responses_await_confirmations"
// "state_dkg_master_key_await_confirmations"
//
// Events: "event_dkg_pub_key_confirm_canceled_by_error",
//
// "event_dkg_commit_confirm_canceled_by_error"
// "event_dkg_deal_confirm_canceled_by_error"
// "event_dkg_response_confirm_canceled_by_error"
// "event_dkg_master_key_confirm_canceled_by_error"
type DKGProposalConfirmationErrorRequest struct {
ParticipantId int
Error *FSMError
CreatedAt time.Time
}
type FSMError struct {
ErrorMsg string
}
func NewFSMError(err error) *FSMError {
return &FSMError{
ErrorMsg: err.Error(),
}
}
func (re FSMError) Error() string {
return re.ErrorMsg
}
func (re FSMError) MarshalJSON() ([]byte, error) {
return json.Marshal(re.ErrorMsg)
}
func (re *FSMError) UnmarshalJSON(data []byte) error {
return json.Unmarshal(data, &re.ErrorMsg)
}