Files
pezkuwi-sdk/pezbridges/pezsnowbridge/primitives/verification/src/lib.rs
T
Kurdistan Tech Ministry 3ddf58cef9 fix: EnsureOrigin try_successful_origin and snowbridge rename
- Fix pezpallet-welati EnsureOrigin implementations (3 fixes)
  - Remove incorrect #[cfg(not(feature = "runtime-benchmarks"))] blocks
  - Affects EnsureSerok, EnsureParlementer, EnsureDiwan

- Fix asset-hub-zagros governance origins macros (2 fixes)
  - Remove non-benchmark try_successful_origin from decl_unit_ensures!
  - Remove non-benchmark try_successful_origin from decl_ensure!

- Rename snowbridge -> pezsnowbridge for consistency

- Update WORKFLOW_PLAN.md with build status and package names
  - Correct package names: pezkuwi-teyrchain-bin, pezstaging-node-cli
  - Mark completed builds: pezkuwi, pezkuwi-teyrchain-bin,
    pezstaging-node-cli, teyrchain-template-node
2025-12-25 01:26:18 +03:00

64 lines
2.1 KiB
Rust

// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: 2023 Snowfork <hello@snowfork.com>
//! Types for representing inbound messages
#![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;
/// A trait for verifying inbound messages from Ethereum.
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 {
/// Execution header is missing
HeaderNotFound,
/// Event log was not found in the verified transaction receipt
LogNotFound,
/// Event log has an invalid format
InvalidLog,
/// Unable to verify the transaction receipt with the provided proof
InvalidProof,
/// Unable to verify the execution header with ancestry proof
InvalidExecutionProof(#[codec(skip)] &'static str),
}
/// A bridge message from the Gateway contract on Ethereum
#[derive(Clone, Encode, Decode, DecodeWithMemTracking, PartialEq, RuntimeDebug, TypeInfo)]
pub struct EventProof {
/// Event log emitted by Gateway contract
pub event_log: Log,
/// Inclusion proof for a transaction receipt containing the event log
pub proof: Proof,
}
/// Event log
#[derive(Clone, Encode, Decode, DecodeWithMemTracking, PartialEq, RuntimeDebug, TypeInfo)]
pub struct Log {
pub address: H160,
pub topics: Vec<H256>,
pub data: Vec<u8>,
}
/// Inclusion proof for a transaction receipt
#[derive(Clone, Encode, Decode, DecodeWithMemTracking, PartialEq, RuntimeDebug, TypeInfo)]
pub struct Proof {
// Proof keys and values (receipts tree)
pub receipt_proof: (Vec<Vec<u8>>, Vec<Vec<u8>>),
// Proof that an execution header was finalized by the beacon chain
pub execution_proof: ExecutionProof,
}
#[derive(Clone, RuntimeDebug)]
pub struct EventFixture {
pub event: EventProof,
pub finalized_header: BeaconHeader,
pub block_roots_root: H256,
}