#![cfg_attr(not(feature = "std"), no_std)]
use codec::{Decode, DecodeWithMemTracking, Encode};
use pezframe_support::PalletError;
use pezsnowbridge_beacon_primitives::{BeaconHeader, ExecutionProof};
use pezsp_core::{RuntimeDebug, H160, H256};
use pezsp_std::prelude::*;
use scale_info::TypeInfo;
pub trait Verifier {
fn verify(event: &Log, proof: &Proof) -> Result<(), VerificationError>;
}
#[derive(Clone, Encode, Decode, DecodeWithMemTracking, RuntimeDebug, PalletError, TypeInfo)]
#[cfg_attr(feature = "std", derive(PartialEq))]
pub enum VerificationError {
HeaderNotFound,
LogNotFound,
InvalidLog,
InvalidProof,
InvalidExecutionProof(#[codec(skip)] &'static str),
}
#[derive(Clone, Encode, Decode, DecodeWithMemTracking, PartialEq, RuntimeDebug, TypeInfo)]
pub struct EventProof {
pub event_log: Log,
pub proof: Proof,
}
#[derive(Clone, Encode, Decode, DecodeWithMemTracking, PartialEq, RuntimeDebug, TypeInfo)]
pub struct Log {
pub address: H160,
pub topics: Vec<H256>,
pub data: Vec<u8>,
}
#[derive(Clone, Encode, Decode, DecodeWithMemTracking, PartialEq, RuntimeDebug, TypeInfo)]
pub struct Proof {
pub receipt_proof: (Vec<Vec<u8>>, Vec<Vec<u8>>),
pub execution_proof: ExecutionProof,
}
#[derive(Clone, RuntimeDebug)]
pub struct EventFixture {
pub event: EventProof,
pub finalized_header: BeaconHeader,
pub block_roots_root: H256,
}