processorV2

package
v1.7.15 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2024 License: GPL-3.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// TooMuchGasProvidedMessage is the message for the too much gas provided error
	TooMuchGasProvidedMessage = "too much gas provided"
)

Variables

This section is empty.

Functions

func GetOriginalSenderForTx

func GetOriginalSenderForTx(tx data.TransactionHandler) []byte

GetOriginalSenderForTx obtains the original's sender address depending on transaction's type

func NewFailureContext

func NewFailureContext() *failureContext

func NewSmartContractProcessorV2

func NewSmartContractProcessorV2(args scrCommon.ArgsNewSmartContractProcessor) (*scProcessor, error)

NewSmartContractProcessorV2 creates a smart contract processor that creates and interprets VM data

Types

type TestScProcessor

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

TestScProcessor extends scProcessor and is used in tests as it exposes some functions that are not supposed to be used in production code Exported functions simplify the reproduction of edge cases

func NewTestScProcessor

func NewTestScProcessor(internalData *scProcessor) *TestScProcessor

NewTestScProcessor -

func (TestScProcessor) CheckBuiltinFunctionIsExecutable

func (sc TestScProcessor) CheckBuiltinFunctionIsExecutable(expectedBuiltinFunction string, tx data.TransactionHandler) error

CheckBuiltinFunctionIsExecutable validates the builtin function arguments and tx fields without executing it

func (*TestScProcessor) CleanGasRefunded

func (tsp *TestScProcessor) CleanGasRefunded()

CleanGasRefunded cleans the gas computation handler

func (TestScProcessor) DeploySmartContract

func (sc TestScProcessor) DeploySmartContract(tx data.TransactionHandler, acntSnd state.UserAccountHandler) (vmcommon.ReturnCode, error)

DeploySmartContract processes the transaction, than deploy the smart contract into VM, final code is saved in account

func (TestScProcessor) ExecuteBuiltInFunction

func (sc TestScProcessor) ExecuteBuiltInFunction(
	tx data.TransactionHandler,
	acntSnd, acntDst state.UserAccountHandler,
) (vmcommon.ReturnCode, error)

ExecuteBuiltInFunction processes the transaction, executes the built in function call and subsequent results

func (TestScProcessor) ExecuteSmartContractTransaction

func (sc TestScProcessor) ExecuteSmartContractTransaction(
	tx data.TransactionHandler,
	acntSnd, acntDst state.UserAccountHandler,
) (vmcommon.ReturnCode, error)

ExecuteSmartContractTransaction processes the transaction, call the VM and processes the SC call output

func (TestScProcessor) GasScheduleChange

func (sc TestScProcessor) GasScheduleChange(gasSchedule map[string]map[string]uint64)

GasScheduleChange sets the new gas schedule where it is needed Warning: do not use flags in this function as it will raise backward compatibility issues because the GasScheduleChange is not called on each epoch change

func (*TestScProcessor) GetAllSCRs

func (tsp *TestScProcessor) GetAllSCRs() []data.TransactionHandler

GetAllSCRs returns all generated scrs

func (*TestScProcessor) GetCompositeTestError

func (tsp *TestScProcessor) GetCompositeTestError() error

GetCompositeTestError composes all errors found in the logs or by parsing the scr forwarder's contents

func (*TestScProcessor) GetGasRemaining

func (tsp *TestScProcessor) GetGasRemaining() uint64

GetGasRemaining returns the remaining gas from the last transaction

func (TestScProcessor) GetScrForwarder

func (sc TestScProcessor) GetScrForwarder() process.IntermediateTransactionHandler

GetScrForwarder is a getter for scrForwarder

func (TestScProcessor) GetTxLogsProcessor

func (sc TestScProcessor) GetTxLogsProcessor() process.TransactionLogProcessor

GetTxLogsProcessor is a getter for txLogsProcessor

func (TestScProcessor) IsInterfaceNil

func (sc TestScProcessor) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (TestScProcessor) IsPayable

func (sc TestScProcessor) IsPayable(sndAddress []byte, recvAddress []byte) (bool, error)

IsPayable returns if address is payable, smart contract ca set to false

func (TestScProcessor) ProcessIfError

func (sc TestScProcessor) ProcessIfError(
	acntSnd state.UserAccountHandler,
	txHash []byte,
	tx data.TransactionHandler,
	returnCode string,
	returnMessage []byte,
	snapshot int,
	gasLocked uint64,
) error

ProcessIfError creates a smart contract result, consumes the gas and returns the value to the user

func (TestScProcessor) ProcessSmartContractResult

func (sc TestScProcessor) ProcessSmartContractResult(scr *smartContractResult.SmartContractResult) (vmcommon.ReturnCode, error)

ProcessSmartContractResult updates the account state from the smart contract result

type VMOutputAccountsProcessor

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

VMOutputAccountsProcessor will process the VMOutput from a regular of builtin function call

func NewVMOutputAccountsProcessor

func NewVMOutputAccountsProcessor(
	sc *scProcessor,
	vmInput *vmcommon.VMInput,
	vmOutput *vmcommon.VMOutput,
	tx data.TransactionHandler,
	txHash []byte) *VMOutputAccountsProcessor

NewVMOutputAccountsProcessor creates a new VMOutputProcessor instance.

func (*VMOutputAccountsProcessor) Run

Run runs the configured processing steps on vm output

Jump to

Keyboard shortcuts

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