provwasm_std/types/cosmos/slashing/
v1beta1.rs

1use provwasm_proc_macro::CosmwasmExt;
2/// ValidatorSigningInfo defines a validator's signing info for monitoring their
3/// liveness activity.
4#[allow(clippy::derive_partial_eq_without_eq)]
5#[derive(Clone, PartialEq, Eq, ::prost::Message, ::schemars::JsonSchema, CosmwasmExt)]
6#[proto_message(type_url = "/cosmos.slashing.v1beta1.ValidatorSigningInfo")]
7pub struct ValidatorSigningInfo {
8    #[prost(string, tag = "1")]
9    pub address: ::prost::alloc::string::String,
10    /// Height at which validator was first a candidate OR was un-jailed
11    #[prost(int64, tag = "2")]
12    pub start_height: i64,
13    /// Index which is incremented every time a validator is bonded in a block and
14    /// _may_ have signed a pre-commit or not. This in conjunction with the
15    /// signed_blocks_window param determines the index in the missed block bitmap.
16    #[prost(int64, tag = "3")]
17    pub index_offset: i64,
18    /// Timestamp until which the validator is jailed due to liveness downtime.
19    #[prost(message, optional, tag = "4")]
20    pub jailed_until: ::core::option::Option<crate::shim::Timestamp>,
21    /// Whether or not a validator has been tombstoned (killed out of validator
22    /// set). It is set once the validator commits an equivocation or for any other
23    /// configured misbehavior.
24    #[prost(bool, tag = "5")]
25    pub tombstoned: bool,
26    /// A counter of missed (unsigned) blocks. It is used to avoid unnecessary
27    /// reads in the missed block bitmap.
28    #[prost(int64, tag = "6")]
29    pub missed_blocks_counter: i64,
30}
31/// Params represents the parameters used for by the slashing module.
32#[allow(clippy::derive_partial_eq_without_eq)]
33#[derive(Clone, PartialEq, Eq, ::prost::Message, ::schemars::JsonSchema, CosmwasmExt)]
34#[proto_message(type_url = "/cosmos.slashing.v1beta1.Params")]
35pub struct Params {
36    #[prost(int64, tag = "1")]
37    pub signed_blocks_window: i64,
38    #[prost(bytes = "vec", tag = "2")]
39    pub min_signed_per_window: ::prost::alloc::vec::Vec<u8>,
40    #[prost(message, optional, tag = "3")]
41    pub downtime_jail_duration: ::core::option::Option<crate::shim::Duration>,
42    #[prost(bytes = "vec", tag = "4")]
43    pub slash_fraction_double_sign: ::prost::alloc::vec::Vec<u8>,
44    #[prost(bytes = "vec", tag = "5")]
45    pub slash_fraction_downtime: ::prost::alloc::vec::Vec<u8>,
46}
47/// GenesisState defines the slashing module's genesis state.
48#[allow(clippy::derive_partial_eq_without_eq)]
49#[derive(Clone, PartialEq, Eq, ::prost::Message, ::schemars::JsonSchema, CosmwasmExt)]
50#[proto_message(type_url = "/cosmos.slashing.v1beta1.GenesisState")]
51pub struct GenesisState {
52    /// params defines all the parameters of the module.
53    #[prost(message, optional, tag = "1")]
54    pub params: ::core::option::Option<Params>,
55    /// signing_infos represents a map between validator addresses and their
56    /// signing infos.
57    #[prost(message, repeated, tag = "2")]
58    pub signing_infos: ::prost::alloc::vec::Vec<SigningInfo>,
59    /// missed_blocks represents a map between validator addresses and their
60    /// missed blocks.
61    #[prost(message, repeated, tag = "3")]
62    pub missed_blocks: ::prost::alloc::vec::Vec<ValidatorMissedBlocks>,
63}
64/// SigningInfo stores validator signing info of corresponding address.
65#[allow(clippy::derive_partial_eq_without_eq)]
66#[derive(Clone, PartialEq, Eq, ::prost::Message, ::schemars::JsonSchema, CosmwasmExt)]
67#[proto_message(type_url = "/cosmos.slashing.v1beta1.SigningInfo")]
68pub struct SigningInfo {
69    /// address is the validator address.
70    #[prost(string, tag = "1")]
71    pub address: ::prost::alloc::string::String,
72    /// validator_signing_info represents the signing info of this validator.
73    #[prost(message, optional, tag = "2")]
74    pub validator_signing_info: ::core::option::Option<ValidatorSigningInfo>,
75}
76/// ValidatorMissedBlocks contains array of missed blocks of corresponding
77/// address.
78#[allow(clippy::derive_partial_eq_without_eq)]
79#[derive(Clone, PartialEq, Eq, ::prost::Message, ::schemars::JsonSchema, CosmwasmExt)]
80#[proto_message(type_url = "/cosmos.slashing.v1beta1.ValidatorMissedBlocks")]
81pub struct ValidatorMissedBlocks {
82    /// address is the validator address.
83    #[prost(string, tag = "1")]
84    pub address: ::prost::alloc::string::String,
85    /// missed_blocks is an array of missed blocks by the validator.
86    #[prost(message, repeated, tag = "2")]
87    pub missed_blocks: ::prost::alloc::vec::Vec<MissedBlock>,
88}
89/// MissedBlock contains height and missed status as boolean.
90#[allow(clippy::derive_partial_eq_without_eq)]
91#[derive(Clone, Copy, PartialEq, Eq, ::prost::Message, ::schemars::JsonSchema, CosmwasmExt)]
92#[proto_message(type_url = "/cosmos.slashing.v1beta1.MissedBlock")]
93pub struct MissedBlock {
94    /// index is the height at which the block was missed.
95    #[prost(int64, tag = "1")]
96    pub index: i64,
97    /// missed is the missed status.
98    #[prost(bool, tag = "2")]
99    pub missed: bool,
100}
101/// QueryParamsRequest is the request type for the Query/Params RPC method
102#[allow(clippy::derive_partial_eq_without_eq)]
103#[derive(Clone, Copy, PartialEq, Eq, ::prost::Message, ::schemars::JsonSchema, CosmwasmExt)]
104#[proto_message(type_url = "/cosmos.slashing.v1beta1.QueryParamsRequest")]
105#[proto_query(
106    path = "/cosmos.slashing.v1beta1.Query/Params",
107    response_type = QueryParamsResponse
108)]
109pub struct QueryParamsRequest {}
110/// QueryParamsResponse is the response type for the Query/Params RPC method
111#[allow(clippy::derive_partial_eq_without_eq)]
112#[derive(Clone, PartialEq, Eq, ::prost::Message, ::schemars::JsonSchema, CosmwasmExt)]
113#[proto_message(type_url = "/cosmos.slashing.v1beta1.QueryParamsResponse")]
114pub struct QueryParamsResponse {
115    #[prost(message, optional, tag = "1")]
116    pub params: ::core::option::Option<Params>,
117}
118/// QuerySigningInfoRequest is the request type for the Query/SigningInfo RPC
119/// method
120#[allow(clippy::derive_partial_eq_without_eq)]
121#[derive(Clone, PartialEq, Eq, ::prost::Message, ::schemars::JsonSchema, CosmwasmExt)]
122#[proto_message(type_url = "/cosmos.slashing.v1beta1.QuerySigningInfoRequest")]
123#[proto_query(
124    path = "/cosmos.slashing.v1beta1.Query/SigningInfo",
125    response_type = QuerySigningInfoResponse
126)]
127pub struct QuerySigningInfoRequest {
128    /// cons_address is the address to query signing info of
129    #[prost(string, tag = "1")]
130    pub cons_address: ::prost::alloc::string::String,
131}
132/// QuerySigningInfoResponse is the response type for the Query/SigningInfo RPC
133/// method
134#[allow(clippy::derive_partial_eq_without_eq)]
135#[derive(Clone, PartialEq, Eq, ::prost::Message, ::schemars::JsonSchema, CosmwasmExt)]
136#[proto_message(type_url = "/cosmos.slashing.v1beta1.QuerySigningInfoResponse")]
137pub struct QuerySigningInfoResponse {
138    /// val_signing_info is the signing info of requested val cons address
139    #[prost(message, optional, tag = "1")]
140    pub val_signing_info: ::core::option::Option<ValidatorSigningInfo>,
141}
142/// QuerySigningInfosRequest is the request type for the Query/SigningInfos RPC
143/// method
144#[allow(clippy::derive_partial_eq_without_eq)]
145#[derive(Clone, PartialEq, Eq, ::prost::Message, ::schemars::JsonSchema, CosmwasmExt)]
146#[proto_message(type_url = "/cosmos.slashing.v1beta1.QuerySigningInfosRequest")]
147#[proto_query(
148    path = "/cosmos.slashing.v1beta1.Query/SigningInfos",
149    response_type = QuerySigningInfosResponse
150)]
151pub struct QuerySigningInfosRequest {
152    #[prost(message, optional, tag = "1")]
153    pub pagination: ::core::option::Option<super::super::base::query::v1beta1::PageRequest>,
154}
155/// QuerySigningInfosResponse is the response type for the Query/SigningInfos RPC
156/// method
157#[allow(clippy::derive_partial_eq_without_eq)]
158#[derive(Clone, PartialEq, Eq, ::prost::Message, ::schemars::JsonSchema, CosmwasmExt)]
159#[proto_message(type_url = "/cosmos.slashing.v1beta1.QuerySigningInfosResponse")]
160pub struct QuerySigningInfosResponse {
161    /// info is the signing info of all validators
162    #[prost(message, repeated, tag = "1")]
163    pub info: ::prost::alloc::vec::Vec<ValidatorSigningInfo>,
164    #[prost(message, optional, tag = "2")]
165    pub pagination: ::core::option::Option<super::super::base::query::v1beta1::PageResponse>,
166}
167/// MsgUnjail defines the Msg/Unjail request type
168#[allow(clippy::derive_partial_eq_without_eq)]
169#[derive(Clone, PartialEq, Eq, ::prost::Message, ::schemars::JsonSchema, CosmwasmExt)]
170#[proto_message(type_url = "/cosmos.slashing.v1beta1.MsgUnjail")]
171pub struct MsgUnjail {
172    #[prost(string, tag = "1")]
173    pub validator_addr: ::prost::alloc::string::String,
174}
175/// MsgUnjailResponse defines the Msg/Unjail response type
176#[allow(clippy::derive_partial_eq_without_eq)]
177#[derive(Clone, Copy, PartialEq, Eq, ::prost::Message, ::schemars::JsonSchema, CosmwasmExt)]
178#[proto_message(type_url = "/cosmos.slashing.v1beta1.MsgUnjailResponse")]
179pub struct MsgUnjailResponse {}
180/// MsgUpdateParams is the Msg/UpdateParams request type.
181///
182/// Since: cosmos-sdk 0.47
183#[allow(clippy::derive_partial_eq_without_eq)]
184#[derive(Clone, PartialEq, Eq, ::prost::Message, ::schemars::JsonSchema, CosmwasmExt)]
185#[proto_message(type_url = "/cosmos.slashing.v1beta1.MsgUpdateParams")]
186pub struct MsgUpdateParams {
187    /// authority is the address that controls the module (defaults to x/gov unless overwritten).
188    #[prost(string, tag = "1")]
189    pub authority: ::prost::alloc::string::String,
190    /// params defines the x/slashing parameters to update.
191    ///
192    /// NOTE: All parameters must be supplied.
193    #[prost(message, optional, tag = "2")]
194    pub params: ::core::option::Option<Params>,
195}
196/// MsgUpdateParamsResponse defines the response structure for executing a
197/// MsgUpdateParams message.
198///
199/// Since: cosmos-sdk 0.47
200#[allow(clippy::derive_partial_eq_without_eq)]
201#[derive(Clone, Copy, PartialEq, Eq, ::prost::Message, ::schemars::JsonSchema, CosmwasmExt)]
202#[proto_message(type_url = "/cosmos.slashing.v1beta1.MsgUpdateParamsResponse")]
203pub struct MsgUpdateParamsResponse {}
204pub struct SlashingQuerier<'a, Q: cosmwasm_std::CustomQuery> {
205    querier: &'a cosmwasm_std::QuerierWrapper<'a, Q>,
206}
207impl<'a, Q: cosmwasm_std::CustomQuery> SlashingQuerier<'a, Q> {
208    pub fn new(querier: &'a cosmwasm_std::QuerierWrapper<'a, Q>) -> Self {
209        Self { querier }
210    }
211    pub fn params(&self) -> Result<QueryParamsResponse, cosmwasm_std::StdError> {
212        QueryParamsRequest {}.query(self.querier)
213    }
214    pub fn signing_info(
215        &self,
216        cons_address: ::prost::alloc::string::String,
217    ) -> Result<QuerySigningInfoResponse, cosmwasm_std::StdError> {
218        QuerySigningInfoRequest { cons_address }.query(self.querier)
219    }
220    pub fn signing_infos(
221        &self,
222        pagination: ::core::option::Option<super::super::base::query::v1beta1::PageRequest>,
223    ) -> Result<QuerySigningInfosResponse, cosmwasm_std::StdError> {
224        QuerySigningInfosRequest { pagination }.query(self.querier)
225    }
226}