vm

package
v1.1.5 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2020 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// InsufficientGasLimit defined constant for return message
	InsufficientGasLimit = "insufficient gas limit"
	// StakeNotEnabled defined constant for return message
	StakeNotEnabled = "stake is not enabled"
	// UnBondNotEnabled defined constant for return message
	UnBondNotEnabled = "unBond is not enabled"
	// UnStakeNotEnabled defined constant for return message
	UnStakeNotEnabled = "unStake is not enabled"
	// TransactionValueMustBeZero defined constant for return message
	TransactionValueMustBeZero = "transaction value must be zero"
	// CannotGetOrCreateRegistrationData defined constant for return message
	CannotGetOrCreateRegistrationData = "cannot get or create registration data: error - "
	// CannotGetAllBlsKeysFromRegistrationData defined constant for return message
	CannotGetAllBlsKeysFromRegistrationData = "could not get all blsKeys from registration data: error - "
)

Variables

View Source
var AuctionSCAddress = []byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 255, 255}

AuctionSCAddress is the hard-coded address for auction smart contract

View Source
var ESDTSCAddress = []byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 255, 255}

ESDTSCAddress is the hard-coded address for esdt issuing smart contract

View Source
var EndOfEpochAddress = []byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255}

EndOfEpochAddress is the hard-coded address which can call system smart contract functions at end of epoch

View Source
var ErrBLSPublicKeyAlreadyJailed = errors.New("bls public key already jailed")

ErrBLSPublicKeyAlreadyJailed signals that bls public key was already jailed

View Source
var ErrBLSPublicKeyMismatch = errors.New("public key mismatch")

ErrBLSPublicKeyMismatch signals that public keys do not match

View Source
var ErrBLSPublicKeyMissmatch = errors.New("public key missmatch")

ErrBLSPublicKeyMissmatch signals that public keys do not match

View Source
var ErrElementNotFound = errors.New("element was not found")

ErrElementNotFound signals that element was not found

View Source
var ErrEmptyStorage = errors.New("storage is nil for given key")

ErrEmptyStorage signals that the storage is empty for given key

View Source
var ErrIncorrectConfig = errors.New("config incorrect")

ErrIncorrectConfig signals that auction config is incorrect

View Source
var ErrInputArgsIsNil = errors.New("input system smart contract arguments are nil")

ErrInputArgsIsNil signals that input arguments are nil for system smart contract

View Source
var ErrInputCallValueIsNil = errors.New("input value for system smart contract is nil")

ErrInputCallValueIsNil signals that input call value is nil for system smart contract

View Source
var ErrInputCallerAddrIsNil = errors.New("input called address for system smart contract is nil")

ErrInputCallerAddrIsNil signals that input caller address is nil for system smart contract

View Source
var ErrInputFunctionIsNil = errors.New("input function for system smart contract is nil")

ErrInputFunctionIsNil signals that input function is nil for system smart contract

View Source
var ErrInputRecipientAddrIsNil = errors.New("input recipient address for system smart contract is nil")

ErrInputRecipientAddrIsNil signals that input recipient address for system smart contract is nil

View Source
var ErrInvalidArgument = errors.New("invalid argument")

ErrInvalidArgument signals that invalid argument has been provided

View Source
var ErrInvalidBaseIssuingCost = errors.New("invalid base issuing cost")

ErrInvalidBaseIssuingCost signals that invalid base issuing cost has been provided

View Source
var ErrInvalidEndOfEpochAccessAddress = errors.New("invalid end of epoch access address")

ErrInvalidEndOfEpochAccessAddress signals that end of epoch access address is invalid

View Source
var ErrInvalidGenesisTotalSupply = errors.New("invalid genesis total supply cost")

ErrInvalidGenesisTotalSupply signals that provided genesis total supply is invalid

View Source
var ErrInvalidJailAccessAddress = errors.New("invalid jailing access address")

ErrInvalidJailAccessAddress signals that invalid jailing access address was provided

View Source
var ErrInvalidMaxNumberOfNodes = errors.New("invalid number of max number of nodes")

ErrInvalidMaxNumberOfNodes signals that invalid number of max number of nodes has been provided

View Source
var ErrInvalidMinNumberOfNodes = errors.New("invalid min number of nodes")

ErrInvalidMinNumberOfNodes signals that provided minimum number of nodes is invalid

View Source
var ErrInvalidMinStakeValue = errors.New("invalid min stake value")

ErrInvalidMinStakeValue signals that an invalid min stake value was provided

View Source
var ErrInvalidMinStepValue = errors.New("invalid min step value")

ErrInvalidMinStepValue signals that an invalid min step value was provided

View Source
var ErrInvalidNodePrice = errors.New("invalid node price")

ErrInvalidNodePrice signals that an invalid node price was provided

View Source
var ErrInvalidNumOfArguments = errors.New("invalid number of arguments")

ErrInvalidNumOfArguments signals that invalid number of arguments has been provided

View Source
var ErrInvalidStakingAccessAddress = errors.New("invalid staking access address")

ErrInvalidStakingAccessAddress signals that invalid staking access address was provided

View Source
var ErrInvalidStartEndVoteNonce = errors.New("invalid start/end vote nonce")

ErrInvalidStartEndVoteNonce signals that invalid arguments where passed for start or end vote nonce

View Source
var ErrInvalidUnJailCost = errors.New("invalid unjail cost")

ErrInvalidUnJailCost signals that provided unjail cost is invalid

View Source
var ErrInvalidWaitingList = errors.New("invalid waiting list")

ErrInvalidWaitingList signals that waiting list is invalid

View Source
var ErrKeyAlreadyRegistered = errors.New("bls key already registered")

ErrKeyAlreadyRegistered signals that bls key is already registered

View Source
var ErrNegativeBleedPercentagePerRound = errors.New("negative bleed percentage per round")

ErrNegativeBleedPercentagePerRound signals that negative bleed percentage per round has been provided

View Source
var ErrNegativeInitialStakeValue = errors.New("initial stake value is negative")

ErrNegativeInitialStakeValue signals that a negative initial stake value was provided

View Source
var ErrNegativeMaximumPercentageToBleed = errors.New("negative maximum percentage to bleed")

ErrNegativeMaximumPercentageToBleed signals that negative maximum percentage to bleed has been provided

View Source
var ErrNegativeOrZeroInitialSupply = errors.New("negative initial supply was provided")

ErrNegativeOrZeroInitialSupply signals that negative initial supply has been provided

View Source
var ErrNegativeWaitingNodesPercentage = errors.New("negative waiting nodes percentage")

ErrNegativeWaitingNodesPercentage signals that negative waiting nodes percentage was provided

View Source
var ErrNilArgumentsParser = errors.New("nil arguments parser")

ErrNilArgumentsParser signals that arguments parses is nil

View Source
var ErrNilAuctionSmartContractAddress = errors.New("nil auction smart contract address")

ErrNilAuctionSmartContractAddress signals that auction smart contract address is nil

View Source
var ErrNilBlockchainHook = errors.New("blockchain hook is nil")

ErrNilBlockchainHook signals that blockchain hook is nil

View Source
var ErrNilChanceComputer = errors.New("nil chance computer")

ErrNilChanceComputer signals that nil chance computer has been provided

View Source
var ErrNilCryptoHook = errors.New("crypto hook is nil")

ErrNilCryptoHook signals that crypto hook is nil

View Source
var ErrNilEconomicsData = errors.New("nil economics data")

ErrNilEconomicsData signals that nil economics data has been provided

View Source
var ErrNilEpochNotifier = errors.New("nil EpochNotifier")

ErrNilEpochNotifier signals that the provided EpochNotifier is nil

View Source
var ErrNilHasher = errors.New("nil Hasher")

ErrNilHasher signals that an operation has been attempted to or with a nil hasher implementation

View Source
var ErrNilKeyGenerator = errors.New("nil key generator")

ErrNilKeyGenerator signals that key generator is nil

View Source
var ErrNilMarshalizer = errors.New("nil Marshalizer")

ErrNilMarshalizer signals that an operation has been attempted to or with a nil Marshalizer implementation

View Source
var ErrNilMessageSignVerifier = errors.New("nil message sign verifier")

ErrNilMessageSignVerifier signals that message sign verifier is nil

View Source
var ErrNilNodesConfigProvider = errors.New("nil nodes config provider")

ErrNilNodesConfigProvider signals that an operation has been attempted to or with a nil nodes config provider

View Source
var ErrNilOrEmptyKey = errors.New("nil or empty key")

ErrNilOrEmptyKey signals that key is nil or empty

View Source
var ErrNilPublicKey = errors.New("nil public key")

ErrNilPublicKey signals that nil public key has been provided

View Source
var ErrNilStakingSmartContractAddress = errors.New("nil staking smart contract address")

ErrNilStakingSmartContractAddress signals that staking smart contract address is nil

View Source
var ErrNilSystemContractsContainer = errors.New("system contract container is nil")

ErrNilSystemContractsContainer signals that the provided system contract container is nil

View Source
var ErrNilSystemEnvironmentInterface = errors.New("system environment interface is nil")

ErrNilSystemEnvironmentInterface signals that a nil system environment interface was provided

View Source
var ErrNilSystemSCConfig = errors.New("nil system sc config")

ErrNilSystemSCConfig signals that nil system sc config was provided

View Source
var ErrNilVMType = errors.New("vm type is nil")

ErrNilVMType signals that the provided vm type is nil

View Source
var ErrNilValidatorAccountsDB = errors.New("nil validator accounts DB")

ErrNilValidatorAccountsDB signals that nil validator accounts DB was provided

View Source
var ErrNoTokenWithGivenName = errors.New("no token with given name")

ErrNoTokenWithGivenName signals that token does not exists with given name

View Source
var ErrNotEnoughArgumentsToStake = errors.New("not enough arguments to stake")

ErrNotEnoughArgumentsToStake signals that the arguments provided are not enough

View Source
var ErrNotEnoughGas = errors.New("not enough gas")

ErrNotEnoughGas signals that there is not enough gas for execution

View Source
var ErrNotEnoughQualifiedNodes = errors.New("not enough qualified nodes")

ErrNotEnoughQualifiedNodes signals that there are insufficient number of qualified nodes

View Source
var ErrOnExecutionAtStakingSC = errors.New("execution error at staking sc")

ErrOnExecutionAtStakingSC signals that there was an error at staking sc call

View Source
var ErrSingleSigner = errors.New("nil single signer")

ErrSingleSigner signals that single signer is nil

View Source
var ErrTokenAlreadyRegistered = errors.New("token was already registered")

ErrTokenAlreadyRegistered signals that token was already registered

View Source
var ErrTokenNameNotHumanReadable = errors.New("token name is not human readable")

ErrTokenNameNotHumanReadable signals that token name is not human readable

View Source
var ErrUnknownSystemSmartContract = errors.New("missing system smart contract on selected address")

ErrUnknownSystemSmartContract signals that there is no system smart contract on the provided address

View Source
var ErrVotedForAProposalThatNotBeginsYet = errors.New("voted for a proposal that not begins yet")

ErrVotedForAProposalThatNotBeginsYet signals that voting was done for a proposal that not begins yet

View Source
var ErrVotedForAnExpiredProposal = errors.New("voted for an expired proposal")

ErrVotedForAnExpiredProposal signals that voting was done for an expired proposal

View Source
var GovernanceSCAddress = []byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 255, 255}

GovernanceSCAddress is the hard-coded address for governance smart contract

View Source
var JailingAddress = []byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255}

JailingAddress is the hard-coded address which can call jail function

View Source
var StakingSCAddress = []byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255}

StakingSCAddress is the hard-coded address for smart contracts

Functions

This section is empty.

Types

type ArgumentsParser

type ArgumentsParser interface {
	ParseData(data string) (string, [][]byte, error)
	IsInterfaceNil() bool
}

ArgumentsParser defines the functionality to parse transaction data into arguments and code for smart contracts

type BaseOperationCost

type BaseOperationCost struct {
	StorePerByte    uint64
	ReleasePerByte  uint64
	DataCopyPerByte uint64
	PersistPerByte  uint64
	CompilePerByte  uint64
}

BaseOperationCost defines cost for base operation cost

type BuiltInCost added in v1.0.114

type BuiltInCost struct {
	ChangeOwnerAddress    uint64
	ClaimDeveloperRewards uint64
	SaveUserName          uint64
	SaveKeyValue          uint64
	ESDTTransfer          uint64
	ESDTBurn              uint64
}

BuiltInCost defines cost for built-in methods

type ContextHandler

type ContextHandler interface {
	SystemEI

	SetSystemSCContainer(scContainer SystemSCContainer) error
	CreateVMOutput() *vmcommon.VMOutput
	CleanCache()
	SetSCAddress(addr []byte)
	AddCode(addr []byte, code []byte)
	AddTxValueToSmartContract(value *big.Int, scAddress []byte)
	SetGasProvided(gasProvided uint64)
}

ContextHandler defines the methods needed to execute system smart contracts

type EconomicsHandler added in v1.0.147

type EconomicsHandler interface {
	GenesisTotalSupply() *big.Int
	IsInterfaceNil() bool
}

EconomicsHandler defines the methods to get data from the economics component

type EpochNotifier added in v1.1.2

type EpochNotifier interface {
	RegisterNotifyHandler(handler core.EpochSubscriberHandler)
	CurrentEpoch() uint32
	CheckEpoch(epoch uint32)
	IsInterfaceNil() bool
}

EpochNotifier can notify upon an epoch change and provide the current epoch

type GasCost

type GasCost struct {
	BaseOperationCost      BaseOperationCost
	MetaChainSystemSCsCost MetaChainSystemSCsCost
	BuiltInCost            BuiltInCost
}

GasCost holds all the needed gas costs for system smart contracts

type MessageSignVerifier

type MessageSignVerifier interface {
	Verify(message []byte, signedMessage []byte, pubKey []byte) error
	IsInterfaceNil() bool
}

MessageSignVerifier is used to verify if message was signed with given public key

type MetaChainSystemSCsCost

type MetaChainSystemSCsCost struct {
	Stake               uint64
	UnStake             uint64
	UnBond              uint64
	Claim               uint64
	Get                 uint64
	ChangeRewardAddress uint64
	ChangeValidatorKeys uint64
	UnJail              uint64
	ESDTIssue           uint64
	ESDTOperations      uint64
	Proposal            uint64
	Vote                uint64
	DelegateVote        uint64
	RevokeVote          uint64
	CloseProposal       uint64
}

MetaChainSystemSCsCost defines the cost of system staking SCs methods

type NodesConfigProvider added in v1.0.110

type NodesConfigProvider interface {
	MinNumberOfNodes() uint32
	MinNumberOfNodesWithHysteresis() uint32
	IsInterfaceNil() bool
}

NodesConfigProvider defines the functionality which is needed for nodes config in system smart contracts

type SystemEI

type SystemEI interface {
	ExecuteOnDestContext(destination []byte, sender []byte, value *big.Int, input []byte) (*vmcommon.VMOutput, error)
	Transfer(destination []byte, sender []byte, value *big.Int, input []byte, gasLimit uint64) error
	SendGlobalSettingToAll(sender []byte, input []byte)
	GetBalance(addr []byte) *big.Int
	SetStorage(key []byte, value []byte)
	SetStorageForAddress(address []byte, key []byte, value []byte)
	AddReturnMessage(msg string)
	GetStorage(key []byte) []byte
	GetStorageFromAddress(address []byte, key []byte) []byte
	Finish(value []byte)
	UseGas(gasToConsume uint64) error
	BlockChainHook() vmcommon.BlockchainHook
	CryptoHook() vmcommon.CryptoHook
	IsValidator(blsKey []byte) bool
	CanUnJail(blsKey []byte) bool
	IsBadRating(blsKey []byte) bool

	IsInterfaceNil() bool
}

SystemEI defines the environment interface system smart contract can use

type SystemSCContainer

type SystemSCContainer interface {
	Get(key []byte) (SystemSmartContract, error)
	Add(key []byte, val SystemSmartContract) error
	Replace(key []byte, val SystemSmartContract) error
	Remove(key []byte)
	Len() int
	Keys() [][]byte
	IsInterfaceNil() bool
}

SystemSCContainer defines a system smart contract holder data type with basic functionality

type SystemSCContainerFactory

type SystemSCContainerFactory interface {
	Create() (SystemSCContainer, error)
	IsInterfaceNil() bool
}

SystemSCContainerFactory defines the functionality to create a system smart contract container

type SystemSmartContract

type SystemSmartContract interface {
	Execute(args *vmcommon.ContractCallInput) vmcommon.ReturnCode
	IsInterfaceNil() bool
}

SystemSmartContract interface defines the function a system smart contract should have

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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