messages

package
v0.43.1-access-memory-... Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 29, 2025 License: AGPL-3.0 Imports: 6 Imported by: 27

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ApprovalRequest added in v0.14.0

type ApprovalRequest struct {
	Nonce      uint64
	ResultID   flow.Identifier
	ChunkIndex uint64
}

ApprovalRequest represents a request for a ResultApproval corresponding to a specific chunk.

func (*ApprovalRequest) ToInternal

func (a *ApprovalRequest) ToInternal() (any, error)

ToInternal converts the untrusted ApprovalRequest into its trusted internal representation.

type ApprovalResponse added in v0.14.0

type ApprovalResponse struct {
	Nonce    uint64
	Approval flow.UntrustedResultApproval
}

ApprovalResponse contains a response to an approval request.

func (*ApprovalResponse) ToInternal

func (a *ApprovalResponse) ToInternal() (any, error)

ToInternal converts the untrusted ApprovalResponse into its trusted internal representation.

type BatchRequest

type BatchRequest flow.BatchRequest

BatchRequest is part of the synchronization protocol and represents an active (pulling) attempt to synchronize with the consensus state of the network. It requests finalized or unfinalized blocks by a list of block IDs. All BatchRequest messages are validated before being processed. If validation fails, then a misbehavior report is created. See synchronization.validateBatchRequestForALSP for more details.

func (*BatchRequest) ToInternal

func (b *BatchRequest) ToInternal() (any, error)

ToInternal returns the internal type representation for BatchRequest.

All errors indicate that the decode target contains a structurally invalid representation of the internal flow.BatchRequest.

type BlockResponse

type BlockResponse struct {
	Nonce  uint64
	Blocks []flow.UntrustedProposal
}

BlockResponse is part of the synchronization protocol and represents the reply to any active synchronization attempts. It contains a list of blocks that should correspond to the request.

func (*BlockResponse) ToInternal

func (br *BlockResponse) ToInternal() (any, error)

ToInternal returns the internal type representation for BlockResponse.

All errors indicate that the decode target contains a structurally invalid representation of the internal flow.BlockResponse.

type BlockVote

type BlockVote flow.BlockVote

BlockVote is part of the consensus protocol and represents a consensus node voting on the proposal of the leader of a given round.

func (*BlockVote) ToInternal

func (b *BlockVote) ToInternal() (any, error)

ToInternal converts the untrusted BlockVote into its trusted internal representation.

type BroadcastDKGMessage added in v0.20.0

type BroadcastDKGMessage struct {
	DKGMessage
	CommitteeMemberIndex uint64          `json:"-"` // CommitteeMemberIndex field is set when reading broadcast messages using the NodeID to find the index of the sender in the DKG committee
	NodeID               flow.Identifier `json:"-"` // NodeID field is added when reading broadcast messages from the DKG contract, this field is ignored when sending broadcast messages
	Signature            crypto.Signature
}

BroadcastDKGMessage is a wrapper around a DKGMessage intended for broadcasting. It contains a signature of the DKGMessage signed with the staking key of the sender. When the DKG contract receives BroadcastDKGMessage' it will attach the NodeID of the sender, we then add this field to the BroadcastDKGMessage when reading broadcast messages.

type ChunkDataRequest

type ChunkDataRequest flow.ChunkDataRequest

ChunkDataRequest represents a request for the chunk data pack which is specified by a chunk ID.

func (*ChunkDataRequest) ToInternal

func (c *ChunkDataRequest) ToInternal() (any, error)

ToInternal returns the internal type representation for ChunkDataRequest.

All errors indicate that the decode target contains a structurally invalid representation of the internal flow.ChunkDataRequest.

type ChunkDataResponse

type ChunkDataResponse struct {
	ChunkDataPack flow.UntrustedChunkDataPack
	Nonce         uint64 // so that we aren't deduplicated by the network layer
}

ChunkDataResponse is the response to a chunk data pack request. It contains the chunk data pack of the interest.

func (*ChunkDataResponse) ToInternal

func (c *ChunkDataResponse) ToInternal() (any, error)

ToInternal returns the internal type representation for ChunkDataResponse.

All errors indicate that the decode target contains a structurally invalid representation of the internal flow.ChunkDataResponse.

type ClusterBlockResponse

type ClusterBlockResponse struct {
	Nonce  uint64
	Blocks []cluster.UntrustedProposal
}

ClusterBlockResponse is the same thing as BlockResponse, but for cluster consensus.

func (*ClusterBlockResponse) ToInternal

func (br *ClusterBlockResponse) ToInternal() (any, error)

ToInternal returns the internal type representation for ClusterBlockResponse.

All errors indicate that the decode target contains a structurally invalid representation of the internal cluster.BlockResponse.

type ClusterBlockVote

type ClusterBlockVote flow.BlockVote

ClusterBlockVote is a vote for a proposed block in collection node cluster consensus; effectively a vote for a particular collection.

func (*ClusterBlockVote) ToInternal

func (c *ClusterBlockVote) ToInternal() (any, error)

ToInternal converts the untrusted ClusterBlockVote into its trusted internal representation.

type ClusterProposal

type ClusterProposal cluster.UntrustedProposal

ClusterProposal is a signed cluster block proposal in collection node cluster consensus.

func (*ClusterProposal) ToInternal

func (p *ClusterProposal) ToInternal() (any, error)

ToInternal returns the internal type representation for ClusterProposal.

All errors indicate that the decode target contains a structurally invalid representation of the internal cluster.Proposal.

type ClusterTimeoutObject added in v0.29.0

type ClusterTimeoutObject TimeoutObject

ClusterTimeoutObject is part of the collection cluster protocol and represents a collection node timing out in given round. Contains a sequential number for deduplication purposes.

func (*ClusterTimeoutObject) ToInternal

func (c *ClusterTimeoutObject) ToInternal() (any, error)

ToInternal returns the internal type representation for ClusterTimeoutObject.

All errors indicate that the decode target contains a structurally invalid representation of the internal model.TimeoutObject.

type CollectionGuarantee

type CollectionGuarantee flow.UntrustedCollectionGuarantee

CollectionGuarantee is a message representation of an CollectionGuarantee, which is used to announce collections to consensus nodes.

func (*CollectionGuarantee) ToInternal

func (c *CollectionGuarantee) ToInternal() (any, error)

ToInternal returns the internal type representation for CollectionGuarantee.

All errors indicate that the decode target contains a structurally invalid representation of the internal flow.CollectionGuarantee.

type CollectionRequest

type CollectionRequest struct {
	ID    flow.Identifier
	Nonce uint64 // so that we aren't deduplicated by the network layer
}

CollectionRequest request all transactions from a collection with the given fingerprint.

type CollectionResponse

type CollectionResponse struct {
	Collection flow.Collection
	Nonce      uint64 // so that we aren't deduplicated by the network layer
}

CollectionResponse is a response to a request for a collection.

type DKGMessage added in v0.20.0

type DKGMessage flow.DKGMessage

DKGMessage is the type of message exchanged between DKG nodes.

func (*DKGMessage) ToInternal

func (d *DKGMessage) ToInternal() (any, error)

ToInternal returns the internal type representation for DKGMessage.

All errors indicate that the decode target contains a structurally invalid representation of the internal flow.DKGMessage.

type EntityRequest

type EntityRequest flow.EntityRequest

EntityRequest is a request for a set of entities, each keyed by an identifier. The relationship between the identifiers and the entity is not specified here. In the typical case, the identifier is simply the ID of the entity being requested, but more complex identifier-entity relationships can be used as well.

func (*EntityRequest) ToInternal

func (e *EntityRequest) ToInternal() (any, error)

ToInternal converts the untrusted EntityRequest into its trusted internal representation. No errors are expected during normal operations.

type EntityResponse

type EntityResponse flow.EntityResponse

EntityResponse is a response to an entity request, containing a set of serialized entities and the identifiers used to request them. The returned entity set may be empty or incomplete.

func (*EntityResponse) ToInternal

func (e *EntityResponse) ToInternal() (any, error)

ToInternal converts the untrusted EntityResponse into its trusted internal representation. No errors are expected during normal operations.

type ExecutionReceipt

type ExecutionReceipt flow.UntrustedExecutionReceipt

ExecutionReceipt is the full execution receipt, as sent by the Execution Node. Specifically, it contains the detailed execution result.

func (*ExecutionReceipt) ToInternal

func (er *ExecutionReceipt) ToInternal() (any, error)

ToInternal returns the internal type representation for ExecutionReceipt.

All errors indicate that the decode target contains a structurally invalid representation of the internal flow.ExecutionReceipt.

type PrivDKGMessageIn added in v0.20.0

type PrivDKGMessageIn struct {
	DKGMessage
	CommitteeMemberIndex uint64 // CommitteeMemberIndex field is set when the message arrives at the Broker
	OriginID             flow.Identifier
}

PrivDKGMessageIn is a wrapper around a DKGMessage containing the network ID of the sender.

type PrivDKGMessageOut added in v0.20.0

type PrivDKGMessageOut struct {
	DKGMessage
	DestID flow.Identifier
}

PrivDKGMessageOut is a wrapper around a DKGMessage containing the network ID of the destination.

type Proposal

type Proposal flow.UntrustedProposal

Proposal is part of the consensus protocol and represents a signed proposal from a consensus node.

func (*Proposal) ToInternal

func (p *Proposal) ToInternal() (any, error)

ToInternal returns the internal type representation for Proposal.

All errors indicate that the decode target contains a structurally invalid representation of the internal flow.Proposal.

type RangeRequest

type RangeRequest flow.RangeRequest

RangeRequest is part of the synchronization protocol and represents an active (pulling) attempt to synchronize with the consensus state of the network. It requests finalized blocks by a range of block heights, including from and to heights. All RangeRequest messages are validated before being processed. If validation fails, then a misbehavior report is created. See synchronization.validateRangeRequestForALSP for more details.

func (*RangeRequest) ToInternal

func (r *RangeRequest) ToInternal() (any, error)

ToInternal returns the internal type representation for RangeRequest.

All errors indicate that the decode target contains a structurally invalid representation of the internal flow.RangeRequest.

type ResultApproval

type ResultApproval flow.UntrustedResultApproval

ResultApproval is a message representation of a ResultApproval, which includes an approval for a chunk, verified by a verification n

func (*ResultApproval) ToInternal

func (a *ResultApproval) ToInternal() (any, error)

ToInternal converts the untrusted ResultApproval into its trusted internal representation.

type SyncRequest

type SyncRequest flow.SyncRequest

SyncRequest is part of the synchronization protocol and represents a node on the network sharing the height of its latest finalized block and requesting the same information from the recipient. All SyncRequest messages are validated before being processed. If validation fails, then a misbehavior report is created. See synchronization.validateSyncRequestForALSP for more details.

func (*SyncRequest) ToInternal

func (s *SyncRequest) ToInternal() (any, error)

ToInternal returns the internal type representation for SyncRequest.

All errors indicate that the decode target contains a structurally invalid representation of the internal flow.SyncRequest.

type SyncResponse

type SyncResponse flow.SyncResponse

SyncResponse is part of the synchronization protocol and represents the reply to a synchronization request that contains the latest finalized block height of the responding node.

func (*SyncResponse) ToInternal

func (s *SyncResponse) ToInternal() (any, error)

ToInternal returns the internal type representation for SyncResponse.

All errors indicate that the decode target contains a structurally invalid representation of the internal flow.SyncResponse.

type TimeoutObject added in v0.29.0

type TimeoutObject model.UntrustedTimeoutObject

TimeoutObject is part of the consensus protocol and represents a consensus node timing out in given round. Contains a sequential number for deduplication purposes.

func (*TimeoutObject) ToInternal

func (t *TimeoutObject) ToInternal() (any, error)

ToInternal returns the internal type representation for TimeoutObject.

All errors indicate that the decode target contains a structurally invalid representation of the internal model.TimeoutObject.

type TransactionBody

type TransactionBody flow.UntrustedTransactionBody

TransactionBody is a message representation of a TransactionBody, which includes the main contents of a transaction

func (*TransactionBody) ToInternal

func (tb *TransactionBody) ToInternal() (any, error)

ToInternal converts the untrusted TransactionBody into its trusted internal representation.

type UntrustedMessage

type UntrustedMessage interface {

	// ToInternal returns the internal type (from flow.* constructors) representation.
	// All errors indicate that the decode target contains a structurally invalid representation of the internal model.
	ToInternal() (any, error)
}

UntrustedMessage represents the set of allowed decode target types for messages received over the network. Conceptually, an UntrustedMessage implementation makes no guarantees whatsoever about its contents. UntrustedMessage's must implement a ToInternal method, which converts the network message to a corresponding internal type (typically in the model/flow package) This conversion provides an opportunity to:

  • perform basic structural validity checks (required fields are non-nil, fields reference one another in a consistent way)
  • attach auxiliary information (for example, caching the hash of a model)

Internal models abide by basic structural validity requirements, but are not trusted. They may still represent invalid or Byzantine inputs in the context of the broader application state. It is the responsibility of engines operating on these models to fully validate them.

func InternalToMessage

func InternalToMessage(event interface{}) (UntrustedMessage, error)

InternalToMessage converts an internal types into the corresponding UntrustedMessage for network.

This is the inverse of ToInternal: instead of decoding a network message into an internal model, it wraps or casts internal objects so they can be encoded and sent over the network. Encoding and always requires an UntrustedMessage.

No errors are expected during normal operation. TODO: investigate how to eliminate this workaround in both ghost/rpc.go and corruptnet/message_processor.go

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL