wasm

package
v1.6.2 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2023 License: GPL-3.0 Imports: 55 Imported by: 0

Documentation

Index

Constants

View Source
const DummyCodeMetadataHex = "0102"

DummyCodeMetadataHex -

View Source
const VMTypeHex = "0500"

VMTypeHex -

Variables

View Source
var DNSAddresses = make(map[string]struct{})

DNSAddresses --

Functions

func CreateDeployTxData

func CreateDeployTxData(scCode string) string

CreateDeployTxData -

func CreateDeployTxDataNonPayable

func CreateDeployTxDataNonPayable(scCode string) string

CreateDeployTxDataNonPayable -

func CreateDeployTxDataWithCodeMetadata

func CreateDeployTxDataWithCodeMetadata(scCode string, codeMetadataHex string) string

CreateDeployTxDataWithCodeMetadata -

func FormatHexNumber

func FormatHexNumber(number uint64) string

FormatHexNumber -

func GetSCCode

func GetSCCode(fileName string) string

GetSCCode -

func RequireAlmostEquals

func RequireAlmostEquals(t *testing.T, expected Balance, actual Balance)

RequireAlmostEquals -

Types

type Balance

type Balance struct {
	Value *big.Int
}

Balance -

func NewBalance

func NewBalance(n int) Balance

NewBalance -

func NewBalanceBig

func NewBalanceBig(bi *big.Int) Balance

NewBalanceBig -

func (Balance) Times

func (b Balance) Times(n int) Balance

Times -

func (Balance) ToHex

func (b Balance) ToHex() string

ToHex -

type RewardsProcessor

type RewardsProcessor interface {
	ProcessRewardTransaction(rTx *rewardTx.RewardTx) error
}

RewardsProcessor -

type TestContext

type TestContext struct {
	T *testing.T

	Round uint64

	Owner        testParticipant
	Alice        testParticipant
	Bob          testParticipant
	Carol        testParticipant
	Participants []*testParticipant

	GasLimit    uint64
	GasSchedule map[string]map[string]uint64

	EpochNotifier       process.EpochNotifier
	EnableRoundsHandler process.EnableRoundsHandler
	RoundNotifier       process.RoundNotifier
	EnableEpochsHandler common.EnableEpochsHandler
	UnsignexTxHandler   process.TransactionFeeHandler
	EconomicsFee        process.FeeHandler
	LastConsumedFee     uint64
	WasmVMChangeLocker  common.Locker

	ScAddress        []byte
	ScCodeMetadata   vmcommon.CodeMetadata
	Accounts         *state.AccountsDB
	TxProcessor      process.TransactionProcessor
	ScProcessor      scrCommon.TestSmartContractProcessor
	QueryService     external.SCQueryService
	VMContainer      process.VirtualMachinesContainer
	BlockchainHook   *hooks.BlockChainHookImpl
	RewardsProcessor RewardsProcessor

	LastTxHash    []byte
	SCRForwarder  *mock.IntermediateTransactionHandlerMock
	LastSCResults []*smartContractResult.SmartContractResult
}

TestContext -

func SetupTestContext

func SetupTestContext(t *testing.T) *TestContext

SetupTestContext -

func SetupTestContextWithGasSchedule

func SetupTestContextWithGasSchedule(t *testing.T, gasSchedule map[string]map[string]uint64) *TestContext

SetupTestContextWithGasSchedule -

func SetupTestContextWithGasSchedulePath

func SetupTestContextWithGasSchedulePath(t *testing.T, gasScheduleConfigPath string) *TestContext

SetupTestContextWithGasSchedulePath -

func (*TestContext) Close

func (context *TestContext) Close()

Close closes the test context

func (*TestContext) DeploySC

func (context *TestContext) DeploySC(wasmPath string, parametersString string) error

DeploySC -

func (*TestContext) ExecuteSC

func (context *TestContext) ExecuteSC(sender *testParticipant, txData string) error

ExecuteSC -

func (*TestContext) ExecuteSCWithValue

func (context *TestContext) ExecuteSCWithValue(sender *testParticipant, txData string, value *big.Int) error

ExecuteSCWithValue -

func (*TestContext) GetAccountBalance

func (context *TestContext) GetAccountBalance(participant *testParticipant) *big.Int

GetAccountBalance -

func (*TestContext) GetAccountBalanceDelta

func (context *TestContext) GetAccountBalanceDelta(participant *testParticipant) *big.Int

GetAccountBalanceDelta -

func (*TestContext) GetCompositeTestError

func (context *TestContext) GetCompositeTestError() error

GetCompositeTestError -

func (*TestContext) GoToEpoch

func (context *TestContext) GoToEpoch(epoch int)

GoToEpoch -

func (*TestContext) InitAdditionalParticipants

func (context *TestContext) InitAdditionalParticipants(num int)

InitAdditionalParticipants -

func (*TestContext) QuerySCBigInt

func (context *TestContext) QuerySCBigInt(function string, args [][]byte) *big.Int

QuerySCBigInt -

func (*TestContext) QuerySCBytes

func (context *TestContext) QuerySCBytes(function string, args [][]byte) []byte

QuerySCBytes -

func (*TestContext) QuerySCInt

func (context *TestContext) QuerySCInt(function string, args [][]byte) uint64

QuerySCInt -

func (*TestContext) QuerySCString

func (context *TestContext) QuerySCString(function string, args [][]byte) string

QuerySCString -

func (*TestContext) TakeAccountBalanceSnapshot

func (context *TestContext) TakeAccountBalanceSnapshot(participant *testParticipant)

TakeAccountBalanceSnapshot -

func (*TestContext) UpdateLastSCResults

func (context *TestContext) UpdateLastSCResults() error

UpdateLastSCResults --

func (*TestContext) UpgradeSC

func (context *TestContext) UpgradeSC(wasmPath string, parametersString string) error

UpgradeSC -

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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