/
ballot.go
80 lines (67 loc) · 1.5 KB
/
ballot.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 base
import (
"time"
"github.com/rs/zerolog"
"github.com/spikeekips/mitum/base/key"
"github.com/spikeekips/mitum/base/seal"
"github.com/spikeekips/mitum/util/hint"
"github.com/spikeekips/mitum/util/valuehash"
)
var (
INITBallotType = hint.Type("init-ballot")
ProposalType = hint.Type("proposal")
ACCEPTBallotType = hint.Type("accept-ballot")
INITBallotFactType = hint.Type("init-ballot-fact")
ProposalFactType = hint.Type("proposal-fact")
ACCEPTBallotFactType = hint.Type("accept-ballot-fact")
)
type Ballot interface {
zerolog.LogObjectMarshaler
seal.Seal
RawFact() BallotFact
FactSign() BallotFactSign
SignedFact() SignedBallotFact
BaseVoteproof() Voteproof
ACCEPTVoteproof() Voteproof
}
type BallotFact interface {
Fact
Stage() Stage
Height() Height
Round() Round
}
type BallotFactSign interface {
FactSign
Node() Address
}
type INITBallotFact interface {
BallotFact
PreviousBlock() valuehash.Hash
}
type ProposalFact interface {
BallotFact
Proposer() Address
Operations() []valuehash.Hash
ProposedAt() time.Time
}
type ACCEPTBallotFact interface {
BallotFact
Proposal() valuehash.Hash // NOTE fact hash of proposal ballot
NewBlock() valuehash.Hash
}
type INITBallot interface {
Ballot
Fact() INITBallotFact
}
type Proposal interface {
Ballot
Fact() ProposalFact
}
type ACCEPTBallot interface {
Ballot
Fact() ACCEPTBallotFact
}
type SignWithFacter interface {
Sign(key.Privatekey, []byte) error
SignWithFact(Address, key.Privatekey, []byte) error
}