types/events+evidence: emit events + metrics on evidence validation (#7802)

* event: Added Events after evidence validation; evidence: refactored AddEvidence

Added context and Metrics as parameter for the pool constructor

* evidence: pushed event firing into evidence pool and added metrics to represent the size of the evpool

* state: fixed parameters of evpool mock functions

* evidence: added test to confirm events are generated

* Removed obsolete EvidenceEventPublisher interface

* evidence: pool removed error on missing eventbus
This commit is contained in:
Jasmina Malicevic
2022-02-21 14:45:56 +01:00
committed by GitHub
parent ce898a738c
commit e80541a251
25 changed files with 395 additions and 125 deletions

View File

@@ -40,6 +40,10 @@ const (
EventTimeoutWaitValue = "TimeoutWait"
EventValidBlockValue = "ValidBlock"
EventVoteValue = "Vote"
// Events emitted by the evidence reactor when evidence is validated
// and before it is committed
EventEvidenceValidatedValue = "EvidenceValidated"
)
// Pre-populated ABCI Tendermint-reserved events
@@ -104,6 +108,7 @@ func init() {
jsontypes.MustRegister(EventDataTx{})
jsontypes.MustRegister(EventDataValidatorSetUpdates{})
jsontypes.MustRegister(EventDataVote{})
jsontypes.MustRegister(EventDataEvidenceValidated{})
jsontypes.MustRegister(EventDataString(""))
}
@@ -223,6 +228,15 @@ type EventDataStateSyncStatus struct {
// TypeTag implements the required method of jsontypes.Tagged.
func (EventDataStateSyncStatus) TypeTag() string { return "tendermint/event/StateSyncStatus" }
type EventDataEvidenceValidated struct {
Evidence Evidence `json:"evidence"`
Height int64 `json:"height,string"`
}
// TypeTag implements the required method of jsontypes.Tagged.
func (EventDataEvidenceValidated) TypeTag() string { return "tendermint/event/EvidenceValidated" }
// PUBSUB
const (
@@ -261,6 +275,7 @@ var (
EventQueryVote = QueryForEvent(EventVoteValue)
EventQueryBlockSyncStatus = QueryForEvent(EventBlockSyncStatusValue)
EventQueryStateSyncStatus = QueryForEvent(EventStateSyncStatusValue)
EventQueryEvidenceValidated = QueryForEvent(EventEvidenceValidatedValue)
)
func EventQueryTxFor(tx Tx) *tmquery.Query {