Module tables

Available on crate feature provider only.
Expand description

Tables and data models.

§Overview

This module defines the tables in reth, as well as some table-related abstractions:

§Database Tour

TODO(onbjerg): Find appropriate format for this…

Modules§

codecs
Integrates different codecs into table::Encode and table::Decode.

Structs§

AccountChangeSets
Stores the state of an account before a certain transaction changed it. Change on state can be: account is created, selfdestructed, touched while empty or changed balance,nonce.
AccountsHistory
Stores pointers to block changeset with changes for each account key.
AccountsTrie
Stores the current state’s Merkle Patricia Tree.
BlockBodyIndices
Stores block indices that contains indexes of transaction and the count of them.
BlockOmmers
Stores the uncles/ommers of the block.
BlockWithdrawals
Stores the block withdrawals.
Bytecodes
Stores all smart contract bytecodes. There will be multiple accounts that have same bytecode So we would need to introduce reference counter. This will be small optimization on state.
CanonicalHeaders
Stores the header hashes belonging to the canonical chain.
ChainState
Stores generic chain state info, like the last finalized block.
HashedAccounts
Stores the current state of an Account indexed with keccak256Address This table is in preparation for merklization and calculation of state root. We are saving whole account data as it is needed for partial update when part of storage is changed. Benefit for merklization is that hashed addresses are sorted.
HashedStorages
Stores the current storage values indexed with keccak256Address and hash of storage key keccak256key. This table is in preparation for merklization and calculation of state root. Benefit for merklization is that hashed addresses/keys are sorted.
HeaderNumbers
Stores the block number corresponding to a header.
HeaderTerminalDifficulties
Stores the total difficulty from a block header.
Headers
Stores header bodies.
PlainAccountState
Stores the current state of an Account.
PlainStorageState
Stores the current value of a storage key.
PruneCheckpoints
Stores the highest pruned block number and prune mode of each prune segment.
RawDupSort
Raw DupSort table that can be used to access any table and its data in raw mode. This is useful for delayed decoding/encoding of data.
RawKey
Raw table key.
RawTable
Raw table that can be used to access any table and its data in raw mode. This is useful for delayed decoding/encoding of data.
RawValue
Raw table value.
Receipts
Canonical only Stores transaction receipts.
StageCheckpointProgresses
Stores arbitrary data to keep track of a stage first-sync progress.
StageCheckpoints
Stores the highest synced block number and stage-specific checkpoint of each stage.
StorageChangeSets
Stores the state of a storage key before a certain transaction changed it. If StorageEntry::value is zero, this means storage was not existing and needs to be removed.
StoragesHistory
Stores pointers to block number changeset with changes for each storage key.
StoragesTrie
From HashedAddress => NibblesSubKey => Intermediate value
TransactionBlocks
Stores the mapping of transaction number to the blocks number.
TransactionHashNumbers
Stores the mapping of the transaction hash to the transaction number.
TransactionSenders
Stores the transaction sender for each canonical transaction. It is needed to speed up execution stage and allows fetching signer without doing transaction signed recovery
Transactions
Canonical only Stores the transaction body for canonical transactions.
VersionHistory
Stores the history of client versions that have accessed the database with write privileges by unix timestamp in seconds.

Enums§

ChainStateKey
Keys for the ChainState table.
TableType
Enum for the types of tables present in libmdbx.
Tables
A table in the database.

Traits§

TableSet
General trait for defining the set of tables Used to initialize database
TableViewer
The general purpose of this is to use with a combination of Tables enum, by implementing a TableViewer trait you can operate on db tables in an abstract way.

Type Aliases§

BlockNumberList
List with transaction numbers.
StageId
Encoded stage id.
TableRawRow
Tuple with RawKey<T::Key> and RawValue<T::Value>.