diff --git a/votepool/event_type.go b/votepool/event_type.go index e40012672..54f0b8bd9 100644 --- a/votepool/event_type.go +++ b/votepool/event_type.go @@ -9,4 +9,7 @@ const ( // FromBscCrossChainEvent defines the type of cross chain events from BSC to the current chain. FromBscCrossChainEvent EventType = 2 + + // DataChallengeEvent defines the type of events for data availability challenges. + DataAvailabilityChallengeEvent EventType = 3 ) diff --git a/votepool/pool.go b/votepool/pool.go index 8f427d1bf..2166efd3d 100644 --- a/votepool/pool.go +++ b/votepool/pool.go @@ -137,8 +137,7 @@ type Pool struct { // NewVotePool creates a Pool, the init validators should be supplied. func NewVotePool(logger log.Logger, validators []*types.Validator, eventBus *types.EventBus) (*Pool, error) { - // only used for cross chain votes currently. - eventTypes := []EventType{ToBscCrossChainEvent, FromBscCrossChainEvent} + eventTypes := []EventType{ToBscCrossChainEvent, FromBscCrossChainEvent, DataAvailabilityChallengeEvent} ticker := time.NewTicker(pruneVoteInterval) stores := make(map[EventType]*voteStore, len(eventTypes)) diff --git a/votepool/vote.go b/votepool/vote.go index f738a9b67..563909408 100644 --- a/votepool/vote.go +++ b/votepool/vote.go @@ -46,7 +46,9 @@ func (v *Vote) ValidateBasic() error { if len(v.EventHash) != eventHashLen { return errors.New("invalid event hash") } - if v.EventType != ToBscCrossChainEvent && v.EventType != FromBscCrossChainEvent { + if v.EventType != ToBscCrossChainEvent && + v.EventType != FromBscCrossChainEvent && + v.EventType != DataAvailabilityChallengeEvent { return errors.New("invalid event type") } if len(v.PubKey) != pubKeyLen { diff --git a/votepool/vote_test.go b/votepool/vote_test.go index 4363aca9a..e45315984 100644 --- a/votepool/vote_test.go +++ b/votepool/vote_test.go @@ -36,7 +36,7 @@ func TestVote_ValidateBasic(t *testing.T) { vote: Vote{ PubKey: pubKey, Signature: sign, - EventType: 3, + EventType: 10, EventHash: eventHash, expireAt: time.Time{}, },