dummy

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2019 License: Apache-2.0 Imports: 12 Imported by: 0

README

Dummy

There are two app's here: the DummyApplication and the PersistentDummyApplication.

DummyApplication

The DummyApplication is a simple merkle key-value store. Transactions of the form key=value are stored as key-value pairs in the tree. Transactions without an = sign set the value to the key. The app has no replay protection (other than what the mempool provides).

PersistentDummyApplication

The PersistentDummyApplication wraps the DummyApplication and provides two additional features:

  1. persistence of state across app restarts (using Tendermint's ABCI-Handshake mechanism)
  2. validator set changes

The state is persisted in leveldb along with the last block committed, and the Handshake allows any necessary blocks to be replayed. Validator set changes are effected using the following transaction format:

val:pubkey1/power1,addr2/power2,addr3/power3"

where power1 is the new voting power for the validator with pubkey1 (possibly a new one). There is no sybil protection against new validators joining. Validators can be removed by setting their power to 0.

Documentation

Index

Constants

View Source
const (
	ValidatorSetChangePrefix string = "val:"
)

Variables

This section is empty.

Functions

func MakeValSetChangeTx

func MakeValSetChangeTx(pubkey []byte, power uint64) []byte

func SaveLastBlock

func SaveLastBlock(db dbm.DB, lastBlock LastBlockInfo)

Types

type DummyApplication

type DummyApplication struct {
	types.BaseApplication
	// contains filtered or unexported fields
}

func NewDummyApplication

func NewDummyApplication() *DummyApplication

func (*DummyApplication) CheckTx

func (app *DummyApplication) CheckTx(tx []byte) types.Result

func (*DummyApplication) Commit

func (app *DummyApplication) Commit() types.Result

func (*DummyApplication) DeliverTx

func (app *DummyApplication) DeliverTx(tx []byte) types.Result

tx is either "key=value" or just arbitrary bytes

func (*DummyApplication) Info

func (app *DummyApplication) Info() (resInfo types.ResponseInfo)

func (*DummyApplication) Query

func (app *DummyApplication) Query(reqQuery types.RequestQuery) (resQuery types.ResponseQuery)

type LastBlockInfo

type LastBlockInfo struct {
	Height  uint64
	AppHash []byte
}

func LoadLastBlock

func LoadLastBlock(db dbm.DB) (lastBlock LastBlockInfo)

Get the last block from the db

type PersistentDummyApplication

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

func NewPersistentDummyApplication

func NewPersistentDummyApplication(dbDir string) *PersistentDummyApplication

func (*PersistentDummyApplication) BeginBlock

func (app *PersistentDummyApplication) BeginBlock(hash []byte, header *types.Header)

Track the block hash and header information

func (*PersistentDummyApplication) CheckTx

func (app *PersistentDummyApplication) CheckTx(tx []byte) types.Result

func (*PersistentDummyApplication) Commit

func (app *PersistentDummyApplication) Commit() types.Result

func (*PersistentDummyApplication) DeliverTx

func (app *PersistentDummyApplication) DeliverTx(tx []byte) types.Result

tx is either "key=value" or just arbitrary bytes

func (*PersistentDummyApplication) EndBlock

func (app *PersistentDummyApplication) EndBlock(height uint64) (resEndBlock types.ResponseEndBlock)

Update the validator set

func (*PersistentDummyApplication) Info

func (app *PersistentDummyApplication) Info() (resInfo types.ResponseInfo)

func (*PersistentDummyApplication) InitChain

func (app *PersistentDummyApplication) InitChain(validators []*types.Validator)

Save the validators in the merkle tree

func (*PersistentDummyApplication) Query

func (*PersistentDummyApplication) SetLogger added in v0.5.0

func (app *PersistentDummyApplication) SetLogger(l log.Logger)

func (*PersistentDummyApplication) SetOption

func (app *PersistentDummyApplication) SetOption(key string, value string) (log string)

func (*PersistentDummyApplication) Validators

func (app *PersistentDummyApplication) Validators() (validators []*types.Validator)

Jump to

Keyboard shortcuts

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