reth_db

Module tables

Source
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§

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

Structs§

  • 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.
  • Stores pointers to block changeset with changes for each account key.
  • Stores the current state’s Merkle Patricia Tree.
  • Stores block indices that contains indexes of transaction and the count of them.
  • Stores the uncles/ommers of the block.
  • Stores the block withdrawals.
  • 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.
  • Stores the header hashes belonging to the canonical chain.
  • Stores generic chain state info, like the last finalized block.
  • 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.
  • 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.
  • Stores the block number corresponding to a header.
  • Stores the total difficulty from a block header.
  • Stores header bodies.
  • Stores the current state of an Account.
  • Stores the current value of a storage key.
  • Stores the highest pruned block number and prune mode of each prune segment.
  • 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.
  • Raw table key.
  • 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.
  • Raw table value.
  • Canonical only Stores transaction receipts.
  • Stores arbitrary data to keep track of a stage first-sync progress.
  • Stores the highest synced block number and stage-specific checkpoint of each stage.
  • 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.
  • Stores pointers to block number changeset with changes for each storage key.
  • From HashedAddress => NibblesSubKey => Intermediate value
  • Stores the mapping of transaction number to the blocks number.
  • Stores the mapping of the transaction hash to the transaction number.
  • 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
  • Canonical only Stores the transaction body for canonical transactions.
  • Stores the history of client versions that have accessed the database with write privileges by unix timestamp in seconds.

Enums§

Traits§

  • 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§