Entry

Struct Entry 

Source
pub struct Entry {
    pub num_hashes: u64,
    pub hash: Hash,
    pub transactions: Vec<VersionedTransaction>,
}
๐Ÿ‘ŽDeprecated since 3.1.0: This crate has been marked for formal inclusion in the Agave Unstable API. From v4.0.0 onward, the agave-unstable-api crate feature must be specified to acknowledge use of an interface that may break without warning.
Expand description

Each Entry contains three pieces of data. The num_hashes field is the number of hashes performed since the previous entry. The hash field is the result of hashing hash from the previous entry num_hashes times. The transactions field points to Transactions that took place shortly before hash was generated.

If you multiply num_hashes by the amount of time it takes to generate a new hash, you get a duration estimate since the last Entry. Since processing power increases over time, one should expect the duration num_hashes represents to decrease proportionally. An upper bound on Duration can be estimated by assuming each hash was generated by the worldโ€™s fastest processor at the time the entry was recorded. Or said another way, it is physically not possible for a shorter duration to have occurred if one assumes the hash was computed by the worldโ€™s fastest processor at that time. The hash chain is both a Verifiable Delay Function (VDF) and a Proof of Work (not to be confused with Proof of Work consensus!)

The solana core protocol currently requires an Entry to contain transactions that are executable in parallel. Implemented in:

  • For TPU: solana_core::banking_stage::BankingStage::process_and_record_transactions()
  • For TVU: solana_core::replay_stage::ReplayStage::replay_blockstore_into_bank()

Until SIMD83 is activated: All transactions in the transactions field have to follow the read/write locking restrictions with regard to the accounts they reference. A single account can be either written by a single transaction, or read by one or more transactions, but not both. This enforcement is done via a call to solana_runtime::accounts::Accounts::lock_accounts() with the txs argument holding all the transactions in the Entry.

Fieldsยง

ยงnum_hashes: u64
๐Ÿ‘ŽDeprecated since 3.1.0: This crate has been marked for formal inclusion in the Agave Unstable API. From v4.0.0 onward, the agave-unstable-api crate feature must be specified to acknowledge use of an interface that may break without warning.

The number of hashes since the previous Entry ID.

ยงhash: Hash
๐Ÿ‘ŽDeprecated since 3.1.0: This crate has been marked for formal inclusion in the Agave Unstable API. From v4.0.0 onward, the agave-unstable-api crate feature must be specified to acknowledge use of an interface that may break without warning.

The SHA-256 hash num_hashes after the previous Entry ID.

ยงtransactions: Vec<VersionedTransaction>
๐Ÿ‘ŽDeprecated since 3.1.0: This crate has been marked for formal inclusion in the Agave Unstable API. From v4.0.0 onward, the agave-unstable-api crate feature must be specified to acknowledge use of an interface that may break without warning.

An unordered list of transactions that were observed before the Entry ID was generated. They may have been observed before a previous Entry ID but were pushed back into this list to ensure deterministic interpretation of the ledger.

Implementationsยง

Sourceยง

impl Entry

Source

pub fn new( prev_hash: &Hash, num_hashes: u64, transactions: Vec<Transaction>, ) -> Self

๐Ÿ‘ŽDeprecated since 3.1.0: This crate has been marked for formal inclusion in the Agave Unstable API. From v4.0.0 onward, the agave-unstable-api crate feature must be specified to acknowledge use of an interface that may break without warning.

Creates the next Entry num_hashes after start_hash.

Source

pub fn new_mut( start_hash: &mut Hash, num_hashes: &mut u64, transactions: Vec<Transaction>, ) -> Self

๐Ÿ‘ŽDeprecated since 3.1.0: This crate has been marked for formal inclusion in the Agave Unstable API. From v4.0.0 onward, the agave-unstable-api crate feature must be specified to acknowledge use of an interface that may break without warning.
Source

pub fn verify(&self, start_hash: &Hash) -> bool

๐Ÿ‘ŽDeprecated since 3.1.0: This crate has been marked for formal inclusion in the Agave Unstable API. From v4.0.0 onward, the agave-unstable-api crate feature must be specified to acknowledge use of an interface that may break without warning.

Verifies self.hash is the result of hashing a start_hash self.num_hashes times. If the transaction is not a Tick, then hash that as well.

Source

pub fn is_tick(&self) -> bool

๐Ÿ‘ŽDeprecated since 3.1.0: This crate has been marked for formal inclusion in the Agave Unstable API. From v4.0.0 onward, the agave-unstable-api crate feature must be specified to acknowledge use of an interface that may break without warning.

Trait Implementationsยง

Sourceยง

impl Clone for Entry

Sourceยง

fn clone(&self) -> Entry

Returns a duplicate of the value. Read more
1.0.0 ยท Sourceยง

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Sourceยง

impl Debug for Entry

Sourceยง

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Sourceยง

impl Default for Entry

Sourceยง

fn default() -> Entry

Returns the โ€œdefault valueโ€ for a type. Read more
Sourceยง

impl<'de> Deserialize<'de> for Entry

Sourceยง

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Sourceยง

impl From<&Entry> for EntrySummary

Sourceยง

fn from(entry: &Entry) -> Self

Converts to this type from the input type.
Sourceยง

impl PartialEq for Entry

Sourceยง

fn eq(&self, other: &Entry) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 ยท Sourceยง

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Sourceยง

impl<'de> SchemaRead<'de> for Entry

Sourceยง

type Dst = Entry

Sourceยง

fn read( reader: &mut Reader<'de>, dst: &mut MaybeUninit<Self::Dst>, ) -> ReadResult<()>

Read into dst from reader. Read more
Sourceยง

fn get(reader: &mut Reader<'de>) -> Result<Self::Dst, ReadError>

Read Self::Dst from reader into a new Self::Dst.
Sourceยง

impl SchemaWrite for Entry

Sourceยง

type Src = Entry

Sourceยง

fn size_of(src: &Self::Src) -> WriteResult<usize>

Get the serialized size of Self::Src.
Sourceยง

fn write(writer: &mut Writer<'_>, src: &Self::Src) -> WriteResult<()>

Write Self::Src to writer.
Sourceยง

impl Serialize for Entry

Sourceยง

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Sourceยง

impl Eq for Entry

Sourceยง

impl StructuralPartialEq for Entry

Auto Trait Implementationsยง

Blanket Implementationsยง

Sourceยง

impl<T> Any for T
where T: 'static + ?Sized,

Sourceยง

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Sourceยง

impl<T> Borrow<T> for T
where T: ?Sized,

Sourceยง

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Sourceยง

impl<T> BorrowMut<T> for T
where T: ?Sized,

Sourceยง

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Sourceยง

impl<T> CloneToUninit for T
where T: Clone,

Sourceยง

unsafe fn clone_to_uninit(&self, dest: *mut u8)

๐Ÿ”ฌThis is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Sourceยง

impl<'de, T> Deserialize<'de> for T
where T: SchemaRead<'de>,

Sourceยง

fn deserialize(bytes: &'de [u8]) -> Result<Self::Dst, ReadError>

Deserialize bytes into a new Self::Dst.
Sourceยง

fn deserialize_into( bytes: &'de [u8], target: &mut MaybeUninit<Self::Dst>, ) -> Result<(), ReadError>

Deserialize bytes into target.
Sourceยง

impl<T> Encode for T
where T: Serialize + ?Sized,

Sourceยง

fn encode<W>(&self, writer: W) -> Result<(), Box<ErrorKind>>
where W: Write,

Sourceยง

impl<T> From<T> for T

Sourceยง

fn from(t: T) -> T

Returns the argument unchanged.

Sourceยง

impl<T> Instrument for T

Sourceยง

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Sourceยง

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Sourceยง

impl<T, U> Into<U> for T
where U: From<T>,

Sourceยง

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Sourceยง

impl<T> IntoEither for T

Sourceยง

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Sourceยง

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Sourceยง

impl<T> Pointable for T

Sourceยง

const ALIGN: usize

The alignment of pointer.
Sourceยง

type Init = T

The type for initializers.
Sourceยง

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Sourceยง

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Sourceยง

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Sourceยง

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Sourceยง

impl<T> PolicyExt for T
where T: ?Sized,

Sourceยง

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Sourceยง

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Sourceยง

impl<T> Same for T

Sourceยง

type Output = T

Should always be Self
Sourceยง

impl<T> Serialize for T
where T: SchemaWrite + ?Sized,

Sourceยง

fn serialize(src: &Self::Src) -> Result<Vec<u8>, WriteError>

Serialize a serializable type into a Vec of bytes.
Sourceยง

fn serialize_into( src: &Self::Src, target: &mut [MaybeUninit<u8>], ) -> Result<usize, WriteError>

Serialize a serializable type into the given byte buffer. Read more
Sourceยง

fn serialized_size(src: &Self::Src) -> Result<u64, WriteError>

Get the size in bytes of the type when serialized.
Sourceยง

impl<T> ToOwned for T
where T: Clone,

Sourceยง

type Owned = T

The resulting type after obtaining ownership.
Sourceยง

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Sourceยง

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Sourceยง

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Sourceยง

type Error = Infallible

The type returned in the event of a conversion error.
Sourceยง

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Sourceยง

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Sourceยง

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Sourceยง

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Sourceยง

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Sourceยง

fn vzip(self) -> V

Sourceยง

impl<T> WithSubscriber for T

Sourceยง

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Sourceยง

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Sourceยง

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Sourceยง

impl<T> ErasedDestructor for T
where T: 'static,

Sourceยง

impl<T> MaybeSendSync for T