penumbra_sdk_proto/
lib.rs

1//! Protobuf definitions for Penumbra.
2//!
3//! This crate only contains the `.proto` files and the Rust types generated
4//! from them.  These types only handle parsing the wire format; validation
5//! should be performed by converting them into an appropriate domain type, as
6//! in the following diagram:
7//!
8//! ```ascii
9//! ┌───────┐          ┌──────────────┐               ┌──────────────┐
10//! │encoded│ protobuf │penumbra_sdk_proto│ TryFrom/Into  │ domain types │
11//! │ bytes │<──wire ─>│    types     │<─validation ─>│(other crates)│
12//! └───────┘  format  └──────────────┘   boundary    └──────────────┘
13//! ```
14//!
15//! The [`DomainType`] marker trait can be implemented on a domain type to ensure
16//! these conversions exist.
17
18// The autogen code is not clippy-clean, so we disable some clippy warnings for this crate.
19#![allow(clippy::derive_partial_eq_without_eq)]
20#![allow(clippy::large_enum_variant)]
21#![allow(clippy::needless_borrow)]
22#![allow(clippy::unwrap_used)]
23#![allow(non_snake_case)]
24#![cfg_attr(docsrs, feature(doc_auto_cfg))]
25
26pub use prost::{Message, Name};
27
28/// Helper methods used for shaping the JSON (and other Serde) formats derived from the protos.
29pub mod serializers;
30
31#[cfg(feature = "box-grpc")]
32pub mod box_grpc_svc;
33
34/// Helper trait for using Protobuf messages as ABCI events.
35pub mod event;
36mod protobuf;
37pub use protobuf::DomainType;
38
39#[cfg(feature = "cnidarium")]
40pub mod state;
41#[cfg(feature = "cnidarium")]
42pub use state::StateReadProto;
43#[cfg(feature = "cnidarium")]
44pub use state::StateWriteProto;
45
46pub use penumbra::*;
47
48pub mod penumbra {
49    /// Core protocol structures.
50    pub mod core {
51        /// Top-level structures for the Penumbra application.
52        pub mod app {
53            pub mod v1 {
54                include!("gen/penumbra.core.app.v1.rs");
55                include!("gen/penumbra.core.app.v1.serde.rs");
56            }
57        }
58
59        pub mod asset {
60            pub mod v1 {
61                include!("gen/penumbra.core.asset.v1.rs");
62                include!("gen/penumbra.core.asset.v1.serde.rs");
63            }
64        }
65
66        pub mod txhash {
67            pub mod v1 {
68                include!("gen/penumbra.core.txhash.v1.rs");
69                include!("gen/penumbra.core.txhash.v1.serde.rs");
70            }
71        }
72
73        /// Components of the Penumbra application.
74        pub mod component {
75            pub mod auction {
76                pub mod v1 {
77                    include!("gen/penumbra.core.component.auction.v1.rs");
78                    include!("gen/penumbra.core.component.auction.v1.serde.rs");
79                }
80            }
81            pub mod compact_block {
82                pub mod v1 {
83                    include!("gen/penumbra.core.component.compact_block.v1.rs");
84                    include!("gen/penumbra.core.component.compact_block.v1.serde.rs");
85                }
86            }
87
88            pub mod community_pool {
89                pub mod v1 {
90                    include!("gen/penumbra.core.component.community_pool.v1.rs");
91                    include!("gen/penumbra.core.component.community_pool.v1.serde.rs");
92                }
93            }
94
95            pub mod dex {
96                pub mod v1 {
97                    include!("gen/penumbra.core.component.dex.v1.rs");
98                    include!("gen/penumbra.core.component.dex.v1.serde.rs");
99                }
100            }
101
102            pub mod distributions {
103                pub mod v1 {
104                    include!("gen/penumbra.core.component.distributions.v1.rs");
105                    include!("gen/penumbra.core.component.distributions.v1.serde.rs");
106                }
107            }
108
109            pub mod fee {
110                pub mod v1 {
111                    include!("gen/penumbra.core.component.fee.v1.rs");
112                    include!("gen/penumbra.core.component.fee.v1.serde.rs");
113                }
114            }
115
116            pub mod funding {
117                pub mod v1 {
118                    include!("gen/penumbra.core.component.funding.v1.rs");
119                    include!("gen/penumbra.core.component.funding.v1.serde.rs");
120                }
121            }
122
123            pub mod governance {
124                pub mod v1 {
125                    include!("gen/penumbra.core.component.governance.v1.rs");
126                    include!("gen/penumbra.core.component.governance.v1.serde.rs");
127                }
128            }
129
130            pub mod ibc {
131                pub mod v1 {
132                    include!("gen/penumbra.core.component.ibc.v1.rs");
133                    include!("gen/penumbra.core.component.ibc.v1.serde.rs");
134                }
135            }
136
137            pub mod sct {
138                pub mod v1 {
139                    include!("gen/penumbra.core.component.sct.v1.rs");
140                    include!("gen/penumbra.core.component.sct.v1.serde.rs");
141                }
142            }
143
144            pub mod shielded_pool {
145                pub mod v1 {
146                    include!("gen/penumbra.core.component.shielded_pool.v1.rs");
147                    include!("gen/penumbra.core.component.shielded_pool.v1.serde.rs");
148                }
149            }
150
151            pub mod stake {
152                pub mod v1 {
153                    include!("gen/penumbra.core.component.stake.v1.rs");
154                    include!("gen/penumbra.core.component.stake.v1.serde.rs");
155                }
156            }
157        }
158
159        pub mod keys {
160            pub mod v1 {
161                include!("gen/penumbra.core.keys.v1.rs");
162                include!("gen/penumbra.core.keys.v1.serde.rs");
163            }
164        }
165
166        pub mod num {
167            pub mod v1 {
168                include!("gen/penumbra.core.num.v1.rs");
169                include!("gen/penumbra.core.num.v1.serde.rs");
170            }
171        }
172
173        /// Transaction structures.
174        pub mod transaction {
175            pub mod v1 {
176                include!("gen/penumbra.core.transaction.v1.rs");
177                include!("gen/penumbra.core.transaction.v1.serde.rs");
178            }
179        }
180    }
181
182    /// Cryptography primitives used by Penumbra.
183    pub mod crypto {
184        pub mod decaf377_fmd {
185            pub mod v1 {
186                include!("gen/penumbra.crypto.decaf377_fmd.v1.rs");
187                include!("gen/penumbra.crypto.decaf377_fmd.v1.serde.rs");
188            }
189        }
190
191        pub mod decaf377_frost {
192            pub mod v1 {
193                include!("gen/penumbra.crypto.decaf377_frost.v1.rs");
194                include!("gen/penumbra.crypto.decaf377_frost.v1.serde.rs");
195            }
196        }
197
198        pub mod decaf377_rdsa {
199            pub mod v1 {
200                include!("gen/penumbra.crypto.decaf377_rdsa.v1.rs");
201                include!("gen/penumbra.crypto.decaf377_rdsa.v1.serde.rs");
202            }
203        }
204
205        pub mod tct {
206            pub mod v1 {
207                include!("gen/penumbra.crypto.tct.v1.rs");
208                include!("gen/penumbra.crypto.tct.v1.serde.rs");
209            }
210        }
211    }
212
213    /// Custody protocol structures.
214    pub mod custody {
215        pub mod threshold {
216            pub mod v1 {
217                include!("gen/penumbra.custody.threshold.v1.rs");
218                include!("gen/penumbra.custody.threshold.v1.serde.rs");
219            }
220        }
221
222        pub mod v1 {
223            include!("gen/penumbra.custody.v1.rs");
224            include!("gen/penumbra.custody.v1.serde.rs");
225        }
226    }
227
228    pub mod util {
229        pub mod tendermint_proxy {
230            pub mod v1 {
231                include!("gen/penumbra.util.tendermint_proxy.v1.rs");
232                include!("gen/penumbra.util.tendermint_proxy.v1.serde.rs");
233            }
234        }
235    }
236
237    pub mod tools {
238        pub mod summoning {
239            pub mod v1 {
240                include!("gen/penumbra.tools.summoning.v1.rs");
241                include!("gen/penumbra.tools.summoning.v1.serde.rs");
242            }
243        }
244    }
245
246    /// View protocol structures.
247    pub mod view {
248        pub mod v1 {
249            include!("gen/penumbra.view.v1.rs");
250            include!("gen/penumbra.view.v1.serde.rs");
251        }
252    }
253}
254
255pub mod tendermint {
256    pub mod crypto {
257        include!("gen/tendermint.crypto.rs");
258    }
259
260    #[allow(clippy::large_enum_variant)]
261    pub mod types {
262        include!("gen/tendermint.types.rs");
263    }
264
265    pub mod version {
266        include!("gen/tendermint.version.rs");
267    }
268
269    pub mod p2p {
270        include!("gen/tendermint.p2p.rs");
271    }
272
273    pub mod abci {
274        include!("gen/tendermint.abci.rs");
275    }
276}
277
278pub mod noble {
279    pub mod forwarding {
280        pub mod v1 {
281            include!("gen/noble.forwarding.v1.rs");
282        }
283    }
284}
285
286pub mod cosmos {
287    pub mod base {
288        pub mod v1beta1 {
289            include!("gen/cosmos.base.v1beta1.rs");
290        }
291
292        pub mod query {
293            pub mod v1beta1 {
294                include!("gen/cosmos.base.query.v1beta1.rs");
295            }
296        }
297
298        pub mod abci {
299            pub mod v1beta1 {
300                include!("gen/cosmos.base.abci.v1beta1.rs");
301            }
302        }
303    }
304
305    pub mod auth {
306        pub mod v1beta1 {
307            include!("gen/cosmos.auth.v1beta1.rs");
308        }
309    }
310
311    pub mod bank {
312        pub mod v1beta1 {
313            include!("gen/cosmos.bank.v1beta1.rs");
314        }
315    }
316
317    pub mod tx {
318        pub mod v1beta1 {
319            include!("gen/cosmos.tx.v1beta1.rs");
320        }
321
322        pub mod config {
323            pub mod v1 {
324                include!("gen/cosmos.tx.config.v1.rs");
325            }
326        }
327
328        pub mod signing {
329            pub mod v1beta1 {
330                include!("gen/cosmos.tx.signing.v1beta1.rs");
331            }
332        }
333    }
334
335    pub mod crypto {
336        pub mod multisig {
337            pub mod v1beta1 {
338                include!("gen/cosmos.crypto.multisig.v1beta1.rs");
339            }
340        }
341    }
342}
343
344#[cfg(feature = "rpc")]
345// https://github.com/penumbra-zone/penumbra/issues/3038#issuecomment-1722534133
346pub const FILE_DESCRIPTOR_SET: &[u8] = include_bytes!("gen/proto_descriptor.bin.no_lfs");