Documentation ¶
Index ¶
- Variables
- func ToABCIBlock(block *Block) (*tmtypes.Block, error)
- func ToABCIBlockDataTxs(data *Data) []tmtypes.Tx
- func ToABCIBlockMeta(block *Block) (*tmtypes.BlockMeta, error)
- func ToABCICommit(commit *Commit, header *Header) *tmtypes.Commit
- func ToABCIHeader(header *Header) tmtypes.Header
- func ToABCIHeaderPB(header *Header) types.Header
- func ValidateProposedTransition(state State, block *Block, commit *Commit, proposer *Sequencer) error
- type Batch
- type Block
- func (b *Block) FromProto(other *pb.Block) error
- func (b *Block) Hash() [32]byte
- func (b *Block) MarshalBinary() ([]byte, error)
- func (b *Block) ToProto() *pb.Block
- func (b *Block) UnmarshalBinary(data []byte) error
- func (b *Block) ValidateBasic() error
- func (b *Block) ValidateWithState(state State) error
- type Commit
- func (c *Commit) FromProto(other *pb.Commit) error
- func (c *Commit) MarshalBinary() ([]byte, error)
- func (c *Commit) ToProto() *pb.Commit
- func (c *Commit) UnmarshalBinary(data []byte) error
- func (c *Commit) Validate(proposer *Sequencer, abciHeaderBytes []byte) error
- func (c *Commit) ValidateBasic() error
- func (c *Commit) ValidateWithHeader(proposer *Sequencer, header *Header) error
- type Data
- type Evidence
- type EvidenceData
- type Header
- type IntermediateStateRoots
- type Logger
- type Sequencer
- type SequencerStatus
- type Signature
- type State
- type Tx
- type TxProof
- type Txs
- type Version
Constants ¶
This section is empty.
Variables ¶
var ( ErrInvalidSignature = errors.New("invalid signature") ErrNoStateFound = errors.New("no state found") ErrSkippedEmptyBlock = errors.New("skipped empty block") ErrInvalidBlockHeight = errors.New("invalid block height") )
var InitStateVersion = tmstate.Version{ Consensus: tmversion.Consensus{ Block: version.BlockProtocol, App: 0, }, Software: version.TMCoreSemVer, }
InitStateVersion sets the Consensus.Block and Software versions, but leaves the Consensus.App version blank. The Consensus.App version will be set during the Handshake, once we hear from the app what protocol version it is running.
var RollappBlockSizeBytesGauge = promauto.NewGauge(prometheus.GaugeOpts{
Name: "rollapp_block_size_bytes",
Help: "Rollapp ",
})
var RollappBlockSizeTxsGauge = promauto.NewGauge(prometheus.GaugeOpts{
Name: "rollapp_block_size_txs",
Help: "Rollapp ",
})
var RollappHeightGauge = promauto.NewGauge(prometheus.GaugeOpts{
Name: "rollapp_height",
Help: "The height of the local rollapp",
})
var RollappHubHeightGauge = promauto.NewGauge(prometheus.GaugeOpts{
Name: "rollapp_hub_height",
Help: "The latest height of the Rollapp that has been synced to the hub.",
})
Functions ¶
func ToABCIBlock ¶ added in v1.1.0
ToABCIBlock converts Dymint block into block format defined by ABCI. Returned block should pass `ValidateBasic`.
func ToABCIBlockDataTxs ¶ added in v1.1.0
ToABCIBlockDataTxs converts Dymint block-data into block-data format defined by ABCI.
func ToABCIBlockMeta ¶ added in v1.1.0
ToABCIBlockMeta converts Dymint block into BlockMeta format defined by ABCI
func ToABCICommit ¶ added in v1.1.0
ToABCICommit converts Dymint commit into commit format defined by ABCI. This function only converts fields that are available in Dymint commit. Other fields (especially ValidatorAddress and Timestamp of Signature) has to be filled by caller.
func ToABCIHeader ¶ added in v1.1.0
ToABCIHeader converts Dymint header to Header format defined in ABCI. Caller should fill all the fields that are not available in Dymint header (like ChainID).
func ToABCIHeaderPB ¶ added in v1.1.0
ToABCIHeaderPB converts Dymint header to Header format defined in ABCI. Caller should fill all the fields that are not available in Dymint header (like ChainID).
Types ¶
type Batch ¶
Batch defines a struct for block aggregation for support of batching. TODO: maybe change to BlockBatch
func (*Batch) MarshalBinary ¶
MarshalBinary encodes Batch into binary form and returns it.
func (*Batch) UnmarshalBinary ¶
UnmarshalBinary decodes binary form of Batch into object.
type Block ¶
Block defines the structure of Dymint block.
func (*Block) MarshalBinary ¶
MarshalBinary encodes Block into binary form and returns it.
func (*Block) UnmarshalBinary ¶
UnmarshalBinary decodes binary form of Block into object.
func (*Block) ValidateBasic ¶
ValidateBasic performs basic validation of a block.
func (*Block) ValidateWithState ¶ added in v1.1.0
type Commit ¶
type Commit struct { Height uint64 HeaderHash [32]byte // TODO(omritoptix): Change from []Signature to Signature as it should be one signature per block Signatures []Signature TMSignature tmtypes.CommitSig }
Commit cointains evidence of block creation.
func (*Commit) MarshalBinary ¶
MarshalBinary encodes Commit into binary form and returns it.
func (*Commit) UnmarshalBinary ¶
UnmarshalBinary decodes binary form of Commit into object.
func (*Commit) ValidateBasic ¶
ValidateBasic performs basic validation of a commit.
type Data ¶
type Data struct { Txs Txs IntermediateStateRoots IntermediateStateRoots Evidence EvidenceData }
Data defines Dymint block data.
func (*Data) MarshalBinary ¶
MarshalBinary encodes Data into binary form and returns it.
func (*Data) ValidateBasic ¶
ValidateBasic performs basic validation of block data. Actually it's a placeholder, because nothing is checked.
type Evidence ¶
type Evidence interface { ABCI() []abci.Evidence // forms individual evidence to be sent to the application Bytes() []byte // bytes which comprise the evidence Hash() []byte // hash of the evidence Height() int64 // height of the infraction String() string // string format of the evidence Time() time.Time // time of the infraction ValidateBasic() error // basic consistency check }
Evidence represents any provable malicious activity by a validator. Verification logic for each evidence is part of the evidence module.
type EvidenceData ¶
type EvidenceData struct {
Evidence []Evidence
}
EvidenceData defines how evidence is stored in block.
type Header ¶
type Header struct { // Block and App version Version Version // NamespaceID identifies this chain e.g. when connected to other rollups via IBC. // TODO(ismail): figure out if we want to use namespace.ID here instead (downside is that it isn't fixed size) // at least extract the used constants (32, 8) as package variables though. NamespaceID [8]byte Height uint64 Time uint64 // time in tai64 format // prev block info LastHeaderHash [32]byte // hashes of block data LastCommitHash [32]byte // commit from aggregator(s) from the last block DataHash [32]byte // Block.Data root aka Transactions ConsensusHash [32]byte // consensus params for current block AppHash [32]byte // state after applying txs from the current block // Root hash of all results from the txs from the previous block. // This is ABCI specific but smart-contract chains require some way of committing // to transaction receipts/results. LastResultsHash [32]byte // Note that the address can be derived from the pubkey which can be derived // from the signature when using secp256k. // We keep this in case users choose another signature format where the // pubkey can't be recovered by the signature (e.g. ed25519). ProposerAddress []byte // original proposer of the block // Hash of block aggregator set, at a time of block creation AggregatorsHash [32]byte // The Chain ID ChainID string }
Header defines the structure of Dymint block header.
func (*Header) MarshalBinary ¶
MarshalBinary encodes Header into binary form and returns it.
func (*Header) UnmarshalBinary ¶
UnmarshalBinary decodes binary form of Header into object.
func (*Header) ValidateBasic ¶
ValidateBasic performs basic validation of a header.
type IntermediateStateRoots ¶
type IntermediateStateRoots struct {
RawRootsList [][]byte
}
IntermediateStateRoots describes the state between transactions. They are required for fraud proofs.
type Logger ¶ added in v1.1.0
type Logger interface { Debug(msg string, keyvals ...interface{}) Info(msg string, keyvals ...interface{}) Error(msg string, keyvals ...interface{}) }
Logger interface is compatible with Tendermint logger
type Sequencer ¶
type Sequencer struct { // PublicKey is the public key of the sequencer PublicKey crypto.PubKey // Status is status of the sequencer Status SequencerStatus }
Sequencer represents a sequencer of the rollapp
type SequencerStatus ¶
type SequencerStatus int32
SequencerStatus defines the operating status of a sequencer
const ( // Proposer defines a sequencer that is currently the proposer Proposer SequencerStatus = iota // Inactive defines a sequencer that is currently inactive Inactive )
type State ¶
type State struct { Version tmstate.Version // immutable ChainID string InitialHeight int64 // should be 1, not 0, when starting from height 1 // LastBlockHeight=0 at genesis (ie. block(H=0) does not exist) LastBlockHeight int64 LastBlockID types.BlockID LastBlockTime time.Time // In the MVP implementation, there will be only one Validator NextValidators *types.ValidatorSet Validators *types.ValidatorSet LastValidators *types.ValidatorSet LastHeightValidatorsChanged int64 // Consensus parameters used for validating blocks. // Changes returned by EndBlock and updated after Commit. ConsensusParams tmproto.ConsensusParams LastHeightConsensusParamsChanged int64 // Merkle root of the results from executing prev block LastResultsHash [32]byte // LastStore height is the last height we've saved to the store. LastStoreHeight uint64 // BaseHeight is the height of the first block we have in store after pruning. BaseHeight uint64 // the latest AppHash we've received from calling abci.Commit() AppHash [32]byte }
State contains information about current state of the blockchain.
func NewFromGenesisDoc ¶
func NewFromGenesisDoc(genDoc *types.GenesisDoc) (State, error)
NewFromGenesisDoc reads blockchain State from genesis.
type TxProof ¶
type TxProof struct { RootHash tmbytes.HexBytes `json:"root_hash"` Data Tx `json:"data"` Proof merkle.Proof `json:"proof"` }
TxProof represents a Merkle proof of the presence of a transaction in the Merkle tree.