actorutils

package
v0.4.0-docker-upgrade Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

README

This package contains utilities to deal with actors (workers, reputers).

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CloseReputerNonce

func CloseReputerNonce(
	k *keeper.Keeper,
	ctx sdk.Context,
	topicId keeper.TopicId,
	nonce types.Nonce) error

Closes an open reputer nonce.

func CloseWorkerNonce

func CloseWorkerNonce(k *keeper.Keeper, ctx sdk.Context, topicId keeper.TopicId, nonce types.Nonce) error

Closes an open worker nonce.

func FilterUnacceptedWorkersFromReputerValueBundle added in v0.3.1

func FilterUnacceptedWorkersFromReputerValueBundle(
	k *keeper.Keeper,
	ctx context.Context,
	topicId uint64,
	reputerRequestNonce types.ReputerRequestNonce,
	reputerValueBundle *types.ReputerValueBundle,
) (*types.ReputerValueBundle, error)

Filter out values of unaccepted workers. It is assumed that the work of inferers and forecasters stored at the nonce is already filtered for acceptance. This also removes duplicate values of the same worker.

func FindTopNByScoreDesc

func FindTopNByScoreDesc(
	ctx sdk.Context,
	n uint64,
	scores []emissionstypes.Score,
	randSeed int64,
) (topNActorsSorted []emissionstypes.Score, allActorsSorted []emissionstypes.Score, actorIsTop map[string]struct{})

Sorts the given actors by score, desc, breaking ties randomly Returns the top N actors as a map with the actor as the key and a boolean (True) as the value

func GetQuantileOfScores added in v0.4.0

func GetQuantileOfScores(
	scores []emissionstypes.Score,
	quantile alloraMath.Dec,
) (alloraMath.Dec, error)

Returns the quantile value of the given sorted scores e.g. if quantile is 0.25 (25%), for all the scores sorted from greatest to smallest give me the value that is greater than 25% of the values and less than 75% of the values the domain of this quantile is assumed to be between 0 and 1. Scores should be of unique actors => no two elements have the same actor address.

Types

This section is empty.

Jump to

Keyboard shortcuts

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