protocol

package
v0.2300.5 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2023 License: Apache-2.0 Imports: 30 Imported by: 0

Documentation

Overview

Package protocol implements the Runtime Host Protocol.

Index

Constants

View Source
const (
	// ExecutionModeExecute is the execution mode where the batch of transactions is executed as-is
	// without the ability to perform any modifications to the batch.
	ExecutionModeExecute = 0
	// ExecutionModeSchedule is the execution mode where the runtime is in control of scheduling and
	// may arbitrarily modify the batch during execution.
	//
	// This execution mode will only be used in case the runtime advertises to support the schedule
	// control feature. In this case the call will only contain up to InitialBatchSize transactions
	// and the runtime will need to request more if it needs more.
	ExecutionModeSchedule = 1
)
View Source
const ModuleVerifierName = "verifier"

ModuleVerifierName is the name of the consensus verifier module inside the runtime.

Variables

View Source
var (
	// ErrNotReady is the error reported when the Runtime Host Protocol is not initialized.
	ErrNotReady = errors.New(moduleName, 1, "rhp: not ready")
)
View Source
var ErrVerifierVerificationFailed = errors.New(ModuleVerifierName, 2, "verifier: light block verification failed")

ErrVerifierVerificationFailed is the error returned when consensus verifier fails to verify the passed consensus light block.

Functions

This section is empty.

Types

type Body

type Body struct {
	Empty *Empty `json:",omitempty"`
	Error *Error `json:",omitempty"`

	// Runtime interface.
	RuntimeInfoRequest                         *RuntimeInfoRequest                        `json:",omitempty"`
	RuntimeInfoResponse                        *RuntimeInfoResponse                       `json:",omitempty"`
	RuntimePingRequest                         *Empty                                     `json:",omitempty"`
	RuntimeShutdownRequest                     *Empty                                     `json:",omitempty"`
	RuntimeCapabilityTEERakInitRequest         *RuntimeCapabilityTEERakInitRequest        `json:",omitempty"`
	RuntimeCapabilityTEERakInitResponse        *Empty                                     `json:",omitempty"`
	RuntimeCapabilityTEERakReportRequest       *Empty                                     `json:",omitempty"`
	RuntimeCapabilityTEERakReportResponse      *RuntimeCapabilityTEERakReportResponse     `json:",omitempty"`
	RuntimeCapabilityTEERakAvrRequest          *RuntimeCapabilityTEERakAvrRequest         `json:",omitempty"`
	RuntimeCapabilityTEERakAvrResponse         *Empty                                     `json:",omitempty"`
	RuntimeCapabilityTEERakQuoteRequest        *RuntimeCapabilityTEERakQuoteRequest       `json:",omitempty"`
	RuntimeCapabilityTEERakQuoteResponse       *RuntimeCapabilityTEERakQuoteResponse      `json:",omitempty"`
	RuntimeRPCCallRequest                      *RuntimeRPCCallRequest                     `json:",omitempty"`
	RuntimeRPCCallResponse                     *RuntimeRPCCallResponse                    `json:",omitempty"`
	RuntimeLocalRPCCallRequest                 *RuntimeLocalRPCCallRequest                `json:",omitempty"`
	RuntimeLocalRPCCallResponse                *RuntimeLocalRPCCallResponse               `json:",omitempty"`
	RuntimeCheckTxBatchRequest                 *RuntimeCheckTxBatchRequest                `json:",omitempty"`
	RuntimeCheckTxBatchResponse                *RuntimeCheckTxBatchResponse               `json:",omitempty"`
	RuntimeExecuteTxBatchRequest               *RuntimeExecuteTxBatchRequest              `json:",omitempty"`
	RuntimeExecuteTxBatchResponse              *RuntimeExecuteTxBatchResponse             `json:",omitempty"`
	RuntimeAbortRequest                        *Empty                                     `json:",omitempty"`
	RuntimeAbortResponse                       *Empty                                     `json:",omitempty"`
	RuntimeKeyManagerStatusUpdateRequest       *RuntimeKeyManagerStatusUpdateRequest      `json:",omitempty"`
	RuntimeKeyManagerStatusUpdateResponse      *Empty                                     `json:",omitempty"`
	RuntimeKeyManagerPolicyUpdateRequest       *RuntimeKeyManagerPolicyUpdateRequest      `json:",omitempty"`
	RuntimeKeyManagerPolicyUpdateResponse      *Empty                                     `json:",omitempty"`
	RuntimeKeyManagerQuotePolicyUpdateRequest  *RuntimeKeyManagerQuotePolicyUpdateRequest `json:",omitempty"`
	RuntimeKeyManagerQuotePolicyUpdateResponse *Empty                                     `json:",omitempty"`
	RuntimeQueryRequest                        *RuntimeQueryRequest                       `json:",omitempty"`
	RuntimeQueryResponse                       *RuntimeQueryResponse                      `json:",omitempty"`
	RuntimeConsensusSyncRequest                *RuntimeConsensusSyncRequest               `json:",omitempty"`
	RuntimeConsensusSyncResponse               *Empty                                     `json:",omitempty"`

	// Host interface.
	HostRPCCallRequest               *HostRPCCallRequest               `json:",omitempty"`
	HostRPCCallResponse              *HostRPCCallResponse              `json:",omitempty"`
	HostStorageSyncRequest           *HostStorageSyncRequest           `json:",omitempty"`
	HostStorageSyncResponse          *HostStorageSyncResponse          `json:",omitempty"`
	HostLocalStorageGetRequest       *HostLocalStorageGetRequest       `json:",omitempty"`
	HostLocalStorageGetResponse      *HostLocalStorageGetResponse      `json:",omitempty"`
	HostLocalStorageSetRequest       *HostLocalStorageSetRequest       `json:",omitempty"`
	HostLocalStorageSetResponse      *Empty                            `json:",omitempty"`
	HostFetchConsensusBlockRequest   *HostFetchConsensusBlockRequest   `json:",omitempty"`
	HostFetchConsensusBlockResponse  *HostFetchConsensusBlockResponse  `json:",omitempty"`
	HostFetchConsensusEventsRequest  *HostFetchConsensusEventsRequest  `json:",omitempty"`
	HostFetchConsensusEventsResponse *HostFetchConsensusEventsResponse `json:",omitempty"`
	HostFetchTxBatchRequest          *HostFetchTxBatchRequest          `json:",omitempty"`
	HostFetchTxBatchResponse         *HostFetchTxBatchResponse         `json:",omitempty"`
	HostFetchGenesisHeightRequest    *HostFetchGenesisHeightRequest    `json:",omitempty"`
	HostFetchGenesisHeightResponse   *HostFetchGenesisHeightResponse   `json:",omitempty"`
	HostFetchBlockMetadataTxRequest  *HostFetchBlockMetadataTxRequest  `json:",omitempty"`
	HostFetchBlockMetadataTxResponse *HostFetchBlockMetadataTxResponse `json:",omitempty"`
	HostProveFreshnessRequest        *HostProveFreshnessRequest        `json:",omitempty"`
	HostProveFreshnessResponse       *HostProveFreshnessResponse       `json:",omitempty"`
	HostIdentityRequest              *HostIdentityRequest              `json:",omitempty"`
	HostIdentityResponse             *HostIdentityResponse             `json:",omitempty"`
}

Body is a protocol message body.

func (Body) Type

func (body Body) Type() string

Type returns the message type by determining the name of the first non-nil member.

type CheckTxMetadata added in v0.2102.0

type CheckTxMetadata struct {
	// Priority is the transaction's priority.
	Priority uint64 `json:"priority,omitempty"`

	// Sender is the unique identifier of the transaction sender.
	Sender []byte `json:"sender,omitempty"`
	// SenderSeq is the per-sender sequence number of the transaction.
	SenderSeq uint64 `json:"sender_seq,omitempty"`
	// SenderStateSeq is the current sequence number of the sender stored in runtime state. This
	// sequence number must be lower than or equal to SenderSeq.
	SenderStateSeq uint64 `json:"sender_state_seq,omitempty"`

	Deprecated1 cbor.RawMessage `json:"weights,omitempty"`
}

CheckTxMetadata is the transaction check-tx metadata.

type CheckTxResult added in v0.2100.0

type CheckTxResult struct {
	// Error is the error (if any) that resulted from the operation.
	Error Error `json:"error"`

	// Meta contains metadata that can be used for scheduling transactions by the scheduler.
	Meta *CheckTxMetadata `json:"meta,omitempty"`
}

CheckTxResult contains the result of a CheckTx operation.

func (*CheckTxResult) IsSuccess added in v0.2100.0

func (r *CheckTxResult) IsSuccess() bool

IsSuccess returns true if transaction execution was successful.

type ComputedBatch

type ComputedBatch struct {
	// Header is the compute results header.
	Header commitment.ComputeResultsHeader `json:"header"`
	// Log that generates the I/O tree.
	IOWriteLog storage.WriteLog `json:"io_write_log"`
	// Batch of storage write operations.
	StateWriteLog storage.WriteLog `json:"state_write_log"`
	// If this runtime uses a TEE, then this is the signature of Header with
	// node's RAK for this runtime.
	RakSig signature.RawSignature `json:"rak_sig"`
	// Messages are the emitted runtime messages.
	Messages []message.Message `json:"messages"`
}

ComputedBatch is a computed batch.

func (*ComputedBatch) String

func (b *ComputedBatch) String() string

String returns a string representation of a computed batch.

type Connection

type Connection interface {
	// Close closes the connection.
	Close()

	// GetInfo retrieves the runtime information.
	GetInfo() (*RuntimeInfoResponse, error)

	// Call sends a request to the other side and returns the response or error.
	Call(ctx context.Context, body *Body) (*Body, error)

	// InitHost performs initialization in host mode and transitions the connection to Ready state.
	//
	// This method must be called before the host will answer requests.
	//
	// Only one of InitHost/InitGuest can be called otherwise the method may panic.
	//
	// Returns the self-reported runtime version.
	InitHost(ctx context.Context, conn net.Conn, hi *HostInfo) (*version.Version, error)

	// InitGuest performs initialization in guest mode and transitions the connection to Ready
	// state.
	//
	// Only one of InitHost/InitGuest can be called otherwise the method may panic.
	InitGuest(conn net.Conn) error
}

Connection is a Runtime Host Protocol connection interface.

func NewConnection

func NewConnection(logger *logging.Logger, runtimeID common.Namespace, handler Handler) (Connection, error)

NewConnection creates a new uninitialized RHP connection.

type Empty

type Empty struct{}

Empty is an empty message body.

type Error

type Error struct {
	Module  string `json:"module,omitempty"`
	Code    uint32 `json:"code,omitempty"`
	Message string `json:"message,omitempty"`
}

Error is a message body representing an error.

func (Error) String added in v0.2100.0

func (e Error) String() string

String returns a string representation of this runtime error.

type EventKind added in v0.2202.0

type EventKind uint8

EventKind is the consensus event kind.

const (
	EventKindStaking    EventKind = 1
	EventKindRegistry   EventKind = 2
	EventKindRootHash   EventKind = 3
	EventKindGovernance EventKind = 4
)

Supported consensus event kinds.

type ExecutionMode added in v0.2103.9

type ExecutionMode uint8

ExecutionMode is the batch execution mode.

type FeatureScheduleControl added in v0.2103.9

type FeatureScheduleControl struct {
	// InitialBatchSize is the size of the initial batch of transactions.
	InitialBatchSize uint32 `json:"initial_batch_size"`
}

FeatureScheduleControl is a feature specifying that the runtime supports controlling the scheduling of batches. This means that the scheduler should only take priority into account and ignore weights, leaving it up to the runtime to decide which transactions to include.

type Features added in v0.2103.9

type Features struct {
	// ScheduleControl is the schedule control feature.
	ScheduleControl *FeatureScheduleControl `json:"schedule_control,omitempty"`
	// KeyManagerQuotePolicyUpdates is a feature specifying that the runtime supports updating
	// key manager's quote policy.
	KeyManagerQuotePolicyUpdates bool `json:"key_manager_quote_policy_updates,omitempty"`
	// KeyManagerStatusUpdates is a feature specifying that the runtime supports updating
	// key manager's status.
	KeyManagerStatusUpdates bool `json:"key_manager_status_updates,omitempty"`
	// KeyManagerMasterSecretRotation is a feature specifying that the runtime supports rotating
	// key manager's master secret.
	KeyManagerMasterSecretRotation bool `json:"key_manager_master_secret_rotation,omitempty"`
	// SameBlockConsensusValidation is a feature specifying that the runtime supports same-block
	// consensus validation.
	SameBlockConsensusValidation bool `json:"same_block_consensus_validation,omitempty"`
}

Features is a set of supported runtime features.

func (*Features) HasScheduleControl added in v0.2103.9

func (f *Features) HasScheduleControl() bool

HasScheduleControl returns true when the runtime supports the schedule control feature.

type Handler

type Handler interface {
	// Handle given request and return a response.
	Handle(ctx context.Context, body *Body) (*Body, error)
}

Handler is a protocol message handler interface.

type HostFetchBlockMetadataTxRequest added in v0.2300.0

type HostFetchBlockMetadataTxRequest struct {
	// Height is the consensus block height.
	Height uint64 `json:"height"`
}

HostFetchBlockMetadataTxRequest is a request to the host to fetch the block metadata transaction for the specified height, along with a proof of inclusion.

type HostFetchBlockMetadataTxResponse added in v0.2300.0

type HostFetchBlockMetadataTxResponse struct {
	// SignedTx is a signed block metadata transaction.
	SignedTx *consensusTx.SignedTransaction `json:"signed_tx"`
	// Proof of transaction inclusion in a block.
	Proof *consensusTx.Proof `json:"proof"`
}

HostFetchBlockMetadataTxResponse is a response from the host fetching the block metadata transaction, along with a proof of inclusion.

type HostFetchConsensusBlockRequest added in v0.2103.0

type HostFetchConsensusBlockRequest struct {
	Height uint64 `json:"height"`
}

HostFetchConsensusBlockRequest is a request to host to fetch the given consensus light block.

type HostFetchConsensusBlockResponse added in v0.2103.0

type HostFetchConsensusBlockResponse struct {
	Block consensus.LightBlock `json:"block"`
}

HostFetchConsensusBlockResponse is a response from host fetching the given consensus light block.

type HostFetchConsensusEventsRequest added in v0.2202.0

type HostFetchConsensusEventsRequest struct {
	Height uint64    `json:"height"`
	Kind   EventKind `json:"kind"`
}

HostFetchConsensusEventsRequest is a request to host to fetch the consensus events for the given height.

type HostFetchConsensusEventsResponse added in v0.2202.0

type HostFetchConsensusEventsResponse struct {
	Events []*consensusResults.Event `json:"events,omitempty"`
}

HostFetchConsensusEventsResponse is a response from host fetching the consensus events for the given height.

type HostFetchGenesisHeightRequest added in v0.2202.0

type HostFetchGenesisHeightRequest struct{}

HostFetchGenesisHeightRequest is a request to host to fetch the consensus genesis height.

type HostFetchGenesisHeightResponse added in v0.2202.0

type HostFetchGenesisHeightResponse struct {
	Height uint64 `json:"height"`
}

HostFetchGenesisHeightResponse is a response from host fetching the consensus genesis height.

type HostFetchTxBatchRequest added in v0.2103.9

type HostFetchTxBatchRequest struct {
	// Offset specifies the transaction hash that should serve as an offset when returning
	// transactions from the pool. Transactions will be skipped until the given hash is encountered
	// and only following transactions will be returned.
	Offset *hash.Hash `json:"offset,omitempty"`
	// Limit specifies the maximum size of the batch to request.
	Limit uint32 `json:"limit"`
}

HostFetchTxBatchRequest is a request to host to fetch a further batch of transactions.

type HostFetchTxBatchResponse added in v0.2103.9

type HostFetchTxBatchResponse struct {
	// Batch is a batch of transactions.
	Batch [][]byte `json:"batch,omitempty"`
}

HostFetchTxBatchResponse is a response from host fetching the given transaction batch.

type HostIdentityRequest added in v0.2202.0

type HostIdentityRequest struct{}

HostIdentityRequest is a request to host to return its identity.

type HostIdentityResponse added in v0.2202.0

type HostIdentityResponse struct {
	// NodeID is the host node identifier.
	NodeID signature.PublicKey `json:"node_id"`
}

HostIdentityResponse is a response from host returning its identity.

type HostInfo added in v0.2100.0

type HostInfo struct {
	// ConsensusBackend is the name of the consensus backend that is in use for the consensus layer.
	ConsensusBackend string
	// ConsensusProtocolVersion is the consensus protocol version that is in use for the consensus
	// layer.
	ConsensusProtocolVersion version.Version
	// ConsensusChainContext is the consensus layer chain domain separation context.
	ConsensusChainContext string

	// LocalConfig is the node-local runtime configuration.
	//
	// This configuration must not be used in any context which requires determinism across
	// replicated runtime instances.
	LocalConfig map[string]interface{}
}

HostInfo contains the information about the host environment that is sent to the runtime during connection initialization.

func (*HostInfo) Clone added in v0.2102.0

func (hi *HostInfo) Clone() *HostInfo

Clone returns a copy of the HostInfo structure.

type HostLocalStorageGetRequest

type HostLocalStorageGetRequest struct {
	Key []byte `json:"key"`
}

HostLocalStorageGetRequest is a host local storage get request message body.

type HostLocalStorageGetResponse

type HostLocalStorageGetResponse struct {
	Value []byte `json:"value"`
}

HostLocalStorageGetResponse is a host local storage get response message body.

type HostLocalStorageSetRequest

type HostLocalStorageSetRequest struct {
	Key   []byte `json:"key"`
	Value []byte `json:"value"`
}

HostLocalStorageSetRequest is a host local storage set request message body.

type HostProveFreshnessRequest added in v0.2202.0

type HostProveFreshnessRequest struct {
	Blob [32]byte `json:"blob"`
}

HostProveFreshnessRequest is a request to host to prove state freshness.

type HostProveFreshnessResponse added in v0.2202.0

type HostProveFreshnessResponse struct {
	// SignedTx is a signed prove freshness transaction.
	SignedTx *consensusTx.SignedTransaction `json:"signed_tx"`
	// Proof of transaction inclusion in a block.
	Proof *consensusTx.Proof `json:"proof"`
}

HostProveFreshnessResponse is a response from host proving state freshness.

type HostRPCCallRequest

type HostRPCCallRequest struct {
	Endpoint string          `json:"endpoint"`
	Request  []byte          `json:"request"`
	Kind     enclaverpc.Kind `json:"kind,omitempty"`

	// Nodes are optional node identities in case the request should be forwarded to specific
	// node instances and not to randomly chosen ones as selected by the host.
	Nodes []signature.PublicKey `json:"nodes,omitempty"`
	// PeerFeedback contains optional peer feedback for the last RPC call under the given endpoint.
	//
	// This enables the runtime to notify the node whether the given peer should continue to be used
	// or not based on higher-level logic that lives in the runtime.
	//
	// In case no feedback is given success is assumed.
	PeerFeedback *enclaverpc.PeerFeedback `json:"pf,omitempty"`
}

HostRPCCallRequest is a host RPC call request message body.

type HostRPCCallResponse

type HostRPCCallResponse struct {
	// Response is a response to a HostRPCCallRequest.
	Response []byte `json:"response"`
	// Node is the identifier of the node that handled the request.
	Node *signature.PublicKey `json:"node,omitempty"`
}

HostRPCCallResponse is a host RPC call response message body.

type HostStorageEndpoint added in v0.2100.0

type HostStorageEndpoint uint8

HostStorageEndpoint is the host storage endpoint.

const (
	// HostStorageEndpointRuntime is the runtime state storage endpoint.
	HostStorageEndpointRuntime HostStorageEndpoint = 0
	// HostStorageEndpointConsensus is the consensus layer state storage endpoint.
	HostStorageEndpointConsensus HostStorageEndpoint = 1
)

type HostStorageSyncRequest

type HostStorageSyncRequest struct {
	// Endpoint is the storage endpoint to which this request should be routed.
	Endpoint HostStorageEndpoint `json:"endpoint,omitempty"`

	SyncGet         *storage.GetRequest         `json:",omitempty"`
	SyncGetPrefixes *storage.GetPrefixesRequest `json:",omitempty"`
	SyncIterate     *storage.IterateRequest     `json:",omitempty"`
}

HostStorageSyncRequest is a host storage read syncer request message body.

type HostStorageSyncResponse

type HostStorageSyncResponse struct {
	ProofResponse *storage.ProofResponse `json:",omitempty"`
}

HostStorageSyncResponse is a host storage read syncer response body.

type Message

type Message struct {
	ID          uint64      `json:"id"`
	MessageType MessageType `json:"message_type"`
	Body        Body        `json:"body"`
}

Message is a protocol message.

type MessageType

type MessageType uint8

MessageType is a message type.

const (
	// MessageInvalid indicates an invalid message (should never be seen on the wire).
	MessageInvalid MessageType = 0

	// MessageRequest indicates a request message.
	MessageRequest MessageType = 1

	// MessageResponse indicates a response message.
	MessageResponse MessageType = 2
)

func (MessageType) String

func (m MessageType) String() string

String returns a string representation of a message type.

type NoOpNotifier

type NoOpNotifier struct{}

NoOpNotifier is the default no-op runtime notifier implementation.

func (*NoOpNotifier) Start

func (n *NoOpNotifier) Start() error

Start the no-op notifier.

func (*NoOpNotifier) Stop

func (n *NoOpNotifier) Stop()

Stop the no-op notifier.

type Notifier

type Notifier interface {
	// Start the notifier.
	Start() error

	// Stop the notifier.
	Stop()
}

Notifier is a protocol runtime notifier interface.

type RuntimeCapabilityTEERakAvrRequest

type RuntimeCapabilityTEERakAvrRequest struct {
	AVR ias.AVRBundle `json:"avr"`
}

RuntimeCapabilityTEERakAvrRequest is a worker RFC 0009 CapabilityTEE RAK AVR setup request message body.

type RuntimeCapabilityTEERakInitRequest

type RuntimeCapabilityTEERakInitRequest struct {
	TargetInfo []byte `json:"target_info"`
}

RuntimeCapabilityTEERakInitRequest is a worker RFC 0009 CapabilityTEE initialization request message body.

type RuntimeCapabilityTEERakQuoteRequest added in v0.2202.0

type RuntimeCapabilityTEERakQuoteRequest struct {
	// Quote is the remote attestation quote.
	Quote quote.Quote `json:"quote"`
}

RuntimeCapabilityTEERakQuoteRequest is a worker RFC 0009 CapabilityTEE RAK quote setup request message body.

type RuntimeCapabilityTEERakQuoteResponse added in v0.2202.0

type RuntimeCapabilityTEERakQuoteResponse struct {
	// Height is the runtime's view of the consensus layer height at the time of attestation.
	Height uint64 `json:"height"`

	// Signature is the signature of the attestation by the enclave.
	Signature signature.RawSignature `json:"signature"`
}

RuntimeCapabilityTEERakQuoteResponse is a worker RFC 0009 CapabilityTEE RAK quote setup response message body.

type RuntimeCapabilityTEERakReportResponse

type RuntimeCapabilityTEERakReportResponse struct {
	RakPub signature.PublicKey `json:"rak_pub"`
	RekPub *x25519.PublicKey   `json:"rek_pub,omitempty"`
	Report []byte              `json:"report"`
	Nonce  string              `json:"nonce"`
}

RuntimeCapabilityTEERakReportResponse is a worker RFC 0009 CapabilityTEE RAK response message body.

type RuntimeCheckTxBatchRequest

type RuntimeCheckTxBatchRequest struct {
	// ConsensusBlock is the consensus light block at the last finalized round
	// height (e.g., corresponding to .Block.Header.Round).
	ConsensusBlock consensus.LightBlock `json:"consensus_block"`

	// Batch of runtime inputs to check.
	Inputs transaction.RawBatch `json:"inputs"`
	// Block on which the batch check should be based.
	Block block.Block `json:"block"`
	// Epoch is the current epoch number.
	Epoch beacon.EpochTime `json:"epoch"`

	// MaxMessages is the maximum number of messages that can be emitted in this
	// round. Any more messages will be rejected by the consensus layer.
	MaxMessages uint32 `json:"max_messages"`
}

RuntimeCheckTxBatchRequest is a worker check tx batch request message body.

type RuntimeCheckTxBatchResponse

type RuntimeCheckTxBatchResponse struct {
	// Batch of CheckTx results corresponding to transactions passed on input.
	Results []CheckTxResult `json:"results"`
}

RuntimeCheckTxBatchResponse is a worker check tx batch response message body.

type RuntimeConsensusSyncRequest added in v0.2103.0

type RuntimeConsensusSyncRequest struct {
	Height uint64 `json:"height"`
}

RuntimeConsensusSyncRequest is a runtime consensus block synchronization request message body.

type RuntimeExecuteTxBatchRequest

type RuntimeExecuteTxBatchRequest struct {
	// Mode is the execution mode.
	Mode ExecutionMode `json:"mode,omitempty"`

	// ConsensusBlock is the consensus light block at the last finalized round
	// height (e.g., corresponding to .Block.Header.Round).
	ConsensusBlock consensus.LightBlock `json:"consensus_block"`

	// RoundResults are the results of executing the previous successful round.
	RoundResults *roothash.RoundResults `json:"round_results"`

	// IORoot is the I/O root containing the inputs (transactions) that
	// the compute node should use. It must match what is passed in "inputs".
	IORoot hash.Hash `json:"io_root"`
	// Batch of inputs (transactions).
	Inputs transaction.RawBatch `json:"inputs"`
	// InMessages are the incoming messages emitted by the consensus layer.
	InMessages []*message.IncomingMessage `json:"in_msgs,omitempty"`
	// Block on which the batch computation should be based.
	Block block.Block `json:"block"`
	// Epoch is the current epoch number.
	Epoch beacon.EpochTime `json:"epoch"`

	// MaxMessages is the maximum number of messages that can be emitted in this
	// round. Any more messages will be rejected by the consensus layer.
	MaxMessages uint32 `json:"max_messages"`
}

RuntimeExecuteTxBatchRequest is a worker execute tx batch request message body.

type RuntimeExecuteTxBatchResponse

type RuntimeExecuteTxBatchResponse struct {
	Batch ComputedBatch `json:"batch"`

	// TxHashes are the transaction hashes of the included batch.
	TxHashes []hash.Hash `json:"tx_hashes,omitempty"`
	// TxRejectHashes are the transaction hashes of transactions that should be immediately removed
	// from the scheduling queue as they are invalid.
	TxRejectHashes []hash.Hash `json:"tx_reject_hashes,omitempty"`
	// TxInputRoot is the root hash of all transaction inputs.
	TxInputRoot hash.Hash `json:"tx_input_root,omitempty"`
	// TxInputWriteLog is the write log for generating transaction inputs.
	TxInputWriteLog storage.WriteLog `json:"tx_input_write_log,omitempty"`

	Deprecated1 cbor.RawMessage `json:"batch_weight_limits,omitempty"`
}

RuntimeExecuteTxBatchResponse is a worker execute tx batch response message body.

type RuntimeInfoRequest

type RuntimeInfoRequest struct {
	// RuntimeID is the assigned runtime ID of the loaded runtime.
	RuntimeID common.Namespace `json:"runtime_id"`

	// ConsensusBackend is the name of the consensus backend that is in use for the consensus layer.
	ConsensusBackend string `json:"consensus_backend"`
	// ConsensusProtocolVersion is the consensus protocol version that is in use for the consensus
	// layer.
	ConsensusProtocolVersion version.Version `json:"consensus_protocol_version"`
	// ConsensusChainContext is the consensus layer chain domain separation context.
	ConsensusChainContext string `json:"consensus_chain_context"`

	// LocalConfig is the node-local runtime configuration.
	//
	// This configuration must not be used in any context which requires determinism across
	// replicated runtime instances.
	LocalConfig map[string]interface{} `json:"local_config,omitempty"`
}

RuntimeInfoRequest is a worker info request message body.

type RuntimeInfoResponse

type RuntimeInfoResponse struct {
	// ProtocolVersion is the runtime protocol version supported by the runtime.
	ProtocolVersion version.Version `json:"protocol_version"`

	// RuntimeVersion is the version of the runtime.
	RuntimeVersion version.Version `json:"runtime_version"`

	// Features describe the features supported by the runtime.
	Features *Features `json:"features,omitempty"`
}

RuntimeInfoResponse is a runtime info response message body.

type RuntimeKeyManagerPolicyUpdateRequest

type RuntimeKeyManagerPolicyUpdateRequest struct {
	SignedPolicyRaw []byte `json:"signed_policy_raw"`
}

RuntimeKeyManagerPolicyUpdateRequest is a runtime key manager policy update request message body.

type RuntimeKeyManagerQuotePolicyUpdateRequest added in v0.2300.0

type RuntimeKeyManagerQuotePolicyUpdateRequest struct {
	Policy quote.Policy `json:"policy"`
}

RuntimeKeyManagerQuotePolicyUpdateRequest is a runtime key manager quote policy update request message body.

type RuntimeKeyManagerStatusUpdateRequest added in v0.2300.0

type RuntimeKeyManagerStatusUpdateRequest struct {
	Status keymanager.Status `json:"status"`
}

RuntimeKeyManagerStatusUpdateRequest is a runtime key manager status update request message body.

type RuntimeLocalRPCCallRequest

type RuntimeLocalRPCCallRequest struct {
	// Request.
	Request []byte `json:"request"`
}

RuntimeLocalRPCCallRequest is a worker local RPC call request message body.

type RuntimeLocalRPCCallResponse

type RuntimeLocalRPCCallResponse struct {
	// Response.
	Response []byte `json:"response"`
}

RuntimeLocalRPCCallResponse is a worker local RPC call response message body.

type RuntimeQueryRequest added in v0.2100.0

type RuntimeQueryRequest struct {
	// ConsensusBlock is the consensus light block at the last finalized round
	// height (e.g., corresponding to .Header.Round).
	ConsensusBlock consensus.LightBlock `json:"consensus_block"`

	// Header is the current block header.
	Header block.Header `json:"header"`
	// Epoch is the current epoch number.
	Epoch beacon.EpochTime `json:"epoch"`

	// MaxMessages is the maximum number of messages that can be emitted in this
	// round. Any more messages will be rejected by the consensus layer.
	MaxMessages uint32 `json:"max_messages"`

	Method string `json:"method"`
	Args   []byte `json:"args,omitempty"`
}

RuntimeQueryRequest is a runtime query request message body.

type RuntimeQueryResponse added in v0.2100.0

type RuntimeQueryResponse struct {
	Data []byte `json:"data,omitempty"`
}

RuntimeQueryResponse is a runtime query response message body.

type RuntimeRPCCallRequest

type RuntimeRPCCallRequest struct {
	// Request.
	Request []byte `json:"request"`
	// Kind is the type of RPC call.
	Kind enclaverpc.Kind `json:"kind,omitempty"`
}

RuntimeRPCCallRequest is a worker RPC call request message body.

type RuntimeRPCCallResponse

type RuntimeRPCCallResponse struct {
	// Response.
	Response []byte `json:"response"`
}

RuntimeRPCCallResponse is a worker RPC call response message body.

Jump to

Keyboard shortcuts

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