pub struct ChunkStateWitness {
    pub chunk_header: ShardChunkHeader,
    pub main_state_transition: ChunkStateTransition,
    pub source_receipt_proofs: HashMap<ChunkHash, ReceiptProof>,
    pub exact_receipts_hash: CryptoHash,
    pub transactions: Vec<SignedTransaction>,
    pub implicit_transitions: Vec<ChunkStateTransition>,
    pub new_transactions: Vec<SignedTransaction>,
    pub new_transactions_validation_state: PartialState,
}
Expand description

The state witness for a chunk; proves the state transition that the chunk attests to.

Fields§

§chunk_header: ShardChunkHeader

The chunk header that this witness is for. While this is not needed to apply the state transition, it is needed for a chunk validator to produce a chunk endorsement while knowing what they are endorsing.

§main_state_transition: ChunkStateTransition

The base state and post-state-root of the main transition where we apply transactions and receipts. Corresponds to the state transition that takes us from the pre-state-root of the last new chunk of this shard to the post-state-root of that same chunk.

§source_receipt_proofs: HashMap<ChunkHash, ReceiptProof>

For the main state transition, we apply transactions and receipts. Exactly which of them must be applied is a deterministic property based on the blockchain history this chunk is based on.

The set of receipts is exactly Filter(R, |receipt| receipt.target_shard = S), where - R is the set of outgoing receipts included in the set of chunks C (defined below), - S is the shard of this chunk.

The set of chunks C, from which the receipts are sourced, is defined as all new chunks included in the set of blocks B.

The set of blocks B is defined as the contiguous subsequence of blocks B1 (EXCLUSIVE) to B2 (inclusive) in this chunk’s chain (i.e. the linear chain that this chunk’s parent block is on), where B1 is the block that contains the last new chunk of shard S before this chunk, and B1 is the block that contains the last new chunk of shard S before B2.

Furthermore, the set of transactions to apply is exactly the transactions included in the chunk of shard S at B2.

For the purpose of this text, a “new chunk” is defined as a chunk that is proposed by a chunk producer, not one that was copied from the previous block (commonly called a “missing chunk”).

This field, source_receipt_proofs, is a (non-strict) superset of the receipts that must be applied, along with information that allows these receipts to be verifiable against the blockchain history.

§exact_receipts_hash: CryptoHash

An overall hash of the list of receipts that should be applied. This is redundant information but is useful for diagnosing why a witness might fail. This is the hash of the borsh encoding of the Vec in the order that they should be applied.

§transactions: Vec<SignedTransaction>

The transactions to apply. These must be in the correct order in which they are to be applied.

§implicit_transitions: Vec<ChunkStateTransition>

For each missing chunk after the last new chunk of the shard, we need to carry out an implicit state transition. Mostly, this is for distributing validator rewards. This list contains one for each such chunk, in forward chronological order.

After these are applied as well, we should arrive at the pre-state-root of the chunk that this witness is for.

§new_transactions: Vec<SignedTransaction>

Finally, we need to be able to verify that the new transitions proposed by the chunk (that this witness is for) are valid. For that, we need the transactions as well as another partial storage (based on the pre-state-root of this chunk) in order to verify that the sender accounts have appropriate balances, access keys, nonces, etc.

§new_transactions_validation_state: PartialState

Trait Implementations§

source§

impl BorshDeserialize for ChunkStateWitness

source§

fn deserialize_reader<R: Read>(reader: &mut R) -> Result<Self, Error>

source§

fn deserialize(buf: &mut &[u8]) -> Result<Self, Error>

Deserializes this instance from a given slice of bytes. Updates the buffer to point at the remaining bytes.
source§

fn try_from_slice(v: &[u8]) -> Result<Self, Error>

Deserialize this instance from a slice of bytes.
source§

fn try_from_reader<R>(reader: &mut R) -> Result<Self, Error>
where R: Read,

source§

impl BorshSerialize for ChunkStateWitness

source§

fn serialize<W: Write>(&self, writer: &mut W) -> Result<(), Error>

source§

impl Clone for ChunkStateWitness

source§

fn clone(&self) -> ChunkStateWitness

Returns a copy 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 ChunkStateWitness

source§

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

Formats the value using the given formatter. Read more
source§

impl PartialEq for ChunkStateWitness

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Eq for ChunkStateWitness

source§

impl StructuralPartialEq for ChunkStateWitness

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> ArchivePointee for T

§

type ArchivedMetadata = ()

The archived version of the pointer metadata for this type.
source§

fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata ) -> <T as Pointee>::Metadata

Converts some archived metadata to the pointer metadata for itself.
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<F, W, T, D> Deserialize<With<T, W>, D> for F
where W: DeserializeWith<F, T, D>, D: Fallible + ?Sized, F: ?Sized,

source§

fn deserialize( &self, deserializer: &mut D ) -> Result<With<T, W>, <D as Fallible>::Error>

Deserializes using the given deserializer
source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
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> Pointable for T

source§

const ALIGN: usize = _

The alignment of pointer.
§

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> Pointee for T

§

type Metadata = ()

The type for metadata in pointers and references to Self.
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

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

§

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>,

§

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>,

§

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