coredebug

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2023 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultGasPrice = 200000000000

DefaultGasPrice is the default gas price for debugging

Variables

View Source
var ErrAccountDoesntExist = errors.New("account does not exist")

ErrAccountDoesntExist signals an error

View Source
var ErrInvalidArgumentEncoding = errors.New("invalid contract argument encoding")

ErrInvalidArgumentEncoding signals an error

Functions

This section is empty.

Types

type Account

type Account struct {
	AddressHex      string
	Nonce           uint64
	Balance         *big.Int
	CodeHex         string
	CodeMetadataHex string
	OwnerAddressHex string
	UserNameHex     string
	Storage         map[string]string
	ShardID         uint32
}

Account is a debug account

func NewAccount

func NewAccount(address []byte, nonce uint64, balance *big.Int) *Account

NewAccount creates a new debug account

func (*Account) AddressBytes

func (a *Account) AddressBytes() []byte

AddressBytes -

func (*Account) GetBalance

func (a *Account) GetBalance() *big.Int

GetBalance -

func (*Account) GetCode

func (a *Account) GetCode() []byte

GetCode -

func (*Account) GetCodeHash

func (a *Account) GetCodeHash() []byte

GetCodeHash -

func (*Account) GetCodeMetadata

func (a *Account) GetCodeMetadata() []byte

GetCodeMetadata -

func (*Account) GetDeveloperReward

func (a *Account) GetDeveloperReward() *big.Int

GetDeveloperReward -

func (*Account) GetNonce

func (a *Account) GetNonce() uint64

GetNonce -

func (*Account) GetOwnerAddress

func (a *Account) GetOwnerAddress() []byte

GetOwnerAddress -

func (*Account) GetRootHash

func (a *Account) GetRootHash() []byte

GetRootHash -

func (*Account) GetUserName

func (a *Account) GetUserName() []byte

GetOwnerAddress -

func (*Account) IsInterfaceNil

func (a *Account) IsInterfaceNil() bool

IsInterfaceNil -

type AccountsMap

type AccountsMap map[string]*Account

AccountsMap is a map from address to account

type BlockchainHookMock

type BlockchainHookMock struct {
	Accounts      AccountsMap
	BlockHash     []byte
	LNonce        uint64
	LRound        uint64
	CNonce        uint64
	CRound        uint64
	LTimeStamp    uint64
	CTimeStamp    uint64
	LRandomSeed   []byte
	CRandomSeed   []byte
	LEpoch        uint32
	CEpoch        uint32
	StateRootHash []byte
	Value         *big.Int
	Gas           uint64

	LastCreatedContractAddress []byte
}

BlockchainHookMock -

func NewBlockchainHookMock

func NewBlockchainHookMock() *BlockchainHookMock

NewBlockchainHookMock -

func (*BlockchainHookMock) AddAccount

func (b *BlockchainHookMock) AddAccount(account *Account)

AddAccount -

func (*BlockchainHookMock) AddAccounts

func (b *BlockchainHookMock) AddAccounts(accounts []*Account)

AddAccounts -

func (*BlockchainHookMock) CurrentEpoch

func (b *BlockchainHookMock) CurrentEpoch() uint32

CurrentEpoch -

func (*BlockchainHookMock) CurrentNonce

func (b *BlockchainHookMock) CurrentNonce() uint64

CurrentNonce -

func (*BlockchainHookMock) CurrentRandomSeed

func (b *BlockchainHookMock) CurrentRandomSeed() []byte

CurrentRandomSeed -

func (*BlockchainHookMock) CurrentRound

func (b *BlockchainHookMock) CurrentRound() uint64

CurrentRound -

func (*BlockchainHookMock) CurrentTimeStamp

func (b *BlockchainHookMock) CurrentTimeStamp() uint64

CurrentTimeStamp -

func (*BlockchainHookMock) GetAllState

func (b *BlockchainHookMock) GetAllState(address []byte) (map[string][]byte, error)

GetAllState -

func (*BlockchainHookMock) GetBlockhash

func (b *BlockchainHookMock) GetBlockhash(nonce uint64) ([]byte, error)

GetBlockhash -

func (*BlockchainHookMock) GetBuiltinFunctionNames

func (b *BlockchainHookMock) GetBuiltinFunctionNames() vmcommon.FunctionNames

GetBuiltinFunctionNames -

func (*BlockchainHookMock) GetShardOfAddress

func (b *BlockchainHookMock) GetShardOfAddress(address []byte) uint32

GetShardOfAddress -

func (*BlockchainHookMock) GetStateRootHash

func (b *BlockchainHookMock) GetStateRootHash() []byte

GetStateRootHash -

func (*BlockchainHookMock) GetStorageData

func (b *BlockchainHookMock) GetStorageData(address []byte, index []byte) ([]byte, error)

GetStorageData -

func (*BlockchainHookMock) GetUserAccount

func (b *BlockchainHookMock) GetUserAccount(address []byte) (vmcommon.UserAccountHandler, error)

GetUserAccount -

func (*BlockchainHookMock) IsPayable added in v0.0.2

func (b *BlockchainHookMock) IsPayable(address []byte) (bool, error)

IsSmartContract -

func (*BlockchainHookMock) IsSmartContract

func (b *BlockchainHookMock) IsSmartContract(address []byte) bool

IsSmartContract -

func (*BlockchainHookMock) LastEpoch

func (b *BlockchainHookMock) LastEpoch() uint32

LastEpoch -

func (*BlockchainHookMock) LastNonce

func (b *BlockchainHookMock) LastNonce() uint64

LastNonce -

func (*BlockchainHookMock) LastRandomSeed

func (b *BlockchainHookMock) LastRandomSeed() []byte

LastRandomSeed -

func (*BlockchainHookMock) LastRound

func (b *BlockchainHookMock) LastRound() uint64

LastRound -

func (*BlockchainHookMock) LastTimeStamp

func (b *BlockchainHookMock) LastTimeStamp() uint64

LastTimeStamp -

func (*BlockchainHookMock) NewAddress

func (b *BlockchainHookMock) NewAddress(creatorAddress []byte, creatorNonce uint64, vmType []byte) ([]byte, error)

NewAddress -

func (*BlockchainHookMock) ProcessBuiltInFunction

func (b *BlockchainHookMock) ProcessBuiltInFunction(input *vmcommon.ContractCallInput) (*vmcommon.VMOutput, error)

ProcessBuiltInFunction -

func (*BlockchainHookMock) UpdateAccounts

func (b *BlockchainHookMock) UpdateAccounts(outputAccounts map[string]*vmcommon.OutputAccount)

UpdateAccounts -

type ContractRequestBase

type ContractRequestBase struct {
	RequestBase
	ImpersonatedHex string
	Impersonated    []byte
	Value           string
	ValueAsBigInt   *big.Int
	GasPrice        uint64
	GasLimit        uint64
}

ContractRequestBase is a CLI / REST request message

type ContractResponseBase

type ContractResponseBase struct {
	ResponseBase
	Input            *vmcommon.VMInput
	Output           *vmcommon.VMOutput
	ReturnCodeString string
}

ContractResponseBase is a CLI / REST response message

type CreateAccountRequest

type CreateAccountRequest struct {
	RequestBase
	AddressHex      string
	Address         []byte
	Balance         string
	BalanceAsBigInt *big.Int
	Nonce           uint64
}

CreateAccountRequest is a CLI / REST request message

type CreateAccountResponse

type CreateAccountResponse struct {
	Account *Account
}

CreateAccountResponse is a CLI / REST response message

type DebugFacade

type DebugFacade struct {
}

DebugFacade is the debug facade

func NewDebugFacade

func NewDebugFacade() *DebugFacade

NewDebugFacade creates a new debug facade

func (*DebugFacade) CreateAccount

func (f *DebugFacade) CreateAccount(request CreateAccountRequest) (*CreateAccountResponse, error)

CreateAccount creates a test account

func (*DebugFacade) DeploySmartContract

func (f *DebugFacade) DeploySmartContract(request DeployRequest) (*DeployResponse, error)

DeploySmartContract deploys a smart contract

func (*DebugFacade) QuerySmartContract

func (f *DebugFacade) QuerySmartContract(request QueryRequest) (*QueryResponse, error)

QuerySmartContract queries a pure function of the smart contract

func (*DebugFacade) RunSmartContract

func (f *DebugFacade) RunSmartContract(request RunRequest) (*RunResponse, error)

RunSmartContract executes a smart contract function

func (*DebugFacade) UpgradeSmartContract

func (f *DebugFacade) UpgradeSmartContract(request UpgradeRequest) (*UpgradeResponse, error)

UpgradeSmartContract upgrades a smart contract

type DebugServer

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

DebugServer is the debugging server

func NewDebugServer

func NewDebugServer(facade *DebugFacade, address string) *DebugServer

NewDebugServer creates a Server object

func (*DebugServer) Start

func (server *DebugServer) Start() error

StartServer starts the debugging server

type DeployRequest

type DeployRequest struct {
	ContractRequestBase
	CodeHex           string
	Code              []byte
	CodePath          string
	CodeMetadata      string
	CodeMetadataBytes []byte
	ArgumentsHex      []string
	Arguments         [][]byte
}

DeployRequest is a CLI / REST request message

type DeployResponse

type DeployResponse struct {
	ContractResponseBase
	ContractAddress    []byte
	ContractAddressHex string
}

DeployResponse is a CLI / REST response message

type QueryRequest

type QueryRequest struct {
	RunRequest
}

QueryRequest is a CLI / REST request message

type QueryResponse

type QueryResponse struct {
	ContractResponseBase
}

QueryResponse is a CLI / REST response message

type RequestBase

type RequestBase struct {
	DatabasePath string
	World        string
	Outcome      string
}

RequestBase is a CLI / REST request message

type RequestError

type RequestError struct {
	Message  string
	InnerErr error
}

RequestError signals an error

func NewRequestError

func NewRequestError(message string) *RequestError

NewRequestError -

func NewRequestErrorInner

func NewRequestErrorInner(err error) *RequestError

NewRequestErrorInner -

func NewRequestErrorMessageInner

func NewRequestErrorMessageInner(message string, err error) *RequestError

NewRequestErrorMessageInner -

func (*RequestError) Error

func (err *RequestError) Error() string

func (*RequestError) Unwrap

func (err *RequestError) Unwrap() error

Unwrap unwraps the inner error

type ResponseBase

type ResponseBase struct {
	Error error
}

ResponseBase is a CLI / REST response message

type RunRequest

type RunRequest struct {
	ContractRequestBase
	ContractAddressHex string
	ContractAddress    []byte
	Function           string
	ArgumentsHex       []string
	Arguments          [][]byte
}

RunRequest is a CLI / REST request message

type RunResponse

type RunResponse struct {
	ContractResponseBase
}

RunResponse is a CLI / REST response message

type UpgradeRequest

type UpgradeRequest struct {
	DeployRequest
	ContractAddressHex string
	ContractAddress    []byte
}

UpgradeRequest is a CLI / REST request message

type UpgradeResponse

type UpgradeResponse struct {
	ContractResponseBase
}

UpgradeResponse is a CLI / REST response message

Jump to

Keyboard shortcuts

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