celestia_core/abci/
request.rs

1//! ABCI requests and request data.
2//!
3
4// IMPORTANT NOTE ON DOCUMENTATION:
5//
6// The documentation for each request type is adapted from the ABCI Methods and
7// Types spec document. However, the same logical request may appear three
8// times, as a struct with the request data, as a Request variant, and as a
9// CategoryRequest variant.
10//
11// To avoid duplication, this documentation is stored in the doc/ folder in
12// individual .md files, which are pasted onto the relevant items using #[doc =
13// include_str!(...)].
14//
15// This is also why certain submodules have #[allow(unused)] imports to bring
16// items into scope for doc links, rather than changing the doc links -- it
17// allows the doc comments to be copied without editing.
18
19// bring into scope for doc links
20#[allow(unused)]
21use super::types::Snapshot;
22
23pub(super) mod apply_snapshot_chunk;
24pub(super) mod begin_block;
25pub(super) mod check_tx;
26pub(super) mod deliver_tx;
27pub(super) mod echo;
28pub(super) mod end_block;
29pub(super) mod info;
30pub(super) mod init_chain;
31pub(super) mod load_snapshot_chunk;
32pub(super) mod offer_snapshot;
33pub(super) mod prepare_proposal;
34pub(super) mod process_proposal;
35pub(super) mod query;
36pub(super) mod set_option;
37
38pub use apply_snapshot_chunk::ApplySnapshotChunk;
39pub use begin_block::BeginBlock;
40pub use check_tx::{CheckTx, CheckTxKind};
41pub use deliver_tx::DeliverTx;
42pub use echo::Echo;
43pub use end_block::EndBlock;
44pub use info::Info;
45pub use init_chain::InitChain;
46pub use load_snapshot_chunk::LoadSnapshotChunk;
47pub use offer_snapshot::OfferSnapshot;
48pub use prepare_proposal::PrepareProposal;
49pub use process_proposal::ProcessProposal;
50pub use query::Query;
51pub use set_option::SetOption;
52
53/// The consensus category of ABCI requests.
54#[allow(clippy::large_enum_variant)]
55#[derive(Clone, PartialEq, Eq, Debug)]
56pub enum ConsensusRequest {
57    #[doc = include_str!("doc/request-initchain.md")]
58    InitChain(InitChain),
59    #[doc = include_str!("doc/request-prepareproposal.md")]
60    PrepareProposal(PrepareProposal),
61    #[doc = include_str!("doc/request-processproposal.md")]
62    ProcessProposal(ProcessProposal),
63    #[doc = include_str!("doc/request-beginblock.md")]
64    BeginBlock(BeginBlock),
65    #[doc = include_str!("doc/request-delivertx.md")]
66    DeliverTx(DeliverTx),
67    #[doc = include_str!("doc/request-endblock.md")]
68    EndBlock(EndBlock),
69    #[doc = include_str!("doc/request-commit.md")]
70    Commit,
71}
72
73/// The mempool category of ABCI requests.
74#[derive(Clone, PartialEq, Eq, Debug)]
75pub enum MempoolRequest {
76    #[doc = include_str!("doc/request-checktx.md")]
77    CheckTx(CheckTx),
78}
79
80/// The info category of ABCI requests.
81#[derive(Clone, PartialEq, Eq, Debug)]
82pub enum InfoRequest {
83    #[doc = include_str!("doc/request-info.md")]
84    Info(Info),
85    #[doc = include_str!("doc/request-query.md")]
86    Query(Query),
87    #[doc = include_str!("doc/request-echo.md")]
88    Echo(Echo),
89    #[doc = include_str!("doc/request-setoption.md")]
90    SetOption(SetOption),
91}
92
93/// The snapshot category of ABCI requests.
94#[derive(Clone, PartialEq, Eq, Debug)]
95pub enum SnapshotRequest {
96    #[doc = include_str!("doc/request-listsnapshots.md")]
97    ListSnapshots,
98    #[doc = include_str!("doc/request-offersnapshot.md")]
99    OfferSnapshot(OfferSnapshot),
100    #[doc = include_str!("doc/request-loadsnapshotchunk.md")]
101    LoadSnapshotChunk(LoadSnapshotChunk),
102    #[doc = include_str!("doc/request-applysnapshotchunk.md")]
103    ApplySnapshotChunk(ApplySnapshotChunk),
104}