pub struct EpochChanges<Hash, Number, E: Epoch> { /* private fields */ }
Expand description

Tree of all epoch changes across all seen forks. Data stored in tree is the hash and block number of the block signaling the epoch change, and the epoch that was signalled at that block.

The first epoch, epoch_0, is special cased by saying that it starts at slot number of the first block in the chain. When bootstrapping a chain, there can be multiple competing block #1s, so we have to ensure that the overlayed DAG doesn’t get confused.

The first block of every epoch should be producing a descriptor for the next epoch - this is checked in higher-level code. So the first block of epoch_0 contains a descriptor for epoch_1. We special-case these and bundle them together in the same DAG entry, pinned to a specific block #1.

Further epochs (epoch_2, …, epoch_n) each get their own entry.

Implementations

Create a new epoch change.

Rebalances the tree of epoch changes so that it is sorted by length of fork (longest fork first).

Map the epoch changes from one storing data to a different one.

Prune out finalized epochs, except for the ancestor of the finalized block. The given slot should be the slot number at which the finalized block was authored.

Get a reference to an epoch with given identifier.

Get a reference to a viable epoch with given descriptor.

Get a mutable reference to an epoch with given identifier.

Get a mutable reference to a viable epoch with given descriptor.

Get the epoch data from an epoch descriptor.

Note that this function ignores the fact that an genesis epoch might need to be imported. Mostly useful for testing.

Finds the epoch data for a child of the given block. Similar to epoch_descriptor_for_child_of but returns the full data.

Note that this function ignores the fact that an genesis epoch might need to be imported. Mostly useful for testing.

Finds the epoch for a child of the given block, assuming the given slot number.

If the returned epoch is an UnimportedGenesis epoch, it should be imported into the tree.

Import a new epoch-change, signalled at the given block.

This assumes that the given block is prospective (i.e. has not been imported yet), but its parent has. This is why the parent hash needs to be provided.

Return the inner fork tree.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Attempt to deserialise the value from input.

Attempt to skip the encoded value from input. Read more

Returns the fixed encoded size of the type. Read more

Returns the “default value” for a type. Read more

Convert self to a slice and append it to the destination.

If possible give a hint of expected size of the encoding. Read more

Convert self to an owned vector.

Convert self to a slice and then invoke the given closure with it.

Calculates the encoded size. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Convert from a value of T into an equivalent instance of Option<Self>. Read more

Consume self to return Some equivalent value of Option<T>. Read more

Decode Self and consume all of the given input data. Read more

Decode Self and consume all of the given input data. Read more

Decode Self with the given maximum recursion depth. Read more

Returns the argument unchanged.

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

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

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

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

Calls U::from(self).

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

Get a reference to the inner from the outer.

Get a mutable reference to the inner from the outer.

Return an encoding of Self prepended by given slice.

The alignment of pointer.

The type for initializers.

Initializes a with the given initializer. Read more

Dereferences the given pointer. Read more

Mutably dereferences the given pointer. Read more

Drops the object pointed to by the given pointer. Read more

Should always be Self

Convert from a value of T into an equivalent instance of Self. Read more

Consume self to return an equivalent value of T. Read more

The resulting type after obtaining ownership.

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

🔬 This is a nightly-only experimental API. (toowned_clone_into)

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The counterpart to unchecked_from.

Consume self to return an equivalent value of T.

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

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