-
Notifications
You must be signed in to change notification settings - Fork 73
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: stop chain block production if node unhealthy event is emitted (#…
…319) Co-authored-by: Michael Tsitrin <[email protected]>
- Loading branch information
1 parent
8b006de
commit 7b017fc
Showing
8 changed files
with
475 additions
and
91 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package da | ||
|
||
import ( | ||
"fmt" | ||
|
||
tmpubsub "github.com/tendermint/tendermint/libs/pubsub" | ||
tmquery "github.com/tendermint/tendermint/libs/pubsub/query" | ||
) | ||
|
||
// Define the event type keys | ||
const ( | ||
// EventTypeKey is a reserved composite key for event name. | ||
EventTypeKey = "da.event" | ||
) | ||
|
||
// Define the event types | ||
const ( | ||
EventDAHealthStatus = "DAHealthStatus" | ||
) | ||
|
||
// EventDataDAHealthStatus defines the structure of the event data for the EventDataDAHealthStatus | ||
type EventDataDAHealthStatus struct { | ||
// Healthy is true if the da layer is healthy | ||
Healthy bool | ||
// Error is the error that was encountered in case of a health check failure | ||
Error error | ||
} | ||
|
||
// Define queries | ||
var ( | ||
EventQueryDAHealthStatus = QueryForEvent(EventDAHealthStatus) | ||
) | ||
|
||
// QueryForEvent returns a query for the given event. | ||
func QueryForEvent(eventType string) tmpubsub.Query { | ||
return tmquery.MustParse(fmt.Sprintf("%s='%s'", EventTypeKey, eventType)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package events | ||
|
||
import ( | ||
"fmt" | ||
|
||
tmpubsub "github.com/tendermint/tendermint/libs/pubsub" | ||
tmquery "github.com/tendermint/tendermint/libs/pubsub/query" | ||
) | ||
|
||
// Define the event type keys | ||
const ( | ||
// EventTypeKey is a reserved composite key for event name. | ||
EventNodeTypeKey = "node.event" | ||
) | ||
|
||
// Define the event types | ||
const ( | ||
EventHealthStatus = "HealthStatus" | ||
) | ||
|
||
// EventDataHealthStatus defines the structure of the event data for the EventHealthStatus | ||
type EventDataHealthStatus struct { | ||
// Healthy is true if the base layers are healthy | ||
Healthy bool | ||
// Error is the error that was encountered in case of a health check failure | ||
Error error | ||
} | ||
|
||
// Define queries | ||
var ( | ||
EventQueryHealthStatus = QueryForEvent(EventHealthStatus) | ||
) | ||
|
||
// QueryForEvent returns a query for the given event. | ||
func QueryForEvent(eventType string) tmpubsub.Query { | ||
return tmquery.MustParse(fmt.Sprintf("%s='%s'", EventNodeTypeKey, eventType)) | ||
} |
Oops, something went wrong.