qbfttypes

package
v0.0.0-...-1d3cd56 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2023 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PreprepareCode  = 0x12
	PrepareCode     = 0x13
	CommitCode      = 0x14
	RoundChangeCode = 0x15
)

QBFT message codes

Variables

This section is empty.

Functions

func MessageCodes

func MessageCodes() map[uint64]struct{}

A set containing the messages codes for all QBFT messages.

Types

type Commit

type Commit struct {
	CommonPayload
	Digest     common.Hash
	CommitSeal []byte
}

A QBFT COMMIT message.

func NewCommit

func NewCommit(sequence *big.Int, round *big.Int, digest common.Hash, seal []byte) *Commit

func (*Commit) DecodeRLP

func (m *Commit) DecodeRLP(stream *rlp.Stream) error

func (*Commit) EncodePayloadForSigning

func (m *Commit) EncodePayloadForSigning() ([]byte, error)

func (*Commit) EncodeRLP

func (m *Commit) EncodeRLP(w io.Writer) error

type CommonPayload

type CommonPayload struct {
	Sequence *big.Int
	Round    *big.Int
	// contains filtered or unexported fields
}

Data that is common to all QBFT messages. Used for composition.

func (*CommonPayload) Code

func (m *CommonPayload) Code() uint64

func (*CommonPayload) SetSignature

func (m *CommonPayload) SetSignature(signature []byte)

func (*CommonPayload) SetSource

func (m *CommonPayload) SetSource(address common.Address)

func (*CommonPayload) Signature

func (m *CommonPayload) Signature() []byte

func (*CommonPayload) Source

func (m *CommonPayload) Source() common.Address

func (*CommonPayload) View

func (m *CommonPayload) View() istanbul.View

type Prepare

type Prepare struct {
	CommonPayload
	Digest common.Hash
}

A QBFT PREPARE message.

func NewPrepare

func NewPrepare(sequence *big.Int, round *big.Int, digest common.Hash) *Prepare

func NewPrepareWithSigAndSource

func NewPrepareWithSigAndSource(sequence *big.Int, round *big.Int, digest common.Hash, signature []byte, source common.Address) *Prepare

func (*Prepare) DecodeRLP

func (p *Prepare) DecodeRLP(stream *rlp.Stream) error

func (*Prepare) EncodePayloadForSigning

func (p *Prepare) EncodePayloadForSigning() ([]byte, error)

func (*Prepare) EncodeRLP

func (p *Prepare) EncodeRLP(w io.Writer) error

func (*Prepare) String

func (p *Prepare) String() string

type Preprepare

type Preprepare struct {
	CommonPayload
	Proposal                  istanbul.Proposal
	JustificationRoundChanges []*SignedRoundChangePayload
	JustificationPrepares     []*Prepare
}

func NewPreprepare

func NewPreprepare(sequence *big.Int, round *big.Int, proposal istanbul.Proposal) *Preprepare

func (*Preprepare) DecodeRLP

func (m *Preprepare) DecodeRLP(stream *rlp.Stream) error

func (*Preprepare) EncodePayloadForSigning

func (m *Preprepare) EncodePayloadForSigning() ([]byte, error)

func (*Preprepare) EncodeRLP

func (m *Preprepare) EncodeRLP(w io.Writer) error

func (*Preprepare) String

func (m *Preprepare) String() string

type QBFTMessage

type QBFTMessage interface {
	Code() uint64
	View() istanbul.View
	Source() common.Address
	SetSource(address common.Address)
	EncodePayloadForSigning() ([]byte, error)
	Signature() []byte
	SetSignature(signature []byte)
}

Common interface for all QBFT messages

func Decode

func Decode(code uint64, data []byte) (QBFTMessage, error)

type RoundChange

type RoundChange struct {
	SignedRoundChangePayload
	PreparedBlock *types.Block
	Justification []*Prepare
}

ROUND-CHANGE

func NewRoundChange

func NewRoundChange(sequence *big.Int, round *big.Int, preparedRound *big.Int, preparedBlock istanbul.Proposal) *RoundChange

func (*RoundChange) DecodeRLP

func (m *RoundChange) DecodeRLP(stream *rlp.Stream) error

func (*RoundChange) EncodeRLP

func (m *RoundChange) EncodeRLP(w io.Writer) error

type SignedRoundChangePayload

type SignedRoundChangePayload struct {
	CommonPayload
	PreparedRound  *big.Int
	PreparedDigest common.Hash
}

func (*SignedRoundChangePayload) DecodeRLP

func (p *SignedRoundChangePayload) DecodeRLP(stream *rlp.Stream) error

func (*SignedRoundChangePayload) EncodePayloadForSigning

func (p *SignedRoundChangePayload) EncodePayloadForSigning() ([]byte, error)

func (*SignedRoundChangePayload) EncodeRLP

func (p *SignedRoundChangePayload) EncodeRLP(w io.Writer) error

func (*SignedRoundChangePayload) String

func (p *SignedRoundChangePayload) String() string

Jump to

Keyboard shortcuts

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