Skip to main content

ValidatorNode

Trait ValidatorNode 

Source
pub trait ValidatorNode: Send {
    type NotificationStream: Stream<Item = Notification> + Unpin + MaybeSend;

Show 23 methods // Required methods fn address(&self) -> String; fn handle_block_proposal( &self, proposal: BlockProposal, ) -> impl Future<Output = Result<ChainInfoResponse, NodeError>> + Send; fn handle_lite_certificate( &self, certificate: LiteCertificate<'_>, delivery: CrossChainMessageDelivery, ) -> impl Future<Output = Result<ChainInfoResponse, NodeError>> + Send; fn handle_confirmed_certificate( &self, certificate: CacheArc<GenericCertificate<ConfirmedBlock>>, delivery: CrossChainMessageDelivery, ) -> impl Future<Output = Result<ChainInfoResponse, NodeError>> + Send; fn handle_validated_certificate( &self, certificate: GenericCertificate<ValidatedBlock>, ) -> impl Future<Output = Result<ChainInfoResponse, NodeError>> + Send; fn handle_timeout_certificate( &self, certificate: GenericCertificate<Timeout>, ) -> impl Future<Output = Result<ChainInfoResponse, NodeError>> + Send; fn handle_chain_info_query( &self, query: ChainInfoQuery, ) -> impl Future<Output = Result<ChainInfoResponse, NodeError>> + Send; fn get_version_info( &self, ) -> impl Future<Output = Result<VersionInfo, NodeError>> + Send; fn get_network_description( &self, ) -> impl Future<Output = Result<NetworkDescription, NodeError>> + Send; fn subscribe( &self, chains: Vec<ChainId>, ) -> impl Future<Output = Result<Self::NotificationStream, NodeError>> + Send; fn upload_blob( &self, content: BlobContent, ) -> impl Future<Output = Result<BlobId, NodeError>> + Send; fn download_blob( &self, blob_id: BlobId, ) -> impl Future<Output = Result<BlobContent, NodeError>> + Send; fn download_blobs( &self, blob_ids: Vec<BlobId>, ) -> impl Future<Output = Result<BlobStream, NodeError>> + Send; fn download_pending_blob( &self, chain_id: ChainId, blob_id: BlobId, ) -> impl Future<Output = Result<BlobContent, NodeError>> + Send; fn handle_pending_blob( &self, chain_id: ChainId, blob: BlobContent, ) -> impl Future<Output = Result<ChainInfoResponse, NodeError>> + Send; fn download_certificate( &self, hash: CryptoHash, ) -> impl Future<Output = Result<ConfirmedBlockCertificate, NodeError>> + Send; fn download_certificates( &self, hashes: Vec<CryptoHash>, ) -> impl Future<Output = Result<Vec<ConfirmedBlockCertificate>, NodeError>> + Send; fn download_certificates_by_heights( &self, chain_id: ChainId, heights: Vec<BlockHeight>, ) -> impl Future<Output = Result<Vec<ConfirmedBlockCertificate>, NodeError>> + Send; fn blob_last_used_by( &self, blob_id: BlobId, ) -> impl Future<Output = Result<CryptoHash, NodeError>> + Send; fn missing_blob_ids( &self, blob_ids: Vec<BlobId>, ) -> impl Future<Output = Result<Vec<BlobId>, NodeError>> + Send; fn blob_last_used_by_certificate( &self, blob_id: BlobId, ) -> impl Future<Output = Result<ConfirmedBlockCertificate, NodeError>> + Send; fn previous_event_blocks( &self, chain_id: ChainId, stream_ids: Vec<StreamId>, ) -> impl Future<Output = Result<BTreeMap<StreamId, (BlockHeight, CryptoHash)>, NodeError>> + Send; // Provided method fn upload_blobs( &self, blobs: Vec<Arc<Blob>>, ) -> impl Future<Output = Result<Vec<BlobId>, NodeError>> + Send { ... }
}
Expand description

How to communicate with a validator node.

Required Associated Types§

Source

type NotificationStream: Stream<Item = Notification> + Unpin + MaybeSend

The type of stream of notifications returned when subscribing.

Required Methods§

Source

fn address(&self) -> String

Returns the address of this validator node.

Source

fn handle_block_proposal( &self, proposal: BlockProposal, ) -> impl Future<Output = Result<ChainInfoResponse, NodeError>> + Send

Proposes a new block.

Source

fn handle_lite_certificate( &self, certificate: LiteCertificate<'_>, delivery: CrossChainMessageDelivery, ) -> impl Future<Output = Result<ChainInfoResponse, NodeError>> + Send

Processes a certificate without a value.

Source

fn handle_confirmed_certificate( &self, certificate: CacheArc<GenericCertificate<ConfirmedBlock>>, delivery: CrossChainMessageDelivery, ) -> impl Future<Output = Result<ChainInfoResponse, NodeError>> + Send

Processes a confirmed certificate.

Source

fn handle_validated_certificate( &self, certificate: GenericCertificate<ValidatedBlock>, ) -> impl Future<Output = Result<ChainInfoResponse, NodeError>> + Send

Processes a validated certificate.

Source

fn handle_timeout_certificate( &self, certificate: GenericCertificate<Timeout>, ) -> impl Future<Output = Result<ChainInfoResponse, NodeError>> + Send

Processes a timeout certificate.

Source

fn handle_chain_info_query( &self, query: ChainInfoQuery, ) -> impl Future<Output = Result<ChainInfoResponse, NodeError>> + Send

Handles information queries for this chain.

Source

fn get_version_info( &self, ) -> impl Future<Output = Result<VersionInfo, NodeError>> + Send

Gets the version info for this validator node.

Source

fn get_network_description( &self, ) -> impl Future<Output = Result<NetworkDescription, NodeError>> + Send

Gets the network’s description.

Source

fn subscribe( &self, chains: Vec<ChainId>, ) -> impl Future<Output = Result<Self::NotificationStream, NodeError>> + Send

Subscribes to receiving notifications for a collection of chains.

Source

fn upload_blob( &self, content: BlobContent, ) -> impl Future<Output = Result<BlobId, NodeError>> + Send

Uploads a blob. Returns an error if the validator has not seen a certificate using this blob.

Source

fn download_blob( &self, blob_id: BlobId, ) -> impl Future<Output = Result<BlobContent, NodeError>> + Send

Downloads a blob. Returns an error if the validator does not have the blob.

Source

fn download_blobs( &self, blob_ids: Vec<BlobId>, ) -> impl Future<Output = Result<BlobStream, NodeError>> + Send

Downloads a batch of blobs as a stream. The stream yields one blob per requested id, in order. On mid-stream errors, the caller can retry the remaining blob ids against another validator.

Source

fn download_pending_blob( &self, chain_id: ChainId, blob_id: BlobId, ) -> impl Future<Output = Result<BlobContent, NodeError>> + Send

Downloads a blob that belongs to a pending proposal or the locking block on a chain.

Source

fn handle_pending_blob( &self, chain_id: ChainId, blob: BlobContent, ) -> impl Future<Output = Result<ChainInfoResponse, NodeError>> + Send

Handles a blob that belongs to a pending proposal or validated block certificate.

Source

fn download_certificate( &self, hash: CryptoHash, ) -> impl Future<Output = Result<ConfirmedBlockCertificate, NodeError>> + Send

Downloads the confirmed block certificate with the given hash.

Source

fn download_certificates( &self, hashes: Vec<CryptoHash>, ) -> impl Future<Output = Result<Vec<ConfirmedBlockCertificate>, NodeError>> + Send

Requests a batch of certificates from the validator.

Source

fn download_certificates_by_heights( &self, chain_id: ChainId, heights: Vec<BlockHeight>, ) -> impl Future<Output = Result<Vec<ConfirmedBlockCertificate>, NodeError>> + Send

Requests a batch of certificates from a specific chain by heights.

Returns certificates in ascending order by height. This method does not guarantee that all requested heights will be returned; if some certificates are missing, the caller must handle that.

Source

fn blob_last_used_by( &self, blob_id: BlobId, ) -> impl Future<Output = Result<CryptoHash, NodeError>> + Send

Returns the hash of the Certificate that last used a blob.

Source

fn missing_blob_ids( &self, blob_ids: Vec<BlobId>, ) -> impl Future<Output = Result<Vec<BlobId>, NodeError>> + Send

Returns the missing Blobs by their IDs.

Source

fn blob_last_used_by_certificate( &self, blob_id: BlobId, ) -> impl Future<Output = Result<ConfirmedBlockCertificate, NodeError>> + Send

Returns the certificate that last used the blob.

Source

fn previous_event_blocks( &self, chain_id: ChainId, stream_ids: Vec<StreamId>, ) -> impl Future<Output = Result<BTreeMap<StreamId, (BlockHeight, CryptoHash)>, NodeError>> + Send

Returns the previous event blocks for a chain’s streams.

Provided Methods§

Source

fn upload_blobs( &self, blobs: Vec<Arc<Blob>>, ) -> impl Future<Output = Result<Vec<BlobId>, NodeError>> + Send

Uploads the blobs to the validator.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§