versions

package
v1.11.1 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2025 License: MIT, MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUnknownVersion      = errors.New("unknown version")
	ErrJsonNotSupported    = errors.New("json not supported")
	ErrUnsupportedMipsArch = errors.New("mips architecture is not supported")
)

Functions

This section is empty.

Types

type StateVersion

type StateVersion uint8
const (
	// VersionSingleThreaded is the version of the Cannon STF found in op-contracts/v1.6.0 - https://github.com/ethereum-optimism/optimism/blob/op-contracts/v1.6.0/packages/contracts-bedrock/src/cannon/MIPS.sol
	VersionSingleThreaded StateVersion = iota
	// VersionMultiThreaded is the original implementation of 32-bit multithreaded cannon, tagged at cannon/v1.3.0
	VersionMultiThreaded
	// VersionSingleThreaded2 is based on VersionSingleThreaded with the addition of support for fcntl(F_GETFD) syscall
	// This is the latest 32-bit single-threaded vm
	VersionSingleThreaded2
	// VersionMultiThreaded64 is the original 64-bit MTCannon implementation (pre-audit), tagged at cannon/v1.2.0
	VersionMultiThreaded64
	// VersionMultiThreaded64_v2 includes an audit fix to ensure futex values are always 32-bit, tagged at cannon/v1.3.0
	VersionMultiThreaded64_v2
	// VersionMultiThreaded_v2 is the latest 32-bit multithreaded vm
	VersionMultiThreaded_v2
	// VersionMultiThreaded64_v3 is the latest 64-bit multithreaded vm
	VersionMultiThreaded64_v3
)

func DetectVersion

func DetectVersion(path string) (StateVersion, error)

func ParseStateVersion

func ParseStateVersion(ver string) (StateVersion, error)

func (StateVersion) String

func (s StateVersion) String() string

type VersionedState

type VersionedState struct {
	Version StateVersion
	mipsevm.FPVMState
}

VersionedState deserializes a FPVMState and implements VersionedState based on the version of that state. It does this based on the version byte read in Deserialize

func LoadStateFromFile

func LoadStateFromFile(path string) (*VersionedState, error)

func NewFromState

func NewFromState(state mipsevm.FPVMState) (*VersionedState, error)

func (*VersionedState) Deserialize

func (s *VersionedState) Deserialize(in io.Reader) error

func (*VersionedState) MarshalJSON

func (s *VersionedState) MarshalJSON() ([]byte, error)

MarshalJSON marshals the underlying state without adding version prefix. JSON states are always assumed to be single threaded

func (*VersionedState) Serialize

func (s *VersionedState) Serialize(w io.Writer) error

Jump to

Keyboard shortcuts

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