Documentation
¶
Overview ¶
nolint: gosec
nolint: gosec
Index ¶
- type Application
- func (app *Application) ApplySnapshotChunk(_ context.Context, req *abci.RequestApplySnapshotChunk) (*abci.ResponseApplySnapshotChunk, error)
- func (app *Application) CheckTx(_ context.Context, req *abci.RequestCheckTx) (*abci.ResponseCheckTx, error)
- func (app *Application) Commit(_ context.Context) (*abci.ResponseCommit, error)
- func (app *Application) ExtendVote(_ context.Context, req *abci.RequestExtendVote) (*abci.ResponseExtendVote, error)
- func (app *Application) FinalizeBlock(_ context.Context, req *abci.RequestFinalizeBlock) (*abci.ResponseFinalizeBlock, error)
- func (app *Application) Info(_ context.Context, req *abci.RequestInfo) (*abci.ResponseInfo, error)
- func (app *Application) InitChain(_ context.Context, req *abci.RequestInitChain) (*abci.ResponseInitChain, error)
- func (app *Application) ListSnapshots(_ context.Context, req *abci.RequestListSnapshots) (*abci.ResponseListSnapshots, error)
- func (app *Application) LoadSnapshotChunk(_ context.Context, req *abci.RequestLoadSnapshotChunk) (*abci.ResponseLoadSnapshotChunk, error)
- func (app *Application) OfferSnapshot(_ context.Context, req *abci.RequestOfferSnapshot) (*abci.ResponseOfferSnapshot, error)
- func (app *Application) PrepareProposal(_ context.Context, req *abci.RequestPrepareProposal) (*abci.ResponsePrepareProposal, error)
- func (app *Application) ProcessProposal(_ context.Context, req *abci.RequestProcessProposal) (*abci.ResponseProcessProposal, error)
- func (app *Application) Query(_ context.Context, req *abci.RequestQuery) (*abci.ResponseQuery, error)
- func (app *Application) Rollback() error
- func (app *Application) VerifyVoteExtension(_ context.Context, req *abci.RequestVerifyVoteExtension) (*abci.ResponseVerifyVoteExtension, error)
- type Config
- type SnapshotStore
- type State
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Application ¶
type Application struct {
abci.BaseApplication
// contains filtered or unexported fields
}
Application is an ABCI application for use by end-to-end tests. It is a simple key/value store for strings, storing data in memory and persisting to disk as JSON, taking state sync snapshots if requested.
func NewApplication ¶
func NewApplication(cfg *Config) (*Application, error)
NewApplication creates the application.
func (*Application) ApplySnapshotChunk ¶
func (app *Application) ApplySnapshotChunk(_ context.Context, req *abci.RequestApplySnapshotChunk) (*abci.ResponseApplySnapshotChunk, error)
ApplySnapshotChunk implements ABCI.
func (*Application) CheckTx ¶
func (app *Application) CheckTx(_ context.Context, req *abci.RequestCheckTx) (*abci.ResponseCheckTx, error)
CheckTx implements ABCI.
func (*Application) Commit ¶
func (app *Application) Commit(_ context.Context) (*abci.ResponseCommit, error)
Commit implements ABCI.
func (*Application) ExtendVote ¶
func (app *Application) ExtendVote(_ context.Context, req *abci.RequestExtendVote) (*abci.ResponseExtendVote, error)
ExtendVote will produce vote extensions in the form of random numbers to demonstrate vote extension nondeterminism.
In the next block, if there are any vote extensions from the previous block, a new transaction will be proposed that updates a special value in the key/value store ("extensionSum") with the sum of all of the numbers collected from the vote extensions.
func (*Application) FinalizeBlock ¶
func (app *Application) FinalizeBlock(_ context.Context, req *abci.RequestFinalizeBlock) (*abci.ResponseFinalizeBlock, error)
FinalizeBlock implements ABCI.
func (*Application) Info ¶
func (app *Application) Info(_ context.Context, req *abci.RequestInfo) (*abci.ResponseInfo, error)
Info implements ABCI.
func (*Application) InitChain ¶
func (app *Application) InitChain(_ context.Context, req *abci.RequestInitChain) (*abci.ResponseInitChain, error)
Info implements ABCI.
func (*Application) ListSnapshots ¶
func (app *Application) ListSnapshots(_ context.Context, req *abci.RequestListSnapshots) (*abci.ResponseListSnapshots, error)
ListSnapshots implements ABCI.
func (*Application) LoadSnapshotChunk ¶
func (app *Application) LoadSnapshotChunk(_ context.Context, req *abci.RequestLoadSnapshotChunk) (*abci.ResponseLoadSnapshotChunk, error)
LoadSnapshotChunk implements ABCI.
func (*Application) OfferSnapshot ¶
func (app *Application) OfferSnapshot(_ context.Context, req *abci.RequestOfferSnapshot) (*abci.ResponseOfferSnapshot, error)
OfferSnapshot implements ABCI.
func (*Application) PrepareProposal ¶
func (app *Application) PrepareProposal(_ context.Context, req *abci.RequestPrepareProposal) (*abci.ResponsePrepareProposal, error)
PrepareProposal will take the given transactions and attempt to prepare a proposal from them when it's our turn to do so. In the process, vote extensions from the previous round of consensus, if present, will be used to construct a special transaction whose value is the sum of all of the vote extensions from the previous round.
NB: Assumes that the supplied transactions do not exceed `req.MaxTxBytes`. If adding a special vote extension-generated transaction would cause the total number of transaction bytes to exceed `req.MaxTxBytes`, we will not append our special vote extension transaction.
func (*Application) ProcessProposal ¶
func (app *Application) ProcessProposal(_ context.Context, req *abci.RequestProcessProposal) (*abci.ResponseProcessProposal, error)
ProcessProposal implements part of the Application interface. It accepts any proposal that does not contain a malformed transaction.
func (*Application) Query ¶
func (app *Application) Query(_ context.Context, req *abci.RequestQuery) (*abci.ResponseQuery, error)
Query implements ABCI.
func (*Application) Rollback ¶
func (app *Application) Rollback() error
func (*Application) VerifyVoteExtension ¶
func (app *Application) VerifyVoteExtension(_ context.Context, req *abci.RequestVerifyVoteExtension) (*abci.ResponseVerifyVoteExtension, error)
VerifyVoteExtension simply validates vote extensions from other validators without doing anything about them. In this case, it just makes sure that the vote extension is a well-formed integer value.
type Config ¶
type Config struct {
// The directory with which state.json will be persisted in. Usually $HOME/.tendermint/data
Dir string `toml:"dir"`
// SnapshotInterval specifies the height interval at which the application
// will take state sync snapshots. Defaults to 0 (disabled).
SnapshotInterval uint64 `toml:"snapshot_interval"`
// RetainBlocks specifies the number of recent blocks to retain. Defaults to
// 0, which retains all blocks. Must be greater that PersistInterval,
// SnapshotInterval and EvidenceAgeHeight.
RetainBlocks uint64 `toml:"retain_blocks"`
// KeyType sets the curve that will be used by validators.
// Options are ed25519 & secp256k1
KeyType string `toml:"key_type"`
// PersistInterval specifies the height interval at which the application
// will persist state to disk. Defaults to 1 (every height), setting this to
// 0 disables state persistence.
PersistInterval uint64 `toml:"persist_interval"`
// ValidatorUpdates is a map of heights to validator names and their power,
// and will be returned by the ABCI application. For example, the following
// changes the power of validator01 and validator02 at height 1000:
//
// [validator_update.1000]
// validator01 = 20
// validator02 = 10
//
// Specifying height 0 returns the validator update during InitChain. The
// application returns the validator updates as-is, i.e. removing a
// validator must be done by returning it with power 0, and any validators
// not specified are not changed.
//
// height <-> pubkey <-> voting power
ValidatorUpdates map[string]map[string]uint8 `toml:"validator_update"`
// Add artificial delays to each of the main ABCI calls to mimic computation time
// of the application
PrepareProposalDelayMS uint64 `toml:"prepare_proposal_delay_ms"`
ProcessProposalDelayMS uint64 `toml:"process_proposal_delay_ms"`
CheckTxDelayMS uint64 `toml:"check_tx_delay_ms"`
VoteExtensionDelayMS uint64 `toml:"vote_extension_delay_ms"`
FinalizeBlockDelayMS uint64 `toml:"finalize_block_delay_ms"`
}
Config allows for the setting of high level parameters for running the e2e Application KeyType and ValidatorUpdates must be the same for all nodes running the same application.
func DefaultConfig ¶
type SnapshotStore ¶
SnapshotStore stores state sync snapshots. Snapshots are stored simply as JSON files, and chunks are generated on-the-fly by splitting the JSON data into fixed-size chunks.
func NewSnapshotStore ¶
func NewSnapshotStore(dir string) (*SnapshotStore, error)
NewSnapshotStore creates a new snapshot store.
func (*SnapshotStore) Create ¶
func (s *SnapshotStore) Create(state *State) (abci.Snapshot, error)
Create creates a snapshot of the given application state's key/value pairs.
func (*SnapshotStore) List ¶
func (s *SnapshotStore) List() ([]*abci.Snapshot, error)
List lists available snapshots.
func (*SnapshotStore) Prune ¶
func (s *SnapshotStore) Prune(n int) error
Prune removes old snapshots ensuring only the most recent n snapshots remain
type State ¶
type State struct {
sync.RWMutex
Height uint64
Values map[string]string
Hash []byte
// contains filtered or unexported fields
}
State is the application state.
func (*State) Finalize ¶
Finalize is called after applying a block, updating the height and returning the new app_hash