//! Test utilities for the `kona-plasma` crate. use crate::{ traits::PlasmaInputFetcher, types::{FinalizedHeadSignal, PlasmaError}, }; use alloc::{boxed::Box, vec::Vec}; use alloy_primitives::Bytes; use async_trait::async_trait; use kona_derive::traits::test_utils::TestChainProvider; use kona_primitives::{BlockID, BlockInfo, SystemConfig}; /// A mock plasma input fetcher for testing. #[derive(Debug, Clone, Default)] pub struct TestPlasmaInputFetcher { /// Inputs to return. pub inputs: Vec>, /// Advance L1 origin results. pub advances: Vec>, /// Reset results. pub resets: Vec>, } #[async_trait] impl PlasmaInputFetcher for TestPlasmaInputFetcher { async fn get_input( &mut self, _fetcher: &TestChainProvider, _commitment: Bytes, _block: BlockID, ) -> Option> { self.inputs.pop() } async fn advance_l1_origin( &mut self, _fetcher: &TestChainProvider, _block: BlockID, ) -> Option> { self.advances.pop() } async fn reset( &mut self, _block_number: BlockInfo, _cfg: SystemConfig, ) -> Option> { self.resets.pop() } async fn finalize(&mut self, _block_number: BlockInfo) -> Option> { None } fn on_finalized_head_signal(&mut self, _block_number: FinalizedHeadSignal) {} }