utils

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2024 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrAlreadyExists = errors.New("got init msg for existing instance")
View Source
var ErrMaxInstances = errors.New("max number of instances ongoing, please wait")
View Source
var ErrMissingInstance = errors.New("got message to instance that I don't have, send Init first")
View Source
var ErrVersion = errors.New("wrong version")

Functions

func CommitsToBytes added in v1.0.0

func CommitsToBytes(cs []kyber.Point) []byte

func Contains added in v1.0.0

func Contains(s []*rsa.PrivateKey, i int) bool

func GetDisjointNewOperators added in v1.0.0

func GetDisjointNewOperators(oldOperators, newOperators []*wire.Operator) []*wire.Operator

GetDisjointNewOperators returns a new set of operators disjoint from old set For example: old set [1,2,3,4,5]; new set [3,4,5,6,7]; returns [6,7]

func GetDisjointOldOperators added in v1.0.0

func GetDisjointOldOperators(oldOperators, newOperators []*wire.Operator) []*wire.Operator

GetDisjointOldOperators returns an old set of operators disjoint from new set For example: old set [1,2,3,4,5]; new set [3,4,5,6,7]; returns [3,4,5]

func GetNetworkByFork added in v1.0.0

func GetNetworkByFork(fork [4]byte) eth2_key_manager_core.Network

GetNetworkByFork translates the network fork bytes into name

TODO: once eth2_key_manager implements this we can get rid of it and support all networks ekm supports automatically

func GetNonce added in v1.2.0

func GetNonce(input []byte) []byte

GetNonce returns a suitable nonce to feed in the DKG config.

func GetThreshold added in v1.0.0

func GetThreshold(ids []uint64) (int, error)

GetThreshold computes threshold from amount of operators following 3f+1 tolerance

func HexToAddress

func HexToAddress(s string) (common.Address, error)

HexToAddress converts a string HEX representation of Ethereum address to Address structure

func JoinSets added in v1.0.0

func JoinSets(oldOperators, newOperators []*wire.Operator) []*wire.Operator

JoinSets creates a set of two groups of operators. For example: [1,2,3,4] and [1,2,5,6,7] will return [1,2,3,4,5,6,7]

func SplitBytes added in v1.0.0

func SplitBytes(buf []byte, lim int) [][]byte

SplitBytes split bytes slice to n parts

func WriteErrorResponse added in v1.1.0

func WriteErrorResponse(logger *zap.Logger, writer http.ResponseWriter, err error, statusCode int)

func WriteJSON

func WriteJSON(filePth string, data any) error

WriteJSON writes data to JSON file

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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