sealevel

package
v0.0.0-...-7621e06 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CUSyscallBaseCost = 100
	CUMemOpBaseCost   = 10
	CuCpiBytesPerUnit = 250
)
View Source
const ReallocAlign = 8

ReallocAlign is the byte amount by which the data following a realloc is aligned.

View Source
const ReallocSpace = 1024 * 10

ReallocSpace is the allowed length by which an account is allowed to grow.

Variables

View Source
var (
	ErrCopyOverlapping = errors.New("Overlapping copy")
)

Functions

func MemOpConsume

func MemOpConsume(cuIn int, n uint64) int

func SyscallAbortImpl

func SyscallAbortImpl(_ sbpf.VM, _ int) (r0 uint64, cuOut int, err error)

func SyscallLog64Impl

func SyscallLog64Impl(vm sbpf.VM, r1, r2, r3, r4, r5 uint64, cuIn int) (r0 uint64, cuOut int, err error)

func SyscallLogCUsImpl

func SyscallLogCUsImpl(vm sbpf.VM, cuIn int) (r0 uint64, cuOut int, err error)

func SyscallLogImpl

func SyscallLogImpl(vm sbpf.VM, ptr, strlen uint64, cuIn int) (r0 uint64, cuOut int, err error)

func SyscallLogPubkeyImpl

func SyscallLogPubkeyImpl(vm sbpf.VM, pubkeyAddr uint64, cuIn int) (r0 uint64, cuOut int, err error)

func SyscallMemcmpImpl

func SyscallMemcmpImpl(vm sbpf.VM, addr1, addr2, n, resultAddr uint64, cuIn int) (r0 uint64, cuOut int, err error)

SyscallMemcmpImpl is the implementation for the memcmp (sol_memcmp_) syscall.

func SyscallMemcpyImpl

func SyscallMemcpyImpl(vm sbpf.VM, dst, src, n uint64, cuIn int) (r0 uint64, cuOut int, err error)

SyscallMemcpyImpl is the implementation of the memcpy (sol_memcpy_) syscall. Overlapping src and dst for a given n bytes to be copied results in an error being returned.

func SyscallMemmoveImpl

func SyscallMemmoveImpl(vm sbpf.VM, dst, src, n uint64, cuIn int) (r0 uint64, cuOut int, err error)

SyscallMemmoveImpl is the implementation for the memmove (sol_memmove_) syscall.

func Syscalls

func Syscalls() sbpf.SyscallRegistry

Syscalls creates a registry of all Sealevel syscalls.

Types

type AccountParam

type AccountParam struct {
	IsDuplicate    bool
	DuplicateIndex uint8 // must not be 0xFF
	IsSigner       bool
	IsWritable     bool
	IsExecutable   bool
	Key            solana.PublicKey
	Owner          solana.PublicKey
	Lamports       uint64
	Data           []byte
	Padding        int // ignored, written by serializer
	RentEpoch      uint64
}

AccountParam is an account input to a program execution.

type Execution

type Execution struct {
	Log Logger
}

type LogRecorder

type LogRecorder struct {
	Logs []string
}

func (*LogRecorder) Log

func (r *LogRecorder) Log(s string)

type Logger

type Logger interface {
	Log(s string)
}

type Params

type Params struct {
	Accounts  []AccountParam
	Data      []byte // per-instruction data
	ProgramID solana.PublicKey
}

Params is the data passed to programs via the Sealevel VM input segment.

func (*Params) Serialize

func (p *Params) Serialize(buf *bytes.Buffer)

Serialize writes the params to the provided buffer.

func (*Params) Update

func (p *Params) Update(buf *bytes.Reader) error

Update writes data modified by a program back to the params struct.

type TxContext

type TxContext struct{}

Jump to

Keyboard shortcuts

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