Documentation ¶
Overview ¶
Package api implements the root hash backend API and common datastructures.
Index ¶
- Constants
- type AnnotatedBlock
- type ConsensusParameters
- type EquivocationBatchEvidence
- type EquivocationExecutorEvidence
- type Event
- type Evidence
- type EvidenceKind
- type ExecutionDiscrepancyDetectedEvent
- type ExecutorCommit
- type ExecutorCommittedEvent
- type ExecutorProposerTimeoutRequest
- type FinalizedEvent
- type Genesis
- type GenesisRuntimeState
- type MessageEvent
- type RoundResults
- type RuntimeState
Constants ¶
const ( // ModuleName is a unique module name for the roothash module. ModuleName = "roothash" // RoundInvalid is a special round number that refers to an invalid round. RoundInvalid uint64 = math.MaxUint64 // LogEventExecutionDiscrepancyDetected is a log event value that signals // an execution discrepancy has been detected. LogEventExecutionDiscrepancyDetected = "roothash/execution_discrepancy_detected" // LogEventTimerFired is a log event value that signals a timer has fired. LogEventTimerFired = "roothash/timer_fired" // LogEventRoundFailed is a log event value that signals a round has failed. LogEventRoundFailed = "roothash/round_failed" // LogEventMessageUnsat is a log event value that signals a roothash message was not satisfactory. LogEventMessageUnsat = "roothash/message_unsat" // LogEventHistoryReindexing is a log event value that signals a roothash runtime reindexing // was run. LogEventHistoryReindexing = "roothash/history_reindexing" )
const ( // GasOpComputeCommit is the gas operation identifier for compute commits. GasOpComputeCommit transaction.Op = "compute_commit" // GasOpProposerTimeout is the gas operation identifier for executor propose timeout cost. GasOpProposerTimeout transaction.Op = "proposer_timeout" // GasOpEvidence is the gas operation identifier for evidence submission transaction cost. GasOpEvidence transaction.Op = "evidence" )
const (
// EvidenceKindEquivocation is the evidence kind for equivocation.
EvidenceKindEquivocation = 1
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AnnotatedBlock ¶
type AnnotatedBlock struct { // Height is the underlying roothash backend's block height that // generated this block. Height int64 `json:"consensus_height"` // Block is the roothash block. Block *block.Block `json:"block"` }
AnnotatedBlock is an annotated roothash block.
type ConsensusParameters ¶
type ConsensusParameters struct { // GasCosts are the roothash transaction gas costs. GasCosts transaction.Costs `json:"gas_costs,omitempty"` // DebugDoNotSuspendRuntimes is true iff runtimes should not be suspended // for lack of paying maintenance fees. DebugDoNotSuspendRuntimes bool `json:"debug_do_not_suspend_runtimes,omitempty"` // DebugBypassStake is true iff the roothash should bypass all of the staking // related checks and operations. DebugBypassStake bool `json:"debug_bypass_stake,omitempty"` // MaxRuntimeMessages is the maximum number of allowed messages that can be emitted by a runtime // in a single round. MaxRuntimeMessages uint32 `json:"max_runtime_messages"` // MaxEvidenceAge is the maximum age of submitted evidence in the number of rounds. MaxEvidenceAge uint64 `json:"max_evidence_age"` }
ConsensusParameters are the roothash consensus parameters.
type EquivocationBatchEvidence ¶
type EquivocationBatchEvidence struct { BatchA commitment.SignedProposedBatch `json:"batch_a"` BatchB commitment.SignedProposedBatch `json:"batch_b"` }
EquivocationBatchEvidence is evidence of executor proposed batch equivocation.
type EquivocationExecutorEvidence ¶
type EquivocationExecutorEvidence struct { CommitA commitment.ExecutorCommitment `json:"commit_a"` CommitB commitment.ExecutorCommitment `json:"commit_b"` }
EquivocationExecutorEvidence is evidence of executor commitment equivocation.
type Event ¶
type Event struct { Height int64 `json:"height,omitempty"` TxHash hash.Hash `json:"tx_hash,omitempty"` RuntimeID common.Namespace `json:"runtime_id"` ExecutorCommitted *ExecutorCommittedEvent `json:"executor_committed,omitempty"` ExecutionDiscrepancyDetected *ExecutionDiscrepancyDetectedEvent `json:"execution_discrepancy,omitempty"` Finalized *FinalizedEvent `json:"finalized,omitempty"` Message *MessageEvent `json:"message,omitempty"` }
Event is a roothash event.
type Evidence ¶
type Evidence struct { ID common.Namespace `json:"id"` EquivocationExecutor *EquivocationExecutorEvidence `json:"equivocation_executor,omitempty"` EquivocationBatch *EquivocationBatchEvidence `json:"equivocation_batch,omitempty"` }
Evidence is an evidence of node misbehaviour.
type ExecutionDiscrepancyDetectedEvent ¶
type ExecutionDiscrepancyDetectedEvent struct { // Timeout signals whether the discrepancy was due to a timeout. Timeout bool `json:"timeout"` }
ExecutionDiscrepancyDetectedEvent is an execute discrepancy detected event.
type ExecutorCommit ¶
type ExecutorCommit struct { ID common.Namespace `json:"id"` Commits []commitment.ExecutorCommitment `json:"commits"` }
ExecutorCommit is the argument set for the ExecutorCommit method.
type ExecutorCommittedEvent ¶
type ExecutorCommittedEvent struct { // Commit is the executor commitment. Commit commitment.ExecutorCommitment `json:"commit"` }
ExecutorCommittedEvent is an event emitted each time an executor node commits.
type ExecutorProposerTimeoutRequest ¶
type ExecutorProposerTimeoutRequest struct { ID common.Namespace `json:"id"` Round uint64 `json:"round"` }
ExecutorProposerTimeoutRequest is an executor proposer timeout request.
type FinalizedEvent ¶
type FinalizedEvent struct { // Round is the round that was finalized. Round uint64 `json:"round"` // GoodComputeNodes are the public keys of compute nodes that positively contributed to the // round by replicating the computation correctly. GoodComputeNodes []signature.PublicKey `json:"good_compute_nodes,omitempty"` // BadComputeNodes are the public keys of compute nodes that negatively contributed to the round // by causing discrepancies. BadComputeNodes []signature.PublicKey `json:"bad_compute_nodes,omitempty"` }
FinalizedEvent is a finalized event.
type Genesis ¶
type Genesis struct { // Parameters are the roothash consensus parameters. Parameters ConsensusParameters `json:"params"` // RuntimeStates are the runtime states at genesis. RuntimeStates map[common.Namespace]*GenesisRuntimeState `json:"runtime_states,omitempty"` }
Genesis is the roothash genesis state.
type GenesisRuntimeState ¶
type GenesisRuntimeState struct { registry.RuntimeGenesis // MessageResults are the message results emitted at the last processed round. MessageResults []*MessageEvent `json:"message_results,omitempty"` }
GenesisRuntimeState contains state for runtimes that are restored in a genesis block.
type MessageEvent ¶
type MessageEvent struct { Module string `json:"module,omitempty"` Code uint32 `json:"code,omitempty"` Index uint32 `json:"index,omitempty"` }
MessageEvent is a runtime message processed event.
type RoundResults ¶
type RoundResults struct { // Messages are the results of executing emitted runtime messages. Messages []*MessageEvent `json:"messages,omitempty"` // GoodComputeEntities are the public keys of compute nodes' controlling entities that // positively contributed to the round by replicating the computation correctly. GoodComputeEntities []signature.PublicKey `json:"good_compute_entities,omitempty"` // BadComputeEntities are the public keys of compute nodes' controlling entities that // negatively contributed to the round by causing discrepancies. BadComputeEntities []signature.PublicKey `json:"bad_compute_entities,omitempty"` }
RoundResults contains information about how a particular round was executed by the consensus layer.
type RuntimeState ¶
type RuntimeState struct { Runtime *registry.Runtime `json:"runtime"` Suspended bool `json:"suspended,omitempty"` GenesisBlock *block.Block `json:"genesis_block"` CurrentBlock *block.Block `json:"current_block"` CurrentBlockHeight int64 `json:"current_block_height"` // LastNormalRound is the runtime round which was normally processed by the runtime. This is // also the round that contains the message results for the last processed runtime messages. LastNormalRound uint64 `json:"last_normal_round"` // LastNormalHeight is the consensus block height corresponding to LastNormalRound. LastNormalHeight int64 `json:"last_normal_height"` ExecutorPool *commitment.Pool `json:"executor_pool"` }
RuntimeState is the per-runtime state.
Directories ¶
Path | Synopsis |
---|---|
Package block implements the roothash block and header.
|
Package block implements the roothash block and header. |
Package commitment defines a roothash commitment.
|
Package commitment defines a roothash commitment. |
Package message implements the supported runtime messages.
|
Package message implements the supported runtime messages. |