stacktrace

package
v1.3.4 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2022 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	INVALID_OPCODE vm.OpCode = 0xfe
)

Variables

View Source
var (
	EnableDebugLogging bool = false
)
View Source
var (
	ErrNotExist = errors.New("contract does not exist")
)

Functions

This section is empty.

Types

type ABI

type ABI struct {
	Constructor Method
	Methods     map[string]Method
	Events      map[string]Event
}

type AccountID

type AccountID string

type Argument

type Argument struct {
	Name    string
	Type    Type
	Indexed bool // indexed is only used by events
}

type Arguments

type Arguments []Argument

type ArgumentsString

type ArgumentsString struct {
	Position int    `json:"position"`
	Value    string `json:"value"`
}

type ArgumentsUint

type ArgumentsUint struct {
	Position int `json:"position"`
	Value    int `json:"value"`
}

type Contract

type Contract struct {
	ID ContractID

	AccountID *AccountID `json:"account_id"`

	Name                string     `json:"contract_name"`
	LowercaseName       string     `json:"lowercase_contract_name"`
	Abi                 string     `json:"abi"`
	Bytecode            string     `json:"bytecode"`
	SourceMap           string     `json:"source_map"`
	Source              string     `json:"source"`
	NumberOfExceptions  int        `json:"number_of_exceptions"`
	LastEventOccurredAt *time.Time `json:"last_event_occurred_at"`

	VerificationDate time.Time `json:"verification_date"`
	CreatedAt        time.Time `json:"created_at"`
}

type ContractAddress

type ContractAddress string

func NewContractAddress

func NewContractAddress(address string) ContractAddress

func (ContractAddress) String

func (address ContractAddress) String() string

type ContractDetails

type ContractDetails struct {
	ID   ContractID
	Name string
	Hash string

	Bytecode         []byte
	DeployedByteCode string

	Abi interface{}

	Source    string
	SourceMap SourceMap
	ProjectID string
}

type ContractID

type ContractID string

func (ContractID) String

func (id ContractID) String() string

type ContractSource

type ContractSource interface {
	Get(id string) (*ContractDetails, error)
}

type ContractStack

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

func NewContractStack

func NewContractStack(initialContract *ContractDetails) *ContractStack

func (*ContractStack) Get

func (cs *ContractStack) Get() *ContractDetails

func (*ContractStack) Pop

func (cs *ContractStack) Pop()

func (*ContractStack) Push

func (cs *ContractStack) Push(contract *ContractDetails)

type Core

type Core struct {
	Contracts ContractSource
	// contains filtered or unexported fields
}

func NewCore

func NewCore(contracts ContractSource) *Core

func (*Core) GenerateStackTrace

func (c *Core) GenerateStackTrace(contractHash string, txTrace types.TransactionStates) ([]*StackFrame, error)

Process a single transaction @TODO: remove client!

func (*Core) Listen

func (c *Core) Listen()

Listen on the provided transaction channel and parse traces

type DecodedArgument

type DecodedArgument struct {
	Soltype Argument
	Value   interface{}
}

type DecodedCallData

type DecodedCallData struct {
	Signature string
	Name      string
	Inputs    []DecodedArgument
}

type DeploymentInformation

type DeploymentInformation struct {
	NetworkID NetworkID       `json:"network_id"`
	Address   ContractAddress `json:"address"`
}

func (DeploymentInformation) String

func (deployment DeploymentInformation) String() string

type Event

type Event struct {
	Name      string
	Anonymous bool
	Inputs    Arguments
}

type Exception

type Exception struct {
	ContractID ContractID `json:"contract_id"`

	BlockNumber   int64  `json:"block_number"`
	TransactionID string `json:"transaction_id"`

	Method     string
	Parameters []DecodedArgument

	StackTrace []*StackFrame

	CreatedAt time.Time

	Projects []string
}

type Frame

type Frame struct {
	File   string `json:"file"`
	Line   int    `json:"line"`
	Column int    `json:"column"`

	Start  int `json:"start"`
	Length int `json:"length"`

	Text string `json:"text"`

	Op string `json:"op"`

	State   *types.EvmState
	Mapping *InstructionMapping
}

func (Frame) String

func (frame Frame) String() string

type InstructionMapping

type InstructionMapping struct {
	Start  int
	Length int

	// WHAT WE REALLY NEED
	Line   int
	Column int

	FileIndex int
	Jump      string
}

type Method

type Method struct {
	Name    string
	Const   bool
	Inputs  Arguments
	Outputs Arguments
}

type NetworkID

type NetworkID string

type SourceMap

type SourceMap map[int]*InstructionMapping

SourceMap is the memory address to instruction information map.

func ParseSourceMap

func ParseSourceMap(sourceMap string, source string, bytecode string) (*SourceMap, error)

type StackFrame

type StackFrame struct {
	ContractAddress ContractAddress `json:"contract"`
	ContractName    string          `json:"name"`
	Line            int             `json:"line"`

	Code   string `json:"code"`
	Op     string `json:"op"`
	Start  int    `json:"start"`
	Length int    `json:"length"`
}

@TODO: Figure out if this is how we want to name it.

func (StackFrame) String

func (f StackFrame) String() string

type StackTrace

type StackTrace struct {
	Frames []*Frame
}

func (*StackTrace) PopFrame

func (st *StackTrace) PopFrame() *Frame

func (*StackTrace) PushFrame

func (st *StackTrace) PushFrame(frame *Frame)

type TenderlyContractSource

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

func (*TenderlyContractSource) Get

type Type

type Type struct {
	Elem *Type

	Kind reflect.Kind
	Type reflect.Type
	Size int
	T    byte // Our own type checking
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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