agreementtest

package
v0.0.0-...-15eb78e Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2022 License: AGPL-3.0 Imports: 15 Imported by: 0

Documentation

Overview

Package agreementtest produces useful functions for testing code.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Simulate

func Simulate(dbname string, n basics.Round, roundDeadline time.Duration, ledger agreement.Ledger, keyManager agreement.KeyManager, proposalFactory agreement.BlockFactory, proposalValidator agreement.BlockValidator, log logging.Logger) error

Simulate n rounds of agreement on the specified Ledger given the specified KeyManager, BlockFactory, and BlockValidator.

If a nonzero roundDeadline is given, this function will return an error if any round does not conclude by the deadline.

The KeyManager must have enough keys to form a cert-quorum.

Types

type CryptoRandomSource

type CryptoRandomSource struct{}

CryptoRandomSource is a random source that is based off our crypto library.

func (*CryptoRandomSource) Uint64

func (c *CryptoRandomSource) Uint64() uint64

Uint64 implements the randomness by calling hte crypto library.

type SimpleKeyManager

type SimpleKeyManager []account.Participation

SimpleKeyManager provides a simple implementation of a KeyManager for unit tests.

func (SimpleKeyManager) DeleteOldKeys

func (m SimpleKeyManager) DeleteOldKeys(r basics.Round)

DeleteOldKeys implements KeyManager.DeleteOldKeys.

func (SimpleKeyManager) Record

func (m SimpleKeyManager) Record(account basics.Address, round basics.Round, action account.ParticipationAction)

Record implements KeyManager.Record.

func (SimpleKeyManager) VotingKeys

func (m SimpleKeyManager) VotingKeys(votingRound, _ basics.Round) []account.ParticipationRecordForRound

VotingKeys implements KeyManager.VotingKeys.

Jump to

Keyboard shortcuts

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