types

package
v0.4.6 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2024 License: Apache-2.0 Imports: 20 Imported by: 16

Documentation

Index

Constants

View Source
const (
	CheckTxType     = 1
	RpcType         = 2
	RunTxType       = 3
	HistoryOnlyType = 4
)
View Source
const (
	// ReceiptStatusFailed is the status code of a transaction if execution failed.
	ReceiptStatusFailed = uint64(0)

	// ReceiptStatusSuccessful is the status code of a transaction if execution succeeded.
	ReceiptStatusSuccessful = uint64(1)
)
View Source
const (
	BondStatusUnbonded = "Unbonded"
	BondStatusBonded   = "Bonded"
)
View Source
const ACCOUNT_KEY byte = 23
View Source
const ACCOUNT_NOT_EXIST int = 1026
View Source
const BYTECODE_KEY byte = 25
View Source
const CREATION_COUNTER_KEY byte = 21
View Source
const CURR_BLOCK_KEY byte = 29
View Source
const FAILED_TO_COMMIT int = 1025
View Source
const IGNORE_TOO_OLD_TX int = 1024
View Source
const TOO_OLD_THRESHOLD uint64 = 10
View Source
const TX_NONCE_TOO_LARGE int = 1029
View Source
const TX_NONCE_TOO_SMALL int = 1027
View Source
const VALUE_KEY byte = 27

Variables

View Source
var (
	ErrAccountNotExist        = errors.New("account does not exist")
	ErrNonceTooSmall          = errors.New("tx nonce is smaller than the account nonce")
	ErrSameNonceAlredyInBlock = errors.New("tx with same nonce already in block")
	ErrNonceTooLarge          = errors.New("tx nonce is larger than the account nonce")
	ErrTooManyEntries         = errors.New("too many candidicate entries to be returned, please limit the difference between startHeight and endHeight")
)
View Source
var (
	ErrAccNotFound         = errors.New("account not found")
	ErrCodeNotFound        = errors.New("code not found")
	ErrBadAccData          = errors.New("bad account data")
	ErrBadNonce            = errors.New("bad nonce")
	ErrBadGasPrice         = errors.New("bad gas price")
	ErrInsufficientBalance = errors.New("insufficient balance")
	ErrBlockNotFound       = errors.New("block not found")
	ErrTxNotFound          = errors.New("tx not found")
	ErrNoFromAddr          = errors.New("missing from address")
	ErrInvalidHeight       = errors.New("invalid height")
)
View Source
var StandbyTxQueueKey [8]byte = [8]byte{255, 255, 255, 255, 255, 255, 255, 0}

Functions

func FromGethAddreses

func FromGethAddreses(gethAddresses []gethcmn.Address) [][20]byte

func FromGethHashes

func FromGethHashes(gethHashes []gethcmn.Hash) [][32]byte

func GetAccountKey

func GetAccountKey(addr common.Address) []byte

func GetBytecodeKey

func GetBytecodeKey(addr common.Address) []byte

func GetCreationCounterKey

func GetCreationCounterKey(lsb uint8) []byte

func GetStandbyTxKey

func GetStandbyTxKey(num uint64) []byte

func GetValueKey

func GetValueKey(seq uint64, key string) []byte

func ToGethHashes

func ToGethHashes(rawHashes [][32]byte) []gethcmn.Hash

func ToGethLog

func ToGethLog(log Log) *gethtypes.Log

func ToGethLogs

func ToGethLogs(logs []Log) []*gethtypes.Log

Types

type AccountInfo

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

func NewAccountInfo

func NewAccountInfo(data []byte) *AccountInfo

func ZeroAccountInfo

func ZeroAccountInfo() *AccountInfo

func (*AccountInfo) Balance

func (info *AccountInfo) Balance() *uint256.Int

func (*AccountInfo) BalanceSlice

func (info *AccountInfo) BalanceSlice() []byte

func (*AccountInfo) Bytes

func (info *AccountInfo) Bytes() []byte

func (*AccountInfo) Nonce

func (info *AccountInfo) Nonce() uint64

func (*AccountInfo) NonceSlice

func (info *AccountInfo) NonceSlice() []byte

func (*AccountInfo) Sequence

func (info *AccountInfo) Sequence() uint64

func (*AccountInfo) SequenceSlice

func (info *AccountInfo) SequenceSlice() []byte

func (*AccountInfo) UpdateBalance

func (info *AccountInfo) UpdateBalance(newBalance *uint256.Int)

func (*AccountInfo) UpdateNonce

func (info *AccountInfo) UpdateNonce(newNonce uint64)

func (*AccountInfo) UpdateSequence

func (info *AccountInfo) UpdateSequence(newSeq uint64)

type AccountRWOp added in v0.4.0

type AccountRWOp struct {
	Addr    [20]byte `msg:"addr"`
	Account []byte   `msg:"account"`
}

func (*AccountRWOp) DecodeMsg added in v0.4.0

func (z *AccountRWOp) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (*AccountRWOp) EncodeMsg added in v0.4.0

func (z *AccountRWOp) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (*AccountRWOp) MarshalMsg added in v0.4.0

func (z *AccountRWOp) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*AccountRWOp) Msgsize added in v0.4.0

func (z *AccountRWOp) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*AccountRWOp) UnmarshalMsg added in v0.4.0

func (z *AccountRWOp) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type BasicTx

type BasicTx struct {
	From     common.Address
	To       common.Address
	Value    [32]byte
	GasPrice [32]byte
	Gas      uint64
	Data     []byte
	Nonce    uint64
}

type Block

type Block struct {
	Number           int64      `msg:"num"`     //the block number. Null when the returned block is the pending block.
	Hash             [32]byte   `msg:"hash"`    //32 Bytes - hash of the block. Null when the returned block is the pending block.
	ParentHash       [32]byte   `msg:"parent"`  //32 Bytes - hash of the parent block.
	LogsBloom        [256]byte  `msg:"bloom"`   // 256 Bytes - the bloom filter for the logs of the block. Null when the returned block is the pending block.
	TransactionsRoot [32]byte   `msg:"troot"`   // 32 Bytes - the root of the transaction trie of the block.
	StateRoot        [32]byte   `msg:"sroot"`   //32 Bytes - the root of the final state trie of the block.
	Miner            [20]byte   `msg:"miner"`   //20 Bytes - the address of the beneficiary to whom the mining rewards were given.
	Size             int64      `msg:"size"`    //integer the size of this block in bytes.
	GasUsed          uint64     `msg:"gasused"` //the total used gas by all transactions in this block.
	Timestamp        int64      `msg:"time"`    //the unix timestamp for when the block was collated.
	Transactions     [][32]byte `msg:"txs"`     //Array - Array of transaction objects, or 32 Bytes transaction hashes depending on the last given parameter.

}

BLOCK - A block object, or null when no block was found

func (*Block) DecodeMsg

func (z *Block) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (*Block) EncodeMsg

func (z *Block) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (*Block) FillBasicInfo

func (blk *Block) FillBasicInfo(bz []byte)

func (*Block) MarshalMsg

func (z *Block) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*Block) Msgsize

func (z *Block) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*Block) SerializeBasicInfo

func (blk *Block) SerializeBasicInfo() []byte

func (*Block) UnmarshalMsg

func (z *Block) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type BlockHashOp added in v0.4.0

type BlockHashOp struct {
	Height uint64   `msg:"height"`
	Hash   [32]byte `msg:"hash"`
}

func (*BlockHashOp) DecodeMsg added in v0.4.0

func (z *BlockHashOp) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (*BlockHashOp) EncodeMsg added in v0.4.0

func (z *BlockHashOp) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (*BlockHashOp) MarshalMsg added in v0.4.0

func (z *BlockHashOp) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*BlockHashOp) Msgsize added in v0.4.0

func (z *BlockHashOp) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*BlockHashOp) UnmarshalMsg added in v0.4.0

func (z *BlockHashOp) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type BlockInfo

type BlockInfo struct {
	Coinbase   [20]byte
	Hash       [32]byte
	Number     int64
	Timestamp  int64
	GasLimit   int64
	Difficulty [32]byte
	ChainId    [32]byte
}

type BondStatus

type BondStatus uint64

BondStatus is the status of a validator

func (BondStatus) String

func (b BondStatus) String() string

String implements the Stringer interface for BondStatus.

type BytecodeInfo

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

func NewBytecodeInfo

func NewBytecodeInfo(data []byte) *BytecodeInfo

func (*BytecodeInfo) BytecodeSlice

func (info *BytecodeInfo) BytecodeSlice() []byte

func (*BytecodeInfo) Bytes

func (info *BytecodeInfo) Bytes() []byte

func (*BytecodeInfo) CodeHashSlice

func (info *BytecodeInfo) CodeHashSlice() []byte

type BytecodeRWOp added in v0.4.0

type BytecodeRWOp struct {
	Addr     [20]byte `msg:"addr"`
	Bytecode []byte   `msg:"bytecode"`
}

func (*BytecodeRWOp) DecodeMsg added in v0.4.0

func (z *BytecodeRWOp) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (*BytecodeRWOp) EncodeMsg added in v0.4.0

func (z *BytecodeRWOp) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (*BytecodeRWOp) MarshalMsg added in v0.4.0

func (z *BytecodeRWOp) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*BytecodeRWOp) Msgsize added in v0.4.0

func (z *BytecodeRWOp) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*BytecodeRWOp) UnmarshalMsg added in v0.4.0

func (z *BytecodeRWOp) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type ChainEvent

type ChainEvent struct {
	BlockHeader *Header
	Block       *modbtypes.Block
	Hash        gethcmn.Hash
	Logs        []*gethtypes.Log
}
type ChainEvent struct {
	Block *types.Block
	Hash  common.Hash
	Logs  []*types.Log
}

func BlockToChainEvent added in v0.3.0

func BlockToChainEvent(mdbBlock *modbtypes.Block) ChainEvent

type Context

type Context struct {
	Rbt                 *rabbit.RabbitStore
	Db                  modbtypes.DB
	Height              int64
	XHedgeForkBlock     int64
	SymbolSbchForkBlock int64
	StakingForkBlock    int64
	ShaGateForkBlock    int64
	Type                uint8
}

update WithRbtCopy when fields change in Context

func NewContext

func NewContext(rbt *rabbit.RabbitStore, db modbtypes.DB) *Context

func (*Context) BasicQueryLogs

func (c *Context) BasicQueryLogs(address common.Address, topics []common.Hash,
	startHeight, endHeight, limit uint32) (logs []Log, err error)

func (*Context) CheckNonce

func (c *Context) CheckNonce(sender common.Address, nonce uint64) (*AccountInfo, error)

func (*Context) Close

func (c *Context) Close(dirty bool)

func (*Context) CreateDynamicArray added in v0.4.0

func (c *Context) CreateDynamicArray(seq uint64, arrSlot string, contents [][]byte)

func (*Context) DeleteDynamicArray added in v0.3.1

func (c *Context) DeleteDynamicArray(seq uint64, arrSlot string)

func (*Context) DeleteStorageAt added in v0.3.1

func (c *Context) DeleteStorageAt(seq uint64, key string)

func (*Context) DeleteValueAtMapKey added in v0.3.1

func (c *Context) DeleteValueAtMapKey(seq uint64, mapSlot string, mapKey string)

func (*Context) GetAccount

func (c *Context) GetAccount(address common.Address) *AccountInfo

func (*Context) GetAndDeleteValueAtMapKey added in v0.3.1

func (c *Context) GetAndDeleteValueAtMapKey(seq uint64, mapSlot string, mapKey string) []byte

func (*Context) GetBalance

func (c *Context) GetBalance(owner common.Address) (*uint256.Int, error)

func (*Context) GetBlockByHash

func (c *Context) GetBlockByHash(hash common.Hash) (blk *Block, err error)

func (*Context) GetBlockByHeight

func (c *Context) GetBlockByHeight(height uint64) (*Block, error)

func (*Context) GetBlockHashByHeight added in v0.1.1

func (c *Context) GetBlockHashByHeight(height uint64) [32]byte

func (*Context) GetCode

func (c *Context) GetCode(contract common.Address) *BytecodeInfo

func (*Context) GetCurrBlockBasicInfo

func (c *Context) GetCurrBlockBasicInfo() *Block

func (*Context) GetDynamicArray added in v0.3.1

func (c *Context) GetDynamicArray(seq uint64, arrSlot string) (res [][]byte)

func (*Context) GetFromAddressCount added in v0.1.4

func (c *Context) GetFromAddressCount(addr common.Address) int64

return the times addr acts as the from-address of a transaction

func (*Context) GetLatestHeight

func (c *Context) GetLatestHeight() int64

func (*Context) GetSep20FromAddressCount added in v0.1.1

func (c *Context) GetSep20FromAddressCount(contract common.Address, addr common.Address) int64

return the times addr acts as a from-address of a SEP20 Transfer event at some contract

func (*Context) GetSep20ToAddressCount added in v0.1.1

func (c *Context) GetSep20ToAddressCount(contract common.Address, addr common.Address) int64

return the times addr acts as the to-address of a SEP20 Transfer event at some contract

func (*Context) GetStorageAt

func (c *Context) GetStorageAt(seq uint64, key string) []byte

func (*Context) GetToAddressCount added in v0.1.1

func (c *Context) GetToAddressCount(addr common.Address) int64

return the times addr acts as the to-address of a transaction

func (*Context) GetTxByBlkHtAndTxIndex

func (c *Context) GetTxByBlkHtAndTxIndex(height uint64, index uint64) *Transaction

func (*Context) GetTxByHash

func (c *Context) GetTxByHash(txHash common.Hash) (tx *Transaction, sig [65]byte, err error)

func (*Context) GetTxListByHeight

func (c *Context) GetTxListByHeight(height uint32) (txs []*Transaction, sigs [][65]byte, err error)

func (*Context) GetTxListByHeightWithRange added in v0.2.0

func (c *Context) GetTxListByHeightWithRange(height uint32, start, end int) (txs []*Transaction, sigs [][65]byte, err error)

func (*Context) GetValueAtMapKey added in v0.3.1

func (c *Context) GetValueAtMapKey(seq uint64, mapSlot string, mapKey string) []byte

func (*Context) IsShaGateFork added in v0.4.0

func (c *Context) IsShaGateFork() bool

func (*Context) IsStakingFork added in v0.4.3

func (c *Context) IsStakingFork() bool

func (*Context) IsSymbolSbchFork added in v0.4.5

func (c *Context) IsSymbolSbchFork() bool

func (*Context) IsXHedgeFork added in v0.4.0

func (c *Context) IsXHedgeFork() bool

func (*Context) QueryLogs

func (c *Context) QueryLogs(addresses []common.Address, topics [][]common.Hash, startHeight, endHeight uint32, filter FilterFunc) (logs []Log, err error)

func (*Context) QueryTxByAddr

func (c *Context) QueryTxByAddr(addr common.Address, startHeight, endHeight, limit uint32) (txs []*Transaction, sigs [][65]byte, err error)

func (*Context) QueryTxByDst

func (c *Context) QueryTxByDst(addr common.Address, startHeight, endHeight, limit uint32) (txs []*Transaction, sigs [][65]byte, err error)

func (*Context) QueryTxBySrc

func (c *Context) QueryTxBySrc(addr common.Address, startHeight, endHeight, limit uint32) (txs []*Transaction, sigs [][65]byte, err error)

func (*Context) SetAccount

func (c *Context) SetAccount(address common.Address, acc *AccountInfo)

func (*Context) SetCurrBlockBasicInfo

func (c *Context) SetCurrBlockBasicInfo(blk *Block)

func (*Context) SetCurrentHeight added in v0.4.0

func (c *Context) SetCurrentHeight(height int64)

func (*Context) SetShaGateForkBlock added in v0.4.0

func (c *Context) SetShaGateForkBlock(shaGateForkBlock int64)

func (*Context) SetStakingForkBlock added in v0.4.3

func (c *Context) SetStakingForkBlock(stakingForkBlock int64)

func (*Context) SetStorageAt

func (c *Context) SetStorageAt(seq uint64, key string, val []byte)

func (*Context) SetSymbolSbchBlock added in v0.4.5

func (c *Context) SetSymbolSbchBlock(symbolSbchForkBlock int64)

func (*Context) SetType added in v0.4.5

func (c *Context) SetType(t uint8)

func (*Context) SetValueAtMapKey added in v0.4.0

func (c *Context) SetValueAtMapKey(seq uint64, mapSlot string, mapKey string, val []byte)

func (*Context) SetXHedgeForkBlock added in v0.4.0

func (c *Context) SetXHedgeForkBlock(xHedgeForkBlock int64)

func (*Context) StoreBlock

func (c *Context) StoreBlock(blk *modbtypes.Block, txid2sigMap map[[32]byte][65]byte)

func (*Context) WithDb

func (c *Context) WithDb(db modbtypes.DB) *Context

func (*Context) WithRbt

func (c *Context) WithRbt(rabbitStore *rabbit.RabbitStore) *Context

func (*Context) WithRbtCopy

func (c *Context) WithRbtCopy() *Context

new empty rbt with same parent store as the old one

type CreationCounterRWOp added in v0.4.0

type CreationCounterRWOp struct {
	Lsb     uint8  `msg:"lsb"`
	Counter uint64 `msg:"counter"`
}

func (*CreationCounterRWOp) DecodeMsg added in v0.4.0

func (z *CreationCounterRWOp) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (CreationCounterRWOp) EncodeMsg added in v0.4.0

func (z CreationCounterRWOp) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (CreationCounterRWOp) MarshalMsg added in v0.4.0

func (z CreationCounterRWOp) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (CreationCounterRWOp) Msgsize added in v0.4.0

func (z CreationCounterRWOp) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*CreationCounterRWOp) UnmarshalMsg added in v0.4.0

func (z *CreationCounterRWOp) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type Description

type Description struct {
	Moniker         string `json:"moniker" yaml:"moniker"`                   // name
	Identity        string `json:"identity" yaml:"identity"`                 // optional identity signature (ex. UPort or Keybase)
	Website         string `json:"website" yaml:"website"`                   // optional website link
	SecurityContact string `json:"security_contact" yaml:"security_contact"` // optional security contact info
	Details         string `json:"details" yaml:"details"`                   // optional details
}

Description - description fields for a validator

func NewDescription

func NewDescription(moniker, identity, website, securityContact, details string) Description

NewDescription returns a new Description with the provided values.

type EvmLog

type EvmLog struct {
	Address common.Address
	Topics  []common.Hash
	Data    []byte
}

type FilterFunc added in v0.2.0

type FilterFunc func(addr common.Address, topics []common.Hash, addrList []common.Address, topicsList [][]common.Hash) (ok bool)
type Header struct {
	Number     hexutil.Uint64  `json:"number"`
	BlockHash  gethcmn.Hash    `json:"hash"`
	ParentHash gethcmn.Hash    `json:"parentHash"`
	Bloom      gethcore.Bloom  `json:"logsBloom"`
	TxRoot     gethcmn.Hash    `json:"transactionsRoot"`
	StateRoot  gethcmn.Hash    `json:"stateRoot"`
	Miner      gethcmn.Address `json:"miner"`
	GasUsed    hexutil.Uint64  `json:"gasUsed"`
	Timestamp  hexutil.Uint64  `json:"timestamp"`
}

func (*Header) Hash

func (h *Header) Hash() gethcmn.Hash

type InternalTxCall added in v0.3.3

type InternalTxCall struct {
	/** The kind of the call. For zero-depth calls ::EVMC_CALL SHOULD be used. */
	Kind int `msg:"kind"`

	/**
	* Additional flags modifying the call execution behavior.
	* In the current version the only valid values are ::EVMC_STATIC or 0.
	 */
	Flags uint32 `msg:"flags"`

	/** The call depth. */
	Depth int32 `msg:"depth"`

	/** The amount of gas for message execution. */
	Gas int64

	/** The callee of the transaction. */
	Destination [20]byte `msg:"destination"`

	/** The caller of the transaction. */
	Sender [20]byte `msg:"sender"`

	/** the input data.  */
	Input []byte `msg:"input"`

	/**
	* The amount of BCH transferred with the message.
	 */
	Value [32]byte `msg:"value"`
}

func (*InternalTxCall) DecodeMsg added in v0.3.3

func (z *InternalTxCall) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (*InternalTxCall) EncodeMsg added in v0.3.3

func (z *InternalTxCall) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (*InternalTxCall) MarshalMsg added in v0.3.3

func (z *InternalTxCall) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*InternalTxCall) Msgsize added in v0.3.3

func (z *InternalTxCall) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*InternalTxCall) UnmarshalMsg added in v0.3.3

func (z *InternalTxCall) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type InternalTxReturn added in v0.3.3

type InternalTxReturn struct {
	/** The execution status code. */
	StatusCode int `msg:"statusCode"`

	/**
	* The amount of gas left after the execution.
	* If StatusCode is neither ::EVMC_SUCCESS nor ::EVMC_REVERT
	* the value MUST be 0.
	 */
	GasLeft int64 `msg:"gasLeft"`

	/**  the output data.  */
	Output []byte `msg:"output"`

	/**
	* The address of the contract created by create instructions.
	*
	* This field has valid value only if:
	* - it is a result of the Host method evmc_host_interface::call
	* - and the result describes successful contract creation
	*   (StatusCode is ::EVMC_SUCCESS).
	* In all other cases the address MUST be null bytes.
	 */
	CreateAddress [20]byte `msg:"createAddress"`
}

func (*InternalTxReturn) DecodeMsg added in v0.3.3

func (z *InternalTxReturn) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (*InternalTxReturn) EncodeMsg added in v0.3.3

func (z *InternalTxReturn) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (*InternalTxReturn) MarshalMsg added in v0.3.3

func (z *InternalTxReturn) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*InternalTxReturn) Msgsize added in v0.3.3

func (z *InternalTxReturn) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*InternalTxReturn) UnmarshalMsg added in v0.3.3

func (z *InternalTxReturn) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type Log

type Log struct {
	// Consensus fields:
	// address of the contract that generated the event
	Address [20]byte `msg:"address"`
	// list of topics provided by the contract.
	Topics [][32]byte `msg:"topics"`
	// supplied by the contract, usually ABI-encoded
	Data []byte `msg:"data"`

	// Derived fields. These fields are filled in by the node
	// but not secured by consensus.
	// block in which the transaction was included
	BlockNumber uint64 `msg:"blockNumber"`
	// hash of the transaction
	TxHash [32]byte `msg:"transactionHash"`
	// index of the transaction in the block
	TxIndex uint `msg:"transactionIndex"`
	// hash of the block in which the transaction was included
	BlockHash [32]byte `msg:"blockHash"`
	// index of the log in the block
	Index uint `msg:"logIndex"`

	// The Removed field is true if this log was reverted due to a chain reorganisation.
	// You must pay attention to this field if you receive logs through a filter query.
	Removed bool `msg:"removed"`
}

func (*Log) DecodeMsg

func (z *Log) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (*Log) EncodeMsg

func (z *Log) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (*Log) MarshalMsg

func (z *Log) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*Log) Msgsize

func (z *Log) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*Log) UnmarshalMsg

func (z *Log) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type ReadWriteLists added in v0.4.0

type ReadWriteLists struct {
	CreationCounterRList []CreationCounterRWOp `msg:"creationcounter_rlist"`
	CreationCounterWList []CreationCounterRWOp `msg:"creationcounter_wlist"`
	AccountRList         []AccountRWOp         `msg:"account_rlist"`
	AccountWList         []AccountRWOp         `msg:"account_wlist"`
	BytecodeRList        []BytecodeRWOp        `msg:"bytecode_rlist"`
	BytecodeWList        []BytecodeRWOp        `msg:"bytecode_wlist"`
	StorageRList         []StorageRWOp         `msg:"storage_rlist"`
	StorageWList         []StorageRWOp         `msg:"storage_wlist"`
	BlockHashList        []BlockHashOp         `msg:"blockhash_list"`
}

func (*ReadWriteLists) DecodeMsg added in v0.4.0

func (z *ReadWriteLists) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (*ReadWriteLists) EncodeMsg added in v0.4.0

func (z *ReadWriteLists) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (*ReadWriteLists) MarshalMsg added in v0.4.0

func (z *ReadWriteLists) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*ReadWriteLists) Msgsize added in v0.4.0

func (z *ReadWriteLists) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*ReadWriteLists) UnmarshalMsg added in v0.4.0

func (z *ReadWriteLists) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type StorageRWOp added in v0.4.0

type StorageRWOp struct {
	Seq   uint64 `msg:"seq"`
	Key   string `msg:"key"`
	Value []byte `msg:"value"`
}

func (*StorageRWOp) DecodeMsg added in v0.4.0

func (z *StorageRWOp) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (*StorageRWOp) EncodeMsg added in v0.4.0

func (z *StorageRWOp) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (*StorageRWOp) MarshalMsg added in v0.4.0

func (z *StorageRWOp) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*StorageRWOp) Msgsize added in v0.4.0

func (z *StorageRWOp) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*StorageRWOp) UnmarshalMsg added in v0.4.0

func (z *StorageRWOp) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type SystemContractExecutor

type SystemContractExecutor interface {
	vm.PrecompiledContract
	Init(ctx *Context)
	IsSystemContract(addr common.Address) bool
	Execute(context *Context, currBlock *BlockInfo, tx *TxToRun) (status int, logs []EvmLog, gasUsed uint64, outData []byte)
}

type Transaction

type Transaction struct {
	Hash              [32]byte  `msg:"hash"`         //32 Bytes - hash of the transaction.
	TransactionIndex  int64     `msg:"index"`        //integer of the transactions index position in the block. null when its pending.
	Nonce             uint64    `msg:"nonce"`        //the number of transactions made by the sender prior to this one.
	BlockHash         [32]byte  `msg:"block"`        //32 Bytes - hash of the block where this transaction was in. null when its pending.
	BlockNumber       int64     `msg:"height"`       //block number where this transaction was in. null when its pending.
	From              [20]byte  `msg:"from"`         //20 Bytes - address of the sender.
	To                [20]byte  `msg:"to"`           //20 Bytes - address of the receiver. null when its a contract creation transaction.
	Value             [32]byte  `msg:"value"`        //value transferred in Wei.
	GasPrice          [32]byte  `msg:"gasprice"`     //gas price provided by the sender in Wei.
	Gas               uint64    `msg:"gas"`          //gas provided by the sender.
	Input             []byte    `msg:"input"`        //the data send along with the transaction.
	CumulativeGasUsed uint64    `msg:"cgasused"`     // the total amount of gas used when this transaction was executed in the block.
	GasUsed           uint64    `msg:"gasused"`      //the amount of gas used by this specific transaction alone.
	ContractAddress   [20]byte  `msg:"contractaddr"` //20 Bytes - the contract address created, if the transaction was a contract creation, otherwise - null.
	Logs              []Log     `msg:"logs"`         //Array - Array of log objects, which this transaction generated.
	LogsBloom         [256]byte `msg:"bloom"`        //256 Bytes - Bloom filter for light clients to quickly retrieve related logs.
	Status            uint64    `msg:"status"`       //tx execute result: ReceiptStatusFailed or ReceiptStatusSuccessful
	StatusStr         string    `msg:"statusstr"`    //tx execute result explained
	OutData           []byte    `msg:"outdata"`      //the output data from the transaction

	InternalTxCalls   []InternalTxCall   `msg:"itxcalls"`
	InternalTxReturns []InternalTxReturn `msg:"itxreturns"`

	RwLists *ReadWriteLists `msg:"rwlist"`
}

TRANSACTION - A transaction object, or null when no transaction was found

func (*Transaction) DecodeMsg

func (z *Transaction) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (*Transaction) EncodeMsg

func (z *Transaction) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (*Transaction) MarshalMsg

func (z *Transaction) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*Transaction) Msgsize

func (z *Transaction) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*Transaction) UnmarshalMsg

func (z *Transaction) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type TxToRun

type TxToRun struct {
	BasicTx
	HashID common.Hash
	Height uint64
}

func (*TxToRun) FromBytes

func (tx *TxToRun) FromBytes(bz []byte)

func (*TxToRun) FromGethTx

func (tx *TxToRun) FromGethTx(gethTx *coretypes.Transaction, sender common.Address, height uint64)

func (TxToRun) ToBytes

func (tx TxToRun) ToBytes() []byte

type ValAddress

type ValAddress []byte

type Validator

type Validator struct {
	OperatorAddress ValAddress    `json:"operator_address" yaml:"operator_address"` // address of the validator's operator; bech encoded in JSON
	ConsPubKey      crypto.PubKey `json:"consensus_pubkey" yaml:"consensus_pubkey"` // the consensus public key of the validator; bech encoded in JSON
	//Jailed                  bool           `json:"jailed" yaml:"jailed"`                           // has the validator been jailed from bonded status?
	Status      BondStatus  `json:"status" yaml:"status"`           // validator status (bonded/unbonded)
	Tokens      *big.Int    `json:"tokens" yaml:"tokens"`           // delegated tokens
	Description Description `json:"description" yaml:"description"` // description terms for the validator
}

func (Validator) MarshalJSON

func (v Validator) MarshalJSON() ([]byte, error)

func (Validator) String

func (v Validator) String() string

String returns a human readable string representation of a validator.

func (*Validator) UnmarshalJSON

func (v *Validator) UnmarshalJSON(data []byte) error

UnmarshalJSON unmarshals the validator from JSON using Bech32

type Validators

type Validators []Validator

Validators is a collection of Validator

func (Validators) Len

func (v Validators) Len() int

Implements sort interface

func (Validators) Less

func (v Validators) Less(i, j int) bool

Implements sort interface

func (Validators) Sort

func (v Validators) Sort()

Sort Validators sorts validator array in ascending operator address order

func (Validators) String

func (v Validators) String() (out string)

func (Validators) Swap

func (v Validators) Swap(i, j int)

Implements sort interface

Jump to

Keyboard shortcuts

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