Documentation ¶
Index ¶
- Constants
- Variables
- func InitKVStore(app *PersistentKVStoreApplication)
- func MakeValSetChangeTx(pubkey crypto.PubKey, power int64) []byte
- func RandVal(i int) abci.ValidatorUpdate
- func RandVals(cnt int) []abci.ValidatorUpdate
- type KVStoreApplication
- func (app *KVStoreApplication) CheckTx(req abci.RequestCheckTx) abci.ResponseCheckTx
- func (app *KVStoreApplication) Close() error
- func (app *KVStoreApplication) Commit() (res abci.ResponseCommit)
- func (app *KVStoreApplication) DeliverTx(req abci.RequestDeliverTx) (res abci.ResponseDeliverTx)
- func (app *KVStoreApplication) Info(req abci.RequestInfo) (resInfo abci.ResponseInfo)
- func (app *KVStoreApplication) Query(reqQuery abci.RequestQuery) (resQuery abci.ResponseQuery)
- type PersistentKVStoreApplication
- func (app *PersistentKVStoreApplication) BeginBlock(req abci.RequestBeginBlock) abci.ResponseBeginBlock
- func (app *PersistentKVStoreApplication) CheckTx(req abci.RequestCheckTx) abci.ResponseCheckTx
- func (app *PersistentKVStoreApplication) Close() error
- func (app *PersistentKVStoreApplication) Commit() abci.ResponseCommit
- func (app *PersistentKVStoreApplication) DeliverTx(req abci.RequestDeliverTx) abci.ResponseDeliverTx
- func (app *PersistentKVStoreApplication) EndBlock(req abci.RequestEndBlock) abci.ResponseEndBlock
- func (app *PersistentKVStoreApplication) Info(req abci.RequestInfo) abci.ResponseInfo
- func (app *PersistentKVStoreApplication) InitChain(req abci.RequestInitChain) abci.ResponseInitChain
- func (app *PersistentKVStoreApplication) Query(reqQuery abci.RequestQuery) (resQuery abci.ResponseQuery)
- func (app *PersistentKVStoreApplication) SetLogger(l *slog.Logger)
- func (app *PersistentKVStoreApplication) SetOption(req abci.RequestSetOption) abci.ResponseSetOption
- func (app *PersistentKVStoreApplication) Validators() (validators []abci.ValidatorUpdate)
- type State
Constants ¶
const ( ValidatorUpdatePrefix string = "val:" ValidatorKeyPrefix string = "/val/" )
Variables ¶
var (
AppVersion = "v0.0.0"
)
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) abci.ValidatorUpdate
RandVal creates one random validator, with a key derived from the input value
func RandVals ¶
func RandVals(cnt int) []abci.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 KVStoreApplication ¶
type KVStoreApplication struct { abci.BaseApplication // contains filtered or unexported fields }
func NewKVStoreApplication ¶
func NewKVStoreApplication() *KVStoreApplication
func (*KVStoreApplication) CheckTx ¶
func (app *KVStoreApplication) CheckTx(req abci.RequestCheckTx) abci.ResponseCheckTx
func (*KVStoreApplication) Close ¶
func (app *KVStoreApplication) Close() error
func (*KVStoreApplication) Commit ¶
func (app *KVStoreApplication) Commit() (res abci.ResponseCommit)
func (*KVStoreApplication) DeliverTx ¶
func (app *KVStoreApplication) DeliverTx(req abci.RequestDeliverTx) (res abci.ResponseDeliverTx)
tx is either "key=value" or just arbitrary bytes
func (*KVStoreApplication) Info ¶
func (app *KVStoreApplication) Info(req abci.RequestInfo) (resInfo abci.ResponseInfo)
func (*KVStoreApplication) Query ¶
func (app *KVStoreApplication) Query(reqQuery abci.RequestQuery) (resQuery abci.ResponseQuery)
Returns an associated value or nil if missing.
type PersistentKVStoreApplication ¶
type PersistentKVStoreApplication struct { // validator set ValSetChanges []abci.ValidatorUpdate // contains filtered or unexported fields }
func NewPersistentKVStoreApplication ¶
func NewPersistentKVStoreApplication(dbDir string) *PersistentKVStoreApplication
func (*PersistentKVStoreApplication) BeginBlock ¶
func (app *PersistentKVStoreApplication) BeginBlock(req abci.RequestBeginBlock) abci.ResponseBeginBlock
Track the block hash and header information
func (*PersistentKVStoreApplication) CheckTx ¶
func (app *PersistentKVStoreApplication) CheckTx(req abci.RequestCheckTx) abci.ResponseCheckTx
func (*PersistentKVStoreApplication) Close ¶
func (app *PersistentKVStoreApplication) Close() error
func (*PersistentKVStoreApplication) Commit ¶
func (app *PersistentKVStoreApplication) Commit() abci.ResponseCommit
Commit will panic if InitChain was not called
func (*PersistentKVStoreApplication) DeliverTx ¶
func (app *PersistentKVStoreApplication) DeliverTx(req abci.RequestDeliverTx) abci.ResponseDeliverTx
tx is either "val:pubkey!power" or "key=value" or just arbitrary bytes
func (*PersistentKVStoreApplication) EndBlock ¶
func (app *PersistentKVStoreApplication) EndBlock(req abci.RequestEndBlock) abci.ResponseEndBlock
Update the validator set
func (*PersistentKVStoreApplication) Info ¶
func (app *PersistentKVStoreApplication) Info(req abci.RequestInfo) abci.ResponseInfo
func (*PersistentKVStoreApplication) InitChain ¶
func (app *PersistentKVStoreApplication) InitChain(req abci.RequestInitChain) abci.ResponseInitChain
Save the validators in the merkle tree
func (*PersistentKVStoreApplication) Query ¶
func (app *PersistentKVStoreApplication) Query(reqQuery abci.RequestQuery) (resQuery abci.ResponseQuery)
When path=/val and data={validator address}, returns the validator update (abci.ValidatorUpdate) varint encoded. For any other path, returns an associated value or nil if missing.
func (*PersistentKVStoreApplication) SetLogger ¶
func (app *PersistentKVStoreApplication) SetLogger(l *slog.Logger)
func (*PersistentKVStoreApplication) SetOption ¶
func (app *PersistentKVStoreApplication) SetOption(req abci.RequestSetOption) abci.ResponseSetOption
func (*PersistentKVStoreApplication) Validators ¶
func (app *PersistentKVStoreApplication) Validators() (validators []abci.ValidatorUpdate)