mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2025-01-05 10:32:19 +00:00
fdbba5202b
* squash commits * enable storage cache * make linter happy * fix subtree prefix len check * save cahnges to test master * remove restriction on prefix len * fix comparison of last bits * fix wrong alignment * remove debug prints * commit current state * commit current state * avoid changing state of resolver from multiwalk * remove debug code * remove debug code * remove debug code * remove unnecessary copy * make code more readable * reduce rebuildHashes initial resolution * fix test after rebase to master * make code more readable * improve pruner * pruner add IntermediateCache bucket * fix panic in Walk on short keys * reduce allocations for storage keys decompression by increasing default buffer size * re-run CI * fix iterator behaviour * rename cache to hash for unification * re-run ci * avoid using underlying DB * hash all subtree nodes before unload * fix getNode method * need to check node type, not parent - before put to hashBucket * return back parent type check, doesn't work without it. * don't recalculate hash again * move unloadFunc from trie to pruner * rename bucket to shorter name * rename bucket to shorter name * clean * rebase to master
86 lines
3.4 KiB
Go
86 lines
3.4 KiB
Go
package dbutils
|
|
|
|
import "github.com/ledgerwatch/turbo-geth/metrics"
|
|
|
|
// The fields below define the low level database schema prefixing.
|
|
var (
|
|
// key - address hash
|
|
// value - account encoded for storage
|
|
AccountsBucket = []byte("AT")
|
|
|
|
//current
|
|
//key - key + encoded timestamp(block number)
|
|
//value - account for storage(old/original value)
|
|
//layout experiment
|
|
//key - address hash
|
|
//value - list of block where it's changed
|
|
AccountsHistoryBucket = []byte("hAT")
|
|
|
|
//key - address hash + incarnation + storage key hash
|
|
//value - storage value(common.hash)
|
|
StorageBucket = []byte("ST")
|
|
|
|
//current
|
|
//key - address hash + incarnation + storage key hash
|
|
//value - storage value(common.hash)
|
|
//layout experiment
|
|
//key - address hash
|
|
//value - list of block where it's changed
|
|
StorageHistoryBucket = []byte("hST")
|
|
|
|
//key - contract code hash
|
|
//value - contract code
|
|
CodeBucket = []byte("CODE")
|
|
|
|
//key - addressHash+incarnation
|
|
//value - code hash
|
|
ContractCodeBucket = []byte("contractCode")
|
|
|
|
// key - encoded timestamp(block number) + history bucket(hAT/hST)
|
|
// value - encoded ChangeSet{k - addrHash|compositeKey(for storage) v - account(encoded) | originalValue(common.Hash)}
|
|
ChangeSetBucket = []byte("ChangeSet")
|
|
|
|
// some_prefix_of(hash_of_address_of_account) => hash_of_subtrie
|
|
IntermediateTrieHashBucket = []byte("iTh")
|
|
|
|
// databaseVerisionKey tracks the current database version.
|
|
DatabaseVerisionKey = []byte("DatabaseVersion")
|
|
|
|
// headHeaderKey tracks the latest know header's hash.
|
|
HeadHeaderKey = []byte("LastHeader")
|
|
|
|
// headBlockKey tracks the latest know full block's hash.
|
|
HeadBlockKey = []byte("LastBlock")
|
|
|
|
// headFastBlockKey tracks the latest known incomplete block's hash during fast sync.
|
|
HeadFastBlockKey = []byte("LastFast")
|
|
|
|
// fastTrieProgressKey tracks the number of trie entries imported during fast sync.
|
|
FastTrieProgressKey = []byte("TrieSync")
|
|
|
|
// Data item prefixes (use single byte to avoid mixing data types, avoid `i`, used for indexes).
|
|
HeaderPrefix = []byte("h") // headerPrefix + num (uint64 big endian) + hash -> header
|
|
HeaderTDSuffix = []byte("t") // headerPrefix + num (uint64 big endian) + hash + headerTDSuffix -> td
|
|
HeaderHashSuffix = []byte("n") // headerPrefix + num (uint64 big endian) + headerHashSuffix -> hash
|
|
HeaderNumberPrefix = []byte("H") // headerNumberPrefix + hash -> num (uint64 big endian)
|
|
|
|
BlockBodyPrefix = []byte("b") // blockBodyPrefix + num (uint64 big endian) + hash -> block body
|
|
BlockReceiptsPrefix = []byte("r") // blockReceiptsPrefix + num (uint64 big endian) + hash -> block receipts
|
|
|
|
TxLookupPrefix = []byte("l") // txLookupPrefix + hash -> transaction/receipt lookup metadata
|
|
BloomBitsPrefix = []byte("B") // bloomBitsPrefix + bit (uint16 big endian) + section (uint64 big endian) + hash -> bloom bits
|
|
|
|
PreimagePrefix = []byte("secure-key-") // preimagePrefix + hash -> preimage
|
|
ConfigPrefix = []byte("ethereum-config-") // config prefix for the db
|
|
|
|
// Chain index prefixes (use `i` + single byte to avoid mixing data types).
|
|
BloomBitsIndexPrefix = []byte("iB") // BloomBitsIndexPrefix is the data table of a chain indexer to track its progress
|
|
|
|
PreimageCounter = metrics.NewRegisteredCounter("db/preimage/total", nil)
|
|
PreimageHitCounter = metrics.NewRegisteredCounter("db/preimage/hits", nil)
|
|
|
|
// last block that was pruned
|
|
// it's saved one in 5 minutes
|
|
LastPrunedBlockKey = []byte("LastPrunedBlock")
|
|
)
|