1c0e57d984
This commit systematically rebrands various references from Parity Technologies' Polkadot/Substrate ecosystem to PezkuwiChain within the kurdistan-sdk. Key changes include: - Updated external repository URLs (zombienet-sdk, parity-db, parity-scale-codec, wasm-instrument) to point to pezkuwichain forks. - Modified internal documentation and code comments to reflect PezkuwiChain naming and structure. - Replaced direct references to with or specific paths within the for XCM, Pezkuwi, and other modules. - Cleaned up deprecated issue and PR references in various and files, particularly in and modules. - Adjusted image and logo URLs in documentation to point to PezkuwiChain assets. - Removed or rephrased comments related to external Polkadot/Substrate PRs and issues. This is a significant step towards fully customizing the SDK for the PezkuwiChain ecosystem.
51 lines
1.6 KiB
Rust
51 lines
1.6 KiB
Rust
// SPDX-License-Identifier: Apache-2.0
|
|
// SPDX-FileCopyrightText: 2023 Snowfork <hello@snowfork.com>
|
|
use snowbridge_core::ChannelId;
|
|
use snowbridge_inbound_queue_primitives::Log;
|
|
|
|
use pezsp_core::{RuntimeDebug, H160, H256};
|
|
use pezsp_std::prelude::*;
|
|
|
|
use alloy_core::{primitives::B256, sol, sol_types::SolEvent};
|
|
|
|
sol! {
|
|
event OutboundMessageAccepted(bytes32 indexed channel_id, uint64 nonce, bytes32 indexed message_id, bytes payload);
|
|
}
|
|
|
|
/// An inbound message that has had its outer envelope decoded.
|
|
#[derive(Clone, RuntimeDebug)]
|
|
pub struct Envelope {
|
|
/// The address of the outbound queue on Ethereum that emitted this message as an event log
|
|
pub gateway: H160,
|
|
/// The message Channel
|
|
pub channel_id: ChannelId,
|
|
/// A nonce for enforcing replay protection and ordering.
|
|
pub nonce: u64,
|
|
/// An id for tracing the message on its route (has no role in bridge consensus)
|
|
pub message_id: H256,
|
|
/// The inner payload generated from the source application.
|
|
pub payload: Vec<u8>,
|
|
}
|
|
|
|
#[derive(Copy, Clone, RuntimeDebug)]
|
|
pub struct EnvelopeDecodeError;
|
|
|
|
impl TryFrom<&Log> for Envelope {
|
|
type Error = EnvelopeDecodeError;
|
|
|
|
fn try_from(log: &Log) -> Result<Self, Self::Error> {
|
|
let topics: Vec<B256> = log.topics.iter().map(|x| B256::from_slice(x.as_ref())).collect();
|
|
|
|
let event = OutboundMessageAccepted::decode_raw_log_validate(topics, &log.data)
|
|
.map_err(|_| EnvelopeDecodeError)?;
|
|
|
|
Ok(Self {
|
|
gateway: log.address,
|
|
channel_id: ChannelId::from(event.channel_id.as_ref()),
|
|
nonce: event.nonce,
|
|
message_id: H256::from(event.message_id.as_ref()),
|
|
payload: event.payload.into(),
|
|
})
|
|
}
|
|
}
|