common

package
v1.2.66 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2024 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ErrCodeSuccess signals success
	ErrCodeSuccess = iota
	// ErrCodeCannotCreateFile signals a critical error
	ErrCodeCannotCreateFile
	// ErrCodeInit signals a critical error
	ErrCodeInit
	// ErrCodeTerminated signals a critical error
	ErrCodeTerminated
)
View Source
const EnvVarVMPath = "VM_PATH"

EnvVarVMPath is an environment variable

Variables

View Source
var ErrBadHookResponseFromNode = &CriticalError{InnerErr: fmt.Errorf("bad hook response from node")}

ErrBadHookResponseFromNode signals a critical error

View Source
var ErrBadMessageFromVM = &CriticalError{InnerErr: fmt.Errorf("bad message from vm")}

ErrBadMessageFromVM signals a critical error

View Source
var ErrBadRequestFromNode = &CriticalError{InnerErr: fmt.Errorf("bad message from node")}

ErrBadRequestFromNode signals a critical error

View Source
var ErrBadVMArguments = &CriticalError{InnerErr: fmt.Errorf("bad arguments passed to vm")}

ErrBadVMArguments signals a critical error

View Source
var ErrCannotReceiveHookCallResponse = &CriticalError{InnerErr: fmt.Errorf("cannot receive hook call response")}

ErrCannotReceiveHookCallResponse signals a critical error

View Source
var ErrCannotSendContractRequest = &CriticalError{InnerErr: fmt.Errorf("cannot send contract request")}

ErrCannotSendContractRequest signals a critical error

View Source
var ErrCannotSendHookCallRequest = &CriticalError{InnerErr: fmt.Errorf("cannot send hook call request")}

ErrCannotSendHookCallRequest signals a critical error

View Source
var ErrCannotSendHookCallResponse = &CriticalError{InnerErr: fmt.Errorf("cannot send hook call response")}

ErrCannotSendHookCallResponse signals a critical error

View Source
var ErrInvalidMessageNonce = &CriticalError{InnerErr: fmt.Errorf("invalid dialogue nonce")}

ErrInvalidMessageNonce signals a critical error

View Source
var ErrStopPerNodeRequest = &CriticalError{InnerErr: fmt.Errorf("vm will stop, as requested")}

ErrStopPerNodeRequest signals a critical error

View Source
var ErrVMClosed = &CriticalError{InnerErr: fmt.Errorf("vm closed")}

ErrVMClosed signals a critical error

View Source
var ErrVMNotFound = &CriticalError{InnerErr: fmt.Errorf("vm binary not found")}

ErrVMNotFound signals a critical error

View Source
var ErrVMTimeExpired = &CriticalError{InnerErr: fmt.Errorf("vm time expired")}

ErrVMTimeExpired signals a critical error

Functions

func IsContractResponse

func IsContractResponse(message MessageHandler) bool

IsContractResponse returns whether a message is a contract response

func IsCriticalError

func IsCriticalError(err error) bool

IsCriticalError returns whether the error is critical

func IsDiagnose

func IsDiagnose(message MessageHandler) bool

IsDiagnose returns whether a message is a diagnose request

func IsGasScheduleChangeResponse

func IsGasScheduleChangeResponse(message MessageHandler) bool

IsGasScheduleChangeResponse returns a message with gas schedule response

func IsHookCall

func IsHookCall(message MessageHandler) bool

IsHookCall returns whether a message is a hook call

func IsStopRequest

func IsStopRequest(message MessageHandler) bool

IsStopRequest returns whether a message is a stop request

func IsVersionResponse

func IsVersionResponse(message MessageHandler) bool

IsVersionResponse returns version response

func SendVMArguments added in v1.2.50

func SendVMArguments(pipe *os.File, pipeArguments VMArguments) error

SendVMArguments sends initialization arguments through a pipe

Types

type Account

type Account struct {
	Nonce           uint64
	Balance         *big.Int
	CodeHash        []byte
	RootHash        []byte
	Address         []byte
	DeveloperReward *big.Int
	OwnerAddress    []byte
	UserName        []byte
	CodeMetadata    []byte
}

Account holds the account info (is a substructure of an IPC message)

func (*Account) AccountDataHandler

func (a *Account) AccountDataHandler() vmcommon.AccountDataHandler

AccountDataHandler returns nil

func (*Account) AddToBalance

func (a *Account) AddToBalance(_ *big.Int) error

AddToBalance does nothing and returns nil

func (*Account) AddressBytes

func (a *Account) AddressBytes() []byte

AddressBytes gets the address

func (*Account) ChangeOwnerAddress

func (a *Account) ChangeOwnerAddress(_ []byte, _ []byte) error

ChangeOwnerAddress does nothing and returns nil

func (*Account) ClaimDeveloperRewards

func (a *Account) ClaimDeveloperRewards(_ []byte) (*big.Int, error)

ClaimDeveloperRewards does nothing and returns 0 and nil

func (*Account) GetBalance

func (a *Account) GetBalance() *big.Int

GetBalance gets the balance

func (*Account) GetCodeHash

func (a *Account) GetCodeHash() []byte

GetCodeHash gets the code hash

func (*Account) GetCodeMetadata

func (a *Account) GetCodeMetadata() []byte

GetCodeMetadata gets the code metadata

func (*Account) GetDeveloperReward

func (a *Account) GetDeveloperReward() *big.Int

GetDeveloperReward gets the developer reward

func (*Account) GetNonce

func (a *Account) GetNonce() uint64

GetNonce gets the nonce

func (*Account) GetOwnerAddress

func (a *Account) GetOwnerAddress() []byte

GetOwnerAddress gets the owner's address

func (*Account) GetRootHash

func (a *Account) GetRootHash() []byte

GetRootHash gets the root hash

func (*Account) GetUserName

func (a *Account) GetUserName() []byte

GetUserName gets the username

func (*Account) IncreaseNonce

func (a *Account) IncreaseNonce(_ uint64)

IncreaseNonce does nothing

func (*Account) IsInterfaceNil

func (a *Account) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*Account) SetCodeMetadata added in v1.2.51

func (a *Account) SetCodeMetadata(_ []byte)

SetCodeMetadata does nothing

func (*Account) SetOwnerAddress

func (a *Account) SetOwnerAddress(_ []byte)

SetOwnerAddress does nothing

func (*Account) SetUserName

func (a *Account) SetUserName(_ []byte)

SetUserName does nothing

type CriticalError

type CriticalError struct {
	InnerErr error
}

CriticalError signals a critical error

func WrapCriticalError

func WrapCriticalError(err error) *CriticalError

WrapCriticalError wraps an error

func (*CriticalError) Error

func (err *CriticalError) Error() string

func (*CriticalError) Unwrap

func (err *CriticalError) Unwrap() error

Unwrap unwraps the inner error

type Message

type Message struct {
	DialogueNonce uint32
	Kind          MessageKind
	ErrorMessage  string
}

Message is the implementation of the abstraction

func NewGasScheduleChangeResponse

func NewGasScheduleChangeResponse() *Message

NewGasScheduleChangeResponse creates a message to respond

func (*Message) DebugString

func (message *Message) DebugString() string

DebugString is a debug representation of the message

func (*Message) GetError

func (message *Message) GetError() error

GetError gets the error within the message

func (*Message) GetKind

func (message *Message) GetKind() MessageKind

GetKind gets the message kind

func (*Message) GetKindName

func (message *Message) GetKindName() string

GetKindName gets the kind name

func (*Message) GetNonce

func (message *Message) GetNonce() uint32

GetNonce gets the dialogue nonce

func (*Message) SetError

func (message *Message) SetError(err error)

SetError sets the error within the message

func (*Message) SetKind

func (message *Message) SetKind(kind MessageKind)

SetKind sets the message kind

func (*Message) SetNonce

func (message *Message) SetNonce(nonce uint32)

SetNonce sets the dialogue nonce

type MessageBlockchainCurrentEpochRequest

type MessageBlockchainCurrentEpochRequest struct {
	Message
}

MessageBlockchainCurrentEpochRequest represents a request message

func NewMessageBlockchainCurrentEpochRequest

func NewMessageBlockchainCurrentEpochRequest() *MessageBlockchainCurrentEpochRequest

NewMessageBlockchainCurrentEpochRequest creates a request message

type MessageBlockchainCurrentEpochResponse

type MessageBlockchainCurrentEpochResponse struct {
	Message
	Result uint32
}

MessageBlockchainCurrentEpochResponse represents a response message

func NewMessageBlockchainCurrentEpochResponse

func NewMessageBlockchainCurrentEpochResponse(result uint32) *MessageBlockchainCurrentEpochResponse

NewMessageBlockchainCurrentEpochResponse creates a response message

type MessageBlockchainCurrentNonceRequest

type MessageBlockchainCurrentNonceRequest struct {
	Message
}

MessageBlockchainCurrentNonceRequest represents a request message

func NewMessageBlockchainCurrentNonceRequest

func NewMessageBlockchainCurrentNonceRequest() *MessageBlockchainCurrentNonceRequest

NewMessageBlockchainCurrentNonceRequest creates a request message

type MessageBlockchainCurrentNonceResponse

type MessageBlockchainCurrentNonceResponse struct {
	Message
	Result uint64
}

MessageBlockchainCurrentNonceResponse represents a response message

func NewMessageBlockchainCurrentNonceResponse

func NewMessageBlockchainCurrentNonceResponse(result uint64) *MessageBlockchainCurrentNonceResponse

NewMessageBlockchainCurrentNonceResponse creates a response message

type MessageBlockchainCurrentRandomSeedRequest

type MessageBlockchainCurrentRandomSeedRequest struct {
	Message
}

MessageBlockchainCurrentRandomSeedRequest represents a request message

func NewMessageBlockchainCurrentRandomSeedRequest

func NewMessageBlockchainCurrentRandomSeedRequest() *MessageBlockchainCurrentRandomSeedRequest

NewMessageBlockchainCurrentRandomSeedRequest creates a request message

type MessageBlockchainCurrentRandomSeedResponse

type MessageBlockchainCurrentRandomSeedResponse struct {
	Message
	Result []byte
}

MessageBlockchainCurrentRandomSeedResponse represents a response message

func NewMessageBlockchainCurrentRandomSeedResponse

func NewMessageBlockchainCurrentRandomSeedResponse(result []byte) *MessageBlockchainCurrentRandomSeedResponse

NewMessageBlockchainCurrentRandomSeedResponse creates a response message

type MessageBlockchainCurrentRoundRequest

type MessageBlockchainCurrentRoundRequest struct {
	Message
}

MessageBlockchainCurrentRoundRequest represents a request message

func NewMessageBlockchainCurrentRoundRequest

func NewMessageBlockchainCurrentRoundRequest() *MessageBlockchainCurrentRoundRequest

NewMessageBlockchainCurrentRoundRequest creates a request message

type MessageBlockchainCurrentRoundResponse

type MessageBlockchainCurrentRoundResponse struct {
	Message
	Result uint64
}

MessageBlockchainCurrentRoundResponse represents a response message

func NewMessageBlockchainCurrentRoundResponse

func NewMessageBlockchainCurrentRoundResponse(result uint64) *MessageBlockchainCurrentRoundResponse

NewMessageBlockchainCurrentRoundResponse creates a response message

type MessageBlockchainCurrentTimeStampRequest

type MessageBlockchainCurrentTimeStampRequest struct {
	Message
}

MessageBlockchainCurrentTimeStampRequest represents a request message

func NewMessageBlockchainCurrentTimeStampRequest

func NewMessageBlockchainCurrentTimeStampRequest() *MessageBlockchainCurrentTimeStampRequest

NewMessageBlockchainCurrentTimeStampRequest creates a request message

type MessageBlockchainCurrentTimeStampResponse

type MessageBlockchainCurrentTimeStampResponse struct {
	Message
	Result uint64
}

MessageBlockchainCurrentTimeStampResponse represents a response message

func NewMessageBlockchainCurrentTimeStampResponse

func NewMessageBlockchainCurrentTimeStampResponse(result uint64) *MessageBlockchainCurrentTimeStampResponse

NewMessageBlockchainCurrentTimeStampResponse creates a response message

type MessageBlockchainGetAllStateRequest

type MessageBlockchainGetAllStateRequest struct {
	Message
	Address []byte
}

MessageBlockchainGetAllStateRequest represents a request message

func NewMessageBlockchainGetAllStateRequest

func NewMessageBlockchainGetAllStateRequest(address []byte) *MessageBlockchainGetAllStateRequest

NewMessageBlockchainGetAllStateRequest creates a request message

type MessageBlockchainGetAllStateResponse

type MessageBlockchainGetAllStateResponse struct {
	Message
	SerializableAllState *SerializableMapStringBytes
}

MessageBlockchainGetAllStateResponse represents a response message

func NewMessageBlockchainGetAllStateResponse

func NewMessageBlockchainGetAllStateResponse(state map[string][]byte, err error) *MessageBlockchainGetAllStateResponse

NewMessageBlockchainGetAllStateResponse creates a response message

type MessageBlockchainGetBlockhashRequest

type MessageBlockchainGetBlockhashRequest struct {
	Message
	Nonce uint64
}

MessageBlockchainGetBlockhashRequest represents a request message

func NewMessageBlockchainGetBlockhashRequest

func NewMessageBlockchainGetBlockhashRequest(nonce uint64) *MessageBlockchainGetBlockhashRequest

NewMessageBlockchainGetBlockhashRequest creates a request message

type MessageBlockchainGetBlockhashResponse

type MessageBlockchainGetBlockhashResponse struct {
	Message
	Result []byte
}

MessageBlockchainGetBlockhashResponse represents a response message

func NewMessageBlockchainGetBlockhashResponse

func NewMessageBlockchainGetBlockhashResponse(result []byte, err error) *MessageBlockchainGetBlockhashResponse

NewMessageBlockchainGetBlockhashResponse creates a response message

type MessageBlockchainGetBuiltinFunctionNamesRequest

type MessageBlockchainGetBuiltinFunctionNamesRequest struct {
	Message
}

MessageBlockchainGetBuiltinFunctionNamesRequest represents a request message

func NewMessageBlockchainGetBuiltinFunctionNamesRequest

func NewMessageBlockchainGetBuiltinFunctionNamesRequest() *MessageBlockchainGetBuiltinFunctionNamesRequest

NewMessageBlockchainGetBuiltinFunctionNamesRequest creates a request message

type MessageBlockchainGetBuiltinFunctionNamesResponse

type MessageBlockchainGetBuiltinFunctionNamesResponse struct {
	Message
	FunctionNames vmcommon.FunctionNames
}

MessageBlockchainGetBuiltinFunctionNamesResponse represents a response message

func NewMessageBlockchainGetBuiltinFunctionNamesResponse

func NewMessageBlockchainGetBuiltinFunctionNamesResponse(functionNames vmcommon.FunctionNames) *MessageBlockchainGetBuiltinFunctionNamesResponse

NewMessageBlockchainGetBuiltinFunctionNamesResponse creates a response message

type MessageBlockchainGetCodeRequest

type MessageBlockchainGetCodeRequest struct {
	Message
	Account *Account
}

NewMessageBlockchainGetCodeRequest represents a request message

func NewMessageBlockchainGetCodeRequest

func NewMessageBlockchainGetCodeRequest(account *Account) *MessageBlockchainGetCodeRequest

NewMessageBlockchainGetCodeRequest creates a request message

type MessageBlockchainGetCodeResponse

type MessageBlockchainGetCodeResponse struct {
	Message
	Code []byte
}

MessageBlockchainGetCodeResponse represents a response message

func NewMessageBlockchainGetCodeResponse

func NewMessageBlockchainGetCodeResponse(code []byte) *MessageBlockchainGetCodeResponse

NewMessageBlockchainGetCodeResponse creates a response message

type MessageBlockchainGetCompiledCodeRequest

type MessageBlockchainGetCompiledCodeRequest struct {
	Message
	CodeHash []byte
}

MessageBlockchainGetCompiledCodeRequest represents a request message

func NewMessageBlockchainGetCompiledCodeRequest

func NewMessageBlockchainGetCompiledCodeRequest(codeHash []byte) *MessageBlockchainGetCompiledCodeRequest

NewMessageBlockchainGetCompiledCodeRequest creates a request message

type MessageBlockchainGetCompiledCodeResponse

type MessageBlockchainGetCompiledCodeResponse struct {
	Message
	Found bool
	Code  []byte
}

MessageBlockchainGetCompiledCodeResponse represents a response message

func NewMessageBlockchainGetCompiledCodeResponse

func NewMessageBlockchainGetCompiledCodeResponse(result bool, code []byte) *MessageBlockchainGetCompiledCodeResponse

NewMessageBlockchainGetCompiledCodeResponse creates a response message

type MessageBlockchainGetESDTTokenRequest

type MessageBlockchainGetESDTTokenRequest struct {
	Message
	Address []byte
	TokenID []byte
	Nonce   uint64
}

MessageBlockchainGetESDTTokenRequest represents a request message

func NewMessageBlockchainGetESDTTokenRequest

func NewMessageBlockchainGetESDTTokenRequest(address []byte, tokenID []byte, nonce uint64) *MessageBlockchainGetESDTTokenRequest

NewMessageBlockchainGetESDTTokenRequest creates a request message

type MessageBlockchainGetESDTTokenResponse

type MessageBlockchainGetESDTTokenResponse struct {
	Message
	ESDTData *esdt.ESDigitalToken
}

MessageBlockchainGetESDTTokenResponse represents a response message

func NewMessageBlockchainGetESDTTokenResponse

func NewMessageBlockchainGetESDTTokenResponse(esdtData *esdt.ESDigitalToken, err error) *MessageBlockchainGetESDTTokenResponse

NewMessageBlockchainGetESDTTokenResponse creates a response message

type MessageBlockchainGetShardOfAddressRequest

type MessageBlockchainGetShardOfAddressRequest struct {
	Message
	Address []byte
}

MessageBlockchainGetShardOfAddressRequest represents a request message

func NewMessageBlockchainGetShardOfAddressRequest

func NewMessageBlockchainGetShardOfAddressRequest(address []byte) *MessageBlockchainGetShardOfAddressRequest

NewMessageBlockchainGetShardOfAddressRequest creates a request message

type MessageBlockchainGetShardOfAddressResponse

type MessageBlockchainGetShardOfAddressResponse struct {
	Message
	Shard uint32
}

MessageBlockchainGetShardOfAddressResponse represents a response message

func NewMessageBlockchainGetShardOfAddressResponse

func NewMessageBlockchainGetShardOfAddressResponse(shard uint32) *MessageBlockchainGetShardOfAddressResponse

NewMessageBlockchainGetShardOfAddressResponse creates a response message

type MessageBlockchainGetStateRootHashRequest

type MessageBlockchainGetStateRootHashRequest struct {
	Message
}

MessageBlockchainGetStateRootHashRequest represents a request message

func NewMessageBlockchainGetStateRootHashRequest

func NewMessageBlockchainGetStateRootHashRequest() *MessageBlockchainGetStateRootHashRequest

NewMessageBlockchainGetStateRootHashRequest creates a request message

type MessageBlockchainGetStateRootHashResponse

type MessageBlockchainGetStateRootHashResponse struct {
	Message
	Result []byte
}

MessageBlockchainGetStateRootHashResponse represents a response message

func NewMessageBlockchainGetStateRootHashResponse

func NewMessageBlockchainGetStateRootHashResponse(result []byte) *MessageBlockchainGetStateRootHashResponse

NewMessageBlockchainGetStateRootHashResponse creates a response message

type MessageBlockchainGetStorageDataRequest

type MessageBlockchainGetStorageDataRequest struct {
	Message
	Address []byte
	Index   []byte
}

MessageBlockchainGetStorageDataRequest represents a request message

func NewMessageBlockchainGetStorageDataRequest

func NewMessageBlockchainGetStorageDataRequest(address []byte, index []byte) *MessageBlockchainGetStorageDataRequest

NewMessageBlockchainGetStorageDataRequest creates a request message

type MessageBlockchainGetStorageDataResponse

type MessageBlockchainGetStorageDataResponse struct {
	Message
	Data []byte
}

MessageBlockchainGetStorageDataResponse represents a response message

func NewMessageBlockchainGetStorageDataResponse

func NewMessageBlockchainGetStorageDataResponse(data []byte, err error) *MessageBlockchainGetStorageDataResponse

NewMessageBlockchainGetStorageDataResponse creates a response message

type MessageBlockchainGetUserAccountRequest

type MessageBlockchainGetUserAccountRequest struct {
	Message
	Address []byte
}

MessageBlockchainGetUserAccountRequest represents a request message

func NewMessageBlockchainGetUserAccountRequest

func NewMessageBlockchainGetUserAccountRequest(address []byte) *MessageBlockchainGetUserAccountRequest

NewMessageBlockchainGetUserAccountRequest creates a request message

type MessageBlockchainGetUserAccountResponse

type MessageBlockchainGetUserAccountResponse struct {
	Message
	Account *Account
}

MessageBlockchainGetUserAccountResponse represents a response message

func NewMessageBlockchainGetUserAccountResponse

func NewMessageBlockchainGetUserAccountResponse(account *Account, err error) *MessageBlockchainGetUserAccountResponse

NewMessageBlockchainGetUserAccountResponse creates a response message

type MessageBlockchainIsPayableRequest

type MessageBlockchainIsPayableRequest struct {
	Message
	Address []byte
}

MessageBlockchainIsPayableRequest represents a request message

func NewMessageBlockchainIsPayableRequest

func NewMessageBlockchainIsPayableRequest(address []byte) *MessageBlockchainIsPayableRequest

NewMessageBlockchainIsPayableRequest creates a request message

type MessageBlockchainIsPayableResponse

type MessageBlockchainIsPayableResponse struct {
	Message
	Result bool
}

MessageBlockchainIsPayableResponse represents a response message

func NewMessageBlockchainIsPayableResponse

func NewMessageBlockchainIsPayableResponse(result bool, err error) *MessageBlockchainIsPayableResponse

NewMessageBlockchainIsPayableResponse creates a response message

type MessageBlockchainIsSmartContractRequest

type MessageBlockchainIsSmartContractRequest struct {
	Message
	Address []byte
}

MessageBlockchainIsSmartContractRequest represents a request message

func NewMessageBlockchainIsSmartContractRequest

func NewMessageBlockchainIsSmartContractRequest(address []byte) *MessageBlockchainIsSmartContractRequest

NewMessageBlockchainIsSmartContractRequest creates a request message

type MessageBlockchainIsSmartContractResponse

type MessageBlockchainIsSmartContractResponse struct {
	Message
	Result bool
}

MessageBlockchainIsSmartContractResponse represents a response message

func NewMessageBlockchainIsSmartContractResponse

func NewMessageBlockchainIsSmartContractResponse(result bool) *MessageBlockchainIsSmartContractResponse

NewMessageBlockchainIsSmartContractResponse creates a response message

type MessageBlockchainLastEpochRequest

type MessageBlockchainLastEpochRequest struct {
	Message
}

MessageBlockchainLastEpochRequest represents a request message

func NewMessageBlockchainLastEpochRequest

func NewMessageBlockchainLastEpochRequest() *MessageBlockchainLastEpochRequest

NewMessageBlockchainLastEpochRequest creates a request message

type MessageBlockchainLastEpochResponse

type MessageBlockchainLastEpochResponse struct {
	Message
	Result uint32
}

MessageBlockchainLastEpochResponse represents a response message

func NewMessageBlockchainLastEpochResponse

func NewMessageBlockchainLastEpochResponse(result uint32) *MessageBlockchainLastEpochResponse

NewMessageBlockchainLastEpochResponse creates a response message

type MessageBlockchainLastNonceRequest

type MessageBlockchainLastNonceRequest struct {
	Message
}

MessageBlockchainLastNonceRequest represents a request message

func NewMessageBlockchainLastNonceRequest

func NewMessageBlockchainLastNonceRequest() *MessageBlockchainLastNonceRequest

NewMessageBlockchainLastNonceRequest creates a request message

type MessageBlockchainLastNonceResponse

type MessageBlockchainLastNonceResponse struct {
	Message
	Result uint64
}

MessageBlockchainLastNonceResponse represents a response message

func NewMessageBlockchainLastNonceResponse

func NewMessageBlockchainLastNonceResponse(result uint64) *MessageBlockchainLastNonceResponse

NewMessageBlockchainLastNonceResponse creates a response message

type MessageBlockchainLastRandomSeedRequest

type MessageBlockchainLastRandomSeedRequest struct {
	Message
}

MessageBlockchainLastRandomSeedRequest represents a request message

func NewMessageBlockchainLastRandomSeedRequest

func NewMessageBlockchainLastRandomSeedRequest() *MessageBlockchainLastRandomSeedRequest

NewMessageBlockchainLastRandomSeedRequest creates a request message

type MessageBlockchainLastRandomSeedResponse

type MessageBlockchainLastRandomSeedResponse struct {
	Message
	Result []byte
}

MessageBlockchainLastRandomSeedResponse represents a response message

func NewMessageBlockchainLastRandomSeedResponse

func NewMessageBlockchainLastRandomSeedResponse(result []byte) *MessageBlockchainLastRandomSeedResponse

NewMessageBlockchainLastRandomSeedResponse creates a response message

type MessageBlockchainLastRoundRequest

type MessageBlockchainLastRoundRequest struct {
	Message
}

MessageBlockchainLastRoundRequest represents a request message

func NewMessageBlockchainLastRoundRequest

func NewMessageBlockchainLastRoundRequest() *MessageBlockchainLastRoundRequest

NewMessageBlockchainLastRoundRequest creates a request message

type MessageBlockchainLastRoundResponse

type MessageBlockchainLastRoundResponse struct {
	Message
	Result uint64
}

MessageBlockchainLastRoundResponse represents a response message

func NewMessageBlockchainLastRoundResponse

func NewMessageBlockchainLastRoundResponse(result uint64) *MessageBlockchainLastRoundResponse

NewMessageBlockchainLastRoundResponse creates a response message

type MessageBlockchainLastTimeStampRequest

type MessageBlockchainLastTimeStampRequest struct {
	Message
}

MessageBlockchainLastTimeStampRequest represents a request message

func NewMessageBlockchainLastTimeStampRequest

func NewMessageBlockchainLastTimeStampRequest() *MessageBlockchainLastTimeStampRequest

NewMessageBlockchainLastTimeStampRequest creates a request message

type MessageBlockchainLastTimeStampResponse

type MessageBlockchainLastTimeStampResponse struct {
	Message
	Result uint64
}

MessageBlockchainLastTimeStampResponse represents a response message

func NewMessageBlockchainLastTimeStampResponse

func NewMessageBlockchainLastTimeStampResponse(result uint64) *MessageBlockchainLastTimeStampResponse

NewMessageBlockchainLastTimeStampResponse creates a response message

type MessageBlockchainNewAddressRequest

type MessageBlockchainNewAddressRequest struct {
	Message
	CreatorAddress []byte
	CreatorNonce   uint64
	VMType         []byte
}

MessageBlockchainNewAddressRequest represents a request message

func NewMessageBlockchainNewAddressRequest

func NewMessageBlockchainNewAddressRequest(creatorAddress []byte, creatorNonce uint64, vmType []byte) *MessageBlockchainNewAddressRequest

NewMessageBlockchainNewAddressRequest creates a request message

type MessageBlockchainNewAddressResponse

type MessageBlockchainNewAddressResponse struct {
	Message
	Result []byte
}

MessageBlockchainNewAddressResponse represents a response message

func NewMessageBlockchainNewAddressResponse

func NewMessageBlockchainNewAddressResponse(result []byte, err error) *MessageBlockchainNewAddressResponse

NewMessageBlockchainNewAddressResponse creates a response message

type MessageBlockchainProcessBuiltinFunctionRequest

type MessageBlockchainProcessBuiltinFunctionRequest struct {
	Message
	CallInput vmcommon.ContractCallInput
}

MessageBlockchainProcessBuiltinFunctionRequest represents a request message

func NewMessageBlockchainProcessBuiltinFunctionRequest

func NewMessageBlockchainProcessBuiltinFunctionRequest(callInput vmcommon.ContractCallInput) *MessageBlockchainProcessBuiltinFunctionRequest

NewMessageBlockchainProcessBuiltinFunctionRequest creates a request message

type MessageBlockchainProcessBuiltinFunctionResponse

type MessageBlockchainProcessBuiltinFunctionResponse struct {
	Message
	SerializableVMOutput *SerializableVMOutput
}

MessageBlockchainProcessBuiltinFunctionResponse represents a response message

func NewMessageBlockchainProcessBuiltinFunctionResponse

func NewMessageBlockchainProcessBuiltinFunctionResponse(vmOutput *vmcommon.VMOutput, err error) *MessageBlockchainProcessBuiltinFunctionResponse

NewMessageBlockchainProcessBuiltinFunctionResponse creates a response message

type MessageBlockchainSaveCompiledCodeRequest

type MessageBlockchainSaveCompiledCodeRequest struct {
	Message
	CodeHash []byte
	Code     []byte
}

MessageBlockchainSaveCompiledCodeRequest represents a request message

func NewMessageBlockchainSaveCompiledCodeRequest

func NewMessageBlockchainSaveCompiledCodeRequest(codeHash []byte, code []byte) *MessageBlockchainSaveCompiledCodeRequest

NewMessageBlockchainSaveCompiledCodeRequest creates a request message

type MessageBlockchainSaveCompiledCodeResponse

type MessageBlockchainSaveCompiledCodeResponse struct {
	Message
}

MessageBlockchainSaveCompiledCodeResponse represents a response message

func NewMessageBlockchainSaveCompiledCodeResponse

func NewMessageBlockchainSaveCompiledCodeResponse() *MessageBlockchainSaveCompiledCodeResponse

NewMessageBlockchainSaveCompiledCodeResponse creates a response message

type MessageContractCallRequest

type MessageContractCallRequest struct {
	Message
	CallInput *vmcommon.ContractCallInput
}

MessageContractCallRequest is a call request message (from the Node)

func NewMessageContractCallRequest

func NewMessageContractCallRequest(input *vmcommon.ContractCallInput) *MessageContractCallRequest

NewMessageContractCallRequest creates a MessageContractCallRequest

type MessageContractDeployRequest

type MessageContractDeployRequest struct {
	Message
	CreateInput *vmcommon.ContractCreateInput
}

MessageContractDeployRequest is a deploy request message (from the Node)

func NewMessageContractDeployRequest

func NewMessageContractDeployRequest(input *vmcommon.ContractCreateInput) *MessageContractDeployRequest

NewMessageContractDeployRequest creates a MessageContractDeployRequest

type MessageContractResponse

type MessageContractResponse struct {
	Message
	SerializableVMOutput *SerializableVMOutput
}

MessageContractResponse is a contract response message (from VM)

func NewMessageContractResponse

func NewMessageContractResponse(vmOutput *vmcommon.VMOutput, err error) *MessageContractResponse

NewMessageContractResponse creates a MessageContractResponse

type MessageDiagnoseWaitRequest

type MessageDiagnoseWaitRequest struct {
	Message
	Milliseconds uint32
}

MessageDiagnoseWaitRequest is a diagnose request message (from Node)

func NewMessageDiagnoseWaitRequest

func NewMessageDiagnoseWaitRequest(milliseconds uint32) *MessageDiagnoseWaitRequest

NewMessageDiagnoseWaitRequest creates a message

type MessageDiagnoseWaitResponse

type MessageDiagnoseWaitResponse struct {
	Message
}

MessageDiagnoseWaitResponse is a diagnose response message (from VM)

func NewMessageDiagnoseWaitResponse

func NewMessageDiagnoseWaitResponse() *MessageDiagnoseWaitResponse

NewMessageDiagnoseWaitResponse creates a message

type MessageGasScheduleChangeRequest

type MessageGasScheduleChangeRequest struct {
	Message
	GasSchedule map[string]map[string]uint64
}

MessageGasScheduleChangeRequest is a deploy request message (from the Node)

func NewMessageGasScheduleChangeRequest

func NewMessageGasScheduleChangeRequest(gasSchedule map[string]map[string]uint64) *MessageGasScheduleChangeRequest

NewMessageGasScheduleChangeRequest creates a MessageGasScheduleChangeRequest

type MessageHandler

type MessageHandler interface {
	GetNonce() uint32
	SetNonce(nonce uint32)
	GetKind() MessageKind
	SetKind(kind MessageKind)
	GetError() error
	SetError(err error)
	GetKindName() string
	DebugString() string
}

MessageHandler is a message abstraction

func CreateMessage

func CreateMessage(kind MessageKind) MessageHandler

CreateMessage creates a message given its kind

type MessageInitialize

type MessageInitialize struct {
	Message
	Arguments VMArguments
}

MessageInitialize is a message sent by Node to initialize VM

func NewMessageInitialize

func NewMessageInitialize(arguments VMArguments) *MessageInitialize

NewMessageInitialize creates a new message

type MessageKind

type MessageKind uint32

MessageKind is the kind of a message (that is passed between the Node and VM)

const (
	FirstKind MessageKind = iota
	Initialize
	Stop
	ContractDeployRequest
	ContractCallRequest
	ContractResponse
	GasScheduleChangeRequest
	GasScheduleChangeResponse
	BlockchainNewAddressRequest
	BlockchainNewAddressResponse
	BlockchainGetStorageDataRequest
	BlockchainGetStorageDataResponse
	BlockchainGetBlockhashRequest
	BlockchainGetBlockhashResponse
	BlockchainLastNonceRequest
	BlockchainLastNonceResponse
	BlockchainLastRoundRequest
	BlockchainLastRoundResponse
	BlockchainLastTimeStampRequest
	BlockchainLastTimeStampResponse
	BlockchainLastRandomSeedRequest
	BlockchainLastRandomSeedResponse
	BlockchainLastEpochRequest
	BlockchainLastEpochResponse
	BlockchainGetStateRootHashRequest
	BlockchainGetStateRootHashResponse
	BlockchainCurrentNonceRequest
	BlockchainCurrentNonceResponse
	BlockchainCurrentRoundRequest
	BlockchainCurrentRoundResponse
	BlockchainCurrentTimeStampRequest
	BlockchainCurrentTimeStampResponse
	BlockchainCurrentRandomSeedRequest
	BlockchainCurrentRandomSeedResponse
	BlockchainCurrentEpochRequest
	BlockchainCurrentEpochResponse
	BlockchainProcessBuiltinFunctionRequest
	BlockchainProcessBuiltinFunctionResponse
	BlockchainGetESDTTokenRequest
	BlockchainGetESDTTokenResponse
	BlockchainGetBuiltinFunctionNamesRequest
	BlockchainGetBuiltinFunctionNamesResponse
	BlockchainGetAllStateRequest
	BlockchainGetAllStateResponse
	BlockchainGetUserAccountRequest
	BlockchainGetUserAccountResponse
	BlockchainGetCodeRequest
	BlockchainGetCodeResponse
	BlockchainGetShardOfAddressRequest
	BlockchainGetShardOfAddressResponse
	BlockchainIsPayableRequest
	BlockchainIsPayableResponse
	BlockchainIsSmartContractRequest
	BlockchainIsSmartContractResponse
	BlockchainSaveCompiledCodeRequest
	BlockchainSaveCompiledCodeResponse
	BlockchainGetCompiledCodeRequest
	BlockchainGetCompiledCodeResponse
	DiagnoseWaitRequest
	DiagnoseWaitResponse
	VersionRequest
	VersionResponse
	UndefinedRequestOrResponse
	LastKind
)

type MessageReplier

type MessageReplier func(MessageHandler) MessageHandler

MessageReplier is a callback signature

func CreateReplySlots

func CreateReplySlots(noopReplier MessageReplier) []MessageReplier

CreateReplySlots creates a slice of no-operation repliers, to be substituted with actual repliers (by message listeners)

type MessageStop

type MessageStop struct {
	Message
}

MessageStop is a message sent by Node to stop VM

func NewMessageStop

func NewMessageStop() *MessageStop

NewMessageStop creates a new message

type MessageVersionRequest

type MessageVersionRequest struct {
	Message
}

MessageVersionRequest is a version request message (from the Node)

func NewMessageVersionRequest

func NewMessageVersionRequest() *MessageVersionRequest

NewMessageVersionRequest creates a MessageVersionRequest

type MessageVersionResponse

type MessageVersionResponse struct {
	Message
	Version string
}

MessageVersionResponse is a version response message (from VM)

func NewMessageVersionResponse

func NewMessageVersionResponse(version string) *MessageVersionResponse

NewMessageVersionResponse creates a MessageVersionResponse

type Messenger

type Messenger struct {
	Name  string
	Nonce uint32
	// contains filtered or unexported fields
}

Messenger intermediates communication (message exchange) via pipes

func NewMessenger

func NewMessenger(name string, receiver *Receiver, sender *Sender) *Messenger

NewMessenger creates a new messenger

func NewMessengerPipes

func NewMessengerPipes(name string, reader *os.File, writer *os.File, marshalizer marshaling.Marshalizer) *Messenger

NewMessengerPipes creates a new messenger from pipes

func (*Messenger) Receive

func (messenger *Messenger) Receive(timeout int) (MessageHandler, error)

Receive receives a message, reads it from the pipe

func (*Messenger) Reset

func (messenger *Messenger) Reset()

Reset resets the messenger

func (*Messenger) ResetDialogue

func (messenger *Messenger) ResetDialogue()

ResetDialogue resets the dialogue nonce

func (*Messenger) Send

func (messenger *Messenger) Send(message MessageHandler) error

Send sends a message over the pipe

func (*Messenger) Shutdown

func (messenger *Messenger) Shutdown()

Shutdown closes the pipes

type Receiver

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

Receiver intermediates communication (message receiving) via pipes

func NewReceiver

func NewReceiver(reader *os.File, marshalizer marshaling.Marshalizer) *Receiver

NewReceiver creates a new receiver

func (*Receiver) Receive

func (receiver *Receiver) Receive(timeout int) (MessageHandler, int, error)

Receive receives a message, reads it from the pipe

func (*Receiver) Shutdown

func (receiver *Receiver) Shutdown() error

Shutdown closes the pipe

type Sender

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

Sender intermediates communication (message sending) via pipes

func NewSender

func NewSender(writer *os.File, marshalizer marshaling.Marshalizer) *Sender

NewSender creates a new sender

func (*Sender) Send

func (sender *Sender) Send(message MessageHandler) (int, error)

Send sends a message over the pipe

func (*Sender) Shutdown

func (sender *Sender) Shutdown() error

Shutdown closes the pipe

type SerializableMapStringBytes

type SerializableMapStringBytes struct {
	Keys   [][]byte
	Values [][]byte
}

func NewSerializableMapStringBytes

func NewSerializableMapStringBytes(data map[string][]byte) *SerializableMapStringBytes

func (*SerializableMapStringBytes) ConvertToMap

func (s *SerializableMapStringBytes) ConvertToMap() map[string][]byte

type SerializableOutputAccount

type SerializableOutputAccount struct {
	Address             []byte
	Nonce               uint64
	Balance             *big.Int
	BalanceDelta        *big.Int
	StorageUpdates      []*vmcommon.StorageUpdate
	Code                []byte
	CodeMetadata        []byte
	GasUsed             uint64
	Transfers           []SerializableOutputTransfer
	CodeDeployerAddress []byte
}

func NewSerializableOutputAccount

func NewSerializableOutputAccount(account *vmcommon.OutputAccount) *SerializableOutputAccount

func (*SerializableOutputAccount) ConvertToOutputAccount

func (a *SerializableOutputAccount) ConvertToOutputAccount() *vmcommon.OutputAccount

type SerializableOutputTransfer

type SerializableOutputTransfer struct {
	Value         *big.Int
	Data          []byte
	GasLimit      uint64
	GasLocked     uint64
	CallType      vm.CallType
	SenderAddress []byte
}

type SerializableVMOutput

type SerializableVMOutput struct {
	ReturnData              [][]byte
	ReturnCode              vmcommon.ReturnCode
	ReturnMessage           string
	GasRemaining            uint64
	GasRefund               *big.Int
	CorrectedOutputAccounts []*SerializableOutputAccount
	DeletedAccounts         [][]byte
	TouchedAccounts         [][]byte
	Logs                    []*vmcommon.LogEntry
}

func NewSerializableVMOutput

func NewSerializableVMOutput(vmOutput *vmcommon.VMOutput) *SerializableVMOutput

func (*SerializableVMOutput) ConvertToVMOutput

func (o *SerializableVMOutput) ConvertToVMOutput() *vmcommon.VMOutput

type UndefinedMessage

type UndefinedMessage struct {
	Message
}

UndefinedMessage is an undefined message

func NewUndefinedMessage

func NewUndefinedMessage() *UndefinedMessage

NewUndefinedMessage creates an undefined message

type VMArguments added in v1.2.50

type VMArguments struct {
	vmhost.VMHostParameters
	LogsMarshalizer     marshaling.MarshalizerKind
	MessagesMarshalizer marshaling.MarshalizerKind
}

VMArguments represents the initialization arguments required by VM, passed through the initialization pipe

func GetVMArguments added in v1.2.50

func GetVMArguments(pipe *os.File) (*VMArguments, error)

GetVMArguments reads initialization arguments from the pipe

Jump to

Keyboard shortcuts

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