Documentation
¶
Overview ¶
DumbGasMeter - gas meter that doesn't count amount of gas during usage.
Errors.
Events types.
Genesis state for VM block.
Basic constants and function to work with types.
Index ¶
- Constants
- Variables
- func Bech32ToLibra(acc types.AccAddress) string
- func ErrDSMissedValue(accessPath vm_grpc.VMAccessPath) sdk.Error
- func ErrEmptyContract() sdk.Error
- func ErrWrongAddressLength(address sdk.AccAddress) sdk.Error
- func ErrWrongArgTypeTag(err error) sdk.Error
- func ErrWrongExecutionResponse(resp vm_grpc.VMExecuteResponses) sdk.Error
- func GetVMTypeByString(typeTag string) (vm_grpc.VMTypeTag, error)
- func NewDumbGasMeter() sdk.GasMeter
- func NewEventDiscard(errorStatus *vm_grpc.VMStatus) sdk.Event
- func NewEventError(vmStatus *vm_grpc.VMStatus) sdk.Event
- func NewEventFromVM(event *vm_grpc.VMEvent) sdk.Event
- func NewEventKeep() sdk.Event
- func PathToHex(path vm_grpc.VMAccessPath) string
- func RegisterCodec(cdc *codec.Codec)
- func VMTypeToString(tag vm_grpc.VMTypeTag) (string, error)
- func VMTypeToStringPanic(tag vm_grpc.VMTypeTag) string
- type Contract
- type DumbGasMeter
- type ErrVMCrashed
- type GenesisState
- type GenesisWriteOp
- type MsgDeployModule
- type MsgExecuteScript
- type QueryAccessPath
- type QueryValueResp
- type ScriptArg
Constants ¶
const ( CodeEmptyContractCode = 101 CodeErrWrongAddressLength = 201 CodeErrWrongArgTypeTag = 202 CodeErrWrongExecutionResponse = 203 // Errors related to DS (Data Source). CodeErrDSMissedValue = 401 // VM related status codes VMCodeExecuted = 4001 )
const ( // Event types. EventTypeContractStatus = "contract_status" EventTypeMvirEvent = "contract_events" // Attributes keys AttrKeyStatus = "status" AttrKeyMajorStatus = "major_status" AttrKeySubStatus = "sub_status" AttrKeyMessage = "message" AttrKeySequenceNumber = "sequence_number" AttrKeyType = "type" AttrKeyData = "data" AttrKeyGuid = "guid" // Values. StatusDiscard = "discard" StatusKeep = "keep" StatusError = "error" )
const ( ModuleName = "vm" StoreKey = ModuleName RouterKey = ModuleName Codespace types.CodespaceType = ModuleName DefaultParamspace = ModuleName VmAddressLength = 32 VmGasPrice = 1 VmUnknowTagType = -1 )
Variables ¶
var ( MsgDeployModuleType = "deploy_module" MsgExecuteScriptType = "execute_script" )
var (
KeyGenesis = []byte("gen") // used to save genesis
)
VM related variables.
var ModuleCdc *codec.Codec
module codec
Functions ¶
func ErrDSMissedValue ¶
func ErrDSMissedValue(accessPath vm_grpc.VMAccessPath) sdk.Error
Value missed in Data Source server
func ErrEmptyContract ¶
Msg contract bytes (Module / Script) are empty
func ErrWrongAddressLength ¶
func ErrWrongAddressLength(address sdk.AccAddress) sdk.Error
Wrong address length
func ErrWrongArgTypeTag ¶
Converting msg.Args VMTypeTag to string failed
func ErrWrongExecutionResponse ¶
func ErrWrongExecutionResponse(resp vm_grpc.VMExecuteResponses) sdk.Error
Move VM can't process request correctly: number of resp.Executions != 1
func GetVMTypeByString ¶
Get TypeTag by string TypeTag representation.
func NewDumbGasMeter ¶
func NewEventDiscard ¶
New event with discard status.
func NewEventError ¶
New event with error status.
func NewEventFromVM ¶
Parse VM event to standard SDK event. In case of event data equal "struct" we don't process struct, and just keep bytes, as for any other type.
func PathToHex ¶
func PathToHex(path vm_grpc.VMAccessPath) string
Convert VMAccessPath to hex string
func VMTypeToString ¶
Convert TypeTag to string representation.
func VMTypeToStringPanic ¶
Convert TypeTag to string representation with panic.
Types ¶
type DumbGasMeter ¶
type DumbGasMeter struct {
}
func (*DumbGasMeter) ConsumeGas ¶
func (g *DumbGasMeter) ConsumeGas(_ sdk.Gas, _ string)
func (DumbGasMeter) GasConsumed ¶
func (g DumbGasMeter) GasConsumed() sdk.Gas
func (DumbGasMeter) GasConsumedToLimit ¶
func (g DumbGasMeter) GasConsumedToLimit() sdk.Gas
func (DumbGasMeter) IsOutOfGas ¶
func (g DumbGasMeter) IsOutOfGas() bool
func (DumbGasMeter) IsPastLimit ¶
func (g DumbGasMeter) IsPastLimit() bool
func (DumbGasMeter) Limit ¶
func (g DumbGasMeter) Limit() sdk.Gas
type ErrVMCrashed ¶
type ErrVMCrashed struct {
// contains filtered or unexported fields
}
Special type for VM crashes, so we can detect later, that it's VM crash error and break consensus
func NewErrVMCrashed ¶
func NewErrVMCrashed(err error) ErrVMCrashed
Move VM crashes, means don't return response, disconnect, etc
type GenesisState ¶
type GenesisState struct {
WriteSet []GenesisWriteOp `json:"write_set"`
}
Genesis state contains write operations.
type GenesisWriteOp ¶
type GenesisWriteOp struct {
Address string `json:"address"`
Path string `json:"path"`
Value string `json:"value"`
}
Genesis write operations.
type MsgDeployModule ¶
type MsgDeployModule struct {
Signer sdk.AccAddress `json:"signer"`
Module Contract `json:"module"`
}
Message to deploy contract.
func NewMsgDeployModule ¶
func NewMsgDeployModule(signer sdk.AccAddress, module Contract) MsgDeployModule
func (MsgDeployModule) GetSignBytes ¶
func (msg MsgDeployModule) GetSignBytes() []byte
func (MsgDeployModule) GetSigners ¶
func (msg MsgDeployModule) GetSigners() []sdk.AccAddress
func (MsgDeployModule) Route ¶
func (MsgDeployModule) Route() string
func (MsgDeployModule) Type ¶
func (MsgDeployModule) Type() string
func (MsgDeployModule) ValidateBasic ¶
func (msg MsgDeployModule) ValidateBasic() sdk.Error
type MsgExecuteScript ¶
type MsgExecuteScript struct {
Signer sdk.AccAddress `json:"signer"`
Script Contract `json:"script"`
Args []ScriptArg `json:"args"`
}
Message for contract script (execution).
func NewMsgExecuteScript ¶
func NewMsgExecuteScript(signer sdk.AccAddress, script Contract, args []ScriptArg) MsgExecuteScript
func (MsgExecuteScript) GetSignBytes ¶
func (msg MsgExecuteScript) GetSignBytes() []byte
func (MsgExecuteScript) GetSigners ¶
func (msg MsgExecuteScript) GetSigners() []sdk.AccAddress
func (MsgExecuteScript) Route ¶
func (MsgExecuteScript) Route() string
func (MsgExecuteScript) Type ¶
func (MsgExecuteScript) Type() string
func (MsgExecuteScript) ValidateBasic ¶
func (msg MsgExecuteScript) ValidateBasic() sdk.Error
type QueryAccessPath ¶
Query when access path to read value.
type QueryValueResp ¶
type QueryValueResp struct {
Value string `json:"value"`
}
Query response.
func (QueryValueResp) String ¶
func (resp QueryValueResp) String() string