Documentation ¶
Index ¶
- Constants
- Variables
- func InitKVStore(app *PersistentKVStoreApplication)
- func MakeValSetChangeTx(pubkey pc.PublicKey, power int64) []byte
- func RandVal(i int) types.ValidatorUpdate
- func RandVals(cnt int) []types.ValidatorUpdate
- type Application
- func (app *Application) BeginBlock(req types.RequestBeginBlock) types.ResponseBeginBlock
- func (app *Application) CheckTx(req types.RequestCheckTx) types.ResponseCheckTx
- func (app *Application) Commit() types.ResponseCommit
- func (app *Application) DeliverTx(req types.RequestDeliverTx) types.ResponseDeliverTx
- func (app *Application) Info(req types.RequestInfo) (resInfo types.ResponseInfo)
- func (app *Application) ProcessProposal(req types.RequestProcessProposal) types.ResponseProcessProposal
- func (app *Application) Query(reqQuery types.RequestQuery) (resQuery types.ResponseQuery)
- type PersistentKVStoreApplication
- func (app *PersistentKVStoreApplication) ApplySnapshotChunk(req types.RequestApplySnapshotChunk) types.ResponseApplySnapshotChunk
- func (app *PersistentKVStoreApplication) BeginBlock(req types.RequestBeginBlock) types.ResponseBeginBlock
- func (app *PersistentKVStoreApplication) CheckTx(req types.RequestCheckTx) types.ResponseCheckTx
- func (app *PersistentKVStoreApplication) Commit() types.ResponseCommit
- func (app *PersistentKVStoreApplication) DeliverTx(req types.RequestDeliverTx) types.ResponseDeliverTx
- func (app *PersistentKVStoreApplication) EndBlock(req types.RequestEndBlock) types.ResponseEndBlock
- func (app *PersistentKVStoreApplication) Info(req types.RequestInfo) types.ResponseInfo
- func (app *PersistentKVStoreApplication) InitChain(req types.RequestInitChain) types.ResponseInitChain
- func (app *PersistentKVStoreApplication) ListSnapshots(req types.RequestListSnapshots) types.ResponseListSnapshots
- func (app *PersistentKVStoreApplication) LoadSnapshotChunk(req types.RequestLoadSnapshotChunk) types.ResponseLoadSnapshotChunk
- func (app *PersistentKVStoreApplication) OfferSnapshot(req types.RequestOfferSnapshot) types.ResponseOfferSnapshot
- func (app *PersistentKVStoreApplication) PrepareProposal(req types.RequestPrepareProposal) types.ResponsePrepareProposal
- func (app *PersistentKVStoreApplication) ProcessProposal(req types.RequestProcessProposal) types.ResponseProcessProposal
- func (app *PersistentKVStoreApplication) Query(reqQuery types.RequestQuery) (resQuery types.ResponseQuery)
- func (app *PersistentKVStoreApplication) SetLogger(l log.Logger)
- func (app *PersistentKVStoreApplication) Validators() (validators []types.ValidatorUpdate)
- type State
Constants ¶
const ( PreparePrefix = "prepare" ReplacePrefix = "replace" )
const (
ValidatorSetChangePrefix string = "val:"
)
Variables ¶
var (
ProtocolVersion uint64 = 0x1
)
Functions ¶
func InitKVStore ¶
func InitKVStore(app *PersistentKVStoreApplication)
InitKVStore initializes the kvstore app with some data, which allows tests to pass and is fine as long as you don't make any tx that modify the validator state
func RandVal ¶
func RandVal(i int) types.ValidatorUpdate
RandVal creates one random validator, with a key derived from the input value
func RandVals ¶
func RandVals(cnt int) []types.ValidatorUpdate
RandVals returns a list of cnt validators for initializing the application. Note that the keys are deterministically derived from the index in the array, while the power is random (Change this if not desired)
Types ¶
type Application ¶ added in v0.33.0
type Application struct { types.BaseApplication RetainBlocks int64 // blocks to retain after commit (via ResponseCommit.RetainHeight) // contains filtered or unexported fields }
func NewApplication ¶ added in v0.33.0
func NewApplication() *Application
func (*Application) BeginBlock ¶
func (app *Application) BeginBlock(req types.RequestBeginBlock) types.ResponseBeginBlock
func (*Application) CheckTx ¶ added in v0.33.0
func (app *Application) CheckTx(req types.RequestCheckTx) types.ResponseCheckTx
func (*Application) Commit ¶ added in v0.33.0
func (app *Application) Commit() types.ResponseCommit
func (*Application) DeliverTx ¶ added in v0.33.0
func (app *Application) DeliverTx(req types.RequestDeliverTx) types.ResponseDeliverTx
tx is either "key=value" or just arbitrary bytes
func (*Application) Info ¶ added in v0.33.0
func (app *Application) Info(req types.RequestInfo) (resInfo types.ResponseInfo)
func (*Application) ProcessProposal ¶
func (app *Application) ProcessProposal( req types.RequestProcessProposal) types.ResponseProcessProposal
func (*Application) Query ¶ added in v0.33.0
func (app *Application) Query(reqQuery types.RequestQuery) (resQuery types.ResponseQuery)
Returns an associated value or nil if missing.
type PersistentKVStoreApplication ¶
type PersistentKVStoreApplication struct { // validator set ValUpdates []types.ValidatorUpdate // contains filtered or unexported fields }
func NewPersistentKVStoreApplication ¶
func NewPersistentKVStoreApplication(dbDir string) *PersistentKVStoreApplication
func (*PersistentKVStoreApplication) ApplySnapshotChunk ¶ added in v0.34.0
func (app *PersistentKVStoreApplication) ApplySnapshotChunk( req types.RequestApplySnapshotChunk) types.ResponseApplySnapshotChunk
func (*PersistentKVStoreApplication) BeginBlock ¶
func (app *PersistentKVStoreApplication) BeginBlock(req types.RequestBeginBlock) types.ResponseBeginBlock
Track the block hash and header information
func (*PersistentKVStoreApplication) CheckTx ¶
func (app *PersistentKVStoreApplication) CheckTx(req types.RequestCheckTx) types.ResponseCheckTx
func (*PersistentKVStoreApplication) Commit ¶
func (app *PersistentKVStoreApplication) Commit() types.ResponseCommit
Commit will panic if InitChain was not called
func (*PersistentKVStoreApplication) DeliverTx ¶
func (app *PersistentKVStoreApplication) DeliverTx(req types.RequestDeliverTx) types.ResponseDeliverTx
tx is either "val:pubkey!power" or "key=value" or just arbitrary bytes
func (*PersistentKVStoreApplication) EndBlock ¶
func (app *PersistentKVStoreApplication) EndBlock(req types.RequestEndBlock) types.ResponseEndBlock
Update the validator set
func (*PersistentKVStoreApplication) Info ¶
func (app *PersistentKVStoreApplication) Info(req types.RequestInfo) types.ResponseInfo
func (*PersistentKVStoreApplication) InitChain ¶
func (app *PersistentKVStoreApplication) InitChain(req types.RequestInitChain) types.ResponseInitChain
Save the validators in the merkle tree
func (*PersistentKVStoreApplication) ListSnapshots ¶ added in v0.34.0
func (app *PersistentKVStoreApplication) ListSnapshots( req types.RequestListSnapshots) types.ResponseListSnapshots
func (*PersistentKVStoreApplication) LoadSnapshotChunk ¶ added in v0.34.0
func (app *PersistentKVStoreApplication) LoadSnapshotChunk( req types.RequestLoadSnapshotChunk) types.ResponseLoadSnapshotChunk
func (*PersistentKVStoreApplication) OfferSnapshot ¶ added in v0.34.0
func (app *PersistentKVStoreApplication) OfferSnapshot( req types.RequestOfferSnapshot) types.ResponseOfferSnapshot
func (*PersistentKVStoreApplication) PrepareProposal ¶
func (app *PersistentKVStoreApplication) PrepareProposal( req types.RequestPrepareProposal) types.ResponsePrepareProposal
func (*PersistentKVStoreApplication) ProcessProposal ¶
func (app *PersistentKVStoreApplication) ProcessProposal( req types.RequestProcessProposal) types.ResponseProcessProposal
func (*PersistentKVStoreApplication) Query ¶
func (app *PersistentKVStoreApplication) Query(reqQuery types.RequestQuery) (resQuery types.ResponseQuery)
When path=/val and data={validator address}, returns the validator update (types.ValidatorUpdate) varint encoded. For any other path, returns an associated value or nil if missing.
func (*PersistentKVStoreApplication) SetLogger ¶
func (app *PersistentKVStoreApplication) SetLogger(l log.Logger)
func (*PersistentKVStoreApplication) Validators ¶
func (app *PersistentKVStoreApplication) Validators() (validators []types.ValidatorUpdate)