Skip to main content

drive_abci/abci/app/
mod.rs

1use crate::error::Error;
2use crate::platform_types::platform::Platform;
3use drive::grovedb::Transaction;
4use std::sync::RwLock;
5
6mod check_tx;
7mod consensus;
8/// Convert state transition execution result into ABCI response
9pub mod execution_result;
10mod full;
11
12use crate::execution::types::block_execution_context::BlockExecutionContext;
13use crate::platform_types::withdrawal::unsigned_withdrawal_txs_by_round::UnsignedWithdrawalTxsByRound;
14use crate::rpc::core::DefaultCoreRPC;
15#[cfg(test)]
16pub(crate) use check_tx::error_into_status;
17pub use check_tx::CheckTxAbciApplication;
18pub use consensus::ConsensusAbciApplication;
19use dpp::version::PlatformVersion;
20pub use full::FullAbciApplication;
21
22/// Platform-based ABCI application
23pub trait PlatformApplication<C = DefaultCoreRPC> {
24    /// Returns Platform
25    fn platform(&self) -> &Platform<C>;
26}
27
28/// Transactional ABCI application
29pub trait TransactionalApplication<'a> {
30    /// Creates and keeps a new transaction
31    fn start_transaction(&self);
32
33    /// Returns the current transaction
34    fn transaction(&self) -> &RwLock<Option<Transaction<'a>>>;
35
36    /// Commits created transaction
37    fn commit_transaction(&self, platform_version: &PlatformVersion) -> Result<(), Error>;
38}
39
40/// Application that executes blocks and need to keep context between handlers
41pub trait BlockExecutionApplication {
42    /// Returns the current block execution context
43    fn block_execution_context(&self) -> &RwLock<Option<BlockExecutionContext>>;
44
45    /// Returns the unsigned withdrawal transactions of every proposal accepted at the current
46    /// height, by round, which vote extensions are verified against
47    fn unsigned_withdrawal_txs_by_round(&self) -> &RwLock<UnsignedWithdrawalTxsByRound>;
48}