proofs

package
v0.10.3 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2017 License: Apache-2.0 Imports: 11 Imported by: 2

Documentation

Index

Constants

View Source
const Raw = "raw"

Variables

This section is empty.

Functions

func ParseHexKey added in v0.10.1

func ParseHexKey(str string) ([]byte, error)

func ValidateBlock added in v0.10.0

func ValidateBlock(meta *types.Block, check lc.Checkpoint) error

func ValidateBlockMeta added in v0.10.0

func ValidateBlockMeta(meta *types.BlockMeta, check lc.Checkpoint) error

func ValidateHeader added in v0.10.0

func ValidateHeader(head *types.Header, check lc.Checkpoint) error

Types

type AppProof

type AppProof struct {
	Height uint64
	Key    data.Bytes
	Value  data.Bytes
	Proof  data.Bytes
}

AppProof containts a key-value pair at a given height. It also contains the merkle proof from that key-value pair to the root hash, which can be verified against a signed header.

func (AppProof) BlockHeight

func (p AppProof) BlockHeight() uint64

func (AppProof) Data added in v0.10.0

func (p AppProof) Data() []byte

func (AppProof) Marshal

func (p AppProof) Marshal() ([]byte, error)

func (AppProof) Validate

func (p AppProof) Validate(check lc.Checkpoint) error

type AppProver

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

AppProver provides positive proofs of key-value pairs in the abciapp.

TODO: also support negative proofs (this key is not set)

func NewAppProver

func NewAppProver(node client.Client) AppProver

func (AppProver) Get

func (a AppProver) Get(key []byte, h uint64) (lc.Proof, error)

Get tries to download a merkle hash for app state on this key from the tendermint node.

func (AppProver) Unmarshal

func (a AppProver) Unmarshal(data []byte) (lc.Proof, error)

type KeyMaker added in v0.10.0

type KeyMaker struct {
	Prefix []byte
}

KeyMaker can be embedded for a basic and flexible key encoder

func (KeyMaker) MakeKey added in v0.10.0

func (k KeyMaker) MakeKey(str string) ([]byte, error)

type Presenter added in v0.10.0

type Presenter interface {
	MakeKey(string) ([]byte, error)
	ParseData([]byte) (interface{}, error)
}

Presenter allows us to encode queries and parse results in an app-specific way

type Presenters added in v0.10.0

type Presenters map[string]Presenter

func NewPresenters added in v0.10.0

func NewPresenters() Presenters

NewPresenters gives you a default raw presenter

func (Presenters) BruteForce added in v0.10.0

func (p Presenters) BruteForce(raw []byte) (interface{}, error)

BruteForce will try all regitered parsers in random order, before calling RawPresenter. Use if we have no idea how to interpret the data (eg. decoding all tx in a block)

func (Presenters) Lookup added in v0.10.0

func (p Presenters) Lookup(app string) (Presenter, error)

Lookup tries to find a registered presenter, or the raw presenter

func (Presenters) Register added in v0.10.0

func (p Presenters) Register(app string, pres Presenter)

Register adds this app to the lookup table to parse it

type RawPresenter added in v0.10.0

type RawPresenter struct {
	KeyMaker
}

RawPresenter just hex-encodes/decodes text. Useful as default, or to embed in other structs for the MakeKey implementation

If you set a prefix, it will be prepended to all your data after hex-decoding them

func (RawPresenter) ParseData added in v0.10.0

func (p RawPresenter) ParseData(raw []byte) (interface{}, error)

ParseData on the raw-presenter, just provides a hex-encoding of the bytes

type TxProof

type TxProof struct {
	Height uint64
	Proof  types.TxProof
}

TxProof checks ALL txs for one block... we need a better way!

func (TxProof) BlockHeight

func (p TxProof) BlockHeight() uint64

func (TxProof) Data added in v0.10.0

func (p TxProof) Data() []byte

func (TxProof) Marshal

func (p TxProof) Marshal() ([]byte, error)

func (TxProof) Validate

func (p TxProof) Validate(check lc.Checkpoint) error

type TxProver

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

TxProver provides positive proofs of key-value pairs in the abciapp.

TODO: also support negative proofs (this key is not set)

func NewTxProver

func NewTxProver(node client.Client) TxProver

func (TxProver) Get

func (t TxProver) Get(key []byte, h uint64) (lc.Proof, error)

Get tries to download a merkle hash for app state on this key from the tendermint node.

Important: key must be Tx.Hash() Height is completely ignored for now :(

func (TxProver) Unmarshal

func (t TxProver) Unmarshal(data []byte) (pr lc.Proof, err error)

Jump to

Keyboard shortcuts

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