pub enum HostMsg<Ctx: Context> {
ConsensusReady {
reply_to: RpcReplyPort<(Ctx::Height, HeightParams<Ctx>)>,
},
StartedRound {
height: Ctx::Height,
round: Round,
proposer: Ctx::Address,
role: Role,
reply_to: RpcReplyPort<Vec<ProposedValue<Ctx>>>,
},
GetValue {
height: Ctx::Height,
round: Round,
timeout: Duration,
reply_to: RpcReplyPort<LocallyProposedValue<Ctx>>,
},
ExtendVote {
height: Ctx::Height,
round: Round,
value_id: ValueId<Ctx>,
reply_to: RpcReplyPort<Option<Ctx::Extension>>,
},
VerifyVoteExtension {
height: Ctx::Height,
round: Round,
value_id: ValueId<Ctx>,
extension: Ctx::Extension,
reply_to: RpcReplyPort<Result<(), VoteExtensionError>>,
},
RestreamValue {
height: Ctx::Height,
round: Round,
valid_round: Round,
address: Ctx::Address,
value_id: ValueId<Ctx>,
},
GetHistoryMinHeight {
reply_to: RpcReplyPort<Ctx::Height>,
},
ReceivedProposalPart {
from: PeerId,
part: StreamMessage<Ctx::ProposalPart>,
reply_to: RpcReplyPort<ProposedValue<Ctx>>,
},
Decided {
certificate: CommitCertificate<Ctx>,
extensions: VoteExtensions<Ctx>,
},
Finalized {
certificate: CommitCertificate<Ctx>,
extensions: VoteExtensions<Ctx>,
evidence: MisbehaviorEvidence<Ctx>,
reply_to: RpcReplyPort<Next<Ctx>>,
},
GetDecidedValues {
range: RangeInclusive<Ctx::Height>,
reply_to: RpcReplyPort<Vec<RawDecidedValue<Ctx>>>,
},
ProcessSyncedValue {
height: Ctx::Height,
round: Round,
proposer: Ctx::Address,
value_bytes: Bytes,
reply_to: RpcReplyPort<ProposedValue<Ctx>>,
},
}Expand description
Messages that need to be handled by the host actor.
Variants§
ConsensusReady
Notifies the application that consensus is ready.
The application MUST reply with a message to instruct consensus to start at a given height.
Fields
reply_to: RpcReplyPort<(Ctx::Height, HeightParams<Ctx>)>Use this reply port to instruct consensus to start the first height.
StartedRound
Consensus has started a new round.
Fields
reply_to: RpcReplyPort<Vec<ProposedValue<Ctx>>>Use this reply port to send the undecided values that were already seen for this round. This is needed when recovering from a crash.
The application MUST reply immediately with the values it has, or with an empty vector.
GetValue
Request to build a local value to propose
The application MUST reply to this message with the requested value within the specified timeout duration.
Fields
reply_to: RpcReplyPort<LocallyProposedValue<Ctx>>Use this reply port to send the value that was built.
ExtendVote
ExtendVote allows the application to extend the pre-commit vote with arbitrary data.
When consensus is preparing to send a pre-commit vote, it first calls ExtendVote.
The application then returns a blob of data called a vote extension.
This data is opaque to the consensus algorithm but can contain application-specific information.
The proposer of the next block will receive all vote extensions along with the commit certificate.
Fields
reply_to: RpcReplyPort<Option<Ctx::Extension>>The vote extension to be added to the vote, if any.
VerifyVoteExtension
Verify a vote extension
If the vote extension is deemed invalid, the vote it was part of will be discarded altogether.
Fields
reply_to: RpcReplyPort<Result<(), VoteExtensionError>>Use this reply port to send the result of the verification.
RestreamValue
Requests the application to re-stream a proposal that it has already seen.
The application MUST re-publish again all the proposal parts pertaining
to that value by sending [NetworkMsg::PublishProposalPart] messages through
the [Channels::network] channel.
Fields
GetHistoryMinHeight
Requests the earliest height available in the history maintained by the application.
The application MUST respond with its earliest available height.
Fields
reply_to: RpcReplyPort<Ctx::Height>ReceivedProposalPart
Notifies the application that consensus has received a proposal part over the network.
If this part completes the full proposal, the application MUST respond
with the complete proposed value. Otherwise, it MUST respond with None.
Decided
Notifies the application that consensus has decided on a value.
This message includes a commit certificate containing the ID of the value that was decided on, the height and round at which it was decided, and the aggregated signatures of the validators that committed to it. It also includes to the vote extensions received for that height.
Fields
certificate: CommitCertificate<Ctx>The commit certificate containing the ID of the value that was decided on, the the height and round at which it was decided, and the aggregated signatures of the validators that committed to it.
extensions: VoteExtensions<Ctx>Vote extensions that were received for this height.
Finalized
Notifies the application that consensus has finalized a height after collecting additional precommits.
This message is sent when the target time for the height has been reached,
which may include a delay between Decided and Finalized messages.
During this delay, additional precommits may have been collected. The certificate may contain more
signatures than the one sent in the initial Decided message.
In response to this message, the application MUST send a Next
message back to consensus, instructing it to either start the next height if
the application was able to commit the decided value, or to restart the current height
otherwise.
If the application does not reply, consensus will stall.
Fields
certificate: CommitCertificate<Ctx>The commit certificate with extended signatures collected during finalization period.
extensions: VoteExtensions<Ctx>Vote extensions that were received for this height (including additional ones).
evidence: MisbehaviorEvidence<Ctx>Misbehavior evidence collected since last height was decided.
reply_to: RpcReplyPort<Next<Ctx>>Use this reply port to instruct consensus to start the next height.
GetDecidedValues
Requests a range of previously decided values from the application’s storage.
The application MUST respond with those values if available, or None otherwise.
§Important
The range is NOT checked for validity by consensus. It is the application’s responsibility to ensure that the the range is within valid bounds.
Fields
range: RangeInclusive<Ctx::Height>Range of decided values to retrieve
reply_to: RpcReplyPort<Vec<RawDecidedValue<Ctx>>>Channel for sending back the decided value
ProcessSyncedValue
Notifies the application that a value has been synced from the network. This may happen when the node is catching up with the network.
If a value can be decoded from the bytes provided, then the application MUST reply
to this message with the decoded value. Otherwise, it MUST reply with None.
Fields
reply_to: RpcReplyPort<ProposedValue<Ctx>>Channel for sending back the proposed value, if successfully decoded
or None if the value could not be decoded
Trait Implementations§
Auto Trait Implementations§
impl<Ctx> !Freeze for HostMsg<Ctx>
impl<Ctx> !RefUnwindSafe for HostMsg<Ctx>
impl<Ctx> Send for HostMsg<Ctx>
impl<Ctx> Sync for HostMsg<Ctx>
impl<Ctx> Unpin for HostMsg<Ctx>
impl<Ctx> UnsafeUnpin for HostMsg<Ctx>where
<Ctx as Context>::Height: UnsafeUnpin,
<Ctx as Context>::Address: UnsafeUnpin,
<<Ctx as Context>::Value as Value>::Id: UnsafeUnpin,
<Ctx as Context>::Extension: UnsafeUnpin,
<Ctx as Context>::ProposalPart: UnsafeUnpin,
impl<Ctx> !UnwindSafe for HostMsg<Ctx>
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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> 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 more