pub enum Vertex<C>where
C: Context,{
Unit(SignedWireUnit<C>),
Evidence(Evidence<C>),
Endorsements(Endorsements<C>),
Ping(Ping<C>),
}Expand description
An element of the protocol state, that might depend on other elements.
It is the vertex in a directed acyclic graph, whose edges are dependencies.
Variants§
Unit(SignedWireUnit<C>)
A signed unit of the consensus DAG.
Evidence(Evidence<C>)
Evidence of a validator’s transgression.
Endorsements(Endorsements<C>)
Endorsements for a unit.
Ping(Ping<C>)
A ping conveying the activity of its creator.
Implementations§
Source§impl<C: Context> Vertex<C>
impl<C: Context> Vertex<C>
Sourcepub fn value(&self) -> Option<&C::ConsensusValue>
pub fn value(&self) -> Option<&C::ConsensusValue>
Returns the consensus value mentioned in this vertex, if any.
These need to be validated before passing the vertex into the protocol state. E.g. if
C::ConsensusValue is a transaction, it should be validated first (correct signature,
structure, gas limit, etc.). If it is a hash of a transaction, the transaction should be
obtained and validated. Only after that, the vertex can be considered valid.
Sourcepub fn unit_hash(&self) -> Option<C::Hash>
pub fn unit_hash(&self) -> Option<C::Hash>
Returns the unit hash of this vertex (if it is a unit).
Sourcepub fn unit_seq_number(&self) -> Option<u64>
pub fn unit_seq_number(&self) -> Option<u64>
Returns the seq number of this vertex (if it is a unit).
Sourcepub fn is_evidence(&self) -> bool
pub fn is_evidence(&self) -> bool
Returns whether this is evidence, as opposed to other types of vertices.
Sourcepub fn timestamp(&self) -> Option<Timestamp>
pub fn timestamp(&self) -> Option<Timestamp>
Returns a Timestamp provided the vertex is a Vertex::Unit or Vertex::Ping.
Sourcepub fn creator(&self) -> Option<ValidatorIndex>
pub fn creator(&self) -> Option<ValidatorIndex>
Returns the creator of this vertex, if one is defined.
Sourcepub fn id(&self) -> Dependency<C>
pub fn id(&self) -> Dependency<C>
Returns the ID of this vertex.
Sourcepub fn unit(&self) -> Option<&SignedWireUnit<C>>
pub fn unit(&self) -> Option<&SignedWireUnit<C>>
Returns a reference to the unit, or None if this is not a unit.
Sourcepub fn is_proposal(&self) -> bool
pub fn is_proposal(&self) -> bool
Returns true whether unit is a proposal.
Trait Implementations§
Source§impl<C> DataSize for Vertex<C>where
SignedWireUnit<C>: DataSize,
Evidence<C>: DataSize,
Endorsements<C>: DataSize,
Ping<C>: DataSize,
C: Context,
impl<C> DataSize for Vertex<C>where
SignedWireUnit<C>: DataSize,
Evidence<C>: DataSize,
Endorsements<C>: DataSize,
Ping<C>: DataSize,
C: Context,
Source§const IS_DYNAMIC: bool = true
const IS_DYNAMIC: bool = true
true, the type has a heap size that can vary at runtime, depending on the actual value.Source§const STATIC_HEAP_SIZE: usize = 0usize
const STATIC_HEAP_SIZE: usize = 0usize
IS_DYNAMIC is false, this is
the total amount of heap memory occupied by the value. Otherwise this is a lower bound.Source§fn estimate_heap_size(&self) -> usize
fn estimate_heap_size(&self) -> usize
Source§fn estimate_detailed_heap_size(&self) -> MemUsageNode
fn estimate_detailed_heap_size(&self) -> MemUsageNode
Source§impl<'de, C> Deserialize<'de> for Vertex<C>where
C: Context,
C::Hash: Deserialize<'de>,
impl<'de, C> Deserialize<'de> for Vertex<C>where
C: Context,
C::Hash: Deserialize<'de>,
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>,
impl<C> Eq for Vertex<C>where
C: Context + Eq,
impl<C> StructuralPartialEq for Vertex<C>where
C: Context,
Auto Trait Implementations§
impl<C> Freeze for Vertex<C>
impl<C> RefUnwindSafe for Vertex<C>where
<C as Context>::Signature: RefUnwindSafe,
<C as Context>::Hash: RefUnwindSafe,
<C as Context>::InstanceId: RefUnwindSafe,
<C as Context>::ConsensusValue: RefUnwindSafe,
impl<C> Send for Vertex<C>
impl<C> Sync for Vertex<C>
impl<C> Unpin for Vertex<C>
impl<C> UnwindSafe for Vertex<C>where
<C as Context>::Signature: UnwindSafe,
<C as Context>::Hash: UnwindSafe + RefUnwindSafe,
<C as Context>::InstanceId: UnwindSafe,
<C as Context>::ConsensusValue: UnwindSafe,
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
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<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<From, To> FallibleInto<To> for Fromwhere
To: TryFrom<From>,
impl<From, To> FallibleInto<To> for Fromwhere
To: TryFrom<From>,
fn try_into_wrapped(self) -> Result<To, VMError>
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> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
out indicating that a T is niched.