inactivity

package
v0.0.0-...-369a1d7 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const ClaimHashByteSize = 32

Variables

This section is empty.

Functions

func PublishClaim

func PublishClaim(
	ctx context.Context,
	logger log.StandardLogger,
	sessionID string,
	memberIndex group.MemberIndex,
	channel net.BroadcastChannel,
	groupSize int,
	dishonestThreshold int,
	membershipValidator *group.MembershipValidator,
	claimSigner ClaimSigner,
	claimSubmitter ClaimSubmitter,
	claim *ClaimPreimage,
) error

func RegisterUnmarshallers

func RegisterUnmarshallers(channel net.BroadcastChannel)

RegisterUnmarshallers initializes the given broadcast channel to be able to perform inactivity claim interactions by registering all the required protocol message unmarshallers.

Types

type ClaimHash

type ClaimHash [ClaimHashByteSize]byte

ClaimHash is a hash of the inactivity claim. The hashing algorithm used depends on the client code.

func ClaimHashFromBytes

func ClaimHashFromBytes(bytes []byte) (ClaimHash, error)

ClaimHashFromBytes converts bytes slice to ClaimHash. It requires provided bytes slice size to be exactly ClaimHashByteSize.

type ClaimPreimage

type ClaimPreimage struct {
	Nonce                  *big.Int
	WalletPublicKey        *ecdsa.PublicKey
	InactiveMembersIndexes []group.MemberIndex
	HeartbeatFailed        bool
}

ClaimPreimage represents an inactivity claim preimage.

func NewClaimPreimage

func NewClaimPreimage(
	nonce *big.Int,
	walletPublicKey *ecdsa.PublicKey,
	inactiveMembersIndexes []group.MemberIndex,
	heartbeatFailed bool,
) *ClaimPreimage

type ClaimSigner

type ClaimSigner interface {
	SignClaim(claim *ClaimPreimage) (*SignedClaimHash, error)
	VerifySignature(signedClaim *SignedClaimHash) (bool, error)
}

type ClaimSubmitter

type ClaimSubmitter interface {
	SubmitClaim(
		ctx context.Context,
		memberIndex group.MemberIndex,
		claim *ClaimPreimage,
		signatures map[group.MemberIndex][]byte,
	) error
}

type SignedClaimHash

type SignedClaimHash struct {
	PublicKey []byte
	Signature []byte
	ClaimHash ClaimHash
}

SignedClaimHash represents information pertaining to the process of signing an inactivity claim: the public key used during signing, the resulting signature and the hash of the inactivity claim that was used during signing.

Directories

Path Synopsis
gen
pb

Jump to

Keyboard shortcuts

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