Skip to main content

forest/blocks/
mod.rs

1// Copyright 2019-2026 ChainSafe Systems
2// SPDX-License-Identifier: Apache-2.0, MIT
3
4use std::borrow::Cow;
5use thiserror::Error;
6
7mod block;
8#[cfg(test)]
9mod chain4u;
10mod election_proof;
11mod gossip_block;
12mod header;
13mod ticket;
14#[cfg(not(doc))]
15mod tipset;
16#[cfg(doc)]
17pub mod tipset;
18mod vrf_proof;
19
20pub use block::{BLOCK_MESSAGE_LIMIT, Block, TxMeta};
21pub use election_proof::ElectionProof;
22pub use gossip_block::GossipBlock;
23pub use header::{CachingBlockHeader, RawBlockHeader};
24pub use ticket::Ticket;
25pub use tipset::{CreateTipsetError, FullTipset, Tipset, TipsetKey, TipsetLike};
26pub use vrf_proof::VRFProof;
27
28/// Blockchain blocks error
29#[derive(Debug, PartialEq, Eq, Error)]
30pub enum Error {
31    /// Invalid signature
32    #[error("Invalid signature: {0}")]
33    InvalidSignature(Cow<'static, str>),
34    /// Error in validating arbitrary data
35    #[error("Error validating data: {0}")]
36    Validation(Cow<'static, str>),
37}
38
39#[cfg(test)]
40pub(crate) use chain4u::{Chain4U, HeaderBuilder, chain4u};
41
42#[cfg(any(test, doc))]
43mod tests {
44
45    mod serialization_vectors;
46    mod ticket_test;
47}