Documentation ¶
Index ¶
- Constants
- Variables
- func AggregatedPrecompiledCallsFixture(t testing.TB) types.AggregatedPrecompiledCalls
- func BlockEventToPayload(t testing.TB, event flow.Event, evmContract flow.Address) *events.BlockEventPayload
- func COAOwnershipProofFixture(t testing.TB) *types.COAOwnershipProof
- func COAOwnershipProofInContextFixture(t testing.TB) *types.COAOwnershipProofInContext
- func CheckCadenceEventTypes(t testing.TB, events []cadence.Event, expectedTypes []string)
- func ConvertToCadence(data []byte) []cadence.Value
- func DeployContract(t testing.TB, caller types.Address, tc *TestContract, led atree.Ledger, ...)
- func EncodeArgs(argValues []cadence.Value) [][]byte
- func GetRandomLogFixture(t testing.TB) *gethTypes.Log
- func LocationResolver(identifiers []ast.Identifier, location common.Location) (result []sema.ResolvedLocation, err error)
- func MakeCallData(t testing.TB, abiString string, name string, args ...interface{}) []byte
- func RandomAddress(t testing.TB) types.Address
- func RandomBigInt(limit int64) *big.Int
- func RandomCommonAddress(t testing.TB) gethCommon.Address
- func RandomCommonHash(t testing.TB) gethCommon.Hash
- func RandomData(t testing.TB) []byte
- func RandomGas(limit int64) uint64
- func RandomResultFixture(t testing.TB) *types.Result
- func RandomUint256Int(limit int64) *uint256.Int
- func RunWithDeployedContract(t testing.TB, tc *TestContract, led atree.Ledger, ...)
- func RunWithEOATestAccount(t testing.TB, led atree.Ledger, flowEVMRootAddress flow.Address, ...)
- func RunWithTestBackend(t testing.TB, f func(*TestBackend))
- func RunWithTestFlowEVMRootAddress(t testing.TB, backend atree.Ledger, f func(flow.Address))
- func TxEventToPayload(t testing.TB, event flow.Event, evmContract flow.Address) *events.TransactionEventPayload
- type EOATestAccount
- func (a *EOATestAccount) Address() types.Address
- func (a *EOATestAccount) Nonce() uint64
- func (a *EOATestAccount) PrepareAndSignTx(t testing.TB, to gethCommon.Address, data []byte, amount *big.Int, ...) *gethTypes.Transaction
- func (a *EOATestAccount) PrepareSignAndEncodeTx(t testing.TB, to gethCommon.Address, data []byte, amount *big.Int, ...) []byte
- func (a *EOATestAccount) SetNonce(nonce uint64)
- func (a *EOATestAccount) SignTx(t testing.TB, tx *gethTypes.Transaction) *gethTypes.Transaction
- type MockUploader
- type TestBackend
- func (m TestBackend) ComputationAvailable(kind common.ComputationKind, intensity uint) bool
- func (m TestBackend) ComputationIntensities() meter.MeteredComputationIntensities
- func (m TestBackend) ComputationUsed() (uint64, error)
- func (vs TestBackend) ConvertedServiceEvents() flow.ServiceEventList
- func (tb *TestBackend) DropEvents()
- func (vs TestBackend) EmitEvent(event cadence.Event) error
- func (vs TestBackend) Events() flow.EventsList
- func (t TestBackend) GenerateUUID() (uint64, error)
- func (tb *TestBackend) Get(id flow.RegisterID) (flow.RegisterValue, error)
- func (m TestBackend) InteractionUsed() (uint64, error)
- func (m TestBackend) MemoryUsed() (uint64, error)
- func (m TestBackend) MeterComputation(kind common.ComputationKind, intensity uint) error
- func (m TestBackend) MeterEmittedEvent(byteSize uint64) error
- func (m TestBackend) MeterMemory(usage common.MemoryUsage) error
- func (vs TestBackend) Reset()
- func (vs TestBackend) ServiceEvents() flow.EventsList
- func (m TestBackend) TotalEmittedEventBytes() uint64
- func (tb *TestBackend) TotalStorageSize() int
- type TestBlockInfo
- type TestContract
- type TestContractFunctionInvoker
- type TestEmulator
- func (em *TestEmulator) BalanceOf(address types.Address) (*big.Int, error)
- func (em *TestEmulator) BatchRunTransactions(txs []*gethTypes.Transaction) ([]*types.Result, error)
- func (em *TestEmulator) CodeHashOf(address types.Address) ([]byte, error)
- func (em *TestEmulator) CodeOf(address types.Address) (types.Code, error)
- func (em *TestEmulator) DirectCall(call *types.DirectCall) (*types.Result, error)
- func (em *TestEmulator) DryRunTransaction(tx *gethTypes.Transaction, address gethCommon.Address) (*types.Result, error)
- func (em *TestEmulator) NewBlockView(_ types.BlockContext) (types.BlockView, error)
- func (em *TestEmulator) NewReadOnlyBlockView(_ types.BlockContext) (types.ReadOnlyBlockView, error)
- func (em *TestEmulator) NonceOf(address types.Address) (uint64, error)
- func (em *TestEmulator) RunTransaction(tx *gethTypes.Transaction) (*types.Result, error)
- type TestMetricsReporter
- type TestRandomGenerator
- type TestTracer
- type TestValueStore
- func (vs *TestValueStore) AllocateStorageIndex(owner []byte) (atree.StorageIndex, error)
- func (vs *TestValueStore) GetValue(owner, key []byte) ([]byte, error)
- func (vs *TestValueStore) ResetStats()
- func (vs *TestValueStore) SetValue(owner, key, value []byte) error
- func (vs *TestValueStore) TotalBytesRead() int
- func (vs *TestValueStore) TotalBytesWritten() int
- func (vs *TestValueStore) TotalStorageItems() int
- func (vs *TestValueStore) TotalStorageSize() int
- func (vs *TestValueStore) ValueExists(owner, key []byte) (bool, error)
Constants ¶
const EOATestAccount1KeyHex = "9c647b8b7c4e7c3490668fb6c11473619db80c93704c70893d3813af4090c39c"
address: 658bdf435d810c91414ec09147daa6db62406379
Variables ¶
var TestComputationLimit = uint(100_000_000)
var TestFlowEVMRootAddress = flow.Address{1, 2, 3, 4}
Functions ¶
func AggregatedPrecompiledCallsFixture ¶ added in v0.36.3
func AggregatedPrecompiledCallsFixture(t testing.TB) types.AggregatedPrecompiledCalls
func BlockEventToPayload ¶ added in v0.36.2
func COAOwnershipProofFixture ¶ added in v0.33.30
func COAOwnershipProofFixture(t testing.TB) *types.COAOwnershipProof
func COAOwnershipProofInContextFixture ¶ added in v0.33.30
func COAOwnershipProofInContextFixture(t testing.TB) *types.COAOwnershipProofInContext
func CheckCadenceEventTypes ¶ added in v0.33.30
func ConvertToCadence ¶
func DeployContract ¶
func EncodeArgs ¶
func LocationResolver ¶ added in v0.33.30
func LocationResolver( identifiers []ast.Identifier, location common.Location, ) ( result []sema.ResolvedLocation, err error, )
LocationResolver is a location Cadence runtime interface location resolver very similar to ContractReader.ResolveLocation, but it does not look up available contract names
func MakeCallData ¶ added in v0.33.30
func RandomBigInt ¶
func RandomCommonAddress ¶
func RandomCommonAddress(t testing.TB) gethCommon.Address
func RandomCommonHash ¶
func RandomCommonHash(t testing.TB) gethCommon.Hash
func RandomData ¶
func RandomUint256Int ¶ added in v0.36.2
func RunWithDeployedContract ¶
func RunWithDeployedContract(t testing.TB, tc *TestContract, led atree.Ledger, flowEVMRootAddress flow.Address, f func(*TestContract))
func RunWithEOATestAccount ¶
func RunWithTestBackend ¶
func RunWithTestBackend(t testing.TB, f func(*TestBackend))
func TxEventToPayload ¶ added in v0.36.2
Types ¶
type EOATestAccount ¶
type EOATestAccount struct {
// contains filtered or unexported fields
}
func GetTestEOAAccount ¶
func GetTestEOAAccount(t testing.TB, keyHex string) *EOATestAccount
func (*EOATestAccount) Address ¶
func (a *EOATestAccount) Address() types.Address
func (*EOATestAccount) Nonce ¶ added in v0.33.30
func (a *EOATestAccount) Nonce() uint64
func (*EOATestAccount) PrepareAndSignTx ¶
func (a *EOATestAccount) PrepareAndSignTx( t testing.TB, to gethCommon.Address, data []byte, amount *big.Int, gasLimit uint64, gasPrice *big.Int, ) *gethTypes.Transaction
func (*EOATestAccount) PrepareSignAndEncodeTx ¶
func (*EOATestAccount) SetNonce ¶
func (a *EOATestAccount) SetNonce(nonce uint64)
func (*EOATestAccount) SignTx ¶
func (a *EOATestAccount) SignTx( t testing.TB, tx *gethTypes.Transaction, ) *gethTypes.Transaction
type MockUploader ¶ added in v0.33.30
type MockUploader struct {
UploadFunc func(string, json.RawMessage) error
}
func (MockUploader) Upload ¶ added in v0.33.30
func (m MockUploader) Upload(id string, data json.RawMessage) error
type TestBackend ¶
type TestBackend struct { *TestValueStore *TestBlockInfo *TestRandomGenerator *TestContractFunctionInvoker *TestTracer *TestMetricsReporter // contains filtered or unexported fields }
func (TestBackend) ComputationAvailable ¶
func (m TestBackend) ComputationAvailable( kind common.ComputationKind, intensity uint, ) bool
func (TestBackend) ComputationIntensities ¶
func (m TestBackend) ComputationIntensities() meter.MeteredComputationIntensities
func (TestBackend) ComputationUsed ¶
func (TestBackend) ConvertedServiceEvents ¶
func (vs TestBackend) ConvertedServiceEvents() flow.ServiceEventList
func (*TestBackend) DropEvents ¶
func (tb *TestBackend) DropEvents()
func (TestBackend) Events ¶
func (vs TestBackend) Events() flow.EventsList
func (TestBackend) GenerateUUID ¶ added in v0.33.30
func (*TestBackend) Get ¶ added in v0.33.30
func (tb *TestBackend) Get(id flow.RegisterID) (flow.RegisterValue, error)
func (TestBackend) InteractionUsed ¶
func (TestBackend) MemoryUsed ¶
func (TestBackend) MeterComputation ¶
func (m TestBackend) MeterComputation( kind common.ComputationKind, intensity uint, ) error
func (TestBackend) MeterEmittedEvent ¶
func (TestBackend) MeterMemory ¶
func (m TestBackend) MeterMemory(usage common.MemoryUsage) error
func (TestBackend) ServiceEvents ¶
func (vs TestBackend) ServiceEvents() flow.EventsList
func (TestBackend) TotalEmittedEventBytes ¶
func (m TestBackend) TotalEmittedEventBytes() uint64
func (*TestBackend) TotalStorageSize ¶
func (tb *TestBackend) TotalStorageSize() int
type TestBlockInfo ¶ added in v0.33.30
type TestBlockInfo struct { GetCurrentBlockHeightFunc func() (uint64, error) GetBlockAtHeightFunc func(height uint64) (runtime.Block, bool, error) }
func (*TestBlockInfo) GetBlockAtHeight ¶ added in v0.33.30
GetBlockAtHeight returns the block at the given height.
func (*TestBlockInfo) GetCurrentBlockHeight ¶ added in v0.33.30
func (tb *TestBlockInfo) GetCurrentBlockHeight() (uint64, error)
GetCurrentBlockHeight returns the current block height.
type TestContract ¶
func GetDummyKittyTestContract ¶
func GetDummyKittyTestContract(t testing.TB) *TestContract
func GetFactoryTestContract ¶ added in v0.37.1
func GetFactoryTestContract(t testing.TB) *TestContract
func GetProxyContract ¶ added in v0.37.1
func GetProxyContract(t testing.TB) *TestContract
func GetStorageTestContract ¶
func GetStorageTestContract(tb testing.TB) *TestContract
func (*TestContract) MakeCallData ¶
func (tc *TestContract) MakeCallData(t testing.TB, name string, args ...interface{}) []byte
func (*TestContract) SetDeployedAt ¶
func (tc *TestContract) SetDeployedAt(deployedAt types.Address)
type TestContractFunctionInvoker ¶ added in v0.33.30
type TestContractFunctionInvoker struct { InvokeFunc func( spec environment.ContractFunctionSpec, arguments []cadence.Value, ) ( cadence.Value, error, ) }
func (*TestContractFunctionInvoker) Invoke ¶ added in v0.33.30
func (t *TestContractFunctionInvoker) Invoke( spec environment.ContractFunctionSpec, arguments []cadence.Value, ) ( cadence.Value, error, )
type TestEmulator ¶
type TestEmulator struct { BalanceOfFunc func(address types.Address) (*big.Int, error) NonceOfFunc func(address types.Address) (uint64, error) CodeOfFunc func(address types.Address) (types.Code, error) CodeHashOfFunc func(address types.Address) ([]byte, error) DirectCallFunc func(call *types.DirectCall) (*types.Result, error) RunTransactionFunc func(tx *gethTypes.Transaction) (*types.Result, error) DryRunTransactionFunc func(tx *gethTypes.Transaction, address gethCommon.Address) (*types.Result, error) BatchRunTransactionFunc func(txs []*gethTypes.Transaction) ([]*types.Result, error) }
func (*TestEmulator) BatchRunTransactions ¶ added in v0.33.30
func (em *TestEmulator) BatchRunTransactions(txs []*gethTypes.Transaction) ([]*types.Result, error)
BatchRunTransactions batch runs transactions and collect gas fees to the coinbase account
func (*TestEmulator) CodeHashOf ¶ added in v0.33.30
func (em *TestEmulator) CodeHashOf(address types.Address) ([]byte, error)
CodeHashOf returns the code hash for this address
func (*TestEmulator) DirectCall ¶
func (em *TestEmulator) DirectCall(call *types.DirectCall) (*types.Result, error)
DirectCall executes a direct call
func (*TestEmulator) DryRunTransaction ¶ added in v0.33.30
func (em *TestEmulator) DryRunTransaction(tx *gethTypes.Transaction, address gethCommon.Address) (*types.Result, error)
DryRunTransaction simulates transaction execution
func (*TestEmulator) NewBlockView ¶
func (em *TestEmulator) NewBlockView(_ types.BlockContext) (types.BlockView, error)
NewBlock returns a new block
func (*TestEmulator) NewReadOnlyBlockView ¶
func (em *TestEmulator) NewReadOnlyBlockView(_ types.BlockContext) (types.ReadOnlyBlockView, error)
NewBlock returns a new block view
func (*TestEmulator) NonceOf ¶
func (em *TestEmulator) NonceOf(address types.Address) (uint64, error)
NonceOfFunc returns the nonce for this address
func (*TestEmulator) RunTransaction ¶
func (em *TestEmulator) RunTransaction(tx *gethTypes.Transaction) (*types.Result, error)
RunTransaction runs a transaction and collect gas fees to the coinbase account
type TestMetricsReporter ¶ added in v0.36.3
type TestMetricsReporter struct { SetNumberOfDeployedCOAsFunc func(uint64) EVMTransactionExecutedFunc func(uint64, bool, bool) EVMBlockExecutedFunc func(int, uint64, float64) }
func (*TestMetricsReporter) EVMBlockExecuted ¶ added in v0.36.3
func (tmr *TestMetricsReporter) EVMBlockExecuted(txCount int, totalGasUsed uint64, totalSupplyInFlow float64)
func (*TestMetricsReporter) EVMTransactionExecuted ¶ added in v0.36.3
func (tmr *TestMetricsReporter) EVMTransactionExecuted(gasUsed uint64, isDirectCall bool, failed bool)
func (*TestMetricsReporter) SetNumberOfDeployedCOAs ¶ added in v0.36.3
func (tmr *TestMetricsReporter) SetNumberOfDeployedCOAs(count uint64)
type TestRandomGenerator ¶ added in v0.33.30
func (*TestRandomGenerator) ReadRandom ¶ added in v0.33.30
func (t *TestRandomGenerator) ReadRandom(buffer []byte) error
type TestTracer ¶ added in v0.35.17
type TestTracer struct {
StartChildSpanFunc func(trace.SpanName, ...otelTrace.SpanStartOption) tracing.TracerSpan
}
func (*TestTracer) ExpectedSpan ¶ added in v0.35.17
func (tt *TestTracer) ExpectedSpan(t *testing.T, expected trace.SpanName)
func (*TestTracer) StartChildSpan ¶ added in v0.35.17
func (tt *TestTracer) StartChildSpan( name trace.SpanName, options ...otelTrace.SpanStartOption, ) tracing.TracerSpan
type TestValueStore ¶
type TestValueStore struct { GetValueFunc func(owner, key []byte) ([]byte, error) SetValueFunc func(owner, key, value []byte) error ValueExistsFunc func(owner, key []byte) (bool, error) AllocateStorageIndexFunc func(owner []byte) (atree.StorageIndex, error) TotalStorageSizeFunc func() int TotalBytesReadFunc func() int TotalBytesWrittenFunc func() int TotalStorageItemsFunc func() int ResetStatsFunc func() }
func GetSimpleValueStore ¶
func GetSimpleValueStore() *TestValueStore
func (*TestValueStore) AllocateStorageIndex ¶
func (vs *TestValueStore) AllocateStorageIndex(owner []byte) (atree.StorageIndex, error)
func (*TestValueStore) GetValue ¶
func (vs *TestValueStore) GetValue(owner, key []byte) ([]byte, error)
func (*TestValueStore) ResetStats ¶
func (vs *TestValueStore) ResetStats()
func (*TestValueStore) SetValue ¶
func (vs *TestValueStore) SetValue(owner, key, value []byte) error
func (*TestValueStore) TotalBytesRead ¶
func (vs *TestValueStore) TotalBytesRead() int
func (*TestValueStore) TotalBytesWritten ¶
func (vs *TestValueStore) TotalBytesWritten() int
func (*TestValueStore) TotalStorageItems ¶
func (vs *TestValueStore) TotalStorageItems() int
func (*TestValueStore) TotalStorageSize ¶
func (vs *TestValueStore) TotalStorageSize() int
func (*TestValueStore) ValueExists ¶
func (vs *TestValueStore) ValueExists(owner, key []byte) (bool, error)