evm

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2025 License: LGPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var LatestFork = "cancun"

Functions

func AllForks added in v0.2.1

func AllForks() (names []string)

func ForksWhereOpAdded added in v0.2.0

func ForksWhereOpAdded(op string) []string

ForksWhereOpAdded returns the fork names where a given op is added. If this returns nil, op is invalid.

Types

type InstructionSet added in v0.2.0

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

InstructionSet is an EVM instruction set.

func FindInstructionSet added in v0.2.0

func FindInstructionSet(name string) *InstructionSet

FindInstructionSet resolves a fork name to a set of opcodes.

func (*InstructionSet) AllOps added in v0.2.1

func (is *InstructionSet) AllOps() []*Op

AllOps returns all operations.

func (*InstructionSet) ForkWhereOpRemoved added in v0.2.0

func (is *InstructionSet) ForkWhereOpRemoved(op string) string

ForkWhereOpRemoved returns the fork where a given op was removed from the instruction set. This is intended to be called when op is known to not exist. Note this will return an empty string in several cases:

  • op is invalid
  • op is valid, but does not appear in lineage of instruction set
  • op is valid and exists in instruction set

func (*InstructionSet) Name added in v0.2.0

func (is *InstructionSet) Name() string

Name returns the canonical instruction set name.

func (*InstructionSet) OpByCode added in v0.2.0

func (is *InstructionSet) OpByCode(code byte) *Op

OpByCode resolves an opcode by its code.

func (*InstructionSet) OpByName added in v0.2.0

func (is *InstructionSet) OpByName(opname string) *Op

OpByName resolves an opcode by its name. Name has to be all uppercase.

func (*InstructionSet) Parents added in v0.2.1

func (is *InstructionSet) Parents() []string

Parents returns the parent fork chain of the instruction set.

func (*InstructionSet) PushBySize added in v0.2.0

func (is *InstructionSet) PushBySize(size int) *Op

PushBySize resolves a push op by its size.

func (*InstructionSet) SupportsPush0 added in v0.2.0

func (is *InstructionSet) SupportsPush0() bool

SupportsPush0 reports whether the instruction set includes the PUSH0 instruction.

type InstructionSetDef added in v0.2.0

type InstructionSetDef struct {
	Names   []string // all names of this instruction set
	Parent  string
	Added   []*Op
	Removed []*Op
}

InstructionSetDef is the definition of an EVM instruction set.

func (*InstructionSetDef) Name added in v0.2.0

func (def *InstructionSetDef) Name() string

Name returns the canonical name.

type Op added in v0.2.0

type Op struct {
	Name string
	Code byte

	// Flags:
	// - Push is set for PUSHx
	// - Term is set for instructions that end execution
	// - Jump is set for all jumps
	// - Unconditional is set for unconditional jumps
	// - JumpDest is set for JUMPDEST
	Push, Term, Jump, Unconditional, JumpDest bool
}

Op is an EVM opcode.

func (Op) PushSize added in v0.2.1

func (op Op) PushSize() int

Jump to

Keyboard shortcuts

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