Documentation ¶
Index ¶
- Constants
- Variables
- func InitializeApp(app *PersistentKVStoreApplication) error
- func InitializeAppWithValidators(app *PersistentKVStoreApplication, validatorCount int) error
- func MakeValSetChangeTx(pubkey pc.PublicKey, power int64) []byte
- 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)
- func (app *Application) SetGenBlockEvents()
- 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) SetGenBlockEvents()
- func (app *PersistentKVStoreApplication) SetLogger(l log.Logger)
- func (app *PersistentKVStoreApplication) Validators() (validators []types.ValidatorUpdate)
- type State
- type ValidatorGenerator
Constants ¶
const ( PreparePrefix = "prepare" ReplacePrefix = "replace" )
const (
ValidatorSetChangePrefix string = "val:"
)
Variables ¶
var ( ErrInvalidValidatorCount = errors.New("validator count must be between 1 and 100") ErrNilApplication = errors.New("application cannot be nil") )
var (
ProtocolVersion uint64 = 0x1
)
Functions ¶
func InitializeApp ¶
func InitializeApp(app *PersistentKVStoreApplication) error
InitializeApp initializes a KVStore application with default settings
func InitializeAppWithValidators ¶
func InitializeAppWithValidators(app *PersistentKVStoreApplication, validatorCount int) error
InitializeAppWithValidators initializes a KVStore application with a specific number of validators
Types ¶
type Application ¶
type Application struct { types.BaseApplication RetainBlocks int64 // blocks to retain after commit (via ResponseCommit.RetainHeight) // contains filtered or unexported fields }
func NewApplication ¶
func NewApplication() *Application
func (*Application) BeginBlock ¶
func (app *Application) BeginBlock(req types.RequestBeginBlock) types.ResponseBeginBlock
func (*Application) CheckTx ¶
func (app *Application) CheckTx(req types.RequestCheckTx) types.ResponseCheckTx
func (*Application) Commit ¶
func (app *Application) Commit() types.ResponseCommit
func (*Application) DeliverTx ¶
func (app *Application) DeliverTx(req types.RequestDeliverTx) types.ResponseDeliverTx
tx is either "key=value" or just arbitrary bytes
func (*Application) Info ¶
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 ¶
func (app *Application) Query(reqQuery types.RequestQuery) (resQuery types.ResponseQuery)
Returns an associated value or nil if missing.
func (*Application) SetGenBlockEvents ¶
func (app *Application) SetGenBlockEvents()
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 ¶
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 ¶
func (app *PersistentKVStoreApplication) ListSnapshots( req types.RequestListSnapshots, ) types.ResponseListSnapshots
func (*PersistentKVStoreApplication) LoadSnapshotChunk ¶
func (app *PersistentKVStoreApplication) LoadSnapshotChunk( req types.RequestLoadSnapshotChunk, ) types.ResponseLoadSnapshotChunk
func (*PersistentKVStoreApplication) OfferSnapshot ¶
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) SetGenBlockEvents ¶
func (app *PersistentKVStoreApplication) SetGenBlockEvents()
func (*PersistentKVStoreApplication) SetLogger ¶
func (app *PersistentKVStoreApplication) SetLogger(l log.Logger)
func (*PersistentKVStoreApplication) Validators ¶
func (app *PersistentKVStoreApplication) Validators() (validators []types.ValidatorUpdate)
type ValidatorGenerator ¶
type ValidatorGenerator struct {
// contains filtered or unexported fields
}
ValidatorGenerator handles creation of validator updates
func NewValidatorGenerator ¶
func NewValidatorGenerator(pubKeyLength int) *ValidatorGenerator
NewValidatorGenerator creates a new validator generator with custom settings
func (*ValidatorGenerator) GenerateValidator ¶
func (vg *ValidatorGenerator) GenerateValidator(index int) types.ValidatorUpdate
GenerateValidator creates a single random validator with deterministic public key derived from the input index and random power value
func (*ValidatorGenerator) GenerateValidators ¶
func (vg *ValidatorGenerator) GenerateValidators(count int) ([]types.ValidatorUpdate, error)
GenerateValidators creates a specified number of random validators