debug

package
v0.0.91 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2023 License: MIT Imports: 23 Imported by: 0

Documentation

Overview

Package debug is a common contract store for local stacktraces and remote stacktraces.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MakeClient

func MakeClient(rpcURL, chainID, projectSlug string, chainConfig *params.ChainConfig) (*ethereum.Client, error)

MakeClient makes a evm processor client project slug is optional.

Types

type Backend

type Backend interface {
	// RPCAddress is the rpc address
	RPCAddress() string
	// GetBigChainID gets the chainid
	GetBigChainID() *big.Int
}

Backend is the backend used for generating stack traces.

type ContractMetadata

type ContractMetadata struct {
	Compiler struct {
		Version string `json:"version"`
	} `json:"compiler"`
	Language string                 `json:"language"`
	Output   interface{}            `json:"output"`
	Settings ContractSettings       `json:"settings"`
	Sources  map[string]interface{} `json:"sources"`
	Version  int                    `json:"version"`
}

ContractMetadata is metadata produced by solc.

type ContractSettings

type ContractSettings struct {
	CompilationTarget map[string]string `json:"compilationTarget"`
	EvmVersion        string            `json:"evmVersion"`
	// TODO implement w/ ast
	Libraries struct{}          `json:"libraries"`
	Metadata  map[string]string `json:"metadata"`
	Optimizer struct {
		Enabled bool `json:"enabled"`
		Runs    int  `json:"runs"`
	} `json:"optimizer"`
	Remappings []interface{} `json:"remappings"`
}

ContractSettings outed by solc.

type ContractSource

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

ContractSource is a contract source for tenderly to pull from.

func NewContractSource

func NewContractSource() *ContractSource

NewContractSource creates a new contract source store.

func (*ContractSource) AddContract

func (c *ContractSource) AddContract(ctx context.Context, chn chain.Chain, contractType contracts.ContractType, contract contracts.DeployedContract) (resultingContract *providers.Contract, err error)

AddContract adds a contract to the deploy.

func (*ContractSource) FetchLocalContracts

func (c *ContractSource) FetchLocalContracts() (resContracts []providers.Contract)

FetchLocalContracts gets local contracts.

func (*ContractSource) Get

Get gets the stacktrace.

func (*ContractSource) GetContract

func (c *ContractSource) GetContract(id string) (*MappedContract, error)

GetContract gets the raw contract address.

type MappedContract

type MappedContract struct {
	*providers.Contract
	// DeployedSourceMap is the currently deployed source map
	DeployedSourceMap *stacktrace.SourceMap
	// ContractType is the raw contract type
	ContractType contracts.ContractType
}

MappedContract is the contract map.

type Provider

type Provider struct {
	// contractSource is the source of the contract
	*ContractSource
}

Provider provides stack trace errors.

func NewStackTraceProvider

func NewStackTraceProvider() *Provider

NewStackTraceProvider creates a new stack trace provider. Note: this currently doesn't work see: https://ethereum.stackexchange.com/questions/25479/how-to-map-evm-trace-to-contract-source for details. this will be fixed in a future version.

func (Provider) GenerateStackTrace

func (p Provider) GenerateStackTrace(backend Backend, tx *types.Transaction) (stackTrace string, err error)

GenerateStackTrace generates a stack trace for a failed tx.

Directories

Path Synopsis
Package tenderly handles interacting with tenderly for easier debugging.
Package tenderly handles interacting with tenderly for easier debugging.

Jump to

Keyboard shortcuts

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