{"modulePath":"github.com/onflow/flow-archive","version":"v0.31.9-decrease-wait-interval","isLatest":false,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package mocks\n\n## Variables\n\n```go\nvar (\n\tNoopLogger = zerolog.New(io.Discard)\n\n\tGenericError = errors.New(\"dummy error\")\n\n\tGenericHeight = uint64(42)\n\n\tGenericBytes = []byte(`test`)\n\n\tGenericHeader = \u0026flow.Header{\n\t\tChainID:   archive.FlowTestnet,\n\t\tHeight:    GenericHeight,\n\t\tParentID:  genericIdentifier(0, offsetBlock),\n\t\tTimestamp: time.Date(1972, 11, 12, 13, 14, 15, 16, time.UTC),\n\t}\n\n\tGenericBlock = \u0026model.Block{\n\t\tBlockID: GenericHeader.ID(),\n\t}\n\n\tGenericLedgerKey = ledger.NewKey([]ledger.KeyPart{\n\t\tledger.NewKeyPart(0, []byte(`owner`)),\n\t\tledger.NewKeyPart(2, []byte(`key`)),\n\t})\n\n\t// GenericRootNode Visual Representation:\n\t//           6 (root)\n\t//          / \\\n\t//         3   5\n\t//        / \\   \\\n\t//       1   2   4\n\tGenericRootNode = node.NewNode(\n\t\t256,\n\t\tnode.NewNode(\n\t\t\t256,\n\t\t\tnode.NewLeaf(GenericLedgerPath(0), GenericLedgerPayload(0), 42),\n\t\t\tnode.NewLeaf(GenericLedgerPath(1), GenericLedgerPayload(1), 42),\n\t\t\tGenericLedgerPath(2),\n\t\t\tGenericLedgerPayload(2),\n\t\t\thash.DummyHash,\n\t\t),\n\t\tnode.NewNode(\n\t\t\t256,\n\t\t\tnode.NewLeaf(GenericLedgerPath(3), GenericLedgerPayload(3), 42),\n\t\t\tnil,\n\t\t\tGenericLedgerPath(4),\n\t\t\tGenericLedgerPayload(4),\n\t\t\thash.DummyHash,\n\t\t),\n\t\tGenericLedgerPath(5),\n\t\tGenericLedgerPayload(5),\n\t\thash.DummyHash,\n\t)\n\n\tGenericTrie, _ = trie.NewMTrie(GenericRootNode, 3, 3*32)\n\n\tGenericAccount = flow.Account{\n\t\tAddress: GenericAddress(0),\n\t\tBalance: 84,\n\t\tKeys: []flow.AccountPublicKey{\n\t\t\t{\n\t\t\t\tIndex:     0,\n\t\t\t\tSeqNumber: 42,\n\t\t\t\tHashAlgo:  chash.SHA2_256,\n\t\t\t\tPublicKey: crypto.IdentityBLSPublicKey(),\n\t\t\t},\n\t\t},\n\t}\n)\n```\nGlobal variables that can be used for testing. They are non-nil valid values for the types commonly needed test DPS components.\n\n## Functions\n\n```go\nfunc ByteSlice(v interface{}) []byte\n```\n\n```go\nfunc GenericAddress(index int) flow.Address\n```\n\n```go\nfunc GenericAddresses(number int) []flow.Address\n```\n\n```go\nfunc GenericAmount(delta int) cadence.Value\n```\n\n```go\nfunc GenericBlockIDs(number int) []flow.Identifier\n```\n\n```go\nfunc GenericCadenceEvent(index int) cadence.Event\n```\n\n```go\nfunc GenericCadenceEventType(index int) *cadence.EventType\n```\n\n```go\nfunc GenericCadenceEventTypes(number int) []*cadence.EventType\n```\n\n```go\nfunc GenericCadenceEvents(number int) []cadence.Event\n```\n\n```go\nfunc GenericCollection(index int) *flow.LightCollection\n```\n\n```go\nfunc GenericCollectionIDs(number int) []flow.Identifier\n```\n\n```go\nfunc GenericCollections(number int) []*flow.LightCollection\n```\n\n```go\nfunc GenericCommit(index int) flow.StateCommitment\n```\n\n```go\nfunc GenericCommits(number int) []flow.StateCommitment\n```\n\n```go\nfunc GenericEvent(index int) flow.Event\n```\n\n```go\nfunc GenericEventType(index int) flow.EventType\n```\n\n```go\nfunc GenericEventTypes(number int) []flow.EventType\n```\n\n```go\nfunc GenericEvents(number int, types ...flow.EventType) []flow.Event\n```\n\n```go\nfunc GenericGuarantee(index int) *flow.CollectionGuarantee\n```\n\n```go\nfunc GenericGuarantees(number int) []*flow.CollectionGuarantee\n```\n\n```go\nfunc GenericLedgerPath(index int) ledger.Path\n```\n\n```go\nfunc GenericLedgerPaths(number int) []ledger.Path\n```\n\n```go\nfunc GenericLedgerPayload(index int) *ledger.Payload\n```\n\n```go\nfunc GenericLedgerPayloads(number int) []*ledger.Payload\n```\n\n```go\nfunc GenericRecord() *uploader.BlockData\n```\n\n```go\nfunc GenericRegister(index int) flow.RegisterID\n```\n\n```go\nfunc GenericRegisterEntries(number int) flow.RegisterEntries\n```\n\n```go\nfunc GenericRegisterEntry(index int) flow.RegisterEntry\n```\n\n```go\nfunc GenericRegisterValue(index int) flow.RegisterValue\n```\n\n```go\nfunc GenericRegisterValues(number int) []flow.RegisterValue\n```\n\n```go\nfunc GenericRegisters(number int) flow.RegisterIDs\n```\n\n```go\nfunc GenericResult(index int) *flow.TransactionResult\n```\n\n```go\nfunc GenericResults(number int) []*flow.TransactionResult\n```\n\n```go\nfunc GenericSeal(index int) *flow.Seal\n```\n\n```go\nfunc GenericSealIDs(number int) []flow.Identifier\n```\n\n```go\nfunc GenericSeals(number int) []*flow.Seal\n```\n\n```go\nfunc GenericTransaction(index int) *flow.TransactionBody\n```\n\n```go\nfunc GenericTransactionIDs(number int) []flow.Identifier\n```\n\n```go\nfunc GenericTransactions(number int) []*flow.TransactionBody\n```\n\n```go\nfunc GenericTrieUpdate(index int) *ledger.TrieUpdate\n```\n\n```go\nfunc GenericTrieUpdates(number int) []*ledger.TrieUpdate\n```\n\n## Types\n\n```go\ntype Cache struct {\n\tGetFunc func(key interface{}) (interface{}, bool)\n\tSetFunc func(key, value interface{}, cost int64) bool\n}\n```\n\n```go\nfunc BaselineCache(t *testing.T) *Cache\n```\n\n```go\nfunc (c *Cache) Get(key interface{}) (interface{}, bool)\n```\n\n```go\nfunc (c *Cache) Set(key, value interface{}, cost int64) bool\n```\n\n```go\ntype Chain struct {\n\tRootFunc         func() (uint64, error)\n\tHeaderFunc       func(height uint64) (*flow.Header, error)\n\tCommitFunc       func(height uint64) (flow.StateCommitment, error)\n\tCollectionsFunc  func(height uint64) ([]*flow.LightCollection, error)\n\tGuaranteesFunc   func(height uint64) ([]*flow.CollectionGuarantee, error)\n\tTransactionsFunc func(height uint64) ([]*flow.TransactionBody, error)\n\tResultsFunc      func(height uint64) ([]*flow.TransactionResult, error)\n\tEventsFunc       func(height uint64) ([]flow.Event, error)\n\tSealsFunc        func(height uint64) ([]*flow.Seal, error)\n}\n```\n\n```go\nfunc BaselineChain(t *testing.T) *Chain\n```\n\n```go\nfunc (c *Chain) Collections(height uint64) ([]*flow.LightCollection, error)\n```\n\n```go\nfunc (c *Chain) Commit(height uint64) (flow.StateCommitment, error)\n```\n\n```go\nfunc (c *Chain) Events(height uint64) ([]flow.Event, error)\n```\n\n```go\nfunc (c *Chain) Guarantees(height uint64) ([]*flow.CollectionGuarantee, error)\n```\n\n```go\nfunc (c *Chain) Header(height uint64) (*flow.Header, error)\n```\n\n```go\nfunc (c *Chain) Results(height uint64) ([]*flow.TransactionResult, error)\n```\n\n```go\nfunc (c *Chain) Root() (uint64, error)\n```\n\n```go\nfunc (c *Chain) Seals(height uint64) ([]*flow.Seal, error)\n```\n\n```go\nfunc (c *Chain) Transactions(height uint64) ([]*flow.TransactionBody, error)\n```\n\n```go\ntype Codec struct {\n\tEncodeFunc     func(value interface{}) ([]byte, error)\n\tDecodeFunc     func(data []byte, value interface{}) error\n\tCompressFunc   func(data []byte) ([]byte, error)\n\tDecompressFunc func(compressed []byte) ([]byte, error)\n\tMarshalFunc    func(value interface{}) ([]byte, error)\n\tUnmarshalFunc  func(compressed []byte, value interface{}) error\n}\n```\n\n```go\nfunc BaselineCodec(t *testing.T) *Codec\n```\n\n```go\nfunc (c *Codec) Compress(data []byte) ([]byte, error)\n```\n\n```go\nfunc (c *Codec) Decode(data []byte, value interface{}) error\n```\n\n```go\nfunc (c *Codec) Decompress(data []byte) ([]byte, error)\n```\n\n```go\nfunc (c *Codec) Encode(value interface{}) ([]byte, error)\n```\n\n```go\nfunc (c *Codec) Marshal(v interface{}) ([]byte, error)\n```\n\n```go\nfunc (c *Codec) Unmarshal(b []byte, v interface{}) error\n```\n\n```go\ntype Invoker struct {\n\tKeyFunc     func(height uint64, address flow.Address, index int) (*flow.AccountPublicKey, error)\n\tAccountFunc func(height uint64, address flow.Address) (*flow.Account, error)\n\tScriptFunc  func(height uint64, script []byte, parameters []cadence.Value) (cadence.Value, error)\n}\n```\n\n```go\nfunc BaselineInvoker(t *testing.T) *Invoker\n```\n\n```go\nfunc (i *Invoker) Account(height uint64, address flow.Address) (*flow.Account, error)\n```\n\n```go\nfunc (i *Invoker) Key(height uint64, address flow.Address, index int) (*flow.AccountPublicKey, error)\n```\n\n```go\nfunc (i *Invoker) Script(height uint64, script []byte, parameters []cadence.Value) (cadence.Value, error)\n```\n\n```go\ntype Parser struct {\n\tUpdatesFunc func() ([]*ledger.TrieUpdate, error)\n}\n```\n\n```go\nfunc BaselineParser(t *testing.T) *Parser\n```\n\n```go\nfunc (f *Parser) AllUpdates() ([]*ledger.TrieUpdate, error)\n```\n\n```go\ntype Reader struct {\n\tFirstFunc                func() (uint64, error)\n\tLastFunc                 func() (uint64, error)\n\tHeightForBlockFunc       func(blockID flow.Identifier) (uint64, error)\n\tCommitFunc               func(height uint64) (flow.StateCommitment, error)\n\tHeaderFunc               func(height uint64) (*flow.Header, error)\n\tEventsFunc               func(height uint64, types ...flow.EventType) ([]flow.Event, error)\n\tValuesFunc               func(height uint64, regs flow.RegisterIDs) ([]flow.RegisterValue, error)\n\tCollectionFunc           func(collID flow.Identifier) (*flow.LightCollection, error)\n\tCollectionsByHeightFunc  func(height uint64) ([]flow.Identifier, error)\n\tGuaranteeFunc            func(collID flow.Identifier) (*flow.CollectionGuarantee, error)\n\tTransactionFunc          func(txID flow.Identifier) (*flow.TransactionBody, error)\n\tHeightForTransactionFunc func(txID flow.Identifier) (uint64, error)\n\tTransactionsByHeightFunc func(height uint64) ([]flow.Identifier, error)\n\tResultFunc               func(txID flow.Identifier) (*flow.TransactionResult, error)\n\tSealFunc                 func(sealID flow.Identifier) (*flow.Seal, error)\n\tSealsByHeightFunc        func(height uint64) ([]flow.Identifier, error)\n}\n```\n\n```go\nfunc BaselineReader(t *testing.T) *Reader\n```\n\n```go\nfunc (r *Reader) Collection(collID flow.Identifier) (*flow.LightCollection, error)\n```\n\n```go\nfunc (r *Reader) CollectionsByHeight(height uint64) ([]flow.Identifier, error)\n```\n\n```go\nfunc (r *Reader) Commit(height uint64) (flow.StateCommitment, error)\n```\n\n```go\nfunc (r *Reader) Events(height uint64, types ...flow.EventType) ([]flow.Event, error)\n```\n\n```go\nfunc (r *Reader) First() (uint64, error)\n```\n\n```go\nfunc (r *Reader) Guarantee(collID flow.Identifier) (*flow.CollectionGuarantee, error)\n```\n\n```go\nfunc (r *Reader) Header(height uint64) (*flow.Header, error)\n```\n\n```go\nfunc (r *Reader) HeightForBlock(blockID flow.Identifier) (uint64, error)\n```\n\n```go\nfunc (r *Reader) HeightForTransaction(txID flow.Identifier) (uint64, error)\n```\n\n```go\nfunc (r *Reader) Last() (uint64, error)\n```\n\n```go\nfunc (r *Reader) Result(txID flow.Identifier) (*flow.TransactionResult, error)\n```\n\n```go\nfunc (r *Reader) Seal(sealID flow.Identifier) (*flow.Seal, error)\n```\n\n```go\nfunc (r *Reader) SealsByHeight(height uint64) ([]flow.Identifier, error)\n```\n\n```go\nfunc (r *Reader) Transaction(txID flow.Identifier) (*flow.TransactionBody, error)\n```\n\n```go\nfunc (r *Reader) TransactionsByHeight(height uint64) ([]flow.Identifier, error)\n```\n\n```go\nfunc (r *Reader) Values(height uint64, regs flow.RegisterIDs) ([]flow.RegisterValue, error)\n```\n\n```go\ntype RecordHolder struct {\n\tRecordFunc func(blockID flow.Identifier) (*uploader.BlockData, error)\n}\n```\n\n```go\nfunc BaselineRecordHolder(t *testing.T) *RecordHolder\n```\n\n```go\nfunc (r *RecordHolder) Record(blockID flow.Identifier) (*uploader.BlockData, error)\n```\n\n```go\ntype RecordStreamer struct {\n\tNextFunc func() (*uploader.BlockData, error)\n}\n```\n\n```go\nfunc BaselineRecordStreamer(t *testing.T) *RecordStreamer\n```\n\n```go\nfunc (r *RecordStreamer) Next() (*uploader.BlockData, error)\n```\n\n```go\ntype VirtualMachine struct {\n\tNewExecutorFunc func(\n\t\tfvm.Context,\n\t\tfvm.Procedure,\n\t\tstorage.TransactionPreparer,\n\t) fvm.ProcedureExecutor\n\n\tGetAccountFunc func(\n\t\tctx fvm.Context,\n\t\taddress flow.Address,\n\t\tv snapshot.StorageSnapshot,\n\t) (\n\t\t*flow.Account,\n\t\terror,\n\t)\n\n\tRunFunc func(\n\t\tctx fvm.Context,\n\t\tproc fvm.Procedure,\n\t\tv snapshot.StorageSnapshot,\n\t) (\n\t\t*snapshot.ExecutionSnapshot,\n\t\tfvm.ProcedureOutput,\n\t\terror,\n\t)\n}\n```\n\n```go\nfunc BaselineVirtualMachine(t *testing.T) *VirtualMachine\n```\n\n```go\nfunc (v *VirtualMachine) GetAccount(\n\tctx fvm.Context,\n\taddress flow.Address,\n\tview snapshot.StorageSnapshot,\n) (\n\t*flow.Account,\n\terror,\n)\n```\n\n```go\nfunc (v *VirtualMachine) NewExecutor(\n\tctx fvm.Context,\n\tproc fvm.Procedure,\n\tpreparer storage.TransactionPreparer,\n) fvm.ProcedureExecutor\n```\n\n```go\nfunc (v *VirtualMachine) Run(\n\tctx fvm.Context,\n\tproc fvm.Procedure,\n\tview snapshot.StorageSnapshot,\n) (\n\t*snapshot.ExecutionSnapshot,\n\tfvm.ProcedureOutput,\n\terror,\n)\n```\n\n```go\ntype WALReader struct {\n\tNextFunc   func() bool\n\tErrFunc    func() error\n\tRecordFunc func() []byte\n}\n```\n\n```go\nfunc BaselineWALReader(t *testing.T) *WALReader\n```\n\n```go\nfunc (w *WALReader) Err() error\n```\n\n```go\nfunc (w *WALReader) Next() bool\n```\n\n```go\nfunc (w *WALReader) Record() []byte\n```\n\n```go\ntype Writer struct {\n\tFirstFunc        func(height uint64) error\n\tLastFunc         func(height uint64) error\n\tHeaderFunc       func(height uint64, header *flow.Header) error\n\tCommitFunc       func(height uint64, commit flow.StateCommitment) error\n\tPayloadsFunc     func(height uint64, payloads []*ledger.Payload) error\n\tRegistersFunc    func(height uint64, registers []*wal.LeafNode) error\n\tHeightFunc       func(blockID flow.Identifier, height uint64) error\n\tCollectionsFunc  func(height uint64, collections []*flow.LightCollection) error\n\tGuaranteesFunc   func(height uint64, guarantees []*flow.CollectionGuarantee) error\n\tTransactionsFunc func(height uint64, transactions []*flow.TransactionBody) error\n\tResultsFunc      func(results []*flow.TransactionResult) error\n\tEventsFunc       func(height uint64, events []flow.Event) error\n\tSealsFunc        func(height uint64, seals []*flow.Seal) error\n\tCloseFunc        func() error\n}\n```\n\n```go\nfunc BaselineWriter(t *testing.T) *Writer\n```\n\n```go\nfunc (w *Writer) Close() error\n```\n\n```go\nfunc (w *Writer) Collections(height uint64, collections []*flow.LightCollection) error\n```\n\n```go\nfunc (w *Writer) Commit(height uint64, commit flow.StateCommitment) error\n```\n\n```go\nfunc (w *Writer) Events(height uint64, events []flow.Event) error\n```\n\n```go\nfunc (w *Writer) First(height uint64) error\n```\n\n```go\nfunc (w *Writer) Guarantees(height uint64, guarantees []*flow.CollectionGuarantee) error\n```\n\n```go\nfunc (w *Writer) Header(height uint64, header *flow.Header) error\n```\n\n```go\nfunc (w *Writer) Height(blockID flow.Identifier, height uint64) error\n```\n\n```go\nfunc (w *Writer) Last(height uint64) error\n```\n\n```go\nfunc (w *Writer) Payloads(height uint64, payloads []*ledger.Payload) error\n```\n\n```go\nfunc (w *Writer) Registers(height uint64, registers []*wal.LeafNode) error\n```\n\n```go\nfunc (w *Writer) Results(results []*flow.TransactionResult) error\n```\n\n```go\nfunc (w *Writer) Seals(height uint64, seals []*flow.Seal) error\n```\n\n```go\nfunc (w *Writer) Transactions(height uint64, transactions []*flow.TransactionBody) error\n```\n\n","path":"github.com/onflow/flow-archive/testing/mocks","name":"mocks","synopsis":"","isRedistributable":true}
