qbft

package
v1.3.8 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2024 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var SignMsg = func(sk *bls.SecretKey, id types.OperatorID, msg *specqbft.Message) *specqbft.SignedMessage {
	domain := testingutils.TestingSSVDomainType
	sigType := types.QBFTSignatureType

	r, _ := types.ComputeSigningRoot(msg, types.ComputeSignatureDomain(domain, sigType))
	sig := sk.SignByte(r[:])

	return &specqbft.SignedMessage{
		Message:   *msg,
		Signers:   []types.OperatorID{id},
		Signature: sig.Serialize(),
	}
}
View Source
var TestingControllerStruct = &specqbft.Controller{
	Identifier:      []byte{1, 2, 3, 4},
	Height:          specqbft.Height(1),
	Share:           testingShare,
	StoredInstances: specqbft.InstanceContainer{TestingInstanceStruct},
}
View Source
var TestingInstanceStruct = &specqbft.Instance{
	State: &specqbft.State{
		Share:                           testingShare,
		ID:                              []byte{1, 2, 3, 4},
		Round:                           1,
		Height:                          1,
		LastPreparedRound:               1,
		LastPreparedValue:               []byte{1, 2, 3, 4},
		ProposalAcceptedForCurrentRound: TestingSignedMsg,
		Decided:                         false,
		DecidedValue:                    []byte{1, 2, 3, 4},

		ProposeContainer: &specqbft.MsgContainer{
			Msgs: map[specqbft.Round][]*specqbft.SignedMessage{
				1: {
					TestingSignedMsg,
				},
			},
		},
		PrepareContainer: &specqbft.MsgContainer{
			Msgs: map[specqbft.Round][]*specqbft.SignedMessage{
				1: {
					TestingSignedMsg,
				},
			},
		},
		CommitContainer: &specqbft.MsgContainer{
			Msgs: map[specqbft.Round][]*specqbft.SignedMessage{
				1: {
					TestingSignedMsg,
				},
			},
		},
		RoundChangeContainer: &specqbft.MsgContainer{
			Msgs: map[specqbft.Round][]*specqbft.SignedMessage{
				1: {
					TestingSignedMsg,
				},
			},
		},
	},
}
View Source
var TestingMessage = &specqbft.Message{
	MsgType:    specqbft.ProposalMsgType,
	Height:     specqbft.FirstHeight,
	Round:      specqbft.FirstRound,
	Identifier: []byte{1, 2, 3, 4},
	Root:       [32]byte{1, 2, 3, 4},
}
View Source
var TestingSK = func() *bls.SecretKey {
	types.InitBLS()
	ret := &bls.SecretKey{}
	ret.SetByCSPRNG()
	return ret
}()
View Source
var TestingSignedMsg = func() *specqbft.SignedMessage {
	return SignMsg(TestingSK, 1, TestingMessage)
}()

Functions

This section is empty.

Types

type Config

type Config struct {
	Signer                spectypes.SSVSigner
	SigningPK             []byte
	Domain                spectypes.DomainType
	ValueCheckF           specqbft.ProposedValueCheckF
	ProposerF             specqbft.ProposerF
	Storage               qbftstorage.QBFTStore
	Network               specqbft.Network
	Timer                 roundtimer.Timer
	SignatureVerification bool
}

func (*Config) GetNetwork

func (c *Config) GetNetwork() specqbft.Network

GetNetwork returns a p2p Network instance

func (*Config) GetProposerF

func (c *Config) GetProposerF() specqbft.ProposerF

GetProposerF returns func used to calculate proposer

func (*Config) GetSignatureDomainType

func (c *Config) GetSignatureDomainType() spectypes.DomainType

GetSignatureDomainType returns the Domain type used for signatures

func (*Config) GetSigner

func (c *Config) GetSigner() spectypes.SSVSigner

GetSigner returns a Signer instance

func (*Config) GetSigningPubKey

func (c *Config) GetSigningPubKey() []byte

GetSigningPubKey returns the public key used to sign all QBFT messages

func (*Config) GetStorage

func (c *Config) GetStorage() qbftstorage.QBFTStore

GetStorage returns a storage instance

func (*Config) GetTimer

func (c *Config) GetTimer() roundtimer.Timer

GetTimer returns round timer

func (*Config) GetValueCheckF

func (c *Config) GetValueCheckF() specqbft.ProposedValueCheckF

GetValueCheckF returns value check instance

func (*Config) VerifySignatures added in v1.1.0

func (c *Config) VerifySignatures() bool

type IConfig

type IConfig interface {

	// GetValueCheckF returns value check function
	GetValueCheckF() specqbft.ProposedValueCheckF
	// GetProposerF returns func used to calculate proposer
	GetProposerF() specqbft.ProposerF
	// GetNetwork returns a p2p Network instance
	GetNetwork() specqbft.Network
	// GetStorage returns a storage instance
	GetStorage() qbftstorage.QBFTStore
	// GetTimer returns round timer
	GetTimer() roundtimer.Timer
	// VerifySignatures returns if signature is checked
	VerifySignatures() bool
	// contains filtered or unexported methods
}

Directories

Path Synopsis
mocks
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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