use crate::InteropValidationError;
use alloc::{boxed::Box, vec::Vec};
use alloy_consensus::Header;
use alloy_primitives::{B256, ChainId};
use async_trait::async_trait;
use core::error::Error;
use kona_protocol::BlockInfo;
use op_alloy_consensus::OpReceiptEnvelope;
#[async_trait]
pub trait InteropProvider {
type Error: Error;
async fn header_by_number(&self, chain_id: u64, number: u64) -> Result<Header, Self::Error>;
async fn receipts_by_number(
&self,
chain_id: u64,
number: u64,
) -> Result<Vec<OpReceiptEnvelope>, Self::Error>;
async fn receipts_by_hash(
&self,
chain_id: u64,
block_hash: B256,
) -> Result<Vec<OpReceiptEnvelope>, Self::Error>;
}
pub trait InteropValidator: Send + Sync {
fn validate_interop_timestamps(
&self,
initiating_chain_id: ChainId,
initiating_timestamp: u64,
executing_chain_id: ChainId,
executing_timestamp: u64,
timeout: Option<u64>,
) -> Result<(), InteropValidationError>;
fn is_post_interop(&self, chain_id: ChainId, timestamp: u64) -> bool;
fn is_interop_activation_block(&self, chain_id: ChainId, block: BlockInfo) -> bool;
}