common

package
v0.0.0-...-33e7cb4 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2023 License: GPL-3.0 Imports: 11 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 EnvVarArwenPath = "ARWEN_PATH"

EnvVarArwenPath is an environment variable

Variables

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

ErrArwenClosed signals a critical error

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

ErrArwenNotFound signals a critical error

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

ErrArwenTimeExpired signals a critical error

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

ErrBadArwenArguments signals a critical error

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

ErrBadHookResponseFromNode signals a critical error

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

ErrBadMessageFromArwen signals a critical error

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

ErrBadRequestFromNode 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("arwen will stop, as requested")}

ErrStopPerNodeRequest 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 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 SendArwenArguments

func SendArwenArguments(pipe *os.File, pipeArguments ArwenArguments) error

SendArwenArguments 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
	Code            []byte
}

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

func (*Account) AddressBytes

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

AddressBytes gets the address

func (*Account) GetBalance

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

GetBalance gets the balance

func (*Account) GetCode

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

GetCode gets the code

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

GetOwnerAddress gets the username

func (*Account) IsInterfaceNil

func (a *Account) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

type ArwenArguments

type ArwenArguments struct {
	arwen.VMHostParameters
	LogsMarshalizer     marshaling.MarshalizerKind
	MessagesMarshalizer marshaling.MarshalizerKind
}

ArwenArguments represents the initialization arguments required by Arwen, passed through the initialization pipe

func GetArwenArguments

func GetArwenArguments(pipe *os.File) (*ArwenArguments, error)

GetArwenArguments reads initialization arguments from the pipe

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 (*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
	AllState map[string][]byte
}

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 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 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
	VMOutput *vmcommon.VMOutput
}

MessageBlockchainProcessBuiltinFunctionResponse represents a response message

func NewMessageBlockchainProcessBuiltinFunctionResponse

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

NewMessageBlockchainProcessBuiltinFunctionResponse creates a response message

type MessageContractCallRequest

type MessageContractCallRequest struct {
	Message
	CallInput *vmcommon.ContractCallInput
}

MessageContractCallRequest is call request message (from Node)

func NewMessageContractCallRequest

func NewMessageContractCallRequest(input *vmcommon.ContractCallInput) *MessageContractCallRequest

NewMessageContractCallRequest creates a message

type MessageContractDeployRequest

type MessageContractDeployRequest struct {
	Message
	CreateInput *vmcommon.ContractCreateInput
}

MessageContractDeployRequest is deploy request message (from Node)

func NewMessageContractDeployRequest

func NewMessageContractDeployRequest(input *vmcommon.ContractCreateInput) *MessageContractDeployRequest

NewMessageContractDeployRequest creates a message

type MessageContractResponse

type MessageContractResponse struct {
	Message
	VMOutput *vmcommon.VMOutput
}

MessageContractResponse is a contract response message (from Arwen)

func NewMessageContractResponse

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

NewMessageContractResponse creates a message

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 Arwen)

func NewMessageDiagnoseWaitResponse

func NewMessageDiagnoseWaitResponse() *MessageDiagnoseWaitResponse

NewMessageDiagnoseWaitResponse creates a message

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 ArwenArguments
}

MessageInitialize is a message sent by Node to initialize Arwen

func NewMessageInitialize

func NewMessageInitialize(arguments ArwenArguments) *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 Arwen)

const (
	FirstKind MessageKind = iota
	Initialize
	Stop
	ContractDeployRequest
	ContractCallRequest
	ContractResponse
	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
	BlockchainGetBuiltinFunctionNamesRequest
	BlockchainGetBuiltinFunctionNamesResponse
	BlockchainGetAllStateRequest
	BlockchainGetAllStateResponse
	BlockchainGetUserAccountRequest
	BlockchainGetUserAccountResponse
	BlockchainGetShardOfAddressRequest
	BlockchainGetShardOfAddressResponse
	BlockchainIsSmartContractRequest
	BlockchainIsSmartContractResponse
	DiagnoseWaitRequest
	DiagnoseWaitResponse
	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 Arwen

func NewMessageStop

func NewMessageStop() *MessageStop

NewMessageStop creates a new message

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 UndefinedMessage

type UndefinedMessage struct {
	Message
}

UndefinedMessage is an undefined message

func NewUndefinedMessage

func NewUndefinedMessage() *UndefinedMessage

NewUndefinedMessage creates an undefined message

Jump to

Keyboard shortcuts

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