Documentation
¶
Index ¶
- Variables
- func ByteSlice(v interface{}) []byte
- func GenericAddress(index int) flow.Address
- func GenericAddresses(number int) []flow.Address
- func GenericAmount(delta int) cadence.Value
- func GenericBlockIDs(number int) []flow.Identifier
- func GenericCadenceEvent(index int) cadence.Event
- func GenericCadenceEventType(index int) *cadence.EventType
- func GenericCadenceEventTypes(number int) []*cadence.EventType
- func GenericCadenceEvents(number int) []cadence.Event
- func GenericCollection(index int) *flow.LightCollection
- func GenericCollectionIDs(number int) []flow.Identifier
- func GenericCollections(number int) []*flow.LightCollection
- func GenericCommit(index int) flow.StateCommitment
- func GenericCommits(number int) []flow.StateCommitment
- func GenericEvent(index int) flow.Event
- func GenericEventType(index int) flow.EventType
- func GenericEventTypes(number int) []flow.EventType
- func GenericEvents(number int, types ...flow.EventType) []flow.Event
- func GenericGuarantee(index int) *flow.CollectionGuarantee
- func GenericGuarantees(number int) []*flow.CollectionGuarantee
- func GenericLedgerPath(index int) ledger.Path
- func GenericLedgerPaths(number int) []ledger.Path
- func GenericLedgerPayload(index int) *ledger.Payload
- func GenericLedgerPayloads(number int) []*ledger.Payload
- func GenericRecord() *uploader.BlockData
- func GenericRegister(index int) flow.RegisterID
- func GenericRegisterEntries(number int) flow.RegisterEntries
- func GenericRegisterEntry(index int) flow.RegisterEntry
- func GenericRegisterValue(index int) flow.RegisterValue
- func GenericRegisterValues(number int) []flow.RegisterValue
- func GenericRegisters(number int) flow.RegisterIDs
- func GenericResult(index int) *flow.TransactionResult
- func GenericResults(number int) []*flow.TransactionResult
- func GenericSeal(index int) *flow.Seal
- func GenericSealIDs(number int) []flow.Identifier
- func GenericSeals(number int) []*flow.Seal
- func GenericTransaction(index int) *flow.TransactionBody
- func GenericTransactionIDs(number int) []flow.Identifier
- func GenericTransactions(number int) []*flow.TransactionBody
- func GenericTrieUpdate(index int) *ledger.TrieUpdate
- func GenericTrieUpdates(number int) []*ledger.TrieUpdate
- type Cache
- type Chain
- func (c *Chain) Collections(height uint64) ([]*flow.LightCollection, error)
- func (c *Chain) Commit(height uint64) (flow.StateCommitment, error)
- func (c *Chain) Events(height uint64) ([]flow.Event, error)
- func (c *Chain) Guarantees(height uint64) ([]*flow.CollectionGuarantee, error)
- func (c *Chain) Header(height uint64) (*flow.Header, error)
- func (c *Chain) Results(height uint64) ([]*flow.TransactionResult, error)
- func (c *Chain) Root() (uint64, error)
- func (c *Chain) Seals(height uint64) ([]*flow.Seal, error)
- func (c *Chain) Transactions(height uint64) ([]*flow.TransactionBody, error)
- type Codec
- func (c *Codec) Compress(data []byte) ([]byte, error)
- func (c *Codec) Decode(data []byte, value interface{}) error
- func (c *Codec) Decompress(data []byte) ([]byte, error)
- func (c *Codec) Encode(value interface{}) ([]byte, error)
- func (c *Codec) Marshal(v interface{}) ([]byte, error)
- func (c *Codec) Unmarshal(b []byte, v interface{}) error
- type Invoker
- type Parser
- type Reader
- func (r *Reader) Collection(collID flow.Identifier) (*flow.LightCollection, error)
- func (r *Reader) CollectionsByHeight(height uint64) ([]flow.Identifier, error)
- func (r *Reader) Commit(height uint64) (flow.StateCommitment, error)
- func (r *Reader) Events(height uint64, types ...flow.EventType) ([]flow.Event, error)
- func (r *Reader) First() (uint64, error)
- func (r *Reader) Guarantee(collID flow.Identifier) (*flow.CollectionGuarantee, error)
- func (r *Reader) Header(height uint64) (*flow.Header, error)
- func (r *Reader) HeightForBlock(blockID flow.Identifier) (uint64, error)
- func (r *Reader) HeightForTransaction(txID flow.Identifier) (uint64, error)
- func (r *Reader) Last() (uint64, error)
- func (r *Reader) LatestRegisterHeight() (uint64, error)
- func (r *Reader) Result(txID flow.Identifier) (*flow.TransactionResult, error)
- func (r *Reader) Seal(sealID flow.Identifier) (*flow.Seal, error)
- func (r *Reader) SealsByHeight(height uint64) ([]flow.Identifier, error)
- func (r *Reader) Transaction(txID flow.Identifier) (*flow.TransactionBody, error)
- func (r *Reader) TransactionsByHeight(height uint64) ([]flow.Identifier, error)
- func (r *Reader) Values(height uint64, regs flow.RegisterIDs) ([]flow.RegisterValue, error)
- type RecordHolder
- type RecordStreamer
- type VirtualMachine
- func (v *VirtualMachine) GetAccount(ctx fvm.Context, address flow.Address, view snapshot.StorageSnapshot) (*flow.Account, error)
- func (v *VirtualMachine) NewExecutor(ctx fvm.Context, proc fvm.Procedure, preparer storage.TransactionPreparer) fvm.ProcedureExecutor
- func (v *VirtualMachine) Run(ctx fvm.Context, proc fvm.Procedure, view snapshot.StorageSnapshot) (*snapshot.ExecutionSnapshot, fvm.ProcedureOutput, error)
- type WALReader
- type Writer
- func (w *Writer) Close() error
- func (w *Writer) Collections(height uint64, collections []*flow.LightCollection) error
- func (w *Writer) Commit(height uint64, commit flow.StateCommitment) error
- func (w *Writer) Events(height uint64, events []flow.Event) error
- func (w *Writer) First(height uint64) error
- func (w *Writer) Guarantees(height uint64, guarantees []*flow.CollectionGuarantee) error
- func (w *Writer) Header(height uint64, header *flow.Header) error
- func (w *Writer) Height(blockID flow.Identifier, height uint64) error
- func (w *Writer) Last(height uint64) error
- func (w *Writer) LatestRegisterHeight(height uint64) error
- func (w *Writer) Payloads(height uint64, payloads []*ledger.Payload) error
- func (w *Writer) Registers(height uint64, registers []*wal.LeafNode) error
- func (w *Writer) Results(results []*flow.TransactionResult) error
- func (w *Writer) Seals(height uint64, seals []*flow.Seal) error
- func (w *Writer) Transactions(height uint64, transactions []*flow.TransactionBody) error
Constants ¶
This section is empty.
Variables ¶
View Source
var ( NoopLogger = zerolog.New(io.Discard) GenericError = errors.New("dummy error") GenericHeight = uint64(42) GenericBytes = []byte(`test`) GenericHeader = &flow.Header{ ChainID: archive.FlowTestnet, Height: GenericHeight, ParentID: genericIdentifier(0, offsetBlock), Timestamp: time.Date(1972, 11, 12, 13, 14, 15, 16, time.UTC), } GenericBlock = &model.Block{ BlockID: GenericHeader.ID(), } GenericLedgerKey = ledger.NewKey([]ledger.KeyPart{ ledger.NewKeyPart(0, []byte(`owner`)), ledger.NewKeyPart(2, []byte(`key`)), }) // GenericRootNode Visual Representation: // 6 (root) // / \ // 3 5 // / \ \ // 1 2 4 GenericRootNode = node.NewNode( 256, node.NewNode( 256, node.NewLeaf(GenericLedgerPath(0), GenericLedgerPayload(0), 42), node.NewLeaf(GenericLedgerPath(1), GenericLedgerPayload(1), 42), GenericLedgerPath(2), GenericLedgerPayload(2), hash.DummyHash, ), node.NewNode( 256, node.NewLeaf(GenericLedgerPath(3), GenericLedgerPayload(3), 42), nil, GenericLedgerPath(4), GenericLedgerPayload(4), hash.DummyHash, ), GenericLedgerPath(5), GenericLedgerPayload(5), hash.DummyHash, ) GenericTrie, _ = trie.NewMTrie(GenericRootNode, 3, 3*32) GenericAccount = flow.Account{ Address: GenericAddress(0), Balance: 84, Keys: []flow.AccountPublicKey{ { Index: 0, SeqNumber: 42, HashAlgo: chash.SHA2_256, PublicKey: crypto.IdentityBLSPublicKey(), }, }, } )
Global variables that can be used for testing. They are non-nil valid values for the types commonly needed test DPS components.
Functions ¶
func GenericAddress ¶
func GenericAddresses ¶
func GenericAmount ¶
func GenericBlockIDs ¶
func GenericBlockIDs(number int) []flow.Identifier
func GenericCadenceEvent ¶
func GenericCadenceEventType ¶
func GenericCadenceEvents ¶
func GenericCollection ¶
func GenericCollection(index int) *flow.LightCollection
func GenericCollectionIDs ¶
func GenericCollectionIDs(number int) []flow.Identifier
func GenericCollections ¶
func GenericCollections(number int) []*flow.LightCollection
func GenericCommit ¶
func GenericCommit(index int) flow.StateCommitment
func GenericCommits ¶
func GenericCommits(number int) []flow.StateCommitment
func GenericEvent ¶
func GenericEventType ¶
func GenericEventTypes ¶
func GenericGuarantee ¶
func GenericGuarantee(index int) *flow.CollectionGuarantee
func GenericGuarantees ¶
func GenericGuarantees(number int) []*flow.CollectionGuarantee
func GenericLedgerPath ¶
func GenericLedgerPaths ¶
func GenericLedgerPayload ¶
func GenericLedgerPayloads ¶
func GenericRecord ¶
func GenericRegister ¶ added in v0.31.4
func GenericRegister(index int) flow.RegisterID
func GenericRegisterEntries ¶ added in v0.31.4
func GenericRegisterEntries(number int) flow.RegisterEntries
func GenericRegisterEntry ¶ added in v0.31.4
func GenericRegisterEntry(index int) flow.RegisterEntry
func GenericRegisterValue ¶ added in v0.31.4
func GenericRegisterValue(index int) flow.RegisterValue
func GenericRegisterValues ¶ added in v0.31.4
func GenericRegisterValues(number int) []flow.RegisterValue
func GenericRegisters ¶ added in v0.31.4
func GenericRegisters(number int) flow.RegisterIDs
func GenericResult ¶
func GenericResult(index int) *flow.TransactionResult
func GenericResults ¶
func GenericResults(number int) []*flow.TransactionResult
func GenericSeal ¶
func GenericSealIDs ¶
func GenericSealIDs(number int) []flow.Identifier
func GenericSeals ¶
func GenericTransaction ¶
func GenericTransaction(index int) *flow.TransactionBody
func GenericTransactionIDs ¶
func GenericTransactionIDs(number int) []flow.Identifier
func GenericTransactions ¶
func GenericTransactions(number int) []*flow.TransactionBody
func GenericTrieUpdate ¶
func GenericTrieUpdate(index int) *ledger.TrieUpdate
func GenericTrieUpdates ¶
func GenericTrieUpdates(number int) []*ledger.TrieUpdate
Types ¶
type Cache ¶
type Cache struct {
GetFunc func(key interface{}) (interface{}, bool)
SetFunc func(key, value interface{}, cost int64) bool
}
func BaselineCache ¶
type Chain ¶
type Chain struct {
RootFunc func() (uint64, error)
HeaderFunc func(height uint64) (*flow.Header, error)
CommitFunc func(height uint64) (flow.StateCommitment, error)
CollectionsFunc func(height uint64) ([]*flow.LightCollection, error)
GuaranteesFunc func(height uint64) ([]*flow.CollectionGuarantee, error)
TransactionsFunc func(height uint64) ([]*flow.TransactionBody, error)
ResultsFunc func(height uint64) ([]*flow.TransactionResult, error)
EventsFunc func(height uint64) ([]flow.Event, error)
SealsFunc func(height uint64) ([]*flow.Seal, error)
}
func BaselineChain ¶
func (*Chain) Collections ¶
func (c *Chain) Collections(height uint64) ([]*flow.LightCollection, error)
func (*Chain) Guarantees ¶
func (c *Chain) Guarantees(height uint64) ([]*flow.CollectionGuarantee, error)
func (*Chain) Transactions ¶
func (c *Chain) Transactions(height uint64) ([]*flow.TransactionBody, error)
type Codec ¶
type Codec struct {
EncodeFunc func(value interface{}) ([]byte, error)
DecodeFunc func(data []byte, value interface{}) error
CompressFunc func(data []byte) ([]byte, error)
DecompressFunc func(compressed []byte) ([]byte, error)
MarshalFunc func(value interface{}) ([]byte, error)
UnmarshalFunc func(compressed []byte, value interface{}) error
}
func BaselineCodec ¶
type Invoker ¶
type Invoker struct {
AccountFunc func(ctx context.Context, height uint64, address flow.Address) (*flow.Account, error)
ScriptFunc func(ctx context.Context, height uint64, script []byte, parameters [][]byte) ([]byte, error)
}
func BaselineInvoker ¶
type Parser ¶ added in v0.31.4
type Parser struct {
UpdatesFunc func() ([]*ledger.TrieUpdate, error)
}
func BaselineParser ¶ added in v0.31.4
func (*Parser) AllUpdates ¶ added in v0.31.4
func (f *Parser) AllUpdates() ([]*ledger.TrieUpdate, error)
type Reader ¶
type Reader struct {
FirstFunc func() (uint64, error)
LastFunc func() (uint64, error)
LatestRegisterHeightFunc func() (uint64, error)
HeightForBlockFunc func(blockID flow.Identifier) (uint64, error)
CommitFunc func(height uint64) (flow.StateCommitment, error)
HeaderFunc func(height uint64) (*flow.Header, error)
EventsFunc func(height uint64, types ...flow.EventType) ([]flow.Event, error)
ValuesFunc func(height uint64, regs flow.RegisterIDs) ([]flow.RegisterValue, error)
CollectionFunc func(collID flow.Identifier) (*flow.LightCollection, error)
CollectionsByHeightFunc func(height uint64) ([]flow.Identifier, error)
GuaranteeFunc func(collID flow.Identifier) (*flow.CollectionGuarantee, error)
TransactionFunc func(txID flow.Identifier) (*flow.TransactionBody, error)
HeightForTransactionFunc func(txID flow.Identifier) (uint64, error)
TransactionsByHeightFunc func(height uint64) ([]flow.Identifier, error)
ResultFunc func(txID flow.Identifier) (*flow.TransactionResult, error)
SealFunc func(sealID flow.Identifier) (*flow.Seal, error)
SealsByHeightFunc func(height uint64) ([]flow.Identifier, error)
}
func BaselineReader ¶
func (*Reader) Collection ¶
func (r *Reader) Collection(collID flow.Identifier) (*flow.LightCollection, error)
func (*Reader) CollectionsByHeight ¶
func (r *Reader) CollectionsByHeight(height uint64) ([]flow.Identifier, error)
func (*Reader) Guarantee ¶
func (r *Reader) Guarantee(collID flow.Identifier) (*flow.CollectionGuarantee, error)
func (*Reader) HeightForBlock ¶
func (r *Reader) HeightForBlock(blockID flow.Identifier) (uint64, error)
func (*Reader) HeightForTransaction ¶
func (r *Reader) HeightForTransaction(txID flow.Identifier) (uint64, error)
func (*Reader) LatestRegisterHeight ¶ added in v0.31.14
func (*Reader) Result ¶
func (r *Reader) Result(txID flow.Identifier) (*flow.TransactionResult, error)
func (*Reader) SealsByHeight ¶
func (r *Reader) SealsByHeight(height uint64) ([]flow.Identifier, error)
func (*Reader) Transaction ¶
func (r *Reader) Transaction(txID flow.Identifier) (*flow.TransactionBody, error)
func (*Reader) TransactionsByHeight ¶
func (r *Reader) TransactionsByHeight(height uint64) ([]flow.Identifier, error)
func (*Reader) Values ¶
func (r *Reader) Values(height uint64, regs flow.RegisterIDs) ([]flow.RegisterValue, error)
type RecordHolder ¶
type RecordHolder struct {
RecordFunc func(blockID flow.Identifier) (*uploader.BlockData, error)
}
func BaselineRecordHolder ¶
func BaselineRecordHolder(t *testing.T) *RecordHolder
func (*RecordHolder) Record ¶
func (r *RecordHolder) Record(blockID flow.Identifier) (*uploader.BlockData, error)
type RecordStreamer ¶
func BaselineRecordStreamer ¶
func BaselineRecordStreamer(t *testing.T) *RecordStreamer
type VirtualMachine ¶
type VirtualMachine struct {
NewExecutorFunc func(
fvm.Context,
fvm.Procedure,
storage.TransactionPreparer,
) fvm.ProcedureExecutor
GetAccountFunc func(
ctx fvm.Context,
address flow.Address,
v snapshot.StorageSnapshot,
) (
*flow.Account,
error,
)
RunFunc func(
ctx fvm.Context,
proc fvm.Procedure,
v snapshot.StorageSnapshot,
) (
*snapshot.ExecutionSnapshot,
fvm.ProcedureOutput,
error,
)
}
func BaselineVirtualMachine ¶
func BaselineVirtualMachine(t *testing.T) *VirtualMachine
func (*VirtualMachine) GetAccount ¶
func (v *VirtualMachine) GetAccount( ctx fvm.Context, address flow.Address, view snapshot.StorageSnapshot, ) ( *flow.Account, error, )
func (*VirtualMachine) NewExecutor ¶ added in v0.31.4
func (v *VirtualMachine) NewExecutor( ctx fvm.Context, proc fvm.Procedure, preparer storage.TransactionPreparer, ) fvm.ProcedureExecutor
func (*VirtualMachine) Run ¶
func (v *VirtualMachine) Run( ctx fvm.Context, proc fvm.Procedure, view snapshot.StorageSnapshot, ) ( *snapshot.ExecutionSnapshot, fvm.ProcedureOutput, error, )
type WALReader ¶
func BaselineWALReader ¶
type Writer ¶
type Writer struct {
FirstFunc func(height uint64) error
LastFunc func(height uint64) error
LatestRegisterHeightFunc func(height uint64) error
HeaderFunc func(height uint64, header *flow.Header) error
CommitFunc func(height uint64, commit flow.StateCommitment) error
PayloadsFunc func(height uint64, payloads []*ledger.Payload) error
RegistersFunc func(height uint64, registers []*wal.LeafNode) error
HeightFunc func(blockID flow.Identifier, height uint64) error
CollectionsFunc func(height uint64, collections []*flow.LightCollection) error
GuaranteesFunc func(height uint64, guarantees []*flow.CollectionGuarantee) error
TransactionsFunc func(height uint64, transactions []*flow.TransactionBody) error
ResultsFunc func(results []*flow.TransactionResult) error
EventsFunc func(height uint64, events []flow.Event) error
SealsFunc func(height uint64, seals []*flow.Seal) error
CloseFunc func() error
}
func BaselineWriter ¶
func (*Writer) Collections ¶
func (w *Writer) Collections(height uint64, collections []*flow.LightCollection) error
func (*Writer) Guarantees ¶
func (w *Writer) Guarantees(height uint64, guarantees []*flow.CollectionGuarantee) error
func (*Writer) LatestRegisterHeight ¶ added in v0.31.14
func (*Writer) Transactions ¶
func (w *Writer) Transactions(height uint64, transactions []*flow.TransactionBody) error
Click to show internal directories.
Click to hide internal directories.