vm

package
v0.11.7 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func JunoAppendActualFee added in v0.6.0

func JunoAppendActualFee(readerHandle C.uintptr_t, ptr unsafe.Pointer)

func JunoAppendDataGasConsumed added in v0.11.0

func JunoAppendDataGasConsumed(readerHandle C.uintptr_t, ptr unsafe.Pointer)

func JunoAppendResponse

func JunoAppendResponse(readerHandle C.uintptr_t, ptr unsafe.Pointer)

func JunoAppendTrace added in v0.6.0

func JunoAppendTrace(readerHandle C.uintptr_t, jsonBytes *C.void, bytesLen C.size_t)

func JunoFree

func JunoFree(ptr unsafe.Pointer)

func JunoReportError

func JunoReportError(readerHandle C.uintptr_t, txnIndex C.long, str *C.char)

func JunoStateGetClassHashAt

func JunoStateGetClassHashAt(readerHandle C.uintptr_t, contractAddress unsafe.Pointer) unsafe.Pointer

func JunoStateGetCompiledClass

func JunoStateGetCompiledClass(readerHandle C.uintptr_t, classHash unsafe.Pointer) unsafe.Pointer

func JunoStateGetNonceAt

func JunoStateGetNonceAt(readerHandle C.uintptr_t, contractAddress unsafe.Pointer) unsafe.Pointer

func JunoStateGetStorageAt

func JunoStateGetStorageAt(readerHandle C.uintptr_t, contractAddress, storageLocation unsafe.Pointer) unsafe.Pointer

Types

type BlockInfo added in v0.11.0

type BlockInfo struct {
	Header                *core.Header
	BlockHashToBeRevealed *felt.Felt
}

type CallInfo added in v0.11.0

type CallInfo struct {
	ContractAddress *felt.Felt
	ClassHash       *felt.Felt
	Selector        *felt.Felt
	Calldata        []felt.Felt
}

type ComputationResources added in v0.11.0

type ComputationResources struct {
	Steps        uint64 `json:"steps"`
	MemoryHoles  uint64 `json:"memory_holes,omitempty"`
	Pedersen     uint64 `json:"pedersen_builtin_applications,omitempty"`
	RangeCheck   uint64 `json:"range_check_builtin_applications,omitempty"`
	Bitwise      uint64 `json:"bitwise_builtin_applications,omitempty"`
	Ecdsa        uint64 `json:"ecdsa_builtin_applications,omitempty"`
	EcOp         uint64 `json:"ec_op_builtin_applications,omitempty"`
	Keccak       uint64 `json:"keccak_builtin_applications,omitempty"`
	Poseidon     uint64 `json:"poseidon_builtin_applications,omitempty"`
	SegmentArena uint64 `json:"segment_arena_builtin,omitempty"`
}

type DataAvailability added in v0.11.0

type DataAvailability struct {
	L1Gas     uint64 `json:"l1_gas"`
	L1DataGas uint64 `json:"l1_data_gas"`
}

func NewDataAvailability added in v0.11.1

func NewDataAvailability(gasConsumed, dataGasConsumed *felt.Felt, mode core.L1DAMode) *DataAvailability

type DataAvailabilityMode added in v0.8.0

type DataAvailabilityMode uint32
const (
	DAModeL1 DataAvailabilityMode = iota
	DAModeL2
)

func (DataAvailabilityMode) MarshalText added in v0.11.0

func (m DataAvailabilityMode) MarshalText() ([]byte, error)

type DeclaredClass added in v0.9.3

type DeclaredClass struct {
	ClassHash         felt.Felt `json:"class_hash"`
	CompiledClassHash felt.Felt `json:"compiled_class_hash"`
}

type DeployedContract added in v0.9.3

type DeployedContract struct {
	Address   felt.Felt `json:"address"`
	ClassHash felt.Felt `json:"class_hash"`
}

type Entry added in v0.9.3

type Entry struct {
	Key   felt.Felt `json:"key"`
	Value felt.Felt `json:"value"`
}

type ExecuteInvocation added in v0.9.3

type ExecuteInvocation struct {
	RevertReason        string `json:"revert_reason"`
	*FunctionInvocation `json:",omitempty"`
}

func (ExecuteInvocation) MarshalJSON added in v0.9.3

func (e ExecuteInvocation) MarshalJSON() ([]byte, error)

type ExecutionResources added in v0.9.3

type ExecutionResources struct {
	ComputationResources
	DataAvailability *DataAvailability `json:"data_availability,omitempty"`
}

type FunctionInvocation added in v0.9.3

type FunctionInvocation struct {
	ContractAddress    felt.Felt              `json:"contract_address"`
	EntryPointSelector *felt.Felt             `json:"entry_point_selector,omitempty"`
	Calldata           []felt.Felt            `json:"calldata"`
	CallerAddress      felt.Felt              `json:"caller_address"`
	ClassHash          *felt.Felt             `json:"class_hash,omitempty"`
	EntryPointType     string                 `json:"entry_point_type,omitempty"`
	CallType           string                 `json:"call_type,omitempty"`
	Result             []felt.Felt            `json:"result"`
	Calls              []FunctionInvocation   `json:"calls"`
	Events             []OrderedEvent         `json:"events"`
	Messages           []OrderedL2toL1Message `json:"messages"`
	ExecutionResources *ExecutionResources    `json:"execution_resources,omitempty"`
}

type Nonce added in v0.9.3

type Nonce struct {
	ContractAddress felt.Felt `json:"contract_address"`
	Nonce           felt.Felt `json:"nonce"`
}

type OrderedEvent added in v0.9.3

type OrderedEvent struct {
	Order uint64       `json:"order"`
	From  *felt.Felt   `json:"from_address,omitempty"`
	Keys  []*felt.Felt `json:"keys"`
	Data  []*felt.Felt `json:"data"`
}

type OrderedL2toL1Message added in v0.9.3

type OrderedL2toL1Message struct {
	Order   uint64       `json:"order"`
	From    *felt.Felt   `json:"from_address,omitempty"`
	To      string       `json:"to_address"` // todo: make common.Address after fixing starknet-api EthAddress serialisation
	Payload []*felt.Felt `json:"payload"`
}

type ReplacedClass added in v0.9.3

type ReplacedClass struct {
	ContractAddress felt.Felt `json:"contract_address"`
	ClassHash       felt.Felt `json:"class_hash"`
}

type Resource added in v0.8.0

type Resource uint32
const (
	ResourceL1Gas Resource = iota + 1
	ResourceL2Gas
)

func (Resource) MarshalText added in v0.8.0

func (r Resource) MarshalText() ([]byte, error)

type ResourceBounds added in v0.8.0

type ResourceBounds struct {
	MaxAmount       *felt.Felt `json:"max_amount"`
	MaxPricePerUnit *felt.Felt `json:"max_price_per_unit"`
}

type StateDiff added in v0.9.3

type StateDiff struct {
	StorageDiffs              []StorageDiff      `json:"storage_diffs"`
	Nonces                    []Nonce            `json:"nonces"`
	DeployedContracts         []DeployedContract `json:"deployed_contracts"`
	DeprecatedDeclaredClasses []*felt.Felt       `json:"deprecated_declared_classes"`
	DeclaredClasses           []DeclaredClass    `json:"declared_classes"`
	ReplacedClasses           []ReplacedClass    `json:"replaced_classes"`
}

type StorageDiff added in v0.9.3

type StorageDiff struct {
	Address        felt.Felt `json:"address"`
	StorageEntries []Entry   `json:"storage_entries"`
}

type Transaction added in v0.8.0

type Transaction struct {
	Version               *felt.Felt                   `json:"version,omitempty"`
	ContractAddress       *felt.Felt                   `json:"contract_address,omitempty"`
	ContractAddressSalt   *felt.Felt                   `json:"contract_address_salt,omitempty"`
	ClassHash             *felt.Felt                   `json:"class_hash,omitempty"`
	ConstructorCallData   *[]*felt.Felt                `json:"constructor_calldata,omitempty"`
	SenderAddress         *felt.Felt                   `json:"sender_address,omitempty"`
	MaxFee                *felt.Felt                   `json:"max_fee,omitempty"`
	Signature             *[]*felt.Felt                `json:"signature,omitempty"`
	CallData              *[]*felt.Felt                `json:"calldata,omitempty"`
	EntryPointSelector    *felt.Felt                   `json:"entry_point_selector,omitempty"`
	Nonce                 *felt.Felt                   `json:"nonce,omitempty"`
	CompiledClassHash     *felt.Felt                   `json:"compiled_class_hash,omitempty"`
	ResourceBounds        *map[Resource]ResourceBounds `json:"resource_bounds,omitempty"`
	Tip                   *felt.Felt                   `json:"tip,omitempty"`
	NonceDAMode           *DataAvailabilityMode        `json:"nonce_data_availability_mode,omitempty"`
	FeeDAMode             *DataAvailabilityMode        `json:"fee_data_availability_mode,omitempty"`
	AccountDeploymentData *[]*felt.Felt                `json:"account_deployment_data,omitempty"`
	PaymasterData         *[]*felt.Felt                `json:"paymaster_data,omitempty"`
}

type TransactionExecutionError added in v0.8.0

type TransactionExecutionError struct {
	Index uint64
	Cause error
}

func (TransactionExecutionError) Error added in v0.8.0

func (TransactionExecutionError) Unwrap added in v0.8.0

func (e TransactionExecutionError) Unwrap() error

type TransactionTrace added in v0.9.3

type TransactionTrace struct {
	Type                  TransactionType     `json:"type,omitempty"`
	ValidateInvocation    *FunctionInvocation `json:"validate_invocation,omitempty"`
	ExecuteInvocation     *ExecuteInvocation  `json:"execute_invocation,omitempty"`
	FeeTransferInvocation *FunctionInvocation `json:"fee_transfer_invocation,omitempty"`
	ConstructorInvocation *FunctionInvocation `json:"constructor_invocation,omitempty"`
	FunctionInvocation    *FunctionInvocation `json:"function_invocation,omitempty"`
	StateDiff             *StateDiff          `json:"state_diff,omitempty"`
	ExecutionResources    *ExecutionResources `json:"execution_resources,omitempty"`
}

func (*TransactionTrace) AllEvents added in v0.9.3

func (t *TransactionTrace) AllEvents() []OrderedEvent

func (*TransactionTrace) AllMessages added in v0.9.3

func (t *TransactionTrace) AllMessages() []OrderedL2toL1Message

func (*TransactionTrace) RevertReason added in v0.9.3

func (t *TransactionTrace) RevertReason() string

func (*TransactionTrace) TotalExecutionResources added in v0.9.3

func (t *TransactionTrace) TotalExecutionResources() *ExecutionResources

type TransactionType added in v0.9.3

type TransactionType uint8
const (
	Invalid TransactionType = iota
	TxnDeclare
	TxnDeploy
	TxnDeployAccount
	TxnInvoke
	TxnL1Handler
)

func (TransactionType) MarshalText added in v0.11.0

func (t TransactionType) MarshalText() ([]byte, error)

func (TransactionType) String added in v0.9.3

func (t TransactionType) String() string

func (*TransactionType) UnmarshalJSON added in v0.9.3

func (t *TransactionType) UnmarshalJSON(data []byte) error

type VM added in v0.5.0

type VM interface {
	Call(callInfo *CallInfo, blockInfo *BlockInfo, state core.StateReader, network *utils.Network, maxSteps uint64, useBlobData bool) ([]*felt.Felt, error) //nolint:lll
	Execute(txns []core.Transaction, declaredClasses []core.Class, paidFeesOnL1 []*felt.Felt, blockInfo *BlockInfo,
		state core.StateReader, network *utils.Network, skipChargeFee, skipValidate, errOnRevert, useBlobData bool,
	) ([]*felt.Felt, []*felt.Felt, []TransactionTrace, error)
}

func New added in v0.5.0

func New(log utils.SimpleLogger) VM

Jump to

Keyboard shortcuts

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