statetype

package
v0.0.0-...-5fb9e85 Latest Latest
Warning

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

Go to latest
Published: Jan 1, 2022 License: Apache-2.0 Imports: 14 Imported by: 3

Documentation

Overview

Package statetype

@author: xwc1125

Package statetype

@author: xwc1125

Package statetype

@author: xwc1125

Package statetype

@author: xwc1125

Package statetype

@author: xwc1125

Index

Constants

View Source
const (
	// BloomByteLength represents the number of bytes used in a header log bloom.
	BloomByteLength = 256

	// BloomBitLength represents the number of bits used in a header log bloom.
	BloomBitLength = 8 * BloomByteLength
)
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)
)

Variables

View Source
var Bloom9 = bloom9

Functions

func BloomLookup

func BloomLookup(bin Bloom, topic bytesBacked) bool

func LogsBloom

func LogsBloom(logs []*Log) *big.Int

Types

type Bloom

type Bloom [BloomByteLength]byte

Bloom represents a 2048 bit bloom filter.

func BytesToBloom

func BytesToBloom(b []byte) Bloom

BytesToBloom converts a byte slice to a bloom filter. It panics if b is not of suitable size.

func CreateBloom

func CreateBloom(receipts Receipts) Bloom

func (*Bloom) Add

func (b *Bloom) Add(d *big.Int)

Add adds d to the filter. Future calls of Test(d) will return true.

func (Bloom) Big

func (b Bloom) Big() *big.Int

Big converts b to a big integer.

func (Bloom) Bytes

func (b Bloom) Bytes() []byte

func (Bloom) MarshalText

func (b Bloom) MarshalText() ([]byte, error)

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

func (*Bloom) SetBytes

func (b *Bloom) SetBytes(d []byte)

SetBytes sets the content of b to the given bytes. It panics if d is not of suitable size.

func (Bloom) Test

func (b Bloom) Test(test *big.Int) bool

func (Bloom) TestBytes

func (b Bloom) TestBytes(test []byte) bool

func (*Bloom) UnmarshalText

func (b *Bloom) UnmarshalText(input []byte) error

UnmarshalText b as a hex string with 0x prefix.

type KV

type KV struct {
	Key   types.TxType
	Value types.Hash
}

type Log

type Log struct {
	Address types.Address `json:"address" gencodec:"required"`
	Topics  []types.Hash  `json:"topics" gencodec:"required"`
	Data    []byte        `json:"data" gencodec:"required"`

	BlockHeight     uint64     `json:"block_height"`
	TransactionHash types.Hash `json:"tx_hash" gencodec:"required"`
	TxIndex         uint       `json:"tx_index" gencodec:"required"`
	BlockHash       types.Hash `json:"block_hash"`
	Index           uint       `json:"index" gencodec:"required"`

	Removed   bool   `json:"removed"`
	BlockTime uint64 `json:"block_time" gencodec:"required"`
}

func (*Log) DecodeRLP

func (l *Log) DecodeRLP(s *rlp.Stream) error

func (*Log) EncodeRLP

func (l *Log) EncodeRLP(w io.Writer) error

func (*Log) String

func (l *Log) String() string

type LogForStorage

type LogForStorage Log

LogForStorage is a wrapper around a Log that flattens and parses the entire content of a log including non-consensus fields.

func (*LogForStorage) DecodeRLP

func (l *LogForStorage) DecodeRLP(s *rlp.Stream) error

DecodeRLP implements rlp.Decoder.

func (*LogForStorage) EncodeRLP

func (l *LogForStorage) EncodeRLP(w io.Writer) error

EncodeRLP implements rlp.Encoder.

type Logs

type Logs []*Log

func (Logs) Deserialize

func (logs Logs) Deserialize(d []byte) error

func (Logs) Serialize

func (logs Logs) Serialize() ([]byte, error)

type Receipt

type Receipt struct {
	// Consensus fields
	Status            uint64 `json:"status"`
	CumulativeGasUsed uint64 `json:"cumulative_gas_used" gencodec:"required"`
	LogsBloom         Bloom  `json:"logs_bloom"         gencodec:"required"`
	Logs              []*Log `json:"logs"              gencodec:"required"`

	TransactionHash types.Hash    `json:"transaction_hash" gencodec:"required"`
	ContractAddress types.Address `json:"contract_address"`
	GasUsed         uint64        `json:"gas_used" gencodec:"required"`
}

Receipt represents the results of a transaction.

func NewReceipt

func NewReceipt(failed bool, cumulativeGasUsed uint64) *Receipt

NewReceipt creates a barebone transaction receipt, copying the init fields.

func (*Receipt) DecodeRLP

func (r *Receipt) DecodeRLP(s *rlp.Stream) error

DecodeRLP implements rlp.Decoder, and loads the consensus fields of a receipt from an RLP stream.

func (*Receipt) EncodeRLP

func (r *Receipt) EncodeRLP(w io.Writer) error

EncodeRLP implements rlp.Encoder, and flattens the consensus fields of a receipt into an RLP stream. If no post state is present, byzantium fork is assumed.

func (Receipt) MarshalJSON

func (r Receipt) MarshalJSON() ([]byte, error)

MarshalJSON marshals as JSON.

func (*Receipt) Size

func (r *Receipt) Size() types.StorageSize

Size returns the approximate memory used by all internal contents. It is used to approximate and limit the memory consumption of various caches.

func (*Receipt) UnmarshalJSON

func (r *Receipt) UnmarshalJSON(input []byte) error

UnmarshalJSON unmarshals from JSON.

type ReceiptForStorage

type ReceiptForStorage Receipt

ReceiptForStorage is a wrapper around a Receipt that flattens and parses the entire content of a receipt, as opposed to only the consensus fields originally.

func (*ReceiptForStorage) DecodeRLP

func (r *ReceiptForStorage) DecodeRLP(s *rlp.Stream) error

DecodeRLP implements rlp.Decoder, and loads both consensus and implementation fields of a receipt from an RLP stream.

func (*ReceiptForStorage) EncodeRLP

func (r *ReceiptForStorage) EncodeRLP(w io.Writer) error

EncodeRLP implements rlp.Encoder, and flattens all content fields of a receipt into an RLP stream.

type Receipts

type Receipts []*Receipt

Receipts is a wrapper around a Receipt array to implement DerivableList.

func (Receipts) Item

func (r Receipts) Item(i int) []byte

GetRlp returns the RLP encoding of one receipt from the list.

func (Receipts) Key

func (r Receipts) Key(i int) []byte

func (Receipts) Len

func (r Receipts) Len() int

Len returns the number of receipts in this list.

type StateRoots

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

StateRoots 并发map 多协程,使用安全

func NewRoots

func NewRoots() *StateRoots

func (*StateRoots) ContainsKey

func (r *StateRoots) ContainsKey(k types.TxType) (bool, string)

ContainsKey 判断是否包括key,如果包含key返回value的类型

func (*StateRoots) DecodeRLP

func (r *StateRoots) DecodeRLP(s *rlp.Stream) error

func (*StateRoots) EncodeRLP

func (r *StateRoots) EncodeRLP(w io.Writer) error

func (*StateRoots) ForEach

func (r *StateRoots) ForEach() map[types.TxType]types.Hash

ForEach 复制map用于外部遍历

func (*StateRoots) Get

func (r *StateRoots) Get(k types.TxType) (types.Hash, bool)

Get 返回值,返回值类型,是否有返回

func (*StateRoots) GetObj

func (r *StateRoots) GetObj(k types.TxType) types.Hash

func (*StateRoots) Ini

func (r *StateRoots) Ini()

Ini 初始化

func (*StateRoots) MarshalJSON

func (r *StateRoots) MarshalJSON() ([]byte, error)

func (*StateRoots) Put

func (r *StateRoots) Put(k types.TxType, v types.Hash)

Put 加入或修改

func (*StateRoots) Remove

func (r *StateRoots) Remove(k types.TxType) (types.Hash, bool)

Remove 移除一个对象

func (*StateRoots) Size

func (r *StateRoots) Size() int

Size 返回个数

func (StateRoots) Sort

func (r StateRoots) Sort() []KV

Sort 排序

func (StateRoots) String

func (r StateRoots) String() string

type TokenValue

type TokenValue struct {
	TokenAddress types.DomainAddress `json:"token_address"`
	Value        *big.Int            `json:"value"`
}

type TokenValues

type TokenValues []TokenValue

Jump to

Keyboard shortcuts

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