watcher

package
v0.19.9 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2021 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TypeOthers = uint32(1)
	TypeState  = uint32(2)
)
View Source
const FlagFastQuery = "fast-query"
View Source
const FlagFastQueryLru = "fast-lru"
View Source
const MsgFunctionDisable = "fast query function has been disabled"
View Source
const WatchDbDir = "data"

Variables

View Source
var (
	PrefixState = []byte{0x08}

	KeyLatestHeight = "LatestHeight"

	TransactionSuccess = uint32(1)
	TransactionFailed  = uint32(0)
)

Functions

func GetMsgAccountKey

func GetMsgAccountKey(addr []byte) []byte

func GetMsgStateKey

func GetMsgStateKey(addr common.Address, key []byte) []byte

func GetWatchLruSize

func GetWatchLruSize() int

func IsWatcherEnabled

func IsWatcherEnabled() bool

Types

type BlockNonce

type BlockNonce [8]byte

A BlockNonce is a 64-bit hash which proves (combined with the mix-hash) that a sufficient amount of computation has been carried out on a block.

func EncodeNonce

func EncodeNonce(i uint64) BlockNonce

EncodeNonce converts the given integer to a block nonce.

func (BlockNonce) MarshalText

func (n BlockNonce) MarshalText() ([]byte, error)

MarshalText encodes n as a hex string with 0x prefix.

func (BlockNonce) Uint64

func (n BlockNonce) Uint64() uint64

Uint64 returns the integer value of a block nonce.

func (*BlockNonce) UnmarshalText

func (n *BlockNonce) UnmarshalText(input []byte) error

UnmarshalText implements encoding.TextUnmarshaler.

type CodeInfo

type CodeInfo struct {
	Height uint64 `json:"height"`
	Code   string `json:"code"`
}

type EthBlock

type EthBlock struct {
	Number           hexutil.Uint64 `json:"number"`
	Hash             common.Hash    `json:"hash"`
	ParentHash       common.Hash    `json:"parentHash"`
	Nonce            BlockNonce     `json:"nonce"`
	UncleHash        common.Hash    `json:"sha3Uncles"`
	LogsBloom        ethtypes.Bloom `json:"logsBloom"`
	TransactionsRoot common.Hash    `json:"transactionsRoot"`
	StateRoot        common.Hash    `json:"stateRoot"`
	Miner            common.Address `json:"miner"`
	MixHash          common.Hash    `json:"mixHash"`
	Difficulty       hexutil.Uint64 `json:"difficulty"`
	TotalDifficulty  hexutil.Uint64 `json:"totalDifficulty"`
	ExtraData        hexutil.Bytes  `json:"extraData"`
	Size             hexutil.Uint64 `json:"size"`
	GasLimit         hexutil.Uint64 `json:"gasLimit"`
	GasUsed          *hexutil.Big   `json:"gasUsed"`
	Timestamp        hexutil.Uint64 `json:"timestamp"`
	Uncles           []common.Hash  `json:"uncles"`
	ReceiptsRoot     common.Hash    `json:"receiptsRoot"`
	Transactions     interface{}    `json:"transactions"`
}

type MsgAccount

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

func NewMsgAccount

func NewMsgAccount(acc auth.Account) *MsgAccount

func (*MsgAccount) GetKey

func (msgAccount *MsgAccount) GetKey() []byte

func (*MsgAccount) GetType

func (msgAccount *MsgAccount) GetType() uint32

func (*MsgAccount) GetValue

func (msgAccount *MsgAccount) GetValue() string

type MsgBlock

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

func NewMsgBlock

func NewMsgBlock(height uint64, blockBloom ethtypes.Bloom, blockHash common.Hash, header abci.Header, gasLimit uint64, gasUsed *big.Int, txs interface{}) *MsgBlock

func (MsgBlock) GetKey

func (m MsgBlock) GetKey() []byte

func (MsgBlock) GetType

func (m MsgBlock) GetType() uint32

func (MsgBlock) GetValue

func (m MsgBlock) GetValue() string

type MsgBlockInfo

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

func NewMsgBlockInfo

func NewMsgBlockInfo(height uint64, blockHash common.Hash) *MsgBlockInfo

func (MsgBlockInfo) GetKey

func (b MsgBlockInfo) GetKey() []byte

func (MsgBlockInfo) GetType

func (b MsgBlockInfo) GetType() uint32

func (MsgBlockInfo) GetValue

func (b MsgBlockInfo) GetValue() string

type MsgCode

type MsgCode struct {
	Key  []byte
	Code string
}

func NewMsgCode

func NewMsgCode(contractAddr common.Address, code []byte, height uint64) *MsgCode

func (MsgCode) GetKey

func (m MsgCode) GetKey() []byte

func (MsgCode) GetType

func (m MsgCode) GetType() uint32

func (MsgCode) GetValue

func (m MsgCode) GetValue() string

type MsgCodeByHash

type MsgCodeByHash struct {
	Key  []byte
	Code string
}

func NewMsgCodeByHash

func NewMsgCodeByHash(hash []byte, code []byte) *MsgCodeByHash

func (MsgCodeByHash) GetKey

func (m MsgCodeByHash) GetKey() []byte

func (MsgCodeByHash) GetType

func (m MsgCodeByHash) GetType() uint32

func (MsgCodeByHash) GetValue

func (m MsgCodeByHash) GetValue() string

type MsgContractBlockedListItem

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

func NewMsgContractBlockedListItem

func NewMsgContractBlockedListItem(addr sdk.AccAddress) *MsgContractBlockedListItem

func (*MsgContractBlockedListItem) GetKey

func (msgItem *MsgContractBlockedListItem) GetKey() []byte

func (*MsgContractBlockedListItem) GetType

func (msgItem *MsgContractBlockedListItem) GetType() uint32

func (*MsgContractBlockedListItem) GetValue

func (msgItem *MsgContractBlockedListItem) GetValue() string

type MsgContractDeploymentWhitelistItem

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

func NewMsgContractDeploymentWhitelistItem

func NewMsgContractDeploymentWhitelistItem(addr sdk.AccAddress) *MsgContractDeploymentWhitelistItem

func (*MsgContractDeploymentWhitelistItem) GetKey

func (msgItem *MsgContractDeploymentWhitelistItem) GetKey() []byte

func (*MsgContractDeploymentWhitelistItem) GetType

func (msgItem *MsgContractDeploymentWhitelistItem) GetType() uint32

func (*MsgContractDeploymentWhitelistItem) GetValue

func (msgItem *MsgContractDeploymentWhitelistItem) GetValue() string

type MsgEthTx

type MsgEthTx struct {
	Key       []byte
	JsonEthTx string
}

func NewMsgEthTx

func NewMsgEthTx(tx *types.MsgEthereumTx, txHash, blockHash common.Hash, height, index uint64) *MsgEthTx

func (MsgEthTx) GetKey

func (m MsgEthTx) GetKey() []byte

func (MsgEthTx) GetType

func (m MsgEthTx) GetType() uint32

func (MsgEthTx) GetValue

func (m MsgEthTx) GetValue() string

type MsgLatestHeight

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

func NewMsgLatestHeight

func NewMsgLatestHeight(height uint64) *MsgLatestHeight

func (MsgLatestHeight) GetKey

func (b MsgLatestHeight) GetKey() []byte

func (MsgLatestHeight) GetType

func (b MsgLatestHeight) GetType() uint32

func (MsgLatestHeight) GetValue

func (b MsgLatestHeight) GetValue() string

type MsgParams

type MsgParams struct {
	types.Params
}

func NewMsgParams

func NewMsgParams(params types.Params) *MsgParams

func (*MsgParams) GetKey

func (msgParams *MsgParams) GetKey() []byte

func (*MsgParams) GetType

func (msgParams *MsgParams) GetType() uint32

func (*MsgParams) GetValue

func (msgParams *MsgParams) GetValue() string

type MsgState

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

func NewMsgState

func NewMsgState(addr common.Address, key, value []byte) *MsgState

func (*MsgState) GetKey

func (msgState *MsgState) GetKey() []byte

func (*MsgState) GetType

func (msgState *MsgState) GetType() uint32

func (*MsgState) GetValue

func (msgState *MsgState) GetValue() string

type MsgTransactionReceipt

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

func NewMsgTransactionReceipt

func NewMsgTransactionReceipt(status uint32, tx *types.MsgEthereumTx, txHash, blockHash common.Hash, txIndex, height uint64, data *types.ResultData, cumulativeGas, GasUsed uint64) *MsgTransactionReceipt

func (MsgTransactionReceipt) GetKey

func (m MsgTransactionReceipt) GetKey() []byte

func (MsgTransactionReceipt) GetType

func (m MsgTransactionReceipt) GetType() uint32

func (MsgTransactionReceipt) GetValue

func (m MsgTransactionReceipt) GetValue() string

type Querier

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

func NewQuerier

func NewQuerier() *Querier

func (Querier) DeleteAccountFromRdb

func (q Querier) DeleteAccountFromRdb(addr sdk.AccAddress)

func (Querier) DeleteStateFromRdb

func (q Querier) DeleteStateFromRdb(addr common.Address, key []byte)

func (*Querier) Enable

func (q *Querier) Enable(sw bool)

func (Querier) GetAccount

func (q Querier) GetAccount(addr sdk.AccAddress) (*types.EthAccount, error)

func (Querier) GetAccountFromRdb

func (q Querier) GetAccountFromRdb(addr sdk.AccAddress) (*types.EthAccount, error)

func (Querier) GetBlockByHash

func (q Querier) GetBlockByHash(hash common.Hash, fullTx bool) (*EthBlock, error)

func (Querier) GetBlockByNumber

func (q Querier) GetBlockByNumber(number uint64, fullTx bool) (*EthBlock, error)

func (Querier) GetBlockHashByNumber

func (q Querier) GetBlockHashByNumber(number uint64) (common.Hash, error)

func (Querier) GetCode

func (q Querier) GetCode(contractAddr common.Address, height uint64) ([]byte, error)

func (Querier) GetCodeByHash

func (q Querier) GetCodeByHash(codeHash []byte) ([]byte, error)

func (Querier) GetLatestBlockNumber

func (q Querier) GetLatestBlockNumber() (uint64, error)

func (Querier) GetParams

func (q Querier) GetParams() (*evmtypes.Params, error)

func (Querier) GetState

func (q Querier) GetState(key []byte) ([]byte, error)

func (Querier) GetStateFromRdb

func (q Querier) GetStateFromRdb(key []byte) ([]byte, error)

func (Querier) GetTransactionByBlockHashAndIndex

func (q Querier) GetTransactionByBlockHashAndIndex(hash common.Hash, idx uint) (*rpctypes.Transaction, error)

func (Querier) GetTransactionByBlockNumberAndIndex

func (q Querier) GetTransactionByBlockNumberAndIndex(number uint64, idx uint) (*rpctypes.Transaction, error)

func (Querier) GetTransactionByHash

func (q Querier) GetTransactionByHash(hash common.Hash) (*rpctypes.Transaction, error)

func (Querier) GetTransactionReceipt

func (q Querier) GetTransactionReceipt(hash common.Hash) (*TransactionReceipt, error)

func (Querier) HasContractBlockedList

func (q Querier) HasContractBlockedList(key []byte) bool

func (Querier) HasContractDeploymentWhitelist

func (q Querier) HasContractDeploymentWhitelist(key []byte) bool

func (Querier) MustGetAccount

func (q Querier) MustGetAccount(addr sdk.AccAddress) (*types.EthAccount, error)

func (Querier) MustGetState

func (q Querier) MustGetState(addr common.Address, key []byte) ([]byte, error)

type TransactionReceipt

type TransactionReceipt struct {
	Status            hexutil.Uint64  `json:"status"`
	CumulativeGasUsed hexutil.Uint64  `json:"cumulativeGasUsed"`
	LogsBloom         ethtypes.Bloom  `json:"logsBloom"`
	Logs              []*ethtypes.Log `json:"logs"`
	TransactionHash   string          `json:"transactionHash"`
	ContractAddress   *common.Address `json:"contractAddress"`
	GasUsed           hexutil.Uint64  `json:"gasUsed"`
	BlockHash         string          `json:"blockHash"`
	BlockNumber       hexutil.Uint64  `json:"blockNumber"`
	TransactionIndex  hexutil.Uint64  `json:"transactionIndex"`
	From              string          `json:"from"`
	To                *common.Address `json:"to"`
}

type WatchMessage

type WatchMessage interface {
	GetKey() []byte
	GetValue() string
	GetType() uint32
}

type WatchStore

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

func InstanceOfWatchStore

func InstanceOfWatchStore() *WatchStore

func (WatchStore) Delete

func (w WatchStore) Delete(key []byte)

func (WatchStore) Get

func (w WatchStore) Get(key []byte) ([]byte, error)

func (WatchStore) Has

func (w WatchStore) Has(key []byte) bool

func (WatchStore) Set

func (w WatchStore) Set(key []byte, value []byte)

type Watcher

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

func NewWatcher

func NewWatcher() *Watcher

func (*Watcher) Commit

func (w *Watcher) Commit()

func (*Watcher) CommitAccountToRpcDb

func (w *Watcher) CommitAccountToRpcDb(account auth.Account)

func (*Watcher) CommitCodeHashToDb

func (w *Watcher) CommitCodeHashToDb(hash []byte, code []byte)

func (*Watcher) CommitStateToRpcDb

func (w *Watcher) CommitStateToRpcDb(addr common.Address, key, value []byte)

func (*Watcher) DeleteAccount

func (w *Watcher) DeleteAccount(addr sdk.AccAddress)

func (*Watcher) DeleteContractBlockedList

func (w *Watcher) DeleteContractBlockedList(addr sdk.AccAddress)

func (*Watcher) DeleteContractDeploymentWhitelist

func (w *Watcher) DeleteContractDeploymentWhitelist(addr sdk.AccAddress)

func (*Watcher) Enable

func (w *Watcher) Enable(sw bool)

func (*Watcher) Enabled

func (w *Watcher) Enabled() bool

func (*Watcher) ExecuteDelayEraseKey

func (w *Watcher) ExecuteDelayEraseKey()

func (*Watcher) Finalize

func (w *Watcher) Finalize()

func (*Watcher) IsFirstUse

func (w *Watcher) IsFirstUse() bool

func (*Watcher) NewHeight

func (w *Watcher) NewHeight(height uint64, blockHash common.Hash, header types.Header)

func (*Watcher) Reset

func (w *Watcher) Reset()

func (*Watcher) SaveAccount

func (w *Watcher) SaveAccount(account auth.Account, isDirectly bool)

func (*Watcher) SaveBlock

func (w *Watcher) SaveBlock(bloom ethtypes.Bloom)

func (*Watcher) SaveContractBlockedListItem

func (w *Watcher) SaveContractBlockedListItem(addr sdk.AccAddress)

func (*Watcher) SaveContractCode

func (w *Watcher) SaveContractCode(addr common.Address, code []byte)

func (*Watcher) SaveContractCodeByHash

func (w *Watcher) SaveContractCodeByHash(hash []byte, code []byte)

func (*Watcher) SaveContractDeploymentWhitelistItem

func (w *Watcher) SaveContractDeploymentWhitelistItem(addr sdk.AccAddress)

func (*Watcher) SaveEthereumTx

func (w *Watcher) SaveEthereumTx(msg evmtypes.MsgEthereumTx, txHash common.Hash, index uint64)

func (*Watcher) SaveLatestHeight

func (w *Watcher) SaveLatestHeight(height uint64)

func (*Watcher) SaveParams

func (w *Watcher) SaveParams(params evmtypes.Params)

func (*Watcher) SaveState

func (w *Watcher) SaveState(addr common.Address, key, value []byte)

func (*Watcher) SaveTransactionReceipt

func (w *Watcher) SaveTransactionReceipt(status uint32, msg evmtypes.MsgEthereumTx, txHash common.Hash, txIndex uint64, data *evmtypes.ResultData, gasUsed uint64)

func (*Watcher) UpdateBlockTxs

func (w *Watcher) UpdateBlockTxs(txHash common.Hash)

func (*Watcher) UpdateCumulativeGas

func (w *Watcher) UpdateCumulativeGas(txIndex, gasUsed uint64)

func (*Watcher) Used

func (w *Watcher) Used()

Jump to

Keyboard shortcuts

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