Struct solders_message::MessageHeader
source · pub struct MessageHeader(/* private fields */);
Expand description
Describes the organization of a :class:Message
’s account keys.
Every :class:~solders.instruction.Instruction
specifies which accounts it may reference, or
otherwise requires specific permissions of. Those specifications are:
whether the account is read-only, or read-write; and whether the account
must have signed the transaction containing the instruction.
Whereas an individual Instruction
contains a list of all accounts they may
access, along with their required permissions, a Message
contains a
single shared flat list of all accounts required by all instructions in
a transaction. When building a Message
, this flat list is created and
each Instruction
is converted to :class:~solders.instruction.CompiledInstruction
. Each
CompiledInstruction
then references by index the accounts they require in
the single shared account list.
The shared account list is ordered by the permissions required of the accounts:
- accounts that are writable and signers
- accounts that are read-only and signers
- accounts that are writable and not signers
- accounts that are read-only and not signers
Given this ordering, the fields of MessageHeader
describe which accounts
in a transaction require which permissions.
When multiple transactions access the same read-only accounts, the runtime
may process them in parallel, in a single
PoH <https://docs.solana.com/cluster/synchronization>
_ entry.
Transactions that access the same read-write accounts are processed sequentially.
Args:
num_required_signatures (int): The number of signatures required for this message
to be considered valid. The signers of those signatures must match the
first num_required_signatures
of :attr:Message.account_keys
.
num_readonly_signed_accounts (int): The last num_readonly_signed_accounts
of
the signed keys are read-only accounts.
num_readonly_unsigned_accounts (int): The last num_readonly_unsigned_accounts
of the unsigned keys are read-only accounts.
Implementations§
source§impl MessageHeader
impl MessageHeader
pub fn new( num_required_signatures: u8, num_readonly_signed_accounts: u8, num_readonly_unsigned_accounts: u8 ) -> Self
sourcepub fn new_default() -> Self
pub fn new_default() -> Self
Create a new default MessageHeader
.
Returns:
MessageHeader: default MessageHeader
.
pub fn num_required_signatures(&self) -> u8
pub fn num_readonly_signed_accounts(&self) -> u8
pub fn num_readonly_unsigned_accounts(&self) -> u8
pub fn __richcmp__(&self, other: &Self, op: CompareOp) -> PyResult<bool>
pub fn __bytes__<'a>(&self, py: Python<'a>) -> &'a PyBytes
pub fn __str__(&self) -> String
pub fn __repr__(&self) -> String
pub fn __reduce__(&self) -> PyResult<(PyObject, PyObject)>
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 CommonMethods<'_> for MessageHeader
impl CommonMethods<'_> for MessageHeader
fn py_to_json(&self) -> String
fn py_from_json(raw: &'a str) -> Result<Self, PyErr>
source§impl CommonMethodsCore for MessageHeader
impl CommonMethodsCore for MessageHeader
source§impl Debug for MessageHeader
impl Debug for MessageHeader
source§impl Default for MessageHeader
impl Default for MessageHeader
source§fn default() -> MessageHeader
fn default() -> MessageHeader
source§impl<'de> Deserialize<'de> for MessageHeader
impl<'de> Deserialize<'de> for MessageHeader
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
source§impl Display for MessageHeader
impl Display for MessageHeader
source§impl From<MessageHeader> for MessageHeader
impl From<MessageHeader> for MessageHeader
source§fn from(original: MessageHeaderOriginal) -> MessageHeader
fn from(original: MessageHeaderOriginal) -> MessageHeader
source§impl From<MessageHeader> for MessageHeader
impl From<MessageHeader> for MessageHeader
source§fn from(original: MessageHeader) -> Self
fn from(original: MessageHeader) -> Self
source§impl PartialEq for MessageHeader
impl PartialEq for MessageHeader
source§fn eq(&self, other: &MessageHeader) -> bool
fn eq(&self, other: &MessageHeader) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl PyBytesBincode for MessageHeader
impl PyBytesBincode for MessageHeader
fn pybytes_bincode<'a>(&self, py: Python<'a>) -> &'a PyBytes
source§impl PyBytesGeneral for MessageHeader
impl PyBytesGeneral for MessageHeader
fn pybytes_general<'a>(&self, py: Python<'a>) -> &'a PyBytes
source§impl PyClassImpl for MessageHeader
impl PyClassImpl for MessageHeader
source§const IS_BASETYPE: bool = true
const IS_BASETYPE: bool = true
source§const IS_SUBCLASS: bool = false
const IS_SUBCLASS: bool = false
source§const IS_MAPPING: bool = false
const IS_MAPPING: bool = false
source§const IS_SEQUENCE: bool = false
const IS_SEQUENCE: bool = false
§type Layout = PyCell<MessageHeader>
type Layout = PyCell<MessageHeader>
§type ThreadChecker = ThreadCheckerStub<MessageHeader>
type ThreadChecker = ThreadCheckerStub<MessageHeader>
§type PyClassMutability = <<PyAny as PyClassBaseType>::PyClassMutability as PyClassMutability>::MutableChild
type PyClassMutability = <<PyAny as PyClassBaseType>::PyClassMutability as PyClassMutability>::MutableChild
§type BaseNativeType = PyAny
type BaseNativeType = PyAny
PyAny
by default, and when you declare
#[pyclass(extends=PyDict)]
, it’s PyDict
.fn items_iter() -> PyClassItemsIter
fn lazy_type_object() -> &'static LazyTypeObject<Self>
fn dict_offset() -> Option<isize>
fn weaklist_offset() -> Option<isize>
source§impl PyClassNewTextSignature<MessageHeader> for PyClassImplCollector<MessageHeader>
impl PyClassNewTextSignature<MessageHeader> for PyClassImplCollector<MessageHeader>
fn new_text_signature(self) -> Option<&'static str>
source§impl PyFromBytesBincode<'_> for MessageHeader
impl PyFromBytesBincode<'_> for MessageHeader
source§impl PyFromBytesGeneral for MessageHeader
impl PyFromBytesGeneral for MessageHeader
fn py_from_bytes_general(raw: &[u8]) -> PyResult<Self>
source§impl<'a, 'py> PyFunctionArgument<'a, 'py> for &'a MessageHeader
impl<'a, 'py> PyFunctionArgument<'a, 'py> for &'a MessageHeader
source§impl<'a, 'py> PyFunctionArgument<'a, 'py> for &'a mut MessageHeader
impl<'a, 'py> PyFunctionArgument<'a, 'py> for &'a mut MessageHeader
source§impl PyMethods<MessageHeader> for PyClassImplCollector<MessageHeader>
impl PyMethods<MessageHeader> for PyClassImplCollector<MessageHeader>
fn py_methods(self) -> &'static PyClassItems
source§impl PyTypeInfo for MessageHeader
impl PyTypeInfo for MessageHeader
§type AsRefTarget = PyCell<MessageHeader>
type AsRefTarget = PyCell<MessageHeader>
source§fn type_object_raw(py: Python<'_>) -> *mut PyTypeObject
fn type_object_raw(py: Python<'_>) -> *mut PyTypeObject
source§fn type_object(py: Python<'_>) -> &PyType
fn type_object(py: Python<'_>) -> &PyType
source§fn is_type_of(object: &PyAny) -> bool
fn is_type_of(object: &PyAny) -> bool
object
is an instance of this type or a subclass of this type.source§fn is_exact_type_of(object: &PyAny) -> bool
fn is_exact_type_of(object: &PyAny) -> bool
object
is an instance of this type.