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§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 PyClass for MessageHeader
impl PyClass for MessageHeader
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
Source§type ThreadChecker = SendablePyClass<MessageHeader>
type ThreadChecker = SendablePyClass<MessageHeader>
Source§type PyClassMutability = <<PyAny as PyClassBaseType>::PyClassMutability as PyClassMutability>::MutableChild
type PyClassMutability = <<PyAny as PyClassBaseType>::PyClassMutability as PyClassMutability>::MutableChild
Source§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
Source§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.Source§impl RichcmpEqualityOnly for MessageHeader
impl RichcmpEqualityOnly for MessageHeader
Source§impl Serialize for MessageHeader
impl Serialize 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> AbiEnumVisitor for T
impl<T> AbiEnumVisitor for T
default fn visit_for_abi( &self, _digester: &mut AbiDigester, ) -> Result<AbiDigester, DigestError>
Source§impl<T> AbiEnumVisitor for T
impl<T> AbiEnumVisitor for T
default fn visit_for_abi( &self, digester: &mut AbiDigester, ) -> Result<AbiDigester, DigestError>
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§impl<'a, T> FromPyObject<'a> for T
impl<'a, T> FromPyObject<'a> for T
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