abci

package
v0.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2024 License: Apache-2.0, UNKNOWN not legal advice Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

This section is empty.

Types

type Application

type Application interface {
	// Info/Query Connection
	Info(RequestInfo) ResponseInfo                // Return application info
	SetOption(RequestSetOption) ResponseSetOption // Set application option
	Query(RequestQuery) ResponseQuery             // Query for state

	// Mempool Connection
	CheckTx(RequestCheckTx) ResponseCheckTx // Validate a tx for the mempool

	// Consensus Connection
	InitChain(RequestInitChain) ResponseInitChain    // Initialize blockchain with validators and other info from TendermintCore
	BeginBlock(RequestBeginBlock) ResponseBeginBlock // Signals the beginning of a block
	DeliverTx(RequestDeliverTx) ResponseDeliverTx    // Deliver a tx for full processing
	EndBlock(RequestEndBlock) ResponseEndBlock       // Signals the end of a block, returns changes to the validator set
	Commit() ResponseCommit                          // Commit the state and return the application Merkle root hash

	// Cleanup
	Close() error
}

Application is an interface that enables any finite, deterministic state machine to be driven by a blockchain-based replication engine via the ABCI. All methods take a RequestXxx argument and return a ResponseXxx argument, except CheckTx/DeliverTx, which take `tx []byte`, and `Commit`, which takes nothing.

type BaseApplication

type BaseApplication struct{}

func NewBaseApplication

func NewBaseApplication() *BaseApplication

func (BaseApplication) BeginBlock

func (BaseApplication) CheckTx

func (BaseApplication) Close

func (BaseApplication) Close() error

func (BaseApplication) Commit

func (BaseApplication) DeliverTx

func (BaseApplication) EndBlock

func (BaseApplication) Info

func (BaseApplication) InitChain

func (BaseApplication) Query

func (BaseApplication) SetOption

type BlockParams

type BlockParams struct {
	MaxTxBytes    int64 // must be > 0
	MaxDataBytes  int64 // must be > 0
	MaxBlockBytes int64 // must be > 0
	MaxGas        int64 // must be >= -1
	TimeIotaMS    int64 // must be > 0
}

type CheckTxType

type CheckTxType int
const (
	CheckTxTypeNew     CheckTxType = 0
	CheckTxTypeRecheck             = iota
)

type ConsensusParams

type ConsensusParams struct {
	Block     *BlockParams
	Validator *ValidatorParams
}

Parameters that need to be negotiated between the app and consensus.

func (ConsensusParams) Hash

func (params ConsensusParams) Hash() []byte

func (ConsensusParams) Update

func (params ConsensusParams) Update(params2 ConsensusParams) ConsensusParams

type Error

type Error interface {
	AssertABCIError()
	Error() string
}

func ABCIErrorOrStringError

func ABCIErrorOrStringError(err error) Error

type Event

type Event interface {
	AssertABCIEvent()
}

type EventString

type EventString string

func (EventString) AssertABCIEvent

func (EventString) AssertABCIEvent()

func (EventString) Event

func (err EventString) Event() string
type Header interface {
	GetChainID() string
	GetHeight() int64
	GetTime() time.Time
	AssertABCIHeader()
}

type LastCommitInfo

type LastCommitInfo struct {
	Round int32
	Votes []VoteInfo
}

type MockHeader

type MockHeader struct {
	Version  string    `json:"version"`
	ChainID  string    `json:"chain_id"`
	Height   int64     `json:"height"`
	Time     time.Time `json:"time"`
	NumTxs   int64     `json:"num_txs"`
	TotalTxs int64     `json:"total_txs"`
}

Only used for tests.

func (MockHeader) AssertABCIHeader

func (MockHeader) AssertABCIHeader()

func (MockHeader) GetChainID

func (mh MockHeader) GetChainID() string

func (MockHeader) GetHeight

func (mh MockHeader) GetHeight() int64

func (MockHeader) GetTime

func (mh MockHeader) GetTime() time.Time

type Request

type Request interface {
	AssertRequest()
}

type RequestBase

type RequestBase struct{}

func (RequestBase) AssertRequest

func (RequestBase) AssertRequest()

type RequestBeginBlock

type RequestBeginBlock struct {
	RequestBase
	Hash           []byte
	Header         Header
	LastCommitInfo *LastCommitInfo
}

type RequestCheckTx

type RequestCheckTx struct {
	RequestBase
	Tx   []byte
	Type CheckTxType
}

type RequestCommit

type RequestCommit struct {
	RequestBase
}

type RequestDeliverTx

type RequestDeliverTx struct {
	RequestBase
	Tx []byte
}

type RequestEcho

type RequestEcho struct {
	RequestBase
	Message string
}

type RequestEndBlock

type RequestEndBlock struct {
	RequestBase
	Height int64
}

type RequestFlush

type RequestFlush struct {
	RequestBase
}

type RequestInfo

type RequestInfo struct {
	RequestBase
}

type RequestInitChain

type RequestInitChain struct {
	RequestBase
	Time            time.Time
	ChainID         string
	ConsensusParams *ConsensusParams
	Validators      []ValidatorUpdate
	AppState        interface{}
}

type RequestQuery

type RequestQuery struct {
	RequestBase
	Data   []byte
	Path   string
	Height int64
	Prove  bool
}

type RequestSetOption

type RequestSetOption struct {
	RequestBase
	Key   string
	Value string
}

nondeterministic

type Response

type Response interface {
	AssertResponse()
}

type ResponseBase

type ResponseBase struct {
	Error  Error
	Data   []byte
	Events []Event

	Log  string // nondeterministic
	Info string // nondeterministic
}

func (ResponseBase) AssertResponse

func (ResponseBase) AssertResponse()

func (ResponseBase) EncodeEvents

func (r ResponseBase) EncodeEvents() []byte

func (ResponseBase) IsErr

func (r ResponseBase) IsErr() bool

func (ResponseBase) IsOK

func (r ResponseBase) IsOK() bool

type ResponseBeginBlock

type ResponseBeginBlock struct {
	ResponseBase
}

type ResponseCheckTx

type ResponseCheckTx struct {
	ResponseBase
	GasWanted int64 // nondeterministic
	GasUsed   int64
}

type ResponseCommit

type ResponseCommit struct {
	ResponseBase
}

type ResponseDeliverTx

type ResponseDeliverTx struct {
	ResponseBase
	GasWanted int64
	GasUsed   int64
}

type ResponseEcho

type ResponseEcho struct {
	ResponseBase
	Message string
}

type ResponseEndBlock

type ResponseEndBlock struct {
	ResponseBase
	ValidatorUpdates []ValidatorUpdate
	ConsensusParams  *ConsensusParams
	Events           []Event
}

type ResponseException

type ResponseException struct {
	ResponseBase
}

nondeterministic

type ResponseFlush

type ResponseFlush struct {
	ResponseBase
}

type ResponseInfo

type ResponseInfo struct {
	ResponseBase
	ABCIVersion      string
	AppVersion       string
	LastBlockHeight  int64
	LastBlockAppHash []byte
}

type ResponseInitChain

type ResponseInitChain struct {
	ResponseBase
	ConsensusParams *ConsensusParams
	Validators      []ValidatorUpdate
}

type ResponseQuery

type ResponseQuery struct {
	ResponseBase
	Key    []byte
	Value  []byte
	Proof  *merkle.Proof
	Height int64
}

type ResponseSetOption

type ResponseSetOption struct {
	ResponseBase
}

nondeterministic

type StringError

type StringError string

func (StringError) AssertABCIError

func (StringError) AssertABCIError()

func (StringError) Error

func (err StringError) Error() string

type ValidatorParams

type ValidatorParams struct {
	PubKeyTypeURLs []string
}

func (ValidatorParams) IsValidPubKeyTypeURL

func (params ValidatorParams) IsValidPubKeyTypeURL(pubKeyTypeURL string) bool

type ValidatorUpdate

type ValidatorUpdate struct {
	Address crypto.Address
	PubKey  crypto.PubKey
	Power   int64
}

func (ValidatorUpdate) Equals

func (vu ValidatorUpdate) Equals(vu2 ValidatorUpdate) bool

type ValidatorUpdates

type ValidatorUpdates []ValidatorUpdate

ValidatorUpdates is a list of validators that implements the Sort interface

func (ValidatorUpdates) Len

func (v ValidatorUpdates) Len() int

func (ValidatorUpdates) Less

func (v ValidatorUpdates) Less(i, j int) bool

func (ValidatorUpdates) Swap

func (v ValidatorUpdates) Swap(i, j int)

type VoteInfo

type VoteInfo struct {
	Address         crypto.Address
	Power           int64
	SignedLastBlock bool
}

unstable

Jump to

Keyboard shortcuts

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