Documentation ¶
Index ¶
- Constants
- Variables
- func AccountIndexChunkKey(key []byte, blockNumber uint64) []byte
- func AstInit()
- func BlockBodyKey(number uint64, hash types.Hash) []byte
- func BodyStorageValue(baseTx uint64, txAmount uint32) []byte
- func CompositeKeyWithoutIncarnation(key []byte) []byte
- func ConfigKey(hash types.Hash) []byte
- func DecodeBlockNumber(number []byte) (uint64, error)
- func EncodeBlockNumber(number uint64) []byte
- func GenerateCompositeStoragePrefix(addressHash []byte, incarnation uint16, storageHashPrefix []byte) []byte
- func GenerateStoragePrefix(addressHash []byte, incarnation uint16) []byte
- func HeaderKey(number uint64, hash types.Hash) []byte
- func LogKey(blockNumber uint64, txId uint32) []byte
- func PlainGenerateCompositeStorageKey(address []byte, incarnation uint16, key []byte) []byte
- func PlainGenerateStoragePrefix(address []byte, incarnation uint16) []byte
- func PlainParseCompositeStorageKey(compositeKey []byte) (types.Address, uint16, types.Hash)
- func PlainParseStoragePrefix(prefix []byte) (types.Address, uint16)
- func StorageIndexChunkKey(key []byte, blockNumber uint64) []byte
Constants ¶
View Source
const ( // DatabaseInfo is used to store information about data layout. DatabaseInfo = "DbInfo" ChainConfig = "ChainConfig" )
StateInfo
View Source
const ( //key - contract code hash //value - contract code Code = "Code" // contract code hash -> contract code Account = "Account" // address(un hashed) -> account encoded Storage = "Storage" // address (un hashed) + incarnation + storage key (un hashed) -> storage value(types.Hash) Reward = "Reward" // ... Deposit = "Deposit" // Deposit info //key - addressHash+incarnation //value - code hash ContractCode = "HashedCodeHash" PlainContractCode = "PlainCodeHash" // address+incarnation -> code hash // IncarnationMap "incarnation" - uint16 number - how much times given account was SelfDestruct'ed IncarnationMap = "IncarnationMap" // address -> incarnation of account when it was last deleted )
PlainState
View Source
const ( AccountChangeSet = "AccountChangeSet" // blockNum_u64 -> address + account(encoded) AccountsHistory = "AccountHistory" // address + shard_id_u64 -> roaring bitmap - list of block where it changed StorageChangeSet = "StorageChangeSet" // blockNum_u64 + address + incarnation_u64 -> plain_storage_key + value StorageHistory = "StorageHistory" // address + storage_key + shard_id_u64 -> roaring bitmap - list of block where it changed )
HistoryState
View Source
const ( Headers = "Header" // block_num_u64 + hash -> header HeaderNumber = "HeaderNumber" // header_hash -> num_u64 HeaderTD = "HeadersTotalDifficulty" // block_num_u64 + hash -> td HeaderCanonical = "CanonicalHeader" // block_num_u64 -> header hash // headBlockKey tracks the latest know full block's hash. HeadBlockKey = "LastBlock" HeadHeaderKey = "LastHeader" BlockBody = "BlockBody" // block_num_u64 + hash -> block body BlockTx = "BlockTransaction" // tbl_sequence_u64 -> (tx) NonCanonicalTxs = "NonCanonicalTransaction" // tbl_sequence_u64 -> rlp(tx) MaxTxNum = "MaxTxNum" // block_number_u64 -> max_tx_num_in_block_u64 TxLookup = "BlockTransactionLookup" // hash -> transaction/receipt lookup metadata BlockVerify = "BlockVerify" BlockRewards = "BlockRewards" // Transaction senders - stored separately from the block bodies Senders = "TxSender" // block_num_u64 + blockHash -> sendersList (no serialization format, every 20 bytes is new sender) Receipts = "Receipt" // block_num_u64 -> canonical block receipts (non-canonical are not stored) Log = "TransactionLog" // block_num_u64 + txId -> logs of transaction // Stores bitmap indices - in which block numbers saw logs of given 'address' or 'topic' // [addr or topic] + [2 bytes inverted shard number] -> bitmap(blockN) // indices are sharded - because some bitmaps are >1Mb and when new incoming blocks process it // updates ~300 of bitmaps - by append small amount new values. It cause much big writes (MDBX does copy-on-write). // // if last existing shard size merge it with delta // if serialized size of delta > ShardLimit - break down to multiple shards // shard number - it's biggest value in bitmap LogTopicIndex = "LogTopicIndex" LogAddressIndex = "LogAddressIndex" // CallTraceSet is the name of the table that contain the mapping of block number to the set (sorted) of all accounts // touched by call traces. It is DupSort-ed table // 8-byte BE block number -> account address -> two bits (one for "from", another for "to") CallTraceSet = "CallTraceSet" // Indices for call traces - have the same format as LogTopicIndex and LogAddressIndex // Store bitmap indices - in which block number we saw calls from (CallFromIndex) or to (CallToIndex) some addresses CallFromIndex = "CallFromIndex" CallToIndex = "CallToIndex" Sequence = "Sequence" // tbl_name -> seq_u64 Stake = "Stake" // stakes ast_stake -> bytes )
Block
View Source
const ( SignersDB = "signersDB" PoaSnapshot = "poaSnapshot" )
View Source
const Incarnation = 2
View Source
const NumberLength = 8
Variables ¶
View Source
var AstTableCfg = kv.TableCfg{ AccountChangeSet: {Flags: kv.DupSort}, StorageChangeSet: {Flags: kv.DupSort}, Storage: { Flags: kv.DupSort, AutoDupSortKeysConversion: true, DupFromLen: 54, DupToLen: 34, }, }
View Source
var ErrInvalidSize = errors.New("bit endian number has an invalid size")
Functions ¶
func AccountIndexChunkKey ¶
func BlockBodyKey ¶
BlockBodyKey = num (uint64 big endian) + hash
func BodyStorageValue ¶
func DecodeBlockNumber ¶
func EncodeBlockNumber ¶
EncodeBlockNumber encodes a block number as big endian uint64
func GenerateCompositeStoragePrefix ¶
func GenerateCompositeStoragePrefix(addressHash []byte, incarnation uint16, storageHashPrefix []byte) []byte
AddrHash + incarnation + StorageHashPrefix
func GenerateStoragePrefix ¶
address hash + incarnation prefix
func PlainGenerateCompositeStorageKey ¶
AddrHash + incarnation + KeyHash For contract storage (for plain state)
func PlainGenerateStoragePrefix ¶
address hash + incarnation prefix (for plain state)
func StorageIndexChunkKey ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.