verifier

package
v0.3.23 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ValidateExecutions

func ValidateExecutions(shard model.JobShard, executions []model.ExecutionState) error

Types

type DecrypterFunction

type DecrypterFunction func(ctx context.Context, data []byte) ([]byte, error)

type Encrypter

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

func NewEncrypter

func NewEncrypter(privateKey crypto.PrivKey) Encrypter

func (Encrypter) Decrypt

func (e Encrypter) Decrypt(ctx context.Context, data []byte) ([]byte, error)

func (Encrypter) Encrypt

func (e Encrypter) Encrypt(ctx context.Context, data, libp2pKeyBytes []byte) ([]byte, error)

type EncrypterFunction

type EncrypterFunction func(ctx context.Context, data []byte, publicKeyBytes []byte) ([]byte, error)

type ErrInsufficientExecutions

type ErrInsufficientExecutions struct {
	ShardID        string
	MinCount       int
	SubmittedCount int
}

ErrInsufficientExecutions is returned when the number of executions is less than the minimum required

func NewErrInsufficientExecutions

func NewErrInsufficientExecutions(id string, minCount, submittedCount int) ErrInsufficientExecutions

func (ErrInsufficientExecutions) Error

type ErrInvalidExecutionState

type ErrInvalidExecutionState struct {
	ExecutionID model.ExecutionID
	State       model.ExecutionStateType
}

ErrInvalidExecutionState is returned when the execution state is not valid for verification

func (ErrInvalidExecutionState) Error

func (e ErrInvalidExecutionState) Error() string

type ErrMismatchingExecution

type ErrMismatchingExecution struct {
	ShardID     model.ShardID
	ExecutionID model.ExecutionID
}

ErrMismatchingExecution is returned when the execution does not match the shard

func NewErrMismatchingExecution

func NewErrMismatchingExecution(shardID model.ShardID, executionID model.ExecutionID) ErrMismatchingExecution

func (ErrMismatchingExecution) Error

func (e ErrMismatchingExecution) Error() string

type ErrMissingVerificationProposal

type ErrMissingVerificationProposal struct {
	ExecutionID model.ExecutionID
}

ErrMissingVerificationProposal is returned when the verification proposal is missing

func NewErrMissingVerificationProposal

func NewErrMissingVerificationProposal(id model.ExecutionID) ErrMissingVerificationProposal

func (ErrMissingVerificationProposal) Error

type Verifier

type Verifier interface {
	model.Providable

	// compute node
	//
	// return the local file path where the output of a local execution
	// should live - this is called by the executor to prepare
	// output volumes when running a job and the publisher when uploading
	// the results after verification
	GetShardResultPath(
		ctx context.Context,
		shard model.JobShard,
	) (string, error)

	// compute node
	//
	// the executor has completed the job and produced a local folder of results
	// the verifier will now "process" this local folder into the result
	// that will be broadcast back to the network
	// For example - the "resultsHash" verifier will hash the folder
	// and encrypt that hash with the public key of the requester
	GetShardProposal(
		ctx context.Context,
		shard model.JobShard,
		shardResultPath string,
	) ([]byte, error)

	// requester node
	//
	// once we've decided that a job is complete - we verify the results reported
	// by the compute nodes - what this actually does is up to the verifier but
	// it's highly likely that a verifier implementation has a controller attached
	// and so can trigger state transitions (such as results accepted / rejected)
	// for each of the shards reported
	//
	// IsJobComplete must return true otherwise this function will error
	VerifyShard(
		ctx context.Context,
		shard model.JobShard,
		executions []model.ExecutionState,
	) ([]VerifierResult, error)
}

Verifier is an interface representing something that can verify the results of a job.

type VerifierProvider

type VerifierProvider interface {
	model.Provider[model.Verifier, Verifier]
}

Returns a verifier that can be used to verify a job.

type VerifierResult

type VerifierResult struct {
	Execution model.ExecutionState
	Verified  bool
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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