Documentation ¶
Index ¶
- Constants
- func NewArgumentParser() *argumentParser
- func NewScQueryServiceDispatcher(list []process.SCQueryService) (*scQueryServiceDispatcher, error)
- func NewSmartContractProcessor(args ArgsNewSmartContractProcessor) (*scProcessor, error)
- type ArgsNewSCQueryService
- type ArgsNewSmartContractProcessor
- type SCQueryService
- type TestScProcessor
- func (tsp *TestScProcessor) CleanGasRefunded()
- func (sc TestScProcessor) DeploySmartContract(tx data.TransactionHandler, acntSnd state.UserAccountHandler) (vmcommon.ReturnCode, error)
- func (sc TestScProcessor) EpochConfirmed(epoch uint32, _ uint64)
- func (sc TestScProcessor) ExecuteBuiltInFunction(tx data.TransactionHandler, acntSnd, acntDst state.UserAccountHandler) (vmcommon.ReturnCode, error)
- func (sc TestScProcessor) ExecuteSmartContractTransaction(tx data.TransactionHandler, acntSnd, acntDst state.UserAccountHandler) (vmcommon.ReturnCode, error)
- func (sc TestScProcessor) GasScheduleChange(gasSchedule map[string]map[string]uint64)
- func (tsp *TestScProcessor) GetAllSCRs() []data.TransactionHandler
- func (tsp *TestScProcessor) GetCompositeTestError() error
- func (tsp *TestScProcessor) GetGasRemaining() uint64
- func (sc TestScProcessor) IsInterfaceNil() bool
- func (sc TestScProcessor) IsPayable(sndAddress []byte, recvAddress []byte) (bool, error)
- func (sc TestScProcessor) ProcessIfError(acntSnd state.UserAccountHandler, txHash []byte, tx data.TransactionHandler, ...) error
- func (sc TestScProcessor) ProcessSmartContractResult(scr *smartContractResult.SmartContractResult) (vmcommon.ReturnCode, error)
Constants ¶
const (
// TooMuchGasProvidedMessage is the message for the too much gas provided error
TooMuchGasProvidedMessage = "too much gas provided"
)
Variables ¶
This section is empty.
Functions ¶
func NewArgumentParser ¶ added in v1.0.133
func NewArgumentParser() *argumentParser
NewArgumentParser creates a full argument parser component
func NewScQueryServiceDispatcher ¶ added in v1.1.18
func NewScQueryServiceDispatcher(list []process.SCQueryService) (*scQueryServiceDispatcher, error)
NewScQueryServiceDispatcher returns a smart contract query service dispatcher that for each function call will forward the request towards the provided list in a round-robin fashion
func NewSmartContractProcessor ¶
func NewSmartContractProcessor(args ArgsNewSmartContractProcessor) (*scProcessor, error)
NewSmartContractProcessor creates a smart contract processor that creates and interprets VM data
Types ¶
type ArgsNewSCQueryService ¶ added in v1.1.62
type ArgsNewSCQueryService struct { VmContainer process.VirtualMachinesContainer EconomicsFee process.FeeHandler BlockChainHook process.BlockChainHookHandler BlockChain data.ChainHandler ArwenChangeLocker common.Locker Bootstrapper process.Bootstrapper AllowExternalQueriesChan chan struct{} }
ArgsNewSCQueryService defines the arguments needed for the sc query service
type ArgsNewSmartContractProcessor ¶
type ArgsNewSmartContractProcessor struct { VmContainer process.VirtualMachinesContainer ArgsParser process.ArgumentsParser Hasher hashing.Hasher Marshalizer marshal.Marshalizer AccountsDB state.AccountsAdapter BlockChainHook process.BlockChainHookHandler BuiltInFunctions vmcommon.BuiltInFunctionContainer PubkeyConv core.PubkeyConverter ShardCoordinator sharding.Coordinator ScrForwarder process.IntermediateTransactionHandler TxFeeHandler process.TransactionFeeHandler EconomicsFee process.FeeHandler TxTypeHandler process.TxTypeHandler GasHandler process.GasHandler GasSchedule core.GasScheduleNotifier TxLogsProcessor process.TransactionLogProcessor BadTxForwarder process.IntermediateTransactionHandler EnableEpochs config.EnableEpochs EpochNotifier process.EpochNotifier VMOutputCacher storage.Cacher ArwenChangeLocker common.Locker IsGenesisProcessing bool }
ArgsNewSmartContractProcessor defines the arguments needed for new smart contract processor
type SCQueryService ¶
type SCQueryService struct {
// contains filtered or unexported fields
}
SCQueryService can execute Get functions over SC to fetch stored values
func NewSCQueryService ¶
func NewSCQueryService( args ArgsNewSCQueryService, ) (*SCQueryService, error)
NewSCQueryService returns a new instance of SCQueryService
func (*SCQueryService) Close ¶ added in v1.2.0
func (service *SCQueryService) Close() error
Close closes all underlying components
func (*SCQueryService) ComputeScCallGasLimit ¶
func (service *SCQueryService) ComputeScCallGasLimit(tx *transaction.Transaction) (uint64, error)
ComputeScCallGasLimit will estimate how many gas a transaction will consume
func (*SCQueryService) ExecuteQuery ¶
ExecuteQuery returns the VMOutput resulted upon running the function on the smart contract
func (*SCQueryService) IsInterfaceNil ¶
func (service *SCQueryService) IsInterfaceNil() bool
IsInterfaceNil returns true if there is no value under the interface
type TestScProcessor ¶ added in v1.1.27
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 ¶ added in v1.1.27
func NewTestScProcessor(internalData *scProcessor) *TestScProcessor
NewTestScProcessor -
func (*TestScProcessor) CleanGasRefunded ¶ added in v1.1.27
func (tsp *TestScProcessor) CleanGasRefunded()
CleanGasRefunded cleans the gas computation handler
func (TestScProcessor) DeploySmartContract ¶ added in v1.1.27
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) EpochConfirmed ¶ added in v1.1.27
EpochConfirmed is called whenever a new epoch is confirmed
func (TestScProcessor) ExecuteBuiltInFunction ¶ added in v1.1.27
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 ¶ added in v1.1.27
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 ¶ added in v1.1.27
GasScheduleChange sets the new gas schedule where it is needed
func (*TestScProcessor) GetAllSCRs ¶ added in v1.1.27
func (tsp *TestScProcessor) GetAllSCRs() []data.TransactionHandler
GetAllSCRs returns all generated scrs
func (*TestScProcessor) GetCompositeTestError ¶ added in v1.3.19
func (tsp *TestScProcessor) GetCompositeTestError() error
GetCompositeTestError composes all errors found in the logs or by parsing the scr forwarder's contents
func (*TestScProcessor) GetGasRemaining ¶ added in v1.1.27
func (tsp *TestScProcessor) GetGasRemaining() uint64
GetGasRemaining returns the remaining gas from the last transaction
func (TestScProcessor) IsInterfaceNil ¶ added in v1.1.27
func (sc TestScProcessor) IsInterfaceNil() bool
IsInterfaceNil returns true if there is no value under the interface
func (TestScProcessor) IsPayable ¶ added in v1.1.27
IsPayable returns if address is payable, smart contract ca set to false
func (TestScProcessor) ProcessIfError ¶ added in v1.1.27
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 ¶ added in v1.1.27
func (sc TestScProcessor) ProcessSmartContractResult(scr *smartContractResult.SmartContractResult) (vmcommon.ReturnCode, error)
ProcessSmartContractResult updates the account state from the smart contract result