Documentation
¶
Overview ¶
Database key format helpers for both SubnetEVM and geth formats
Index ¶
- Variables
- func LoadSubnetEVMDatabase(targetDB ethdb.Database) error
- func NewBadgerDatabase(luxDB database.Database, config BadgerDatabaseConfig) (ethdb.Database, error)
- func NewPebbleWithAncient(db *pebble.Database) ethdb.Database
- func NewSubnetNamespaceStripper(db ethdb.Database) ethdb.Database
- func OpenPebbleDB(path string) (database.Database, error)
- func SlurpIntoAncient(sourceDB ethdb.Database, targetPath string, startBlock, endBlock uint64) error
- func TriggerRuntimeReplay(vm *VM) error
- func WrapDatabase(db database.Database) ethdb.Database
- type BadgerDatabaseConfig
- type BatchWrapper
- func (b *BatchWrapper) Delete(key []byte) error
- func (b *BatchWrapper) DeleteRange(start, end []byte) error
- func (b *BatchWrapper) Put(key []byte, value []byte) error
- func (b *BatchWrapper) Replay(w ethdb.KeyValueWriter) error
- func (b *BatchWrapper) Reset()
- func (b *BatchWrapper) ValueSize() int
- func (b *BatchWrapper) Write() error
- type Block
- func (b *Block) Accept(ctx context.Context) error
- func (b *Block) Bytes() []byte
- func (b *Block) EpochBit() bool
- func (b *Block) FPCVotes() [][]byte
- func (b *Block) Height() uint64
- func (b *Block) ID() ids.ID
- func (b *Block) Parent() ids.ID
- func (b *Block) ParentID() ids.ID
- func (b *Block) Reject(ctx context.Context) error
- func (b *Block) Status() uint8
- func (b *Block) Timestamp() time.Time
- func (b *Block) Verify(ctx context.Context) error
- type DatabaseBackend
- type DatabaseFormat
- type DatabaseIterator
- type DatabaseReplayConfig
- type DatabaseType
- type DatabaseWrapper
- func (d *DatabaseWrapper) Ancient(kind string, number uint64) ([]byte, error)
- func (d *DatabaseWrapper) AncientDatadir() (string, error)
- func (d *DatabaseWrapper) AncientRange(kind string, start, count, maxBytes uint64) ([][]byte, error)
- func (d *DatabaseWrapper) AncientSize(kind string) (uint64, error)
- func (d *DatabaseWrapper) Ancients() (uint64, error)
- func (d *DatabaseWrapper) Close() error
- func (d *DatabaseWrapper) Compact(start []byte, limit []byte) error
- func (d *DatabaseWrapper) DB() database.Database
- func (d *DatabaseWrapper) Delete(key []byte) error
- func (d *DatabaseWrapper) DeleteRange(start, end []byte) error
- func (d *DatabaseWrapper) Get(key []byte) ([]byte, error)
- func (d *DatabaseWrapper) Has(key []byte) (bool, error)
- func (d *DatabaseWrapper) MigrateTable(string, func([]byte) ([]byte, error)) error
- func (d *DatabaseWrapper) ModifyAncients(fn func(ethdb.AncientWriteOp) error) (int64, error)
- func (d *DatabaseWrapper) NewBatch() ethdb.Batch
- func (d *DatabaseWrapper) NewBatchWithSize(size int) ethdb.Batch
- func (d *DatabaseWrapper) NewIterator(prefix []byte, start []byte) ethdb.Iterator
- func (d *DatabaseWrapper) Put(key []byte, value []byte) error
- func (d *DatabaseWrapper) ReadAncients(fn func(ethdb.AncientReaderOp) error) (err error)
- func (d *DatabaseWrapper) Stat() (string, error)
- func (d *DatabaseWrapper) Sync() error
- func (d *DatabaseWrapper) SyncAncient() error
- func (d *DatabaseWrapper) SyncKeyValue() error
- func (d *DatabaseWrapper) Tail() (uint64, error)
- func (d *DatabaseWrapper) TruncateHead(n uint64) (uint64, error)
- func (d *DatabaseWrapper) TruncateTail(n uint64) (uint64, error)
- type EVMReplayProgress
- type EthAPI
- func (api *EthAPI) BlockNumber() (hexutil.Uint64, error)
- func (api *EthAPI) ChainId() (*hexutil.Big, error)
- func (api *EthAPI) EstimateGas(ctx context.Context, args TransactionArgs, ...) (hexutil.Uint64, error)
- func (api *EthAPI) GasPrice(ctx context.Context) (*hexutil.Big, error)
- func (api *EthAPI) GetBalance(ctx context.Context, address common.Address, ...) (*hexutil.Big, error)
- func (api *EthAPI) GetBlockByHash(ctx context.Context, hash common.Hash, fullTx bool) (map[string]interface{}, error)
- func (api *EthAPI) GetBlockByNumber(ctx context.Context, number rpc.BlockNumber, fullTx bool) (map[string]interface{}, error)
- func (api *EthAPI) GetCode(ctx context.Context, address common.Address, ...) (hexutil.Bytes, error)
- func (api *EthAPI) GetTransactionByHash(ctx context.Context, hash common.Hash) (*RPCTransaction, error)
- func (api *EthAPI) GetTransactionCount(ctx context.Context, address common.Address, ...) (*hexutil.Uint64, error)
- func (api *EthAPI) GetTransactionReceipt(ctx context.Context, hash common.Hash) (map[string]interface{}, error)
- func (api *EthAPI) SendRawTransaction(ctx context.Context, input hexutil.Bytes) (common.Hash, error)
- type Factory
- type IteratorWrapper
- type LegacyHeader
- type LuxAPI
- type MigratedDataAdapter
- func (m *MigratedDataAdapter) Ancient(kind string, number uint64) ([]byte, error)
- func (m *MigratedDataAdapter) AncientDatadir() (string, error)
- func (m *MigratedDataAdapter) AncientRange(kind string, start, count, maxBytes uint64) ([][]byte, error)
- func (m *MigratedDataAdapter) AncientSize(kind string) (uint64, error)
- func (m *MigratedDataAdapter) Ancients() (uint64, error)
- func (m *MigratedDataAdapter) Close() error
- func (m *MigratedDataAdapter) Compact(start []byte, limit []byte) error
- func (m *MigratedDataAdapter) Delete(key []byte) error
- func (m *MigratedDataAdapter) DeleteRange(start, end []byte) error
- func (m *MigratedDataAdapter) Get(key []byte) ([]byte, error)
- func (m *MigratedDataAdapter) Has(key []byte) (bool, error)
- func (m *MigratedDataAdapter) ModifyAncients(fn func(ethdb.AncientWriteOp) error) (int64, error)
- func (m *MigratedDataAdapter) NewBatch() ethdb.Batch
- func (m *MigratedDataAdapter) NewBatchWithSize(size int) ethdb.Batch
- func (m *MigratedDataAdapter) NewIterator(prefix []byte, start []byte) ethdb.Iterator
- func (m *MigratedDataAdapter) Put(key []byte, value []byte) error
- func (m *MigratedDataAdapter) ReadAncients(fn func(ethdb.AncientReaderOp) error) error
- func (m *MigratedDataAdapter) Stat() (string, error)
- func (m *MigratedDataAdapter) SyncAncient() error
- func (m *MigratedDataAdapter) SyncKeyValue() error
- func (m *MigratedDataAdapter) Tail() (uint64, error)
- func (m *MigratedDataAdapter) TruncateHead(n uint64) (uint64, error)
- func (m *MigratedDataAdapter) TruncateTail(n uint64) (uint64, error)
- type MinimalEthBackend
- func NewMigratedBackend(db ethdb.Database, migratedHeight uint64) (*MinimalEthBackend, error)
- func NewMinimalEthBackend(db ethdb.Database, config *ethconfig.Config, genesis *gethcore.Genesis) (*MinimalEthBackend, error)
- func NewMinimalEthBackendForMigration(db ethdb.Database, config *ethconfig.Config, genesis *gethcore.Genesis, ...) (*MinimalEthBackend, error)
- type NamespaceStrippingBatch
- func (b *NamespaceStrippingBatch) Delete(key []byte) error
- func (b *NamespaceStrippingBatch) DeleteRange(start, end []byte) error
- func (b *NamespaceStrippingBatch) Put(key []byte, value []byte) error
- func (b *NamespaceStrippingBatch) Replay(w ethdb.KeyValueWriter) error
- func (b *NamespaceStrippingBatch) Reset()
- func (b *NamespaceStrippingBatch) ValueSize() int
- func (b *NamespaceStrippingBatch) Write() error
- type NamespaceStrippingIterator
- type NetAPI
- type PebbleWithAncient
- func (db *PebbleWithAncient) Ancient(kind string, number uint64) ([]byte, error)
- func (db *PebbleWithAncient) AncientBatch() ethdb.AncientWriteOp
- func (db *PebbleWithAncient) AncientDatadir() (string, error)
- func (db *PebbleWithAncient) AncientOffSet() uint64
- func (db *PebbleWithAncient) AncientRange(kind string, start, count, maxBytes uint64) ([][]byte, error)
- func (db *PebbleWithAncient) AncientSize(kind string) (uint64, error)
- func (db *PebbleWithAncient) Ancients() (uint64, error)
- func (db *PebbleWithAncient) HasAncient(kind string, number uint64) (bool, error)
- func (db *PebbleWithAncient) ModifyAncients(fn func(ethdb.AncientWriteOp) error) (int64, error)
- func (db *PebbleWithAncient) ReadAncients(fn func(ethdb.AncientReaderOp) error) error
- func (db *PebbleWithAncient) Sync() error
- func (db *PebbleWithAncient) SyncAncient() error
- func (db *PebbleWithAncient) SyncKeyValue() error
- func (db *PebbleWithAncient) Tail() (uint64, error)
- func (db *PebbleWithAncient) TruncateHead(n uint64) (uint64, error)
- func (db *PebbleWithAncient) TruncateTail(n uint64) (uint64, error)
- type PreShanghaiHeader
- type RPCTransaction
- type ReplayProgress
- func (p *ReplayProgress) Complete()
- func (p *ReplayProgress) Fail(err error)
- func (p *ReplayProgress) GetStatus() map[string]interface{}
- func (p *ReplayProgress) IncrementBlock() uint64
- func (p *ReplayProgress) IsReplaying() bool
- func (p *ReplayProgress) SetPhase(phase string)
- func (p *ReplayProgress) Start(totalBlocks uint64)
- func (p *ReplayProgress) Update(blockCount uint64)
- func (p *ReplayProgress) UpdateBlock(blockNum uint64)
- func (p *ReplayProgress) UpdatePhase(phase string)
- type ReplayState
- type RuntimeReplayManager
- type SourceDatabase
- type StartReplayRequest
- type SubnetEVMHeader
- type SubnetNamespaceStripper
- func (s *SubnetNamespaceStripper) Ancient(kind string, number uint64) ([]byte, error)
- func (s *SubnetNamespaceStripper) AncientDatadir() (string, error)
- func (s *SubnetNamespaceStripper) AncientRange(kind string, start, count, maxBytes uint64) ([][]byte, error)
- func (s *SubnetNamespaceStripper) AncientSize(kind string) (uint64, error)
- func (s *SubnetNamespaceStripper) Ancients() (uint64, error)
- func (s *SubnetNamespaceStripper) Close() error
- func (s *SubnetNamespaceStripper) Compact(start []byte, limit []byte) error
- func (s *SubnetNamespaceStripper) Delete(key []byte) error
- func (s *SubnetNamespaceStripper) DeleteRange(start, end []byte) error
- func (s *SubnetNamespaceStripper) Get(key []byte) ([]byte, error)
- func (s *SubnetNamespaceStripper) Has(key []byte) (bool, error)
- func (s *SubnetNamespaceStripper) LoadLastBlock() (*types.Block, error)
- func (s *SubnetNamespaceStripper) ModifyAncients(fn func(ethdb.AncientWriteOp) error) (int64, error)
- func (s *SubnetNamespaceStripper) NewBatch() ethdb.Batch
- func (s *SubnetNamespaceStripper) NewBatchWithSize(size int) ethdb.Batch
- func (s *SubnetNamespaceStripper) NewIterator(prefix []byte, start []byte) ethdb.Iterator
- func (s *SubnetNamespaceStripper) Put(key []byte, value []byte) error
- func (s *SubnetNamespaceStripper) ReadAncients(fn func(ethdb.AncientReaderOp) error) error
- func (s *SubnetNamespaceStripper) Stat() (string, error)
- func (s *SubnetNamespaceStripper) SyncAncient() error
- func (s *SubnetNamespaceStripper) SyncKeyValue() error
- func (s *SubnetNamespaceStripper) Tail() (uint64, error)
- func (s *SubnetNamespaceStripper) TruncateHead(n uint64) (uint64, error)
- func (s *SubnetNamespaceStripper) TruncateTail(n uint64) (uint64, error)
- type TransactionArgs
- type UnifiedReplayConfig
- type UnifiedReplayer
- type VM
- func (vm *VM) AppGossip(ctx context.Context, nodeID ids.NodeID, msg []byte) error
- func (vm *VM) AppRequest(ctx context.Context, nodeID ids.NodeID, requestID uint32, deadline time.Time, ...) error
- func (vm *VM) AppRequestFailed(ctx context.Context, nodeID ids.NodeID, requestID uint32, ...) error
- func (vm *VM) AppResponse(ctx context.Context, nodeID ids.NodeID, requestID uint32, response []byte) error
- func (vm *VM) BuildBlock(ctx context.Context) (block.Block, error)
- func (vm *VM) Connected(ctx context.Context, nodeID ids.NodeID, version *version.Application) error
- func (vm *VM) CreateHandlers(ctx context.Context) (map[string]http.Handler, error)
- func (vm *VM) CrossChainAppRequest(ctx context.Context, chainID ids.ID, requestID uint32, deadline time.Time, ...) error
- func (vm *VM) CrossChainAppRequestFailed(ctx context.Context, chainID ids.ID, requestID uint32, appErr *core.AppError) error
- func (vm *VM) CrossChainAppResponse(ctx context.Context, chainID ids.ID, requestID uint32, response []byte) error
- func (vm *VM) Disconnected(ctx context.Context, nodeID ids.NodeID) error
- func (vm *VM) ForceBlockchainReload(targetHeight uint64, targetHash common.Hash) error
- func (vm *VM) GetBlock(ctx context.Context, blkID ids.ID) (block.Block, error)
- func (vm *VM) GetBlockIDAtHeight(ctx context.Context, height uint64) (ids.ID, error)
- func (vm *VM) HealthCheck(ctx context.Context) (interface{}, error)
- func (vm *VM) Initialize(ctx context.Context, chainCtx interface{}, db interface{}, genesisBytes []byte, ...) error
- func (vm *VM) InitializeWithReplay() error
- func (vm *VM) LastAccepted(ctx context.Context) (ids.ID, error)
- func (vm *VM) NewHTTPHandler(ctx context.Context) (http.Handler, error)
- func (vm *VM) ParseBlock(ctx context.Context, blockBytes []byte) (block.Block, error)
- func (vm *VM) RecreateBackendAfterReplay(genesis *gethcore.Genesis) error
- func (vm *VM) ReloadBlockchainState() error
- func (vm *VM) RunReplay(config *DatabaseReplayConfig) error
- func (vm *VM) SetPreference(ctx context.Context, blkID ids.ID) error
- func (vm *VM) SetState(ctx context.Context, state consensusNode.State) error
- func (vm *VM) Shutdown(ctx context.Context) error
- func (vm *VM) VerifyBlockchainIntegrity() error
- func (vm *VM) Version(ctx context.Context) (string, error)
- func (vm *VM) WaitForEvent(ctx context.Context) (interface{}, error)
- type Web3API
Constants ¶
This section is empty.
Variables ¶
var SubnetEVMNamespace = []byte{
0x33, 0x7f, 0xb7, 0x3f, 0x9b, 0xcd, 0xac, 0x8c,
0x31, 0xa2, 0xd5, 0xf7, 0xb8, 0x77, 0xab, 0x1e,
0x8a, 0x2b, 0x7f, 0x2a, 0x1e, 0x9b, 0xf0, 0x2a,
0x0a, 0x0e, 0x6c, 0x6f, 0xd1, 0x64, 0xf1, 0xd1,
}
SubnetEVM namespace for LUX mainnet (blockchain ID 4aYc2FXx...)
var UseSubnetNamespace = false
Flag to enable net namespace handling (set when using --genesis-db)
Functions ¶
func LoadSubnetEVMDatabase ¶
LoadSubnetEVMDatabase is DEPRECATED - we now use the migrated BadgerDB directly The migrated data is at /home/z/.luxd/chainData/C/db/badgerdb/ethdb
func NewBadgerDatabase ¶
func NewBadgerDatabase(luxDB database.Database, config BadgerDatabaseConfig) (ethdb.Database, error)
NewBadgerDatabase creates a new BadgerDB with optional ancient store support
func NewPebbleWithAncient ¶ added in v1.20.0
NewPebbleWithAncient wraps a PebbleDB database with Ancient store stubs
func NewSubnetNamespaceStripper ¶ added in v1.18.26
NewSubnetNamespaceStripper creates a new namespace stripping wrapper
func OpenPebbleDB ¶ added in v1.20.0
OpenPebbleDB opens a PebbleDB database at the given path
func SlurpIntoAncient ¶
func SlurpIntoAncient(sourceDB ethdb.Database, targetPath string, startBlock, endBlock uint64) error
SlurpIntoAncient imports all historical data into the ancient store
func TriggerRuntimeReplay ¶ added in v1.17.2
TriggerRuntimeReplay is the main entry point to trigger replay at runtime
Types ¶
type BadgerDatabaseConfig ¶
type BadgerDatabaseConfig struct {
DataDir string
EnableAncient bool
AncientDir string
ReadOnly bool
FreezeThreshold uint64 // Blocks to keep in main DB before freezing
}
BadgerDatabaseConfig holds configuration for BadgerDB with ancient store
type BatchWrapper ¶
type BatchWrapper struct {
// contains filtered or unexported fields
}
BatchWrapper wraps a Lux batch to implement ethdb.Batch
func (*BatchWrapper) Delete ¶
func (b *BatchWrapper) Delete(key []byte) error
Delete removes the key from the batch
func (*BatchWrapper) DeleteRange ¶
func (b *BatchWrapper) DeleteRange(start, end []byte) error
DeleteRange removes the key range from the batch
func (*BatchWrapper) Put ¶
func (b *BatchWrapper) Put(key []byte, value []byte) error
Put inserts the given value into the batch
func (*BatchWrapper) Replay ¶
func (b *BatchWrapper) Replay(w ethdb.KeyValueWriter) error
Replay replays the batch contents to the given writer
func (*BatchWrapper) ValueSize ¶
func (b *BatchWrapper) ValueSize() int
ValueSize retrieves the amount of data queued up for writing
func (*BatchWrapper) Write ¶
func (b *BatchWrapper) Write() error
Write flushes any accumulated data to disk
type Block ¶
type Block struct {
// contains filtered or unexported fields
}
Block wraps an Ethereum block to implement the chain.Block interface
func (*Block) EpochBit ¶ added in v1.17.2
EpochBit implements the chain.Block interface Returns the epoch fence bit for FPC
func (*Block) FPCVotes ¶ added in v1.17.2
FPCVotes implements the chain.Block interface Returns embedded fast-path consensus vote references
func (*Block) ParentID ¶ added in v1.17.2
ParentID implements the chain.Block interface (alias for Parent)
type DatabaseBackend ¶ added in v1.18.26
type DatabaseBackend string
DatabaseBackend represents the storage backend type
const ( // PebbleBackend uses PebbleDB PebbleBackend DatabaseBackend = "pebbledb" // BadgerBackend uses BadgerDB BadgerBackend DatabaseBackend = "badgerdb" // AutoDetectBackend will attempt to detect the backend type AutoDetectBackend DatabaseBackend = "auto" )
type DatabaseFormat ¶
type DatabaseFormat int
DatabaseFormat represents the database format type
const ( UnknownFormat DatabaseFormat = iota SubnetEVMFormat GethFormat )
type DatabaseIterator ¶ added in v1.18.26
type DatabaseIterator interface {
First() bool
Valid() bool
Next() bool
Key() []byte
Value() []byte
Close()
}
DatabaseIterator abstracts iteration over database keys
type DatabaseReplayConfig ¶
type DatabaseReplayConfig struct {
SourcePath string `json:"source-path"` // Path to source database
DatabaseType string `json:"database-type,omitempty"` // Type: "auto", "namespaced", or "standard"
TestLimit uint64 `json:"test-limit"` // If > 0, limit replay to this many blocks
ExtractGenesisFromSource bool `json:"extract-genesis-from-source"` // If true, extract genesis from block 0 of source
CopyAllState bool `json:"copy-all-state"` // If true, copy all state trie data
// Subnet-EVM replay configuration
SubnetReplayEnabled bool `json:"subnet-replay-enabled"` // Enable replay from Subnet-EVM via RPC
SubnetReplaySourceURL string `json:"subnet-replay-source-url"` // RPC URL e.g. http://127.0.0.1:9630/ext/bc/<chainID>/rpc
SubnetReplayStart uint64 `json:"subnet-replay-start"` // Start block (default 0)
SubnetReplayEnd uint64 `json:"subnet-replay-end"` // End block (0 = tip)
SubnetReplayBatch uint64 `json:"subnet-replay-batch"` // Batch size (default 1000)
SubnetReplayResume bool `json:"subnet-replay-resume"` // Resume from checkpoint (default true)
}
DatabaseReplayConfig holds configuration for database replay
type DatabaseType ¶
type DatabaseType string
DatabaseType represents the type of database to replay from
const ( // StandardDB is a regular geth/coreth database without namespacing StandardDB DatabaseType = "standard" // NamespacedDB is a SubnetEVM database with 32-byte namespace prefix NamespacedDB DatabaseType = "namespaced" // AutoDetect will attempt to detect the database type AutoDetect DatabaseType = "auto" )
type DatabaseWrapper ¶
type DatabaseWrapper struct {
// contains filtered or unexported fields
}
DatabaseWrapper wraps a Lux database to implement ethdb.Database
func (*DatabaseWrapper) Ancient ¶
func (d *DatabaseWrapper) Ancient(kind string, number uint64) ([]byte, error)
Ancient retrieves an ancient binary blob from the append-only immutable files
func (*DatabaseWrapper) AncientDatadir ¶
func (d *DatabaseWrapper) AncientDatadir() (string, error)
AncientDatadir returns the ancient datadir
func (*DatabaseWrapper) AncientRange ¶
func (d *DatabaseWrapper) AncientRange(kind string, start, count, maxBytes uint64) ([][]byte, error)
AncientRange retrieves multiple items in sequence
func (*DatabaseWrapper) AncientSize ¶
func (d *DatabaseWrapper) AncientSize(kind string) (uint64, error)
AncientSize returns the ancient size of the specified category
func (*DatabaseWrapper) Ancients ¶
func (d *DatabaseWrapper) Ancients() (uint64, error)
Ancients returns the ancient item numbers in the ancient store
func (*DatabaseWrapper) Compact ¶
func (d *DatabaseWrapper) Compact(start []byte, limit []byte) error
Compact flattens the underlying data store for the given key range
func (*DatabaseWrapper) DB ¶ added in v1.20.0
func (d *DatabaseWrapper) DB() database.Database
DB returns the underlying database for unwrapping
func (*DatabaseWrapper) Delete ¶
func (d *DatabaseWrapper) Delete(key []byte) error
Delete removes the key from the key-value data store
func (*DatabaseWrapper) DeleteRange ¶
func (d *DatabaseWrapper) DeleteRange(start, end []byte) error
DeleteRange removes all entries between the given markers
func (*DatabaseWrapper) Get ¶
func (d *DatabaseWrapper) Get(key []byte) ([]byte, error)
Get retrieves the given key if it's present in the key-value data store
func (*DatabaseWrapper) Has ¶
func (d *DatabaseWrapper) Has(key []byte) (bool, error)
Has retrieves if a key is present in the key-value data store
func (*DatabaseWrapper) MigrateTable ¶
MigrateTable processes and migrates entries of a given table to a new format
func (*DatabaseWrapper) ModifyAncients ¶
func (d *DatabaseWrapper) ModifyAncients(fn func(ethdb.AncientWriteOp) error) (int64, error)
ModifyAncients runs a write operation on the ancient store
func (*DatabaseWrapper) NewBatch ¶
func (d *DatabaseWrapper) NewBatch() ethdb.Batch
NewBatch creates a write-only database that buffers changes to its host db
func (*DatabaseWrapper) NewBatchWithSize ¶
func (d *DatabaseWrapper) NewBatchWithSize(size int) ethdb.Batch
NewBatchWithSize creates a write-only database batch with a specified size
func (*DatabaseWrapper) NewIterator ¶
func (d *DatabaseWrapper) NewIterator(prefix []byte, start []byte) ethdb.Iterator
NewIterator creates a binary-alphabetical iterator over a subset
func (*DatabaseWrapper) Put ¶
func (d *DatabaseWrapper) Put(key []byte, value []byte) error
Put inserts the given value into the key-value data store
func (*DatabaseWrapper) ReadAncients ¶
func (d *DatabaseWrapper) ReadAncients(fn func(ethdb.AncientReaderOp) error) (err error)
ReadAncients applies the provided AncientReader function
func (*DatabaseWrapper) Stat ¶
func (d *DatabaseWrapper) Stat() (string, error)
Stat returns a particular internal stat of the database
func (*DatabaseWrapper) Sync ¶
func (d *DatabaseWrapper) Sync() error
Sync flushes the database to disk
func (*DatabaseWrapper) SyncAncient ¶
func (d *DatabaseWrapper) SyncAncient() error
SyncAncient syncs the ancient data directory
func (*DatabaseWrapper) SyncKeyValue ¶
func (d *DatabaseWrapper) SyncKeyValue() error
SyncKeyValue ensures that all pending writes are flushed to disk
func (*DatabaseWrapper) Tail ¶
func (d *DatabaseWrapper) Tail() (uint64, error)
Tail returns the number of first stored item in the freezer
func (*DatabaseWrapper) TruncateHead ¶
func (d *DatabaseWrapper) TruncateHead(n uint64) (uint64, error)
TruncateHead discards all but the first n ancient data from the ancient store
func (*DatabaseWrapper) TruncateTail ¶
func (d *DatabaseWrapper) TruncateTail(n uint64) (uint64, error)
TruncateTail discards the first n ancient data from the ancient store
type EVMReplayProgress ¶ added in v1.18.26
type EVMReplayProgress struct {
StartTime time.Time
CurrentBlock uint64
TotalBlocks uint64
ProcessedTxs uint64
FailedTxs uint64
StateVerifications uint64
TargetWalletBalance *uint256.Int
LastLogTime time.Time
// contains filtered or unexported fields
}
EVMReplayProgress tracks the progress of replaying blocks (renamed to avoid conflict)
type EthAPI ¶
type EthAPI struct {
// contains filtered or unexported fields
}
EthAPI provides an Ethereum RPC API
func NewEthAPI ¶
func NewEthAPI(backend *MinimalEthBackend) *EthAPI
NewEthAPI creates a new Ethereum RPC API
func (*EthAPI) BlockNumber ¶
BlockNumber returns the current block number
func (*EthAPI) EstimateGas ¶
func (api *EthAPI) EstimateGas(ctx context.Context, args TransactionArgs, blockNrOrHash *rpc.BlockNumberOrHash) (hexutil.Uint64, error)
EstimateGas estimates the gas needed for a transaction
func (*EthAPI) GetBalance ¶
func (api *EthAPI) GetBalance(ctx context.Context, address common.Address, blockNrOrHash rpc.BlockNumberOrHash) (*hexutil.Big, error)
GetBalance returns the balance of an account
func (*EthAPI) GetBlockByHash ¶
func (api *EthAPI) GetBlockByHash(ctx context.Context, hash common.Hash, fullTx bool) (map[string]interface{}, error)
GetBlockByHash returns the block for the given block hash
func (*EthAPI) GetBlockByNumber ¶
func (api *EthAPI) GetBlockByNumber(ctx context.Context, number rpc.BlockNumber, fullTx bool) (map[string]interface{}, error)
GetBlockByNumber returns the block for the given block number
func (*EthAPI) GetCode ¶
func (api *EthAPI) GetCode(ctx context.Context, address common.Address, blockNrOrHash rpc.BlockNumberOrHash) (hexutil.Bytes, error)
GetCode returns the code of a contract
func (*EthAPI) GetTransactionByHash ¶
func (api *EthAPI) GetTransactionByHash(ctx context.Context, hash common.Hash) (*RPCTransaction, error)
GetTransactionByHash returns a transaction by hash
func (*EthAPI) GetTransactionCount ¶
func (api *EthAPI) GetTransactionCount(ctx context.Context, address common.Address, blockNrOrHash rpc.BlockNumberOrHash) (*hexutil.Uint64, error)
GetTransactionCount returns the nonce of an account
type IteratorWrapper ¶
type IteratorWrapper struct {
// contains filtered or unexported fields
}
IteratorWrapper wraps a Lux iterator to implement ethdb.Iterator
func (*IteratorWrapper) Error ¶
func (i *IteratorWrapper) Error() error
Error returns any accumulated error
func (*IteratorWrapper) Key ¶
func (i *IteratorWrapper) Key() []byte
Key returns the key of the current key/value pair
func (*IteratorWrapper) Next ¶
func (i *IteratorWrapper) Next() bool
Next moves the iterator to the next key/value pair
func (*IteratorWrapper) Release ¶
func (i *IteratorWrapper) Release()
Release releases associated resources
func (*IteratorWrapper) Value ¶
func (i *IteratorWrapper) Value() []byte
Value returns the value of the current key/value pair
type LegacyHeader ¶ added in v1.20.0
type LegacyHeader struct {
ParentHash common.Hash `json:"parentHash"`
UncleHash common.Hash `json:"sha3Uncles"`
Coinbase common.Address `json:"miner"`
Root common.Hash `json:"stateRoot"`
TxHash common.Hash `json:"transactionsRoot"`
ReceiptHash common.Hash `json:"receiptsRoot"`
Bloom types.Bloom `json:"logsBloom"`
Difficulty *big.Int `json:"difficulty"`
Number *big.Int `json:"number"`
GasLimit uint64 `json:"gasLimit"`
GasUsed uint64 `json:"gasUsed"`
Time uint64 `json:"timestamp"`
Extra []byte `json:"extraData"`
MixDigest common.Hash `json:"mixHash"`
Nonce types.BlockNonce `json:"nonce"`
BaseFee *big.Int `json:"baseFeePerGas" rlp:"optional"`
ExtData rlp.RawValue `rlp:"tail"` // Capture any extra SubnetEVM fields
}
LegacyHeader represents the SubnetEVM header format without newer fields
type LuxAPI ¶ added in v1.18.2
type LuxAPI struct {
// contains filtered or unexported fields
}
LuxAPI provides Lux-specific RPC API
func (*LuxAPI) ReloadBlockchain ¶ added in v1.20.0
ReloadBlockchain forces the blockchain to reload and recognize database changes This is useful after replay or direct database modifications
func (*LuxAPI) ReplayStart ¶ added in v1.20.0
func (api *LuxAPI) ReplayStart(req StartReplayRequest) (map[string]interface{}, error)
ReplayStart starts the database replay process from the specified source This is the lux_replayStart RPC method
func (*LuxAPI) ReplayStatus ¶ added in v1.18.2
ReplayStatus returns the status of database replay
func (*LuxAPI) VerifyBlockchain ¶ added in v1.20.0
VerifyBlockchain checks the integrity of the blockchain
type MigratedDataAdapter ¶ added in v1.17.2
type MigratedDataAdapter struct {
// contains filtered or unexported fields
}
MigratedDataAdapter wraps a BadgerDB with migrated data and converts it to geth format
func NewMigratedDataAdapter ¶ added in v1.17.2
func NewMigratedDataAdapter(underlying ethdb.Database) *MigratedDataAdapter
NewMigratedDataAdapter creates an adapter for migrated blockchain data
func (*MigratedDataAdapter) Ancient ¶ added in v1.17.2
func (m *MigratedDataAdapter) Ancient(kind string, number uint64) ([]byte, error)
Ancient retrieves an ancient binary blob from the append-only immutable files.
func (*MigratedDataAdapter) AncientDatadir ¶ added in v1.17.2
func (m *MigratedDataAdapter) AncientDatadir() (string, error)
AncientDatadir returns the path of the ancient store directory.
func (*MigratedDataAdapter) AncientRange ¶ added in v1.17.2
func (m *MigratedDataAdapter) AncientRange(kind string, start, count, maxBytes uint64) ([][]byte, error)
AncientRange retrieves multiple items in sequence, starting from the index 'start'.
func (*MigratedDataAdapter) AncientSize ¶ added in v1.17.2
func (m *MigratedDataAdapter) AncientSize(kind string) (uint64, error)
AncientSize returns the ancient size of the specified category.
func (*MigratedDataAdapter) Ancients ¶ added in v1.17.2
func (m *MigratedDataAdapter) Ancients() (uint64, error)
Ancients returns the ancient item numbers in the ancient store.
func (*MigratedDataAdapter) Close ¶ added in v1.17.2
func (m *MigratedDataAdapter) Close() error
Close closes the database
func (*MigratedDataAdapter) Compact ¶ added in v1.17.2
func (m *MigratedDataAdapter) Compact(start []byte, limit []byte) error
Compact compacts the database
func (*MigratedDataAdapter) Delete ¶ added in v1.17.2
func (m *MigratedDataAdapter) Delete(key []byte) error
Delete removes a key
func (*MigratedDataAdapter) DeleteRange ¶ added in v1.17.2
func (m *MigratedDataAdapter) DeleteRange(start, end []byte) error
DeleteRange deletes all of the keys (and values) in the range [start,end)
func (*MigratedDataAdapter) Get ¶ added in v1.17.2
func (m *MigratedDataAdapter) Get(key []byte) ([]byte, error)
Get retrieves a value, converting migrated format to geth format
func (*MigratedDataAdapter) Has ¶ added in v1.17.2
func (m *MigratedDataAdapter) Has(key []byte) (bool, error)
Has checks if a key exists, converting migrated format to geth format
func (*MigratedDataAdapter) ModifyAncients ¶ added in v1.17.2
func (m *MigratedDataAdapter) ModifyAncients(fn func(ethdb.AncientWriteOp) error) (int64, error)
ModifyAncients runs a write operation on the ancient store.
func (*MigratedDataAdapter) NewBatch ¶ added in v1.17.2
func (m *MigratedDataAdapter) NewBatch() ethdb.Batch
NewBatch creates a new batch
func (*MigratedDataAdapter) NewBatchWithSize ¶ added in v1.17.2
func (m *MigratedDataAdapter) NewBatchWithSize(size int) ethdb.Batch
NewBatchWithSize creates a write-only database batch with pre-allocated buffer
func (*MigratedDataAdapter) NewIterator ¶ added in v1.17.2
func (m *MigratedDataAdapter) NewIterator(prefix []byte, start []byte) ethdb.Iterator
NewIterator creates a new iterator
func (*MigratedDataAdapter) Put ¶ added in v1.17.2
func (m *MigratedDataAdapter) Put(key []byte, value []byte) error
Put stores a value
func (*MigratedDataAdapter) ReadAncients ¶ added in v1.17.2
func (m *MigratedDataAdapter) ReadAncients(fn func(ethdb.AncientReaderOp) error) error
ReadAncients runs the given read operation while ensuring that no writes take place on the underlying ancient store.
func (*MigratedDataAdapter) Stat ¶ added in v1.17.2
func (m *MigratedDataAdapter) Stat() (string, error)
Stat returns database statistics
func (*MigratedDataAdapter) SyncAncient ¶ added in v1.17.2
func (m *MigratedDataAdapter) SyncAncient() error
SyncAncient flushes all in-memory ancient store data to disk.
func (*MigratedDataAdapter) SyncKeyValue ¶ added in v1.17.2
func (m *MigratedDataAdapter) SyncKeyValue() error
SyncKeyValue ensures that all pending writes are flushed to disk
func (*MigratedDataAdapter) Tail ¶ added in v1.17.2
func (m *MigratedDataAdapter) Tail() (uint64, error)
Tail returns the number of first stored item in the ancient store.
func (*MigratedDataAdapter) TruncateHead ¶ added in v1.17.2
func (m *MigratedDataAdapter) TruncateHead(n uint64) (uint64, error)
TruncateHead discards all but the first n ancient data from the ancient store.
func (*MigratedDataAdapter) TruncateTail ¶ added in v1.17.2
func (m *MigratedDataAdapter) TruncateTail(n uint64) (uint64, error)
TruncateTail discards the first n ancient data from the ancient store.
type MinimalEthBackend ¶
type MinimalEthBackend struct {
// contains filtered or unexported fields
}
MinimalEthBackend provides a minimal Ethereum backend without p2p networking
func NewMigratedBackend ¶
func NewMigratedBackend(db ethdb.Database, migratedHeight uint64) (*MinimalEthBackend, error)
NewMigratedBackend creates a special backend for fully migrated data This completely bypasses genesis initialization
func NewMinimalEthBackend ¶
func NewMinimalEthBackend(db ethdb.Database, config *ethconfig.Config, genesis *gethcore.Genesis) (*MinimalEthBackend, error)
NewMinimalEthBackend creates a new minimal Ethereum backend
func NewMinimalEthBackendForMigration ¶
func NewMinimalEthBackendForMigration(db ethdb.Database, config *ethconfig.Config, genesis *gethcore.Genesis, migratedHeight uint64) (*MinimalEthBackend, error)
NewMinimalEthBackendForMigration creates a backend that loads from migrated data
func (*MinimalEthBackend) APIs ¶
func (b *MinimalEthBackend) APIs() []rpc.API
APIs returns the collection of RPC services the ethereum package offers
func (*MinimalEthBackend) BlockChain ¶
func (b *MinimalEthBackend) BlockChain() *gethcore.BlockChain
BlockChain returns the blockchain
func (*MinimalEthBackend) ChainConfig ¶
func (b *MinimalEthBackend) ChainConfig() *params.ChainConfig
ChainConfig returns the chain configuration
func (*MinimalEthBackend) TxPool ¶
func (b *MinimalEthBackend) TxPool() *txpool.TxPool
TxPool returns the transaction pool
type NamespaceStrippingBatch ¶ added in v1.18.26
type NamespaceStrippingBatch struct {
// contains filtered or unexported fields
}
NamespaceStrippingBatch wraps a batch to handle namespace stripping
func (*NamespaceStrippingBatch) Delete ¶ added in v1.18.26
func (b *NamespaceStrippingBatch) Delete(key []byte) error
func (*NamespaceStrippingBatch) DeleteRange ¶ added in v1.18.26
func (b *NamespaceStrippingBatch) DeleteRange(start, end []byte) error
func (*NamespaceStrippingBatch) Put ¶ added in v1.18.26
func (b *NamespaceStrippingBatch) Put(key []byte, value []byte) error
func (*NamespaceStrippingBatch) Replay ¶ added in v1.18.26
func (b *NamespaceStrippingBatch) Replay(w ethdb.KeyValueWriter) error
func (*NamespaceStrippingBatch) Reset ¶ added in v1.18.26
func (b *NamespaceStrippingBatch) Reset()
func (*NamespaceStrippingBatch) ValueSize ¶ added in v1.18.26
func (b *NamespaceStrippingBatch) ValueSize() int
func (*NamespaceStrippingBatch) Write ¶ added in v1.18.26
func (b *NamespaceStrippingBatch) Write() error
type NamespaceStrippingIterator ¶ added in v1.18.26
type NamespaceStrippingIterator struct {
// contains filtered or unexported fields
}
NamespaceStrippingIterator strips namespace from keys during iteration
func (*NamespaceStrippingIterator) Error ¶ added in v1.18.26
func (i *NamespaceStrippingIterator) Error() error
func (*NamespaceStrippingIterator) Key ¶ added in v1.18.26
func (i *NamespaceStrippingIterator) Key() []byte
func (*NamespaceStrippingIterator) Next ¶ added in v1.18.26
func (i *NamespaceStrippingIterator) Next() bool
func (*NamespaceStrippingIterator) Release ¶ added in v1.18.26
func (i *NamespaceStrippingIterator) Release()
func (*NamespaceStrippingIterator) Value ¶ added in v1.18.26
func (i *NamespaceStrippingIterator) Value() []byte
type NetAPI ¶
type NetAPI struct {
// contains filtered or unexported fields
}
NetAPI provides network RPC API
type PebbleWithAncient ¶ added in v1.20.0
PebbleWithAncient wraps a PebbleDB database to add Ancient store method stubs This allows PebbleDB to be used with geth's blockchain, which expects Ancient methods
func (*PebbleWithAncient) Ancient ¶ added in v1.20.0
func (db *PebbleWithAncient) Ancient(kind string, number uint64) ([]byte, error)
func (*PebbleWithAncient) AncientBatch ¶ added in v1.20.0
func (db *PebbleWithAncient) AncientBatch() ethdb.AncientWriteOp
func (*PebbleWithAncient) AncientDatadir ¶ added in v1.20.0
func (db *PebbleWithAncient) AncientDatadir() (string, error)
func (*PebbleWithAncient) AncientOffSet ¶ added in v1.20.0
func (db *PebbleWithAncient) AncientOffSet() uint64
func (*PebbleWithAncient) AncientRange ¶ added in v1.20.0
func (db *PebbleWithAncient) AncientRange(kind string, start, count, maxBytes uint64) ([][]byte, error)
func (*PebbleWithAncient) AncientSize ¶ added in v1.20.0
func (db *PebbleWithAncient) AncientSize(kind string) (uint64, error)
func (*PebbleWithAncient) Ancients ¶ added in v1.20.0
func (db *PebbleWithAncient) Ancients() (uint64, error)
func (*PebbleWithAncient) HasAncient ¶ added in v1.20.0
func (db *PebbleWithAncient) HasAncient(kind string, number uint64) (bool, error)
func (*PebbleWithAncient) ModifyAncients ¶ added in v1.20.0
func (db *PebbleWithAncient) ModifyAncients(fn func(ethdb.AncientWriteOp) error) (int64, error)
func (*PebbleWithAncient) ReadAncients ¶ added in v1.20.0
func (db *PebbleWithAncient) ReadAncients(fn func(ethdb.AncientReaderOp) error) error
func (*PebbleWithAncient) Sync ¶ added in v1.20.0
func (db *PebbleWithAncient) Sync() error
func (*PebbleWithAncient) SyncAncient ¶ added in v1.20.0
func (db *PebbleWithAncient) SyncAncient() error
func (*PebbleWithAncient) SyncKeyValue ¶ added in v1.20.0
func (db *PebbleWithAncient) SyncKeyValue() error
func (*PebbleWithAncient) Tail ¶ added in v1.20.0
func (db *PebbleWithAncient) Tail() (uint64, error)
func (*PebbleWithAncient) TruncateHead ¶ added in v1.20.0
func (db *PebbleWithAncient) TruncateHead(n uint64) (uint64, error)
func (*PebbleWithAncient) TruncateTail ¶ added in v1.20.0
func (db *PebbleWithAncient) TruncateTail(n uint64) (uint64, error)
type PreShanghaiHeader ¶ added in v1.20.0
type PreShanghaiHeader struct {
ParentHash common.Hash
UncleHash common.Hash
Coinbase common.Address
Root common.Hash
TxHash common.Hash
ReceiptHash common.Hash
Bloom types.Bloom
Difficulty *big.Int
Number *big.Int
GasLimit uint64
GasUsed uint64
Time uint64
Extra []byte
MixDigest common.Hash
Nonce types.BlockNonce
BaseFee *big.Int `rlp:"optional"` // EIP-1559
// ExtDataHash can be present as empty bytes, so use []byte instead of Hash
// to allow RLP decoder to handle variable-length data
ExtDataHash []byte `rlp:"optional"` // SubnetEVM specific, may be empty or 32 bytes
}
PreShanghaiHeader represents header format from SubnetEVM before Shanghai upgrade SubnetEVM headers may have 16 or 17 fields depending on presence of ExtDataHash
func (*PreShanghaiHeader) ToPostShanghai ¶ added in v1.20.0
func (h *PreShanghaiHeader) ToPostShanghai() *types.Header
ToPostShanghai converts pre-Shanghai header to post-Shanghai types.Header
type RPCTransaction ¶
type RPCTransaction struct {
BlockHash *common.Hash `json:"blockHash"`
BlockNumber *hexutil.Big `json:"blockNumber"`
From common.Address `json:"from"`
Gas hexutil.Uint64 `json:"gas"`
GasPrice *hexutil.Big `json:"gasPrice"`
GasFeeCap *hexutil.Big `json:"maxFeePerGas,omitempty"`
GasTipCap *hexutil.Big `json:"maxPriorityFeePerGas,omitempty"`
Hash common.Hash `json:"hash"`
Input hexutil.Bytes `json:"input"`
Nonce hexutil.Uint64 `json:"nonce"`
To *common.Address `json:"to"`
TransactionIndex *hexutil.Uint64 `json:"transactionIndex"`
Value *hexutil.Big `json:"value"`
Type hexutil.Uint64 `json:"type"`
Accesses *types.AccessList `json:"accessList,omitempty"`
ChainID *hexutil.Big `json:"chainId,omitempty"`
V *hexutil.Big `json:"v"`
R *hexutil.Big `json:"r"`
S *hexutil.Big `json:"s"`
}
RPCTransaction represents a transaction for RPC
type ReplayProgress ¶ added in v1.18.2
type ReplayProgress struct {
// contains filtered or unexported fields
}
ReplayProgress tracks the progress of database replay
func NewReplayProgress ¶ added in v1.18.2
func NewReplayProgress() *ReplayProgress
NewReplayProgress creates a new replay progress tracker
func (*ReplayProgress) Complete ¶ added in v1.18.2
func (p *ReplayProgress) Complete()
Complete marks the replay as completed
func (*ReplayProgress) Fail ¶ added in v1.18.2
func (p *ReplayProgress) Fail(err error)
Fail marks the replay as failed
func (*ReplayProgress) GetStatus ¶ added in v1.18.2
func (p *ReplayProgress) GetStatus() map[string]interface{}
GetStatus returns the current status
func (*ReplayProgress) IncrementBlock ¶ added in v1.18.2
func (p *ReplayProgress) IncrementBlock() uint64
IncrementBlock increments the current block counter
func (*ReplayProgress) IsReplaying ¶ added in v1.20.0
func (p *ReplayProgress) IsReplaying() bool
IsReplaying returns true if replay is currently in progress
func (*ReplayProgress) SetPhase ¶ added in v1.18.2
func (p *ReplayProgress) SetPhase(phase string)
SetPhase updates the current phase
func (*ReplayProgress) Start ¶ added in v1.18.2
func (p *ReplayProgress) Start(totalBlocks uint64)
Start marks the replay as started
func (*ReplayProgress) Update ¶ added in v1.20.0
func (p *ReplayProgress) Update(blockCount uint64)
Update updates the current block count
func (*ReplayProgress) UpdateBlock ¶ added in v1.18.2
func (p *ReplayProgress) UpdateBlock(blockNum uint64)
UpdateBlock updates the current block number
func (*ReplayProgress) UpdatePhase ¶ added in v1.20.0
func (p *ReplayProgress) UpdatePhase(phase string)
UpdatePhase is an alias for SetPhase for compatibility
type ReplayState ¶ added in v1.18.2
type ReplayState int32
ReplayState represents the state of database replay
const ( ReplayNotStarted ReplayState = 0 ReplayInProgress ReplayState = 1 ReplayCompleted ReplayState = 2 ReplayFailed ReplayState = 3 )
type RuntimeReplayManager ¶ added in v1.17.2
type RuntimeReplayManager struct {
// contains filtered or unexported fields
}
RuntimeReplayManager handles runtime detection and loading of migrated blockchain data
func NewRuntimeReplayManager ¶ added in v1.17.2
func NewRuntimeReplayManager(vm *VM) *RuntimeReplayManager
NewRuntimeReplayManager creates a new runtime replay manager
func (*RuntimeReplayManager) DetectAndLoadMigratedData ¶ added in v1.17.2
func (r *RuntimeReplayManager) DetectAndLoadMigratedData() error
DetectAndLoadMigratedData checks for migrated BadgerDB data and loads it into the chain
type SourceDatabase ¶ added in v1.18.26
type SourceDatabase interface {
Get(key []byte) ([]byte, io.Closer, error)
Close() error
NewIterator(prefix []byte, upperBound []byte) (DatabaseIterator, error)
}
SourceDatabase is an interface for different database backends
type StartReplayRequest ¶ added in v1.20.0
type StartReplayRequest struct {
SourcePath string `json:"sourcePath"`
StartBlock uint64 `json:"startBlock"`
EndBlock uint64 `json:"endBlock"`
BatchSize uint64 `json:"batchSize"`
}
StartReplayRequest represents the request for starting database replay
type SubnetEVMHeader ¶
type SubnetEVMHeader struct {
ParentHash common.Hash `json:"parentHash" gencodec:"required"`
UncleHash common.Hash `json:"sha3Uncles" gencodec:"required"`
Coinbase common.Address `json:"miner"`
Root common.Hash `json:"stateRoot" gencodec:"required"`
TxHash common.Hash `json:"transactionsRoot" gencodec:"required"`
ReceiptHash common.Hash `json:"receiptsRoot" gencodec:"required"`
Bloom types.Bloom `json:"logsBloom" gencodec:"required"`
Difficulty *big.Int `json:"difficulty" gencodec:"required"`
Number *big.Int `json:"number" gencodec:"required"`
GasLimit uint64 `json:"gasLimit" gencodec:"required"`
GasUsed uint64 `json:"gasUsed" gencodec:"required"`
Time uint64 `json:"timestamp" gencodec:"required"`
Extra []byte `json:"extraData" gencodec:"required"`
MixDigest common.Hash `json:"mixHash"`
Nonce types.BlockNonce `json:"nonce"`
BaseFee *big.Int `json:"baseFeePerGas" rlp:"optional"`
WithdrawalsHash common.Hash `json:"withdrawalsRoot" rlp:"optional"`
BlockGasCost *big.Int `rlp:"optional"`
ExtDataHash common.Hash `rlp:"optional"`
}
SubnetEVMHeader is the SubnetEVM header format with additional optional fields
type SubnetNamespaceStripper ¶ added in v1.18.26
type SubnetNamespaceStripper struct {
// contains filtered or unexported fields
}
SubnetNamespaceStripper wraps a database and strips the 32-byte namespace prefix from SubnetEVM migrated data, making it readable by C-Chain
func (*SubnetNamespaceStripper) Ancient ¶ added in v1.18.26
func (s *SubnetNamespaceStripper) Ancient(kind string, number uint64) ([]byte, error)
Ancient store methods (delegate to underlying)
func (*SubnetNamespaceStripper) AncientDatadir ¶ added in v1.18.26
func (s *SubnetNamespaceStripper) AncientDatadir() (string, error)
func (*SubnetNamespaceStripper) AncientRange ¶ added in v1.18.26
func (s *SubnetNamespaceStripper) AncientRange(kind string, start, count, maxBytes uint64) ([][]byte, error)
func (*SubnetNamespaceStripper) AncientSize ¶ added in v1.18.26
func (s *SubnetNamespaceStripper) AncientSize(kind string) (uint64, error)
func (*SubnetNamespaceStripper) Ancients ¶ added in v1.18.26
func (s *SubnetNamespaceStripper) Ancients() (uint64, error)
func (*SubnetNamespaceStripper) Close ¶ added in v1.18.26
func (s *SubnetNamespaceStripper) Close() error
func (*SubnetNamespaceStripper) Compact ¶ added in v1.18.26
func (s *SubnetNamespaceStripper) Compact(start []byte, limit []byte) error
func (*SubnetNamespaceStripper) Delete ¶ added in v1.18.26
func (s *SubnetNamespaceStripper) Delete(key []byte) error
Delete removes a key
func (*SubnetNamespaceStripper) DeleteRange ¶ added in v1.18.26
func (s *SubnetNamespaceStripper) DeleteRange(start, end []byte) error
func (*SubnetNamespaceStripper) Get ¶ added in v1.18.26
func (s *SubnetNamespaceStripper) Get(key []byte) ([]byte, error)
Get retrieves a value, handling namespace translation
func (*SubnetNamespaceStripper) Has ¶ added in v1.18.26
func (s *SubnetNamespaceStripper) Has(key []byte) (bool, error)
Has checks if a key exists
func (*SubnetNamespaceStripper) LoadLastBlock ¶ added in v1.18.26
func (s *SubnetNamespaceStripper) LoadLastBlock() (*types.Block, error)
LoadLastBlock loads the highest block from the migrated database
func (*SubnetNamespaceStripper) ModifyAncients ¶ added in v1.18.26
func (s *SubnetNamespaceStripper) ModifyAncients(fn func(ethdb.AncientWriteOp) error) (int64, error)
func (*SubnetNamespaceStripper) NewBatch ¶ added in v1.18.26
func (s *SubnetNamespaceStripper) NewBatch() ethdb.Batch
NewBatch creates a new batch
func (*SubnetNamespaceStripper) NewBatchWithSize ¶ added in v1.18.26
func (s *SubnetNamespaceStripper) NewBatchWithSize(size int) ethdb.Batch
NewBatchWithSize creates a batch with size hint
func (*SubnetNamespaceStripper) NewIterator ¶ added in v1.18.26
func (s *SubnetNamespaceStripper) NewIterator(prefix []byte, start []byte) ethdb.Iterator
NewIterator creates an iterator
func (*SubnetNamespaceStripper) Put ¶ added in v1.18.26
func (s *SubnetNamespaceStripper) Put(key []byte, value []byte) error
Put stores a value (no namespace manipulation on writes)
func (*SubnetNamespaceStripper) ReadAncients ¶ added in v1.18.26
func (s *SubnetNamespaceStripper) ReadAncients(fn func(ethdb.AncientReaderOp) error) error
func (*SubnetNamespaceStripper) Stat ¶ added in v1.18.26
func (s *SubnetNamespaceStripper) Stat() (string, error)
func (*SubnetNamespaceStripper) SyncAncient ¶ added in v1.18.26
func (s *SubnetNamespaceStripper) SyncAncient() error
func (*SubnetNamespaceStripper) SyncKeyValue ¶ added in v1.18.26
func (s *SubnetNamespaceStripper) SyncKeyValue() error
func (*SubnetNamespaceStripper) Tail ¶ added in v1.18.26
func (s *SubnetNamespaceStripper) Tail() (uint64, error)
func (*SubnetNamespaceStripper) TruncateHead ¶ added in v1.18.26
func (s *SubnetNamespaceStripper) TruncateHead(n uint64) (uint64, error)
func (*SubnetNamespaceStripper) TruncateTail ¶ added in v1.18.26
func (s *SubnetNamespaceStripper) TruncateTail(n uint64) (uint64, error)
type TransactionArgs ¶
type TransactionArgs struct {
From *common.Address `json:"from"`
To *common.Address `json:"to"`
Gas *hexutil.Uint64 `json:"gas"`
GasPrice *hexutil.Big `json:"gasPrice"`
Value *hexutil.Big `json:"value"`
Nonce *hexutil.Uint64 `json:"nonce"`
Data *hexutil.Bytes `json:"data"`
Input *hexutil.Bytes `json:"input"`
}
TransactionArgs represents the arguments for a transaction
type UnifiedReplayConfig ¶
type UnifiedReplayConfig struct {
SourcePath string // Path to source database
DatabaseBackend DatabaseBackend // Storage backend type (pebbledb/badgerdb/auto)
DatabaseType DatabaseType // Type of source database
Namespace []byte // Namespace for namespaced databases (optional)
TestMode bool // If true, only replay first 100 blocks
TestLimit uint64 // Number of blocks to replay in test mode
CopyAllState bool // If true, copy all state data (can be large)
MaxStateNodes uint64 // Maximum state nodes to copy (0 = unlimited)
ExtractGenesisFromSource bool // If true, extract genesis from block 0
ParallelWorkers int // Number of parallel workers for processing (default: 8)
BatchSize int // Batch size for database writes (default: 100000)
TargetWallet common.Address // Wallet to track balance changes
TargetHeight uint64 // Target block height to process to
ChainConfig *params.ChainConfig // Chain configuration for EVM
ReplayTransactions bool // If true, replay transactions through EVM (default: true)
VerifyStateRoots bool // If true, verify state roots after each block
LogInterval uint64 // Log progress every N blocks (default: 1000)
}
UnifiedReplayConfig holds configuration for database replay
type UnifiedReplayer ¶
type UnifiedReplayer struct {
// contains filtered or unexported fields
}
UnifiedReplayer handles replaying blocks from various database formats
func NewUnifiedReplayer ¶
func NewUnifiedReplayer(config *UnifiedReplayConfig, targetDB ethdb.Database, blockchain *core.BlockChain) (*UnifiedReplayer, error)
NewUnifiedReplayer creates a new unified database replayer (backward compatibility)
func NewUnifiedReplayerWithTrieDB ¶ added in v1.20.0
func NewUnifiedReplayerWithTrieDB(config *UnifiedReplayConfig, targetDB ethdb.Database, blockchain *core.BlockChain, trieDB *triedb.Database, stateCache state.Database) (*UnifiedReplayer, error)
NewUnifiedReplayerWithTrieDB creates a new unified database replayer with optional external trie database
func (*UnifiedReplayer) Close ¶
func (r *UnifiedReplayer) Close() error
Close closes the replayer and cleans up resources
func (*UnifiedReplayer) ExtractGenesis ¶
func (r *UnifiedReplayer) ExtractGenesis() (*types.Block, error)
ExtractGenesis extracts the genesis block from the source database
func (*UnifiedReplayer) ReplayWithEVM ¶ added in v1.18.26
func (r *UnifiedReplayer) ReplayWithEVM() error
ReplayWithEVM replays blocks by executing transactions through the EVM
type VM ¶
type VM struct {
// contains filtered or unexported fields
}
VM implements the C-Chain VM interface using geth
func (*VM) AppRequest ¶
func (vm *VM) AppRequest(ctx context.Context, nodeID ids.NodeID, requestID uint32, deadline time.Time, request []byte) error
AppRequest implements the block.ChainVM interface
func (*VM) AppRequestFailed ¶
func (vm *VM) AppRequestFailed(ctx context.Context, nodeID ids.NodeID, requestID uint32, appErr *core.AppError) error
AppRequestFailed implements the block.ChainVM interface
func (*VM) AppResponse ¶
func (vm *VM) AppResponse(ctx context.Context, nodeID ids.NodeID, requestID uint32, response []byte) error
AppResponse implements the block.ChainVM interface
func (*VM) BuildBlock ¶
BuildBlock implements the block.ChainVM interface
func (*VM) CreateHandlers ¶
CreateHandlers implements the block.ChainVM interface
func (*VM) CrossChainAppRequest ¶
func (vm *VM) CrossChainAppRequest(ctx context.Context, chainID ids.ID, requestID uint32, deadline time.Time, request []byte) error
CrossChainAppRequest implements the block.ChainVM interface
func (*VM) CrossChainAppRequestFailed ¶
func (vm *VM) CrossChainAppRequestFailed(ctx context.Context, chainID ids.ID, requestID uint32, appErr *core.AppError) error
CrossChainAppRequestFailed implements the block.ChainVM interface
func (*VM) CrossChainAppResponse ¶
func (vm *VM) CrossChainAppResponse(ctx context.Context, chainID ids.ID, requestID uint32, response []byte) error
CrossChainAppResponse implements the block.ChainVM interface
func (*VM) Disconnected ¶
Disconnected implements the block.ChainVM interface
func (*VM) ForceBlockchainReload ¶ added in v1.20.0
ForceBlockchainReload forces the blockchain to recognize replayed blocks This is called after replay completes to ensure eth_blockNumber returns the correct value
func (*VM) GetBlockIDAtHeight ¶
GetBlockIDAtHeight implements the block.ChainVM interface
func (*VM) HealthCheck ¶
HealthCheck implements the block.ChainVM interface
func (*VM) Initialize ¶
func (vm *VM) Initialize( ctx context.Context, chainCtx interface{}, db interface{}, genesisBytes []byte, upgradeBytes []byte, configBytes []byte, msgChan interface{}, fxs []interface{}, appSender interface{}, ) error
Initialize implements the block.ChainVM interface
func (*VM) InitializeWithReplay ¶ added in v1.18.28
InitializeWithReplay initializes the VM with migrated blockchain data
func (*VM) LastAccepted ¶
LastAccepted implements the block.ChainVM interface
func (*VM) NewHTTPHandler ¶
NewHTTPHandler implements the block.ChainVM interface
func (*VM) ParseBlock ¶
ParseBlock implements the block.ChainVM interface
func (*VM) RecreateBackendAfterReplay ¶ added in v1.20.0
RecreateBackendAfterReplay recreates the backend and blockchain after replay This ensures all components properly recognize the replayed data
func (*VM) ReloadBlockchainState ¶ added in v1.20.0
ReloadBlockchainState forces the blockchain to reload its state from the database This is useful after direct database modifications or replay operations
func (*VM) RunReplay ¶ added in v1.20.0
func (vm *VM) RunReplay(config *DatabaseReplayConfig) error
RunReplay executes the runtime replay of blocks from SubnetEVM to C-Chain This method is called by the lux_replayStart RPC method
func (*VM) SetPreference ¶
SetPreference implements the block.ChainVM interface
func (*VM) VerifyBlockchainIntegrity ¶ added in v1.20.0
VerifyBlockchainIntegrity checks that the blockchain properly recognizes replayed data
type Web3API ¶
type Web3API struct{}
Web3API provides web3 RPC API
func (*Web3API) ClientVersion ¶
ClientVersion returns the node client version
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
cmd
|
|
|
replay
command
|
|
|
replay-standalone
command
replay-standalone is a standalone tool for replaying SubnetEVM data into C-Chain format It doesn't depend on the node package, making it more portable.
|
replay-standalone is a standalone tool for replaying SubnetEVM data into C-Chain format It doesn't depend on the node package, making it more portable. |