runtime

package
v0.1.24 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2023 License: Apache-2.0 Imports: 33 Imported by: 0

Documentation

Index

Constants

View Source
const TxRevertErrPrefix = "reverted: "

Variables

This section is empty.

Functions

func DecodeAccountsEvent

func DecodeAccountsEvent(event *nodeapi.RuntimeEvent) ([]accounts.Event, error)

func DecodeConsensusAccountsEvent

func DecodeConsensusAccountsEvent(event *nodeapi.RuntimeEvent) ([]consensusaccounts.Event, error)

func DecodeCoreEvent

func DecodeCoreEvent(event *nodeapi.RuntimeEvent) ([]core.Event, error)

func DecodeEVMEvent

func DecodeEVMEvent(event *nodeapi.RuntimeEvent) ([]evm.Event, error)

func NewRuntimeAnalyzer

func NewRuntimeAnalyzer(
	runtime common.Runtime,
	runtimeMetadata *sdkConfig.ParaTime,
	blockRange config.BlockRange,
	batchSize uint64,
	mode analyzer.BlockAnalysisMode,
	sourceClient nodeapi.RuntimeApiLite,
	target storage.TargetStorage,
	logger *log.Logger,
) (analyzer.Analyzer, error)

NewRuntimeAnalyzer returns a new runtime analyzer for a runtime.

func VisitCall

func VisitCall(call *sdkTypes.Call, result *sdkTypes.CallResult, handler *CallHandler) error

func VisitEVMEvent

func VisitEVMEvent(event *evm.Event, handler *EVMEventHandler) error

func VisitSdkEvent

func VisitSdkEvent(event *nodeapi.RuntimeEvent, handler *SdkEventHandler) error

func VisitSdkEvents

func VisitSdkEvents(events []nodeapi.RuntimeEvent, handler *SdkEventHandler) error

Types

type AddressPreimageData

type AddressPreimageData struct {
	ContextIdentifier string
	ContextVersion    int
	Data              []byte
}

type BlockData

type BlockData struct {
	Header              nodeapi.RuntimeBlockHeader
	NumTransactions     int // Might be different from len(TransactionData) if some transactions are malformed.
	GasUsed             uint64
	Size                int
	TransactionData     []*BlockTransactionData
	EventData           []*EventData
	AddressPreimages    map[apiTypes.Address]*AddressPreimageData
	TokenBalanceChanges map[TokenChangeKey]*big.Int
	PossibleTokens      map[apiTypes.Address]*evm.EVMPossibleToken // key is oasis bech32 address
	PossibleNFTs        map[NFTKey]*PossibleNFT
}

func ExtractRound

func ExtractRound(blockHeader nodeapi.RuntimeBlockHeader, txrs []nodeapi.RuntimeTransactionWithResults, rawEvents []nodeapi.RuntimeEvent, logger *log.Logger) (*BlockData, error)

type BlockTransactionData

type BlockTransactionData struct {
	Index                   int
	Hash                    string
	EthHash                 *string
	GasUsed                 uint64
	Size                    int
	Raw                     []byte
	RawResult               []byte
	SignerData              []*BlockTransactionSignerData
	RelatedAccountAddresses map[apiTypes.Address]bool
	Fee                     common.BigInt
	GasLimit                uint64
	Method                  string
	Body                    interface{}
	ContractCandidate       *apiTypes.Address // If non-nil, an address that was encountered in the tx and might be a contract.
	To                      *apiTypes.Address // Extracted from the body for convenience. Semantics vary by tx type.
	Amount                  *common.BigInt    // Extracted from the body for convenience. Semantics vary by tx type.
	EVMEncrypted            *evm.EVMEncryptedData
	EVMContract             *evm.EVMContractData
	Success                 *bool
	Error                   *TxError
}

type BlockTransactionSignerData

type BlockTransactionSignerData struct {
	Index   int
	Address apiTypes.Address
	Nonce   int
}

type CallHandler

type CallHandler struct {
	AccountsTransfer            func(body *accounts.Transfer) error
	ConsensusAccountsDeposit    func(body *consensusaccounts.Deposit) error
	ConsensusAccountsWithdraw   func(body *consensusaccounts.Withdraw) error
	ConsensusAccountsDelegate   func(body *consensusaccounts.Delegate) error
	ConsensusAccountsUndelegate func(body *consensusaccounts.Undelegate) error
	EVMCreate                   func(body *evm.Create, ok *[]byte) error
	EVMCall                     func(body *evm.Call, ok *[]byte) error
	UnknownMethod               func(methodName string) error // Invoked for a tx call that doesn't map to any of the above method names.
}

type EVMEventHandler

type EVMEventHandler struct {
	ERC20Transfer        func(from ethCommon.Address, to ethCommon.Address, value *big.Int) error
	ERC20Approval        func(owner ethCommon.Address, spender ethCommon.Address, value *big.Int) error
	ERC721Transfer       func(from ethCommon.Address, to ethCommon.Address, tokenID *big.Int) error
	ERC721Approval       func(owner ethCommon.Address, approved ethCommon.Address, tokenID *big.Int) error
	ERC721ApprovalForAll func(owner ethCommon.Address, operator ethCommon.Address, approved bool) error
}

type EventBody

type EventBody interface{}

type EventData

type EventData struct {
	TxIndex          *int    // nil for non-tx events
	TxHash           *string // nil for non-tx events
	TxEthHash        *string // nil for non-evm-tx events
	Type             apiTypes.RuntimeEventType
	Body             EventBody
	WithScope        ScopedSdkEvent
	EvmLogName       string
	EvmLogSignature  ethCommon.Hash
	EvmLogParams     []*apiTypes.EvmEventParam
	RelatedAddresses map[apiTypes.Address]bool
}

type NFTKey added in v0.1.16

type NFTKey struct {
	TokenAddress apiTypes.Address
	TokenID      *big.Int
}

type PossibleNFT added in v0.1.17

type PossibleNFT struct {
	NewOwner     *apiTypes.Address
	NumTransfers int
}

type ScopedSdkEvent

type ScopedSdkEvent struct {
	Core              *core.Event
	Accounts          *accounts.Event
	ConsensusAccounts *consensusaccounts.Event
	EVM               *sdkEVM.Event
}

ScopedSdkEvent is a one-of container for SDK events.

type SdkEventHandler

type SdkEventHandler struct {
	Core              func(event *core.Event) error
	Accounts          func(event *accounts.Event) error
	ConsensusAccounts func(event *consensusaccounts.Event) error
	EVM               func(event *evm.Event) error
}

type TokenChangeKey

type TokenChangeKey struct {
	// TokenAddress is the Oasis address of the smart contract of the
	// compatible (e.g. ERC-20) token.
	TokenAddress apiTypes.Address
	// AccountAddress is the Oasis address of the owner of some amount of the
	// compatible (e.g. ERC-20) token.
	AccountAddress apiTypes.Address
}

type TxError

type TxError struct {
	Code   uint32
	Module string
	// The raw error message returned by the node. Note that this may be null.
	// https://github.com/oasisprotocol/oasis-sdk/blob/fb741678585c04fdb413441f2bfba18aafbf98f3/client-sdk/go/types/transaction.go#L488-L492
	RawMessage *string
	// The human-readable error message parsed from RawMessage.
	Message *string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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