mirror of
https://github.com/luxfi/evmgpu.git
synced 2026-10-30 16:57:11 +00:00
Mirrors luxfi/evm Wave 1C cascade. 18 files. Same migration patterns:
plugin/evm/message/codec.go local Manager interface, sync/* swap,
customrawdb/* + validators/state/* hand-rolled binary, vm.go +
network.go + plugin/evm/network_handler.go call-site fixups, plus
core/parallel/gpu_{ecrecover,evm}.go GPU dispatch wiring.
Builds clean: go build ./...
84 lines
3.5 KiB
Go
84 lines
3.5 KiB
Go
// Copyright (C) 2019-2025, Lux Industries, Inc. All rights reserved.
|
|
// See the file LICENSE for licensing terms.
|
|
|
|
package customrawdb
|
|
|
|
import (
|
|
"github.com/luxfi/geth/common"
|
|
"github.com/luxfi/utils/wrappers"
|
|
)
|
|
|
|
var (
|
|
// snapshotBlockHashKey tracks the block hash of the last snapshot.
|
|
snapshotBlockHashKey = []byte("SnapshotBlockHash")
|
|
// offlinePruningKey tracks runs of offline pruning
|
|
offlinePruningKey = []byte("OfflinePruning")
|
|
// populateMissingTriesKey tracks runs of trie backfills
|
|
populateMissingTriesKey = []byte("PopulateMissingTries")
|
|
// pruningDisabledKey tracks whether the node has ever run in archival mode
|
|
// to ensure that a user does not accidentally corrupt an archival node.
|
|
pruningDisabledKey = []byte("PruningDisabled")
|
|
// acceptorTipKey tracks the tip of the last accepted block that has been fully processed.
|
|
acceptorTipKey = []byte("AcceptorTipKey")
|
|
// upgradeConfigPrefix prefixes upgrade bytes passed to the chain
|
|
upgradeConfigPrefix = []byte("upgrade-config-")
|
|
)
|
|
|
|
// State sync progress keys and prefixes
|
|
var (
|
|
// syncRootKey indicates the root of the main account trie currently being synced
|
|
syncRootKey = []byte("sync_root")
|
|
// syncStorageTriesPrefix is the prefix for storage tries that need to be fetched.
|
|
// syncStorageTriesPrefix + trie root + account hash: indicates a storage trie must be fetched for the account
|
|
syncStorageTriesPrefix = []byte("sync_storage")
|
|
// syncSegmentsPrefix is the prefix for segments.
|
|
// syncSegmentsPrefix + trie root + 32-byte start key: indicates the trie at root has a segment starting at the specified key
|
|
syncSegmentsPrefix = []byte("sync_segments")
|
|
// CodeToFetchPrefix is the prefix for code hashes that need to be fetched.
|
|
// CodeToFetchPrefix + code hash -> empty value tracks the outstanding code hashes we need to fetch.
|
|
CodeToFetchPrefix = []byte("CP")
|
|
)
|
|
|
|
// State sync progress key lengths
|
|
var (
|
|
syncStorageTriesKeyLength = len(syncStorageTriesPrefix) + 2*common.HashLength
|
|
syncSegmentsKeyLength = len(syncSegmentsPrefix) + 2*common.HashLength
|
|
codeToFetchKeyLength = len(CodeToFetchPrefix) + common.HashLength
|
|
)
|
|
|
|
// State sync metadata
|
|
var (
|
|
syncPerformedPrefix = []byte("sync_performed")
|
|
// syncPerformedKeyLength is the length of the key for the sync performed metadata key,
|
|
// and is equal to [syncPerformedPrefix] + block number as uint64.
|
|
syncPerformedKeyLength = len(syncPerformedPrefix) + wrappers.LongLen
|
|
)
|
|
|
|
// FirewoodScheme is the state scheme for Firewood (currently disabled).
|
|
// To disable Firewood, the scheme value must still be "firewood" so that
|
|
// comparisons like `provided == FirewoodScheme` don't accidentally match
|
|
// when provided is empty string. Firewood is disabled by not requesting it.
|
|
var FirewoodScheme = "firewood"
|
|
|
|
// upgradeConfigKey = upgradeConfigPrefix + hash
|
|
func upgradeConfigKey(hash common.Hash) []byte {
|
|
return append(upgradeConfigPrefix, hash.Bytes()...)
|
|
}
|
|
|
|
// blockGasCostPrefix is the prefix for storing BlockGasCost data
|
|
// blockGasCostPrefix + num (8 bytes) + hash (32 bytes) -> BlockGasCost RLP encoded
|
|
var blockGasCostPrefix = []byte("bgc")
|
|
|
|
// blockGasCostKey returns the database key for storing BlockGasCost
|
|
func blockGasCostKey(number uint64, hash common.Hash) []byte {
|
|
result := make([]byte, len(blockGasCostPrefix)+8+32)
|
|
copy(result, blockGasCostPrefix)
|
|
// Encode number as big-endian 8 bytes
|
|
for i := 7; i >= 0; i-- {
|
|
result[len(blockGasCostPrefix)+i] = byte(number)
|
|
number >>= 8
|
|
}
|
|
copy(result[len(blockGasCostPrefix)+8:], hash[:])
|
|
return result
|
|
}
|