types

package
v0.0.0-...-a3b524e Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2018 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const TimeFormat = wire.RFC3339Millis

Variables

This section is empty.

Functions

func CanonicalTime

func CanonicalTime(t time.Time) string

Types

type ABCIResponses

type ABCIResponses struct {
	DeliverTx []*abci.ResponseDeliverTx
	EndBlock  *abci.ResponseEndBlock
}

ABCIResponse

func (*ABCIResponses) Bytes

func (a *ABCIResponses) Bytes() []byte

type Address

type Address = cmn.HexBytes

type Block

type Block struct {
	*Header    `json:"header"`
	*Data      `json:"data"`
	Evidence   EvidenceData `json:"evidence"`
	LastCommit *Commit      `json:"last_commit"`
}

func (*Block) MakePartSet

func (b *Block) MakePartSet(partSize int) *PartSet

type BlockGossip

type BlockGossip struct {
	BlockPartSizeBytes int `json:"block_part_size_bytes"` // NOTE: must not be 0
}

type BlockID

type BlockID struct {
	Hash        cmn.HexBytes  `json:"hash"`
	PartsHeader PartSetHeader `json:"parts"`
}

func (BlockID) Equals

func (blockID BlockID) Equals(other BlockID) bool

type BlockMeta

type BlockMeta struct {
	BlockID BlockID `json:"block_id"` // the block hash and partsethash
	Header  *Header `json:"header"`   // The block's Header
}

type BlockSize

type BlockSize struct {
	MaxBytes int   `json:"max_bytes"` // NOTE: must not be 0 nor greater than 100MB
	MaxTxs   int   `json:"max_txs"`
	MaxGas   int64 `json:"max_gas"`
}

type BlockStoreStateJSON

type BlockStoreStateJSON struct {
	Height int64
}

type CanonicalJSONBlockID

type CanonicalJSONBlockID struct {
	Hash        cmn.HexBytes               `json:"hash,omitempty"`
	PartsHeader CanonicalJSONPartSetHeader `json:"parts,omitempty"`
}

func CanonicalBlockID

func CanonicalBlockID(blockID BlockID) CanonicalJSONBlockID

type CanonicalJSONOnceProposal

type CanonicalJSONOnceProposal struct {
	ChainID  string                `json:"chain_id"`
	Proposal CanonicalJSONProposal `json:"proposal"`
}

type CanonicalJSONOnceVote

type CanonicalJSONOnceVote struct {
	ChainID string            `json:"chain_id"`
	Vote    CanonicalJSONVote `json:"vote"`
}

type CanonicalJSONPartSetHeader

type CanonicalJSONPartSetHeader struct {
	Hash  cmn.HexBytes `json:"hash"`
	Total int          `json:"total"`
}

func CanonicalPartSetHeader

func CanonicalPartSetHeader(psh PartSetHeader) CanonicalJSONPartSetHeader

type CanonicalJSONProposal

type CanonicalJSONProposal struct {
	BlockPartsHeader CanonicalJSONPartSetHeader `json:"block_parts_header"`
	Height           int64                      `json:"height"`
	POLBlockID       CanonicalJSONBlockID       `json:"pol_block_id"`
	POLRound         int                        `json:"pol_round"`
	Round            int                        `json:"round"`
	Timestamp        string                     `json:"timestamp"`
}

func CanonicalProposal

func CanonicalProposal(proposal *Proposal) CanonicalJSONProposal

type CanonicalJSONVote

type CanonicalJSONVote struct {
	BlockID   CanonicalJSONBlockID `json:"block_id"`
	Height    int64                `json:"height"`
	Round     int                  `json:"round"`
	Timestamp string               `json:"timestamp"`
	Type      byte                 `json:"type"`
}

func CanonicalVote

func CanonicalVote(vote *Vote) CanonicalJSONVote

type Commit

type Commit struct {
	BlockID    BlockID `json:"blockID"`
	Precommits []*Vote `json:"precommits"`
	// contains filtered or unexported fields
}

type ConsensusParams

type ConsensusParams struct {
	BlockSize      `json:"block_size_params"`
	TxSize         `json:"tx_size_params"`
	BlockGossip    `json:"block_gossip_params"`
	EvidenceParams `json:"evidence_params"`
}

type ConsensusParamsInfo

type ConsensusParamsInfo struct {
	ConsensusParams   ConsensusParams
	LastHeightChanged int64
}

ConsensusParamsInfo

func (ConsensusParamsInfo) Bytes

func (params ConsensusParamsInfo) Bytes() []byte

type Data

type Data struct {
	Txs Txs `json:"txs"`
	// contains filtered or unexported fields
}

type DuplicateVoteEvidence

type DuplicateVoteEvidence struct {
	PubKey gco.PubKey
	VoteA  *Vote
	VoteB  *Vote
}

func (*DuplicateVoteEvidence) Address

func (dve *DuplicateVoteEvidence) Address() []byte

Address returns the address of the validator.

func (*DuplicateVoteEvidence) Equal

func (dve *DuplicateVoteEvidence) Equal(ev Evidence) bool

Equal checks if two pieces of evidence are equal.

func (*DuplicateVoteEvidence) Hash

func (dve *DuplicateVoteEvidence) Hash() []byte

Hash returns the hash of the evidence.

func (*DuplicateVoteEvidence) Height

func (dve *DuplicateVoteEvidence) Height() int64

Height returns the height this evidence refers to.

func (*DuplicateVoteEvidence) Index

func (dve *DuplicateVoteEvidence) Index() int

Index returns the index of the validator.

func (*DuplicateVoteEvidence) String

func (dve *DuplicateVoteEvidence) String() string

func (*DuplicateVoteEvidence) Verify

func (dve *DuplicateVoteEvidence) Verify(chainID string) error

Verify returns an error if the two votes aren't conflicting. To be conflicting, they must be from the same validator, for the same H/R/S, but for different blocks.

type EventDataRoundState

type EventDataRoundState struct {
	Height int64  `json:"height"`
	Round  int    `json:"round"`
	Step   string `json:"step"`

	// private, not exposed to websockets
	RoundState interface{} `json:"-"`
}

type Evidence

type Evidence interface {
	Height() int64               // height of the equivocation
	Address() []byte             // address of the equivocating validator
	Index() int                  // index of the validator in the validator set
	Hash() []byte                // hash of the evidence
	Verify(chainID string) error // verify the evidence
	Equal(Evidence) bool         // check equality of evidence

	String() string
}

type EvidenceData

type EvidenceData struct {
	Evidence EvidenceList `json:"evidence"`
	// contains filtered or unexported fields
}

type EvidenceInfo

type EvidenceInfo struct {
	Committed bool
	Priority  int64
	Evidence  Evidence
}

type EvidenceList

type EvidenceList []Evidence

type EvidenceParams

type EvidenceParams struct {
	MaxAge int64 `json:"max_age"` // only accept new evidence more recent than this
}

type GenesisDoc

type GenesisDoc struct {
	GenesisTime     time.Time          `json:"genesis_time"`
	ChainID         string             `json:"chain_id"`
	ConsensusParams *ConsensusParams   `json:"consensus_params,omitempty"`
	Validators      []GenesisValidator `json:"validators"`
	AppHash         cmn.HexBytes       `json:"app_hash"`
	AppStateJSON    json.RawMessage    `json:"app_state,omitempty"`
	AppOptions      json.RawMessage    `json:"app_options,omitempty"` // DEPRECATED
}

func GenesisDocFromJSON

func GenesisDocFromJSON(jsonBlob []byte) (*GenesisDoc, error)

func MakeGenesisDocFromFile

func MakeGenesisDocFromFile(genDocFile string) (*GenesisDoc, error)

type GenesisValidator

type GenesisValidator struct {
	PubKey gco.PubKey `json:"pub_key"`
	Power  int64      `json:"power"`
	Name   string     `json:"name"`
}
type Header struct {
	// basic block info
	ChainID string    `json:"chain_id"`
	Height  int64     `json:"height"`
	Time    time.Time `json:"time"`
	NumTxs  int64     `json:"num_txs"`

	// prev block info
	LastBlockID BlockID `json:"last_block_id"`
	TotalTxs    int64   `json:"total_txs"`

	// hashes of block data
	LastCommitHash cmn.HexBytes `json:"last_commit_hash"` // commit from validators from the last block
	DataHash       cmn.HexBytes `json:"data_hash"`        // transactions

	// hashes from the app output from the prev block
	ValidatorsHash  cmn.HexBytes `json:"validators_hash"`   // validators for the current block
	ConsensusHash   cmn.HexBytes `json:"consensus_hash"`    // consensus params for current block
	AppHash         cmn.HexBytes `json:"app_hash"`          // state after txs from the previous block
	LastResultsHash cmn.HexBytes `json:"last_results_hash"` // root hash of all results from the txs from the previous block

	// consensus info
	EvidenceHash cmn.HexBytes `json:"evidence_hash"` // evidence included in the block
}

type Heartbeat

type Heartbeat struct {
	ValidatorAddress Address          `json:"validator_address"`
	ValidatorIndex   int              `json:"validator_index"`
	Height           int64            `json:"height"`
	Round            int              `json:"round"`
	Sequence         int              `json:"sequence"`
	Signature        crypto.Signature `json:"signature"`
}

type Part

type Part struct {
	Index int                `json:"index"`
	Bytes cmn.HexBytes       `json:"bytes"`
	Proof merkle.SimpleProof `json:"proof"`
	// contains filtered or unexported fields
}

func (*Part) Hash

func (part *Part) Hash() []byte

type PartSet

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

func NewPartSetFromData

func NewPartSetFromData(data []byte, partSize int) *PartSet

func (*PartSet) Total

func (ps *PartSet) Total() int

type PartSetHeader

type PartSetHeader struct {
	Total int          `json:"total"`
	Hash  cmn.HexBytes `json:"hash"`
}

func (PartSetHeader) Equals

func (psh PartSetHeader) Equals(other PartSetHeader) bool

type PrivValidatorFS

type PrivValidatorFS struct {
	Address       Address       `json:"address"`
	PubKey        gco.PubKey    `json:"pub_key"`
	LastHeight    int64         `json:"last_height"`
	LastRound     int           `json:"last_round"`
	LastStep      int8          `json:"last_step"`
	LastSignature gco.Signature `json:"last_signature,omitempty"` // so we dont lose signatures
	LastSignBytes cmn.HexBytes  `json:"last_signbytes,omitempty"` // so we dont lose signatures
	PrivKey       gco.PrivKey   `json:"priv_key"`
	// contains filtered or unexported fields
}

func LoadPrivValidator

func LoadPrivValidator(filePath string) *PrivValidatorFS

func (*PrivValidatorFS) Save

func (pv *PrivValidatorFS) Save()

Save persists the PrivValidatorFS to disk.

type Proposal

type Proposal struct {
	Height           int64            `json:"height"`
	Round            int              `json:"round"`
	Timestamp        time.Time        `json:"timestamp"`
	BlockPartsHeader PartSetHeader    `json:"block_parts_header"`
	POLRound         int              `json:"pol_round"`    // -1 if null.
	POLBlockID       BlockID          `json:"pol_block_id"` // zero if null.
	Signature        crypto.Signature `json:"signature"`
}

func (*Proposal) SignBytes

func (p *Proposal) SignBytes(chainID string) []byte

type State

type State struct {
	ChainID                          string
	LastBlockHeight                  int64
	LastBlockTotalTx                 int64
	LastBlockID                      BlockID
	LastBlockTime                    time.Time
	Validators                       *ValidatorSet
	LastValidators                   *ValidatorSet
	LastHeightValidatorsChanged      int64
	ConsensusParams                  ConsensusParams
	LastHeightConsensusParamsChanged int64
	LastResultsHash                  []byte
	AppHash                          []byte
}

func (State) Bytes

func (s State) Bytes() []byte

type Tx

type Tx []byte

type TxSize

type TxSize struct {
	MaxBytes int   `json:"max_bytes"`
	MaxGas   int64 `json:"max_gas"`
}

type Txs

type Txs []Tx

type Validator

type Validator struct {
	Address     Address    `json:"address"`
	PubKey      gco.PubKey `json:"pub_key"`
	VotingPower int64      `json:"voting_power"`
	Accum       int64      `json:"accum"`
}

func (*Validator) Copy

func (v *Validator) Copy() *Validator

type ValidatorSet

type ValidatorSet struct {
	// NOTE: persisted via reflect, must be exported.
	Validators []*Validator `json:"validators"`
	Proposer   *Validator   `json:"proposer"`
	// contains filtered or unexported fields
}

func (*ValidatorSet) Copy

func (valSet *ValidatorSet) Copy() *ValidatorSet

type ValidatorsInfo

type ValidatorsInfo struct {
	ValidatorSet      *ValidatorSet
	LastHeightChanged int64
}

ValidatorsInfo

func (*ValidatorsInfo) Bytes

func (valInfo *ValidatorsInfo) Bytes() []byte

type Vote

type Vote struct {
	ValidatorAddress Address       `json:"validator_address"`
	ValidatorIndex   int           `json:"validator_index"`
	Height           int64         `json:"height"`
	Round            int           `json:"round"`
	Timestamp        time.Time     `json:"timestamp"`
	Type             byte          `json:"type"`
	BlockID          BlockID       `json:"block_id"` // zero if vote is nil.
	Signature        gco.Signature `json:"signature"`
}

func (*Vote) SignBytes

func (vote *Vote) SignBytes(chainID string) []byte

Jump to

Keyboard shortcuts

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