unittest

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2021 License: AGPL-3.0 Imports: 42 Imported by: 30

Documentation

Index

Constants

View Source
const GenesisStateCommitmentHex = "a8821281ef643bee84d3d0d4aee75435555a9205805881ec30a3c637ff5ba013"

Pre-calculated state commitment with root account with the above private key

View Source
const ServiceAccountPrivateKeyHex = "e3a08ae3d0461cfed6d6f49bfc25fa899351c39d1bd21fdba8c87595b6c49bb4cc430201"

Variables

View Source
var GenesisStateCommitment flow.StateCommitment
View Source
var GenesisTokenSupply = func() cadence.UFix64 {
	value, err := cadence.NewUFix64("10000000.00000000")
	if err != nil {
		panic(fmt.Errorf("invalid genesis token supply: %w", err))
	}
	return value
}()
View Source
var IncorporatedResult incorporatedResultFactory
View Source
var IncorporatedResultSeal incorporatedResultSealFactory
View Source
var Seal sealFactory
View Source
var ServiceAccountPrivateKey flow.AccountPrivateKey
View Source
var ServiceAccountPublicKey flow.AccountPublicKey

Functions

func AccountKeyFixture

func AccountKeyFixture() (*flow.AccountPrivateKey, error)

AccountKeyFixture returns a randomly generated ECDSA/SHA3 account key.

func AddressFixture

func AddressFixture() flow.Address

func AlterTransactionForCluster

func AlterTransactionForCluster(tx flow.TransactionBody, clusters flow.ClusterList, target flow.IdentityList, after func(tx *flow.TransactionBody)) flow.TransactionBody

AlterTransactionForCluster modifies a transaction nonce until it is assigned to the target cluster.

The `after` function is run after each modification to allow for any content dependent changes to the transaction (eg. signing it).

func ApprovalFor added in v0.14.0

func ApprovalFor(result *flow.ExecutionResult, chunkIdx uint64, approverID flow.Identifier) *flow.ResultApproval

func AssertClosesBefore

func AssertClosesBefore(t *testing.T, done <-chan struct{}, duration time.Duration)

AssertClosesBefore asserts that the given channel closes before the duration expires.

func AssertErrSubstringMatch

func AssertErrSubstringMatch(t testing.TB, expected, actual error)

AssertErrSubstringMatch asserts that two errors match with substring checking on the Error method (`expected` must be a substring of `actual`, to account for the actual error being wrapped). Fails the test if either error is nil.

NOTE: This should only be used in cases where `errors.Is` cannot be, like when errors are transmitted over the network without type information.

func AssertReturnsBefore

func AssertReturnsBefore(t *testing.T, f func(), duration time.Duration)

AssertReturnsBefore asserts that the given function returns before the duration expires.

func BadgerDB

func BadgerDB(t testing.TB, dir string) *badger.DB

func BatchFixture

func BatchFixture() flow.Batch

func BatchListFixture

func BatchListFixture(n int) []flow.Batch

func BlockFixture

func BlockFixture() flow.Block

func BlockFixtures added in v0.13.0

func BlockFixtures(number int) []*flow.Block

func BlockHeaderFixture

func BlockHeaderFixture() flow.Header

func BlockHeaderFixtureOnChain

func BlockHeaderFixtureOnChain(chainID flow.ChainID) flow.Header

func BlockHeaderWithParentFixture

func BlockHeaderWithParentFixture(parent *flow.Header) flow.Header

func BlockSealsFixture

func BlockSealsFixture(n int) []*flow.Seal

func BlockWithParentAndProposerFixture added in v0.10.0

func BlockWithParentAndProposerFixture(parent *flow.Header, proposer flow.Identifier) flow.Block

func BlockWithParentAndSeal added in v0.10.0

func BlockWithParentAndSeal(
	parent *flow.Header, sealed *flow.Header) *flow.Block

func BlockWithParentFixture

func BlockWithParentFixture(parent *flow.Header) flow.Block

func BootstrapExecutionResultFixture

func BootstrapExecutionResultFixture(block *flow.Block, commit flow.StateCommitment) *flow.ExecutionResult

func BootstrapFixture

func BootstrapFixture(participants flow.IdentityList, opts ...func(*flow.Block)) (*flow.Block, *flow.ExecutionResult, *flow.Seal)

BootstrapFixture generates all the artifacts necessary to bootstrap the protocol state.

func ChainFixture added in v0.11.0

func ChainFixture(nonGenesisCount int) ([]*flow.Block, *flow.ExecutionResult, *flow.Seal)

ChainFixture creates a list of blocks that forms a chain

func ChainFixtureFrom added in v0.11.0

func ChainFixtureFrom(count int, parent *flow.Header) []*flow.Block

ChainFixtureFrom creates a chain of blocks starting from a given parent block, the total number of blocks in the chain is specified by the given count

func ChunkDataPackFixture

func ChunkDataPackFixture(identifier flow.Identifier) *flow.ChunkDataPack

func ChunkFixture

func ChunkFixture(blockID flow.Identifier, collectionIndex uint) *flow.Chunk

func ChunksFixture added in v0.9.6

func ChunksFixture(n uint, blockID flow.Identifier) []*flow.Chunk

func ClusterAssignment

func ClusterAssignment(n uint, nodes flow.IdentityList) flow.AssignmentList

ClusterAssignment creates an assignment list with n clusters and with nodes evenly distributed among clusters.

func ClusterBlockFixture

func ClusterBlockFixture() cluster.Block

func ClusterBlockWithParent

func ClusterBlockWithParent(parent *cluster.Block) cluster.Block

ClusterBlockWithParent creates a new cluster consensus block that is valid with respect to the given parent block.

func ClusterPayloadFixture

func ClusterPayloadFixture(n int) *cluster.Payload

func CollectionFixture

func CollectionFixture(n int) flow.Collection

func CollectionGuaranteeFixture

func CollectionGuaranteeFixture(options ...func(*flow.CollectionGuarantee)) *flow.CollectionGuarantee

func CollectionGuaranteesFixture

func CollectionGuaranteesFixture(n int, options ...func(*flow.CollectionGuarantee)) []*flow.CollectionGuarantee

func CommitWithCounter

func CommitWithCounter(counter uint64) func(*flow.EpochCommit)

func CompleteCollectionFixture

func CompleteCollectionFixture() *entity.CompleteCollection

func CompleteIdentitySet

func CompleteIdentitySet(identities ...*flow.Identity) flow.IdentityList

CompleteIdentitySet takes a number of identities and completes the missing roles.

func CreateNParticipantsWithMyRole

func CreateNParticipantsWithMyRole(myRole flow.Role, otherRoles ...flow.Role) (
	flow.IdentityList, flow.Identifier, *module.Local)

CreateNParticipantsWithMyRole creates a list of identities from given roles

func EmulatorRootKey

func EmulatorRootKey() (*flow.AccountPrivateKey, error)

func EntityWithID added in v0.14.0

func EntityWithID(expectedID flow.Identifier) interface{}

func EpochCommitFixture

func EpochCommitFixture(opts ...func(*flow.EpochCommit)) *flow.EpochCommit

func EpochSetupFixture

func EpochSetupFixture(opts ...func(setup *flow.EpochSetup)) *flow.EpochSetup

func EpochStatusFixture added in v0.14.0

func EpochStatusFixture() *flow.EpochStatus

func EventFixture

func EventFixture(eType flow.EventType, transactionIndex uint32, eventIndex uint32, txID flow.Identifier) flow.Event

EventFixture returns an event

func ExecutableBlockFixture

func ExecutableBlockFixture(collectionsSignerIDs [][]flow.Identifier) *entity.ExecutableBlock

func ExecutableBlockFixtureWithParent

func ExecutableBlockFixtureWithParent(collectionsSignerIDs [][]flow.Identifier, parent *flow.Header) *entity.ExecutableBlock

func ExecutionReceiptFixture

func ExecutionReceiptFixture(opts ...func(*flow.ExecutionReceipt)) *flow.ExecutionReceipt

func ExecutionResultFixture

func ExecutionResultFixture(opts ...func(*flow.ExecutionResult)) *flow.ExecutionResult

func ExpectPanic

func ExpectPanic(expectedMsg string, t *testing.T)

func FinalizedProtocolStateWithParticipants

func FinalizedProtocolStateWithParticipants(participants flow.IdentityList) (
	*flow.Block, *protocol.Snapshot, *protocol.State, *protocol.Snapshot)

FinalizedProtocolStateWithParticipants returns a protocol state with finalized participants

func FullBlockFixture added in v0.14.0

func FullBlockFixture() flow.Block

func GenesisFixture

func GenesisFixture(identities flow.IdentityList) *flow.Block

func HashFixture

func HashFixture(size int) hash.Hash

func HeadersFromMap

func HeadersFromMap(headerDB map[flow.Identifier]*flow.Header) *storage.Headers

HeadersFromMap creates a storage header mock that backed by a given map

func IDEqual added in v0.11.0

func IDEqual(t *testing.T, id1, id2 flow.Identifier)

func IDsEqual added in v0.11.0

func IDsEqual(t *testing.T, id1, id2 []flow.Identifier)

func IdentifierFixture

func IdentifierFixture() flow.Identifier

func IdentifierListFixture

func IdentifierListFixture(n int) []flow.Identifier

func IdentityFixture

func IdentityFixture(opts ...func(*flow.Identity)) *flow.Identity

IdentityFixture returns a node identity.

func IdentityListFixture

func IdentityListFixture(n int, opts ...func(*flow.Identity)) flow.IdentityList

IdentityListFixture returns a list of node identity objects. The identities can be customized (ie. set their role) by passing in a function that modifies the input identities as required.

func IndexFixture added in v0.14.0

func IndexFixture() *flow.Index

func InvalidAddressFixture added in v0.11.0

func InvalidAddressFixture() flow.Address

func InvalidFormatSignature added in v0.12.0

func InvalidFormatSignature() flow.TransactionSignature

func KeyFixture

func KeyFixture(algo crypto.SigningAlgorithm) crypto.PrivateKey

func Logger added in v0.10.0

func Logger() zerolog.Logger

Logger returns a zerolog use -vv flag to print debugging logs for tests

func NetworkingKey

func NetworkingKey() (crypto.PrivateKey, error)

func NetworkingKeys

func NetworkingKeys(n int) ([]crypto.PrivateKey, error)

func NoopTxScript

func NoopTxScript() []byte

NoopTxScript returns a Cadence script for a no-op transaction.

func PayloadFixture

func PayloadFixture(options ...func(*flow.Payload)) *flow.Payload

func PendingFromBlock

func PendingFromBlock(block *flow.Block) *flow.PendingBlock

func ProposalFixture

func ProposalFixture() *messages.BlockProposal

func ProposalFromBlock

func ProposalFromBlock(block *flow.Block) *messages.BlockProposal

func ProposalKeyFixture

func ProposalKeyFixture() flow.ProposalKey

func QuorumCertificateFixture

func QuorumCertificateFixture() *flow.QuorumCertificate

func RandomAddressFixture added in v0.11.0

func RandomAddressFixture() flow.Address

func RandomBytes

func RandomBytes(n int) []byte

func RangeFixture

func RangeFixture() flow.Range

func RangeListFixture

func RangeListFixture(n int) []flow.Range

func ReadyDoneify

func ReadyDoneify(toMock interface{})

ReadyDoneify sets up a generated mock to respond to Ready and Done lifecycle methods. Any mock type generated by mockery can be used.

func ReceiptChainFor added in v0.14.0

func ReceiptChainFor(blocks []*flow.Block, result0 *flow.ExecutionResult) []*flow.ExecutionReceipt

func ReceiptForBlockFixture added in v0.14.0

func ReceiptForBlockFixture(block *flow.Block) *flow.ExecutionReceipt

func ReconnectBlocksAndReceipts added in v0.14.0

func ReconnectBlocksAndReceipts(blocks []*flow.Block, receipts []*flow.ExecutionReceipt)

ReconnectBlocksAndReceipts re-computes each block's PayloadHash and ParentID so that all the blocks are connected. blocks' height have to be in strict increasing order.

func RegisterNetwork

func RegisterNetwork() (*module.Network, *mocknetwork.Conduit)

RegisterNetwork returns a mocked network and conduit

func RequireCloseBefore added in v0.12.0

func RequireCloseBefore(t testing.TB, c <-chan struct{}, duration time.Duration, message string)

RequireCloseBefore requires that the given channel returns before the duration expires.

func RequireConcurrentCallsReturnBefore added in v0.11.0

func RequireConcurrentCallsReturnBefore(t *testing.T, f func(), count int, duration time.Duration, message string)

RequireConcurrentCallsReturnBefore is a test helper that runs function `f` count-many times concurrently, and requires all invocations to return within duration.

func RequireFileEmpty added in v0.14.0

func RequireFileEmpty(t *testing.T, path string)

func RequireNeverClosedWithin added in v0.11.0

func RequireNeverClosedWithin(t *testing.T, ch <-chan struct{}, duration time.Duration, message string)

RequireNeverClosedWithin is a test helper function that fails the test if channel `ch` is closed before the determined duration.

func RequireNeverReturnBefore added in v0.11.0

func RequireNeverReturnBefore(t *testing.T, f func(), duration time.Duration, message string) <-chan struct{}

RequireNeverReturnBefore is a test helper that tries invoking function `f` and fails the test if either: - function `f` is not invoked within 1 second. - function `f` returns before specified `duration`.

It also returns a channel that is closed once the function `f` returns and hence its openness can evaluate return status of function `f` for intervals longer than duration.

func RequireReturnsBefore

func RequireReturnsBefore(t testing.TB, f func(), duration time.Duration, message string)

RequireReturnBefore requires that the given function returns before the duration expires.

func ResultApprovalFixture

func ResultApprovalFixture(opts ...func(*flow.ResultApproval)) *flow.ResultApproval

func RunWithBadgerDB

func RunWithBadgerDB(t testing.TB, f func(*badger.DB))

func RunWithTempDir

func RunWithTempDir(t testing.TB, f func(string))

func SeedFixture

func SeedFixture(n int) []byte

SeedFixture returns a random []byte with length n

func SeedFixtures

func SeedFixtures(m int, n int) [][]byte

SeedFixtures returns a list of m random []byte, each having length n

func SetupWithCounter

func SetupWithCounter(counter uint64) func(*flow.EpochSetup)

func SignatureFixture

func SignatureFixture() crypto.Signature

func SignaturesFixture

func SignaturesFixture(n int) []crypto.Signature

func StakingKey

func StakingKey() (crypto.PrivateKey, error)

func StakingKeys

func StakingKeys(n int) ([]crypto.PrivateKey, error)

func StateCommitmentFixture

func StateCommitmentFixture() flow.StateCommitment

func StateDeltaFixture

func StateDeltaFixture() *messages.ExecutionStateDelta

func StateDeltaWithParentFixture

func StateDeltaWithParentFixture(parent *flow.Header) *messages.ExecutionStateDelta

func StateInteractionsFixture added in v0.11.0

func StateInteractionsFixture() *delta.Snapshot

func StateSnapshotForKnownBlock added in v0.14.0

func StateSnapshotForKnownBlock(block *flow.Header, identities map[flow.Identifier]*flow.Identity) *protocol.Snapshot

func StateSnapshotForUnknownBlock added in v0.14.0

func StateSnapshotForUnknownBlock() *protocol.Snapshot

func TempBadgerDB

func TempBadgerDB(t testing.TB) (*badger.DB, string)

func TempDir

func TempDir(t testing.TB) string

func TransactionBodyFixture

func TransactionBodyFixture(opts ...func(*flow.TransactionBody)) flow.TransactionBody

func TransactionDSLFixture

func TransactionDSLFixture(chain flow.Chain) dsl.Transaction

func TransactionFixture

func TransactionFixture(n ...func(t *flow.Transaction)) flow.Transaction

func TransactionForCluster

func TransactionForCluster(clusters flow.ClusterList, target flow.IdentityList) flow.TransactionBody

TransactionForCluster generates a transaction that will be assigned to the target cluster ID.

func TransactionSignatureFixture

func TransactionSignatureFixture() flow.TransactionSignature

func VerifiableChunkDataFixture

func VerifiableChunkDataFixture(chunkIndex uint64) *verification.VerifiableChunkData

VerifiableChunkDataFixture returns a complete verifiable chunk with an execution receipt referencing the block/collections.

func VoteFixture

func VoteFixture() *hotstuff.Vote

func WithAddress added in v0.13.0

func WithAddress(address string) func(*flow.Identity)

WithAddress sets the network address of identity fixture.

func WithAllRoles

func WithAllRoles() func(*flow.Identity)

WithAllRoles can be used used to ensure an IdentityList fixtures contains all the roles required for a valid genesis block.

func WithAllRolesExcept

func WithAllRolesExcept(except ...flow.Role) func(*flow.Identity)

Same as above, but omitting a certain role for cases where we are manually setting up nodes or a particular role.

func WithApproverID added in v0.11.0

func WithApproverID(approverID flow.Identifier) func(*flow.ResultApproval)

func WithAttestationBlock added in v0.14.0

func WithAttestationBlock(block *flow.Block) func(*flow.ResultApproval)

func WithBlock added in v0.11.0

func WithBlock(block *flow.Block) func(*flow.ExecutionResult)

func WithBlockID added in v0.11.0

func WithBlockID(id flow.Identifier) func(*flow.ResultApproval)

func WithChunk added in v0.11.0

func WithChunk(chunkIdx uint64) func(*flow.ResultApproval)

func WithCollRef

func WithCollRef(refID flow.Identifier) func(*flow.CollectionGuarantee)

func WithCollection added in v0.14.0

func WithCollection(collection *flow.Collection) func(guarantee *flow.CollectionGuarantee)

func WithDKGFromParticipants

func WithDKGFromParticipants(participants flow.IdentityList) func(*flow.EpochCommit)

func WithExecutionResultID

func WithExecutionResultID(id flow.Identifier) func(*flow.ResultApproval)

func WithExecutorID added in v0.11.0

func WithExecutorID(executorID flow.Identifier) func(*flow.ExecutionReceipt)

func WithFinalView

func WithFinalView(view uint64) func(*flow.EpochSetup)

func WithNetworkingKey added in v0.13.0

func WithNetworkingKey(key crypto.PublicKey) func(*flow.Identity)

WithNetworkingKey sets the networking public key of identity fixture.

func WithNodeID

func WithNodeID(b byte) func(*flow.Identity)

WithNodeID adds a node ID with the given first byte to an identity.

func WithParticipants

func WithParticipants(participants flow.IdentityList) func(*flow.EpochSetup)

func WithPreviousResult added in v0.11.0

func WithPreviousResult(prevResult flow.ExecutionResult) func(*flow.ExecutionResult)

func WithRandomPublicKeys

func WithRandomPublicKeys() func(*flow.Identity)

WithRandomPublicKeys adds random public keys to an identity.

func WithReferenceBlock

func WithReferenceBlock(id flow.Identifier) func(tx *flow.TransactionBody)

func WithResult added in v0.11.0

func WithResult(result *flow.ExecutionResult) func(*flow.ExecutionReceipt)

func WithRole

func WithRole(role flow.Role) func(*flow.Identity)

WithRole adds a role to an identity fixture.

func WithStake

func WithStake(stake uint64) func(*flow.Identity)

func WithTransactionDSL

func WithTransactionDSL(txDSL dsl.Transaction) func(tx *flow.TransactionBody)

func WithoutSeals

func WithoutSeals(payload *flow.Payload)

Types

type BaseChainSuite added in v0.14.0

type BaseChainSuite struct {
	suite.Suite

	// IDENTITIES
	ConID flow.Identifier
	ExeID flow.Identifier
	VerID flow.Identifier

	Identities map[flow.Identifier]*flow.Identity
	Approvers  flow.IdentityList

	// BLOCKS
	RootBlock            flow.Block
	LatestSealedBlock    flow.Block
	LatestFinalizedBlock *flow.Block
	UnfinalizedBlock     flow.Block
	Blocks               map[flow.Identifier]*flow.Block

	// PROTOCOL STATE
	State          *protocol.State
	SealedSnapshot *protocol.Snapshot
	FinalSnapshot  *protocol.Snapshot

	// MEMPOOLS and STORAGE which are injected into Matching Engine
	// mock storage.ExecutionReceipts: backed by in-memory map PersistedReceipts
	ReceiptsDB             *storage.ExecutionReceipts
	PersistedReceipts      map[flow.Identifier]*flow.ExecutionReceipt
	PersistedReceiptsIndex map[flow.Identifier]flow.Identifier // index ExecutionResult.BlockID -> ExecutionReceipt.ID

	ResultsDB        *storage.ExecutionResults
	PersistedResults map[flow.Identifier]*flow.ExecutionResult

	// mock mempool.IncorporatedResults: backed by in-memory map PendingResults
	ResultsPL      *mempool.IncorporatedResults
	PendingResults map[flow.Identifier]*flow.IncorporatedResult

	// mock mempool.IncorporatedResultSeals: backed by in-memory map PendingSeals
	SealsPL      *mempool.IncorporatedResultSeals
	PendingSeals map[flow.Identifier]*flow.IncorporatedResultSeal

	// mock BLOCK STORAGE: backed by in-memory map Blocks
	HeadersDB  *storage.Headers               // backed by map Blocks
	IndexDB    *storage.Index                 // backed by map Blocks
	PayloadsDB *storage.Payloads              // backed by map Blocks
	SealsDB    *storage.Seals                 // backed by map SealsIndex
	SealsIndex map[flow.Identifier]*flow.Seal // last valid seal for block

	// mock mempool.Approvals: used to test whether or not Matching Engine stores approvals
	// mock storage backed by in-memory map PendingApprovals
	ApprovalsPL      *mempool.Approvals
	PendingApprovals map[flow.Identifier]map[uint64]map[flow.Identifier]*flow.ResultApproval

	// mock mempool.ReceiptsForest: used to test whether or not Matching Engine stores receipts
	ReceiptsPL *mempool.ExecutionTree

	Assigner    *module.ChunkAssigner
	Assignments map[flow.Identifier]*chunks.Assignment // index for assignments for given execution result
}

func (*BaseChainSuite) AddSubgraphFixtureToMempools added in v0.14.0

func (bc *BaseChainSuite) AddSubgraphFixtureToMempools(subgraph subgraphFixture)

addSubgraphFixtureToMempools adds add entities in subgraph to mempools and persistent storage mocks

func (*BaseChainSuite) Extend added in v0.14.0

func (bc *BaseChainSuite) Extend(block *flow.Block)

func (*BaseChainSuite) SetupChain added in v0.14.0

func (bc *BaseChainSuite) SetupChain()

func (*BaseChainSuite) ValidSubgraphFixture added in v0.14.0

func (bc *BaseChainSuite) ValidSubgraphFixture() subgraphFixture

Generates a valid subgraph: let

  • R1 be a result which pertains to blockA
  • R2 be R1's previous result, where R2 pertains to blockB

The execution results form a valid subgraph if and only if:

blockA.ParentID == blockB.ID

type ClusterStateChecker

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

ClusterStateChecker is a test utility for checking cluster state. First, prepare it with expectations about the state, using `Expect*` functions, then use `Check` to assert the expectations.

Duplicates are checked automatically without setting any expectations.

func NewClusterStateChecker

func NewClusterStateChecker(state cluster.State) *ClusterStateChecker

NewClusterStateChecker returns a state checker for the given state.

func (*ClusterStateChecker) Assert

func (checker *ClusterStateChecker) Assert(t *testing.T)

Assert checks all assertions against the cluster state. If any assertions fail, the test will fail.

func (*ClusterStateChecker) ExpectContainsTx

func (checker *ClusterStateChecker) ExpectContainsTx(txIDs ...flow.Identifier) *ClusterStateChecker

ExpectContainsTx adds an expectation that the given transaction exists in the cluster state.

func (*ClusterStateChecker) ExpectOmitsTx

func (checker *ClusterStateChecker) ExpectOmitsTx(txIDs ...flow.Identifier) *ClusterStateChecker

ExpectOmitsTx adds an expectation that the given transaction does not exist in the cluster state.

func (*ClusterStateChecker) ExpectTxCount

func (checker *ClusterStateChecker) ExpectTxCount(n int) *ClusterStateChecker

ExpectTxCount adds an expectation for the total count of transactions in the cluster state.

type EpochBuilder added in v0.12.0

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

EpochBuilder is a testing utility for building epochs into chain state.

func NewEpochBuilder added in v0.12.0

func NewEpochBuilder(t *testing.T, state protocol.MutableState) *EpochBuilder

func (*EpochBuilder) BuildEpoch added in v0.12.0

func (builder *EpochBuilder) BuildEpoch() *EpochBuilder

D contains a seal for block B containing the EpochSetup service event. F contains a seal for block D containing the EpochCommit service event.

To build a sequence of epochs, we call BuildEpoch, then CompleteEpoch, and so on.

func (*EpochBuilder) CompleteEpoch added in v0.12.0

func (builder *EpochBuilder) CompleteEpoch()

CompleteEpoch caps off the current epoch by building the first block of the next epoch. We must be in the Committed phase to call CompleteEpoch. Once the epoch has been capped off, we can build the next epoch with BuildEpoch.

func (*EpochBuilder) UsingCommitOpts added in v0.12.0

func (builder *EpochBuilder) UsingCommitOpts(opts ...func(*flow.EpochCommit)) *EpochBuilder

UsingCommitOpts sets options for the epoch setup event. For options targeting the same field, those added here will take precedence over defaults.

func (*EpochBuilder) UsingSetupOpts added in v0.12.0

func (builder *EpochBuilder) UsingSetupOpts(opts ...func(*flow.EpochSetup)) *EpochBuilder

UsingSetupOpts sets options for the epoch setup event. For options targeting the same field, those added here will take precedence over defaults.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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