celestia-core 0.34.0

This is a hard fork of tendermint to make it compatible with Celestia network. Tendermint is a high-performance blockchain consensus engine that powers Byzantine fault tolerant applications written in any programming language. This crate provides core types for representing information about Tendermint blockchain networks, including chain information types, secret connections, and remote procedure calls (JSON-RPC).
Documentation
use super::super::Event;
use crate::prelude::*;

#[doc = include_str!("../doc/response-beginblock.md")]
#[derive(Clone, PartialEq, Eq, Debug, Default)]
pub struct BeginBlock {
    /// Events that occurred while beginning the block.
    pub events: Vec<Event>,
}

// =============================================================================
// Protobuf conversions
// =============================================================================

tendermint_pb_modules! {
    use super::BeginBlock;

    impl From<BeginBlock> for pb::abci::ResponseBeginBlock {
        fn from(begin_block: BeginBlock) -> Self {
            Self {
                events: begin_block.events.into_iter().map(Into::into).collect(),
            }
        }
    }

    impl TryFrom<pb::abci::ResponseBeginBlock> for BeginBlock {
        type Error = crate::Error;

        fn try_from(begin_block: pb::abci::ResponseBeginBlock) -> Result<Self, Self::Error> {
            Ok(Self {
                events: begin_block
                    .events
                    .into_iter()
                    .map(TryInto::try_into)
                    .collect::<Result<_, _>>()?,
            })
        }
    }

    impl Protobuf<pb::abci::ResponseBeginBlock> for BeginBlock {}
}