evidences

package
v0.4.8 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2020 License: Apache-2.0 Imports: 10 Imported by: 4

Documentation

Overview

Package evidences defines Tendermint proofs. It is needed by a store to know how to deserialize a segment containing a Tendermint proof.

Index

Constants

View Source
const (
	// Version0_1_0 is used with Tendermint 0.18.0.
	// It shouldn't be used in production.
	Version0_1_0 = "0.1.0"

	// Version is the current version of the Tendermint evidence.
	Version = Version0_1_0

	// TMPopName is the name used as the Tendermint PoP backend.
	TMPopName = "TMPop"
)

Variables

View Source
var (
	ErrInvalidBackend = errors.New("backend is not TMPop")
	ErrMissingChainID = errors.New("provider should be the ID of the tendermint chain")
	ErrUnknownVersion = errors.New("unknown evidence version")
)

Errors used by the Tendermint evidence.

Functions

This section is empty.

Types

type TendermintProof

type TendermintProof struct {
	BlockHeight int64 `json:"blockHeight"`

	Root            []byte       `json:"merkleRoot"`
	Path            mktypes.Path `json:"merklePath"`
	ValidationsHash []byte       `json:"validationsHash"`

	// The header and its votes are needed to validate
	// the previous app hash and metadata such as the height and time.
	Header             *tmtypes.Header       `json:"header"`
	HeaderVotes        []*TendermintVote     `json:"headerVotes"`
	HeaderValidatorSet *tmtypes.ValidatorSet `json:"headerValidatorSet"`

	// The next header and its votes are needed to validate
	// the app hash representing the validations and merkle path.
	NextHeader             *tmtypes.Header       `json:"nextHeader"`
	NextHeaderVotes        []*TendermintVote     `json:"nextHeaderVotes"`
	NextHeaderValidatorSet *tmtypes.ValidatorSet `json:"nextHeaderValidatorSet"`
}

TendermintProof implements the Proof interface.

func UnmarshalProof

func UnmarshalProof(e *chainscript.Evidence) (*TendermintProof, error)

UnmarshalProof unmarshals the Tendermint proof contained in an evidence.

func (*TendermintProof) Evidence

func (p *TendermintProof) Evidence(chainID string) (*chainscript.Evidence, error)

Evidence wraps the proof in a versioned evidence.

func (*TendermintProof) Time

func (p *TendermintProof) Time() uint64

Time returns the timestamp from the block header

func (*TendermintProof) Verify

func (p *TendermintProof) Verify(linkHash interface{}) bool

Verify returns true if the proof of a given linkHash is correct

type TendermintVote

type TendermintVote struct {
	PubKey *crypto.PubKey `json:"pubKey"`
	Vote   *tmtypes.Vote  `json:"vote"`
}

TendermintVote is a signed vote by one of the Tendermint validator nodes.

Jump to

Keyboard shortcuts

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