pub struct MessageHeader {
pub version: u32,
pub source_domain: DomainId,
pub destination_domain: DomainId,
pub nonce: FixedBytes<32>,
pub sender: FixedBytes<32>,
pub recipient: FixedBytes<32>,
pub destination_caller: FixedBytes<32>,
pub min_finality_threshold: u32,
pub finality_threshold_executed: u32,
}Expand description
CCTP v2 Message Header
The message header contains metadata about cross-chain messages, including source/destination domains, finality requirements, and routing.
§Format
- version: uint32 (4 bytes)
- sourceDomain: uint32 (4 bytes)
- destinationDomain: uint32 (4 bytes)
- nonce: bytes32 (32 bytes) - unique identifier assigned by Circle
- sender: bytes32 (32 bytes) - message sender address
- recipient: bytes32 (32 bytes) - message recipient address
- destinationCaller: bytes32 (32 bytes) - authorized caller on destination
- minFinalityThreshold: uint32 (4 bytes) - minimum required finality
- finalityThresholdExecuted: uint32 (4 bytes) - actual finality level
Total fixed size: 4 + 4 + 4 + 32 + 32 + 32 + 32 + 4 + 4 = 148 bytes
Fields§
§version: u32Message format version
source_domain: DomainIdSource blockchain domain ID
destination_domain: DomainIdDestination blockchain domain ID
nonce: FixedBytes<32>Unique message nonce assigned by Circle
sender: FixedBytes<32>Address that sent the message (padded to 32 bytes)
recipient: FixedBytes<32>Address that will receive the message (padded to 32 bytes)
destination_caller: FixedBytes<32>Address authorized to call receiveMessage on destination (0 = anyone)
min_finality_threshold: u32Minimum finality threshold required (1000 = Fast, 2000 = Standard)
finality_threshold_executed: u32Actual finality threshold when message was attested
Implementations§
Source§impl MessageHeader
impl MessageHeader
Sourcepub fn new(
version: u32,
source_domain: DomainId,
destination_domain: DomainId,
nonce: FixedBytes<32>,
sender: FixedBytes<32>,
recipient: FixedBytes<32>,
destination_caller: FixedBytes<32>,
min_finality_threshold: u32,
finality_threshold_executed: u32,
) -> Self
pub fn new( version: u32, source_domain: DomainId, destination_domain: DomainId, nonce: FixedBytes<32>, sender: FixedBytes<32>, recipient: FixedBytes<32>, destination_caller: FixedBytes<32>, min_finality_threshold: u32, finality_threshold_executed: u32, ) -> Self
Creates a new message header
Sourcepub fn encode(&self) -> Bytes
pub fn encode(&self) -> Bytes
Encodes the message header to bytes
The encoding follows Circle’s v2 message format specification.
Sourcepub fn decode(bytes: &[u8]) -> Option<Self>
pub fn decode(bytes: &[u8]) -> Option<Self>
Decodes a message header from bytes
Returns None if the bytes are not at least MessageHeader::SIZE bytes long
or if domain IDs are invalid.
Trait Implementations§
Source§impl Clone for MessageHeader
impl Clone for MessageHeader
Source§fn clone(&self) -> MessageHeader
fn clone(&self) -> MessageHeader
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for MessageHeader
impl Debug for MessageHeader
Source§impl PartialEq for MessageHeader
impl PartialEq for MessageHeader
impl Eq for MessageHeader
impl StructuralPartialEq for MessageHeader
Auto Trait Implementations§
impl Freeze for MessageHeader
impl RefUnwindSafe for MessageHeader
impl Send for MessageHeader
impl Sync for MessageHeader
impl Unpin for MessageHeader
impl UnwindSafe for MessageHeader
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more