Documentation
¶
Index ¶
- func New(logger *zap.Logger, key dbft.PrivateKey, pub dbft.PublicKey, ...) (*dbft.DBFT[crypto.Uint256], error)
- func NewAMEVBlock(pre dbft.PreBlock[crypto.Uint256], cnData [][]byte, m int) dbft.Block[crypto.Uint256]
- func NewAMEVCommit(data []byte) dbft.Commit
- func NewBlock(timestamp uint64, index uint32, prevHash crypto.Uint256, nonce uint64, ...) dbft.Block[crypto.Uint256]
- func NewChangeView(newViewNumber byte, _ dbft.ChangeViewReason, ts uint64) dbft.ChangeView
- func NewCommit(signature []byte) dbft.Commit
- func NewConsensusPayload(t dbft.MessageType, height uint32, validatorIndex uint16, viewNumber byte, ...) dbft.ConsensusPayload[crypto.Uint256]
- func NewPreBlock(timestamp uint64, index uint32, prevHash crypto.Uint256, nonce uint64, ...) dbft.PreBlock[crypto.Uint256]
- func NewPreCommit(data []byte) dbft.PreCommit
- func NewPrepareRequest(ts uint64, nonce uint64, transactionsHashes []crypto.Uint256) dbft.PrepareRequest[crypto.Uint256]
- func NewPrepareResponse(preparationHash crypto.Uint256) dbft.PrepareResponse[crypto.Uint256]
- func NewRecoveryMessage(preparationHash *crypto.Uint256) dbft.RecoveryMessage[crypto.Uint256]
- func NewRecoveryRequest(ts uint64) dbft.RecoveryRequest
- type Payload
- func (p *Payload) DecodeBinary(r *gob.Decoder) error
- func (p Payload) EncodeBinary(w *gob.Encoder) error
- func (m Payload) GetChangeView() dbft.ChangeView
- func (m Payload) GetCommit() dbft.Commit
- func (m Payload) GetPreCommit() dbft.PreCommit
- func (m Payload) GetPrepareRequest() dbft.PrepareRequest[crypto.Uint256]
- func (m Payload) GetPrepareResponse() dbft.PrepareResponse[crypto.Uint256]
- func (m Payload) GetRecoveryMessage() dbft.RecoveryMessage[crypto.Uint256]
- func (m Payload) GetRecoveryRequest() dbft.RecoveryRequest
- func (p *Payload) Hash() crypto.Uint256
- func (p Payload) Height() uint32
- func (p Payload) MarshalUnsigned() []byte
- func (m Payload) Payload() any
- func (p Payload) PrevHash() crypto.Uint256
- func (p *Payload) SetValidatorIndex(i uint16)
- func (m Payload) Type() dbft.MessageType
- func (p *Payload) UnmarshalUnsigned(data []byte) error
- func (p Payload) ValidatorIndex() uint16
- func (p Payload) Version() uint32
- func (m Payload) ViewNumber() byte
- type Serializable
- type Tx64
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func New ¶
func New(logger *zap.Logger, key dbft.PrivateKey, pub dbft.PublicKey, getTx func(uint256 crypto.Uint256) dbft.Transaction[crypto.Uint256], getVerified func() []dbft.Transaction[crypto.Uint256], broadcast func(dbft.ConsensusPayload[crypto.Uint256]), processBlock func(dbft.Block[crypto.Uint256]) error, currentHeight func() uint32, currentBlockHash func() crypto.Uint256, getValidators func(...dbft.Transaction[crypto.Uint256]) []dbft.PublicKey, verifyPayload func(consensusPayload dbft.ConsensusPayload[crypto.Uint256]) error) (*dbft.DBFT[crypto.Uint256], error)
func NewAMEVBlock ¶ added in v0.3.0
func NewAMEVBlock(pre dbft.PreBlock[crypto.Uint256], cnData [][]byte, m int) dbft.Block[crypto.Uint256]
NewAMEVBlock returns new block based on PreBlock and additional Commit-level data collected from M consensus nodes.
func NewAMEVCommit ¶ added in v0.3.0
NewAMEVCommit returns minimal dbft.Commit implementation for anti-MEV extension.
func NewBlock ¶
func NewBlock(timestamp uint64, index uint32, prevHash crypto.Uint256, nonce uint64, txHashes []crypto.Uint256) dbft.Block[crypto.Uint256]
NewBlock returns new block.
func NewChangeView ¶
func NewChangeView(newViewNumber byte, _ dbft.ChangeViewReason, ts uint64) dbft.ChangeView
NewChangeView returns minimal ChangeView implementation.
func NewConsensusPayload ¶
func NewConsensusPayload(t dbft.MessageType, height uint32, validatorIndex uint16, viewNumber byte, consensusMessage any) dbft.ConsensusPayload[crypto.Uint256]
NewConsensusPayload returns minimal ConsensusPayload implementation.
func NewPreBlock ¶ added in v0.3.0
func NewPreBlock(timestamp uint64, index uint32, prevHash crypto.Uint256, nonce uint64, txHashes []crypto.Uint256) dbft.PreBlock[crypto.Uint256]
NewPreBlock returns new preBlock.
func NewPreCommit ¶ added in v0.3.0
NewPreCommit returns minimal dbft.PreCommit implementation.
func NewPrepareRequest ¶
func NewPrepareRequest(ts uint64, nonce uint64, transactionsHashes []crypto.Uint256) dbft.PrepareRequest[crypto.Uint256]
NewPrepareRequest returns minimal prepareRequest implementation.
func NewPrepareResponse ¶
NewPrepareResponse returns minimal PrepareResponse implementation.
func NewRecoveryMessage ¶
NewRecoveryMessage returns minimal RecoveryMessage implementation.
func NewRecoveryRequest ¶
func NewRecoveryRequest(ts uint64) dbft.RecoveryRequest
NewRecoveryRequest returns minimal RecoveryRequest implementation.
Types ¶
type Payload ¶
type Payload struct {
// contains filtered or unexported fields
}
Payload represents minimal payload containing all necessary fields.
func (*Payload) DecodeBinary ¶
DecodeBinary implements Serializable interface.
func (Payload) EncodeBinary ¶
EncodeBinary implements Serializable interface.
func (Payload) GetChangeView ¶
func (m Payload) GetChangeView() dbft.ChangeView
func (Payload) GetPreCommit ¶ added in v0.3.0
func (Payload) GetPrepareRequest ¶
func (m Payload) GetPrepareRequest() dbft.PrepareRequest[crypto.Uint256]
func (Payload) GetPrepareResponse ¶
func (m Payload) GetPrepareResponse() dbft.PrepareResponse[crypto.Uint256]
func (Payload) GetRecoveryMessage ¶
func (m Payload) GetRecoveryMessage() dbft.RecoveryMessage[crypto.Uint256]
func (Payload) GetRecoveryRequest ¶
func (m Payload) GetRecoveryRequest() dbft.RecoveryRequest
func (Payload) MarshalUnsigned ¶
MarshalUnsigned implements ConsensusPayload interface.
func (Payload) Payload ¶
func (m Payload) Payload() any
Payload implements ConsensusMessage interface.
func (*Payload) SetValidatorIndex ¶
SetValidatorIndex implements ConsensusPayload interface.
func (Payload) Type ¶
func (m Payload) Type() dbft.MessageType
Type implements ConsensusMessage interface.
func (*Payload) UnmarshalUnsigned ¶
UnmarshalUnsigned implements ConsensusPayload interface.
func (Payload) ValidatorIndex ¶
ValidatorIndex implements ConsensusPayload interface.
func (Payload) ViewNumber ¶
func (m Payload) ViewNumber() byte
ViewNumber implements ConsensusMessage interface.
type Serializable ¶
type Serializable interface {
EncodeBinary(encoder *gob.Encoder) error
DecodeBinary(decoder *gob.Decoder) error
}
Serializable is an interface for serializing consensus messages.
type Tx64 ¶ added in v0.3.0
type Tx64 uint64
func (*Tx64) MarshalBinary ¶ added in v0.3.0
MarshalBinary implements encoding.BinaryMarshaler interface.
func (*Tx64) UnmarshalBinary ¶ added in v0.3.0
UnmarshalBinary implements encoding.BinaryUnarshaler interface.