pub struct Entry {
pub num_hashes: u64,
pub hash: Hash,
pub transactions: Vec<VersionedTransaction>,
}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: u64agave-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: Hashagave-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>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
impl Entry
Sourcepub 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.
pub fn new( prev_hash: &Hash, num_hashes: u64, transactions: Vec<Transaction>, ) -> Self
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.
pub fn new_mut( start_hash: &mut Hash, num_hashes: &mut u64, transactions: Vec<Transaction>, ) -> Self
agave-unstable-api crate feature must be specified to acknowledge use of an interface that may break without warning.Sourcepub 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.
pub fn verify(&self, start_hash: &Hash) -> bool
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.
pub fn is_tick(&self) -> bool
agave-unstable-api crate feature must be specified to acknowledge use of an interface that may break without warning.Trait Implementationsยง
Sourceยงimpl<'de> Deserialize<'de> for Entry
impl<'de> Deserialize<'de> for Entry
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 From<&Entry> for EntrySummary
impl From<&Entry> for EntrySummary
Sourceยงimpl<'de> SchemaRead<'de> for Entry
impl<'de> SchemaRead<'de> for Entry
Sourceยงimpl SchemaWrite for Entry
impl SchemaWrite for Entry
impl Eq for Entry
impl StructuralPartialEq for Entry
Auto Trait Implementationsยง
impl Freeze for Entry
impl RefUnwindSafe for Entry
impl Send for Entry
impl Sync for Entry
impl Unpin for Entry
impl UnwindSafe for Entry
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<'de, T> Deserialize<'de> for Twhere
T: SchemaRead<'de>,
impl<'de, T> Deserialize<'de> for Twhere
T: SchemaRead<'de>,
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 moreSourceยงimpl<T> Pointable for T
impl<T> Pointable for T
Sourceยงimpl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Sourceยงimpl<T> Serialize for Twhere
T: SchemaWrite + ?Sized,
impl<T> Serialize for Twhere
T: SchemaWrite + ?Sized,
Sourceยงfn serialize(src: &Self::Src) -> Result<Vec<u8>, WriteError>
fn serialize(src: &Self::Src) -> Result<Vec<u8>, WriteError>
Vec of bytes.