consensus

package
v0.1.15 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2023 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Overview

Package consensus implements an analyzer for the consensus layer.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewAnalyzer

func NewAnalyzer(blockRange config.BlockRange, batchSize uint64, mode analyzer.BlockAnalysisMode, history config.History, sourceClient *source.ConsensusClient, target storage.TargetStorage, logger *log.Logger) (analyzer.Analyzer, error)

NewAnalyzer returns a new analyzer for the consensus layer.

func OpenSignedTxNoVerify

func OpenSignedTxNoVerify(signedTx *transaction.SignedTransaction) (*transaction.Transaction, error)

OpenSignedTxNoVerify decodes the Transaction inside a Signed transaction without verifying the signature. Callers should be sure to check if the transaction actually succeeded. Nexus trusts its oasis-node to provide the correct transaction result, which will indicate if there was an authentication problem. Skipping the verification saves CPU on the analyzer. Due to the chain context being global, we cannot verify transactions for multiple networks anyway.

Types

type EventType

type EventType = apiTypes.ConsensusEventType // alias for brevity

type GenesisProcessor

type GenesisProcessor struct {
	// contains filtered or unexported fields
}

GenesisProcessor generates sql statements for indexing the genesis state.

func NewGenesisProcessor

func NewGenesisProcessor(logger *log.Logger) *GenesisProcessor

NewGenesisProcessor creates a new GenesisProcessor.

func (*GenesisProcessor) Process

func (mg *GenesisProcessor) Process(document *genesis.Document) ([]string, error)

type TransferType

type TransferType string

Enum of transfer types. We single out transfers that deduct from the special "fee accumulator" account. These deductions/disbursements happen at the end of each block. However, oasis-core returns each block's events in the following order: BeginBlockEvents, EndBlockEvents (which include disbursements), TxEvents (which fill the fee accumulator). Thus, processing the events in order results in a temporary negative balance for the fee accumulator, which violates our DB checks. We therefore artificially split transfer events into two: accumulator disbursements, and all others. We process the former at the very end. We might be able to remove this once https://github.com/oasisprotocol/oasis-core/pull/5117 is deployed, making oasis-core send the "correct" event order on its own. But Cobalt (pre-Damask network) will never be fixed.

const (
	TransferTypeAccumulatorDisbursement TransferType = "AccumulatorDisbursement"
	TransferTypeOther                   TransferType = "Other"
)

Jump to

Keyboard shortcuts

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