Skip to main content

hotmint_types/
validator_update.rs

1use serde::{Deserialize, Serialize};
2
3use crate::crypto::PublicKey;
4use crate::validator::ValidatorId;
5
6/// A validator update returned by the application layer.
7/// Power of 0 means remove the validator.
8#[derive(Debug, Clone, Serialize, Deserialize)]
9pub struct ValidatorUpdate {
10    pub id: ValidatorId,
11    pub public_key: PublicKey,
12    pub power: u64,
13}
14
15/// An application-defined event emitted during block execution.
16#[derive(Debug, Clone, Default, Serialize, Deserialize)]
17pub struct Event {
18    pub r#type: String,
19    pub attributes: Vec<EventAttribute>,
20}
21
22/// A key-value pair within an [`Event`].
23#[derive(Debug, Clone, Serialize, Deserialize)]
24pub struct EventAttribute {
25    pub key: String,
26    pub value: String,
27}
28
29/// Response from `Application::end_block()`.
30/// If `validator_updates` is non-empty, an epoch transition is scheduled.
31#[derive(Debug, Clone, Default, Serialize, Deserialize)]
32pub struct EndBlockResponse {
33    pub validator_updates: Vec<ValidatorUpdate>,
34    /// Application-defined events emitted during this block.
35    pub events: Vec<Event>,
36}