gemachain_program/message/
mod.rs

1//! A library for generating a message from a sequence of instructions
2
3pub mod legacy;
4
5#[cfg(not(target_arch = "bpf"))]
6#[path = ""]
7mod non_bpf_modules {
8    mod mapped;
9    mod sanitized;
10    pub mod v0;
11    mod versions;
12
13    pub use mapped::*;
14    pub use sanitized::*;
15    pub use versions::*;
16}
17
18pub use legacy::Message;
19
20#[cfg(not(target_arch = "bpf"))]
21pub use non_bpf_modules::*;
22
23/// The length of a message header in bytes
24pub const MESSAGE_HEADER_LENGTH: usize = 3;
25
26#[derive(Serialize, Deserialize, Default, Debug, PartialEq, Eq, Clone, AbiExample)]
27#[serde(rename_all = "camelCase")]
28pub struct MessageHeader {
29    /// The number of signatures required for this message to be considered valid. The
30    /// signatures must match the first `num_required_signatures` of `account_keys`.
31    /// NOTE: Serialization-related changes must be paired with the direct read at sigverify.
32    pub num_required_signatures: u8,
33
34    /// The last num_readonly_signed_accounts of the signed keys are read-only accounts. Programs
35    /// may process multiple transactions that load read-only accounts within a single PoH entry,
36    /// but are not permitted to credit or debit carats or modify account data. Transactions
37    /// targeting the same read-write account are evaluated sequentially.
38    pub num_readonly_signed_accounts: u8,
39
40    /// The last num_readonly_unsigned_accounts of the unsigned keys are read-only accounts.
41    pub num_readonly_unsigned_accounts: u8,
42}