verify

package
v0.6.3 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2023 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PublicKeyLength = bls12381.SizeOfG1AffineCompressed
	SecretKeyLength = fr.Bytes
	SignatureLength = bls12381.SizeOfG2AffineCompressed
)
View Source
const (
	ResponseQueueSubmit = iota
	ResponseQueueRegister
	ResponseQueueOther
)

Variables

View Source
var (
	ErrInvalidPubkeyLength    = errors.New("invalid public key length")
	ErrInvalidSecretKeyLength = errors.New("invalid secret key length")
	ErrInvalidSignatureLength = errors.New("invalid signature length")
	ErrSecretKeyIsZero        = errors.New("invalid secret key is zero")
)
View Source
var ErrInvalidSignature = errors.New("invalid signature")

Functions

func VerifySignature

func VerifySignature(sig *Signature, pk *PublicKey, msg []byte) (bool, error)

func VerifySignatureBytes

func VerifySignatureBytes(msg [32]byte, sigBytes, pkBytes []byte) (ok bool, err error)

Types

type ProcessManagerMetrics

type ProcessManagerMetrics struct {
	VerifyTiming   *prometheus.HistogramVec
	RunningWorkers *prometheus.GaugeVec
}

type PublicKey added in v0.6.0

type PublicKey = bls12381.G1Affine

func PublicKeyFromBytes added in v0.6.0

func PublicKeyFromBytes(pkBytes []byte) (*PublicKey, error)

type Request

type Request struct {
	Signature [96]byte
	Pubkey    [48]byte
	Msg       [32]byte
	// Unique identifier of payload
	// if needed to be passed back in response
	ID       int
	Response *StoreResp
}

VerifyReq is a request structure used in communication between api calls and fixed set of worker goroutines it's using return channel pattern, meaning that after sent the sender locks on that channel to get the response

type Resp

type Resp struct {
	ID     int
	Type   int8
	Commit bool
	Err    error
}

Resp response structure - potential candidate for structure pool as it's almost constant size

type SecretKey added in v0.6.0

type SecretKey = fr.Element

type Signature added in v0.6.0

type Signature = bls12381.G2Affine

func SignatureFromBytes added in v0.6.0

func SignatureFromBytes(sigBytes []byte) (*Signature, error)

type StoreResp

type StoreResp struct {
	// contains filtered or unexported fields
}

func NewRespC

func NewRespC(numAll int) (s *StoreResp)

func (*StoreResp) Close

func (s *StoreResp) Close(id int, err error)

func (*StoreResp) Done

func (s *StoreResp) Done() chan error

func (*StoreResp) Error

func (s *StoreResp) Error() (err error)

func (*StoreResp) IsClosed

func (s *StoreResp) IsClosed() bool

func (*StoreResp) Send

func (s *StoreResp) Send(r Resp)

func (*StoreResp) SkipOne

func (s *StoreResp) SkipOne()

func (*StoreResp) SuccessfullIndexes

func (s *StoreResp) SuccessfullIndexes() []int64

type VerificationManager

type VerificationManager struct {
	VerifySubmitBlockCh       chan Request
	VerifyRegisterValidatorCh chan Request
	VerifyOtherCh             chan Request
	// contains filtered or unexported fields
}

func NewVerificationManager

func NewVerificationManager(l log.Logger, verifySize uint) *VerificationManager

func (*VerificationManager) AttachMetrics

func (rm *VerificationManager) AttachMetrics(m *metrics.Metrics)

func (*VerificationManager) Enqueue

func (rm *VerificationManager) Enqueue(ctx context.Context, sig [96]byte, pubkey [48]byte, msg [32]byte) (err error)

func (*VerificationManager) GetVerifyChan

func (rm *VerificationManager) GetVerifyChan(stack uint) chan Request

func (*VerificationManager) RunVerify

func (rm *VerificationManager) RunVerify(num uint)

func (*VerificationManager) VerifyChan

func (rm *VerificationManager) VerifyChan() chan Request

func (*VerificationManager) VerifyParallel

func (rm *VerificationManager) VerifyParallel()

Jump to

Keyboard shortcuts

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