@@ -8,83 +8,83 @@ import (
88 "github.com/sei-protocol/sei-chain/sei-tendermint/internal/protoutils"
99)
1010
11- // ConsensusReq is the interface for all consensus messages.
12- type ConsensusReq interface {
13- isConsensusReq ()
11+ // ConsensusMsg is the interface for all consensus messages.
12+ type ConsensusMsg interface {
13+ isConsensusMsg ()
1414 View () View
1515}
1616
17- // ConsensusReqPrepareVote is a PrepareVote variant of ConsensusReq .
18- type ConsensusReqPrepareVote struct { * Signed [* PrepareVote ] }
17+ // ConsensusMsgPrepareVote is a PrepareVote variant of ConsensusMsg .
18+ type ConsensusMsgPrepareVote struct { * Signed [* PrepareVote ] }
1919
20- // ConsensusReqCommitVote is a CommitVote variant of ConsensusReq .
21- type ConsensusReqCommitVote struct { * Signed [* CommitVote ] }
20+ // ConsensusMsgCommitVote is a CommitVote variant of ConsensusMsg .
21+ type ConsensusMsgCommitVote struct { * Signed [* CommitVote ] }
2222
23- // View implements ConsensusReq .
24- func (m * ConsensusReqPrepareVote ) View () View { return m .Msg ().Proposal ().View () }
23+ // View implements ConsensusMsg .
24+ func (m * ConsensusMsgPrepareVote ) View () View { return m .Msg ().Proposal ().View () }
2525
26- // View implements ConsensusReq .
27- func (m * ConsensusReqCommitVote ) View () View { return m .Msg ().Proposal ().View () }
26+ // View implements ConsensusMsg .
27+ func (m * ConsensusMsgCommitVote ) View () View { return m .Msg ().Proposal ().View () }
2828
29- func (m * FullProposal ) isConsensusReq () {}
30- func (m * ConsensusReqPrepareVote ) isConsensusReq () {}
31- func (m * ConsensusReqCommitVote ) isConsensusReq () {}
32- func (m * FullTimeoutVote ) isConsensusReq () {}
33- func (m * TimeoutQC ) isConsensusReq () {}
29+ func (m * FullProposal ) isConsensusMsg () {}
30+ func (m * ConsensusMsgPrepareVote ) isConsensusMsg () {}
31+ func (m * ConsensusMsgCommitVote ) isConsensusMsg () {}
32+ func (m * FullTimeoutVote ) isConsensusMsg () {}
33+ func (m * TimeoutQC ) isConsensusMsg () {}
3434
35- // ConsensusReqConv is the protobuf converter for ConsensusReq .
36- var ConsensusReqConv = protoutils.Conv [ConsensusReq , * pb.ConsensusReq ]{
37- Encode : func (m ConsensusReq ) * pb.ConsensusReq {
35+ // ConsensusMsgConv is the protobuf converter for ConsensusMsg .
36+ var ConsensusMsgConv = protoutils.Conv [ConsensusMsg , * pb.ConsensusMsg ]{
37+ Encode : func (m ConsensusMsg ) * pb.ConsensusMsg {
3838 switch m := m .(type ) {
3939 case * FullProposal :
40- return & pb.ConsensusReq {
41- T : & pb.ConsensusReq_Proposal {Proposal : FullProposalConv .Encode (m )},
40+ return & pb.ConsensusMsg {
41+ T : & pb.ConsensusMsg_Proposal {Proposal : FullProposalConv .Encode (m )},
4242 }
43- case * ConsensusReqPrepareVote :
44- return & pb.ConsensusReq {
45- T : & pb.ConsensusReq_PrepareVoteV2 {PrepareVoteV2 : SignedPrepareVoteConv .Encode (m .Signed )},
43+ case * ConsensusMsgPrepareVote :
44+ return & pb.ConsensusMsg {
45+ T : & pb.ConsensusMsg_PrepareVoteV2 {PrepareVoteV2 : SignedPrepareVoteConv .Encode (m .Signed )},
4646 }
47- case * ConsensusReqCommitVote :
48- return & pb.ConsensusReq {
49- T : & pb.ConsensusReq_CommitVoteV2 {CommitVoteV2 : SignedCommitVoteConv .Encode (m .Signed )},
47+ case * ConsensusMsgCommitVote :
48+ return & pb.ConsensusMsg {
49+ T : & pb.ConsensusMsg_CommitVoteV2 {CommitVoteV2 : SignedCommitVoteConv .Encode (m .Signed )},
5050 }
5151 case * FullTimeoutVote :
52- return & pb.ConsensusReq {
53- T : & pb.ConsensusReq_TimeoutVote {TimeoutVote : FullTimeoutVoteConv .Encode (m )},
52+ return & pb.ConsensusMsg {
53+ T : & pb.ConsensusMsg_TimeoutVote {TimeoutVote : FullTimeoutVoteConv .Encode (m )},
5454 }
5555 case * TimeoutQC :
56- return & pb.ConsensusReq {
57- T : & pb.ConsensusReq_TimeoutQc {TimeoutQc : TimeoutQCConv .Encode (m )},
56+ return & pb.ConsensusMsg {
57+ T : & pb.ConsensusMsg_TimeoutQc {TimeoutQc : TimeoutQCConv .Encode (m )},
5858 }
5959 default :
60- panic (fmt .Sprintf ("Unknown ConsensusReq type: %T" , m ))
60+ panic (fmt .Sprintf ("Unknown ConsensusMsg type: %T" , m ))
6161 }
6262 },
63- Decode : func (m * pb.ConsensusReq ) (ConsensusReq , error ) {
63+ Decode : func (m * pb.ConsensusMsg ) (ConsensusMsg , error ) {
6464 if m .T == nil {
6565 return nil , errors .New ("empty" )
6666 }
6767 switch t := m .T .(type ) {
68- case * pb.ConsensusReq_Proposal :
68+ case * pb.ConsensusMsg_Proposal :
6969 return FullProposalConv .DecodeReq (t .Proposal )
70- case * pb.ConsensusReq_PrepareVoteV2 :
70+ case * pb.ConsensusMsg_PrepareVoteV2 :
7171 vote , err := SignedPrepareVoteConv .DecodeReq (t .PrepareVoteV2 )
7272 if err != nil {
7373 return nil , fmt .Errorf ("prepareVote: %w" , err )
7474 }
75- return & ConsensusReqPrepareVote {vote }, nil
76- case * pb.ConsensusReq_CommitVoteV2 :
75+ return & ConsensusMsgPrepareVote {vote }, nil
76+ case * pb.ConsensusMsg_CommitVoteV2 :
7777 vote , err := SignedCommitVoteConv .DecodeReq (t .CommitVoteV2 )
7878 if err != nil {
7979 return nil , fmt .Errorf ("commitVote: %w" , err )
8080 }
81- return & ConsensusReqCommitVote {vote }, nil
82- case * pb.ConsensusReq_TimeoutVote :
81+ return & ConsensusMsgCommitVote {vote }, nil
82+ case * pb.ConsensusMsg_TimeoutVote :
8383 return FullTimeoutVoteConv .DecodeReq (t .TimeoutVote )
84- case * pb.ConsensusReq_TimeoutQc :
84+ case * pb.ConsensusMsg_TimeoutQc :
8585 return TimeoutQCConv .DecodeReq (t .TimeoutQc )
8686 default :
87- return nil , fmt .Errorf ("unknown ConsensusReq type: %T" , t )
87+ return nil , fmt .Errorf ("unknown ConsensusMsg type: %T" , t )
8888 }
8989 },
9090}
0 commit comments