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 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 DatabaseFormat
- 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) 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 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 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 NetAPI
- 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) SetPhase(phase string)
- func (p *ReplayProgress) Start(totalBlocks uint64)
- func (p *ReplayProgress) UpdateBlock(blockNum uint64)
- type ReplayState
- type RuntimeReplayManager
- type SubnetEVMHeader
- 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) 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) 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) 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) Version(ctx context.Context) (string, error)
- type Web3API
Constants ¶
This section is empty.
Variables ¶
var UseSubnetNamespace = false
Flag to enable net namespace handling (set when using --genesis-db)
Functions ¶
func LoadSubnetEVMDatabase ¶
LoadSubnetEVMDatabase directly copies all blocks from SubnetEVM database
func NewBadgerDatabase ¶
func NewBadgerDatabase(luxDB database.Database, config BadgerDatabaseConfig) (ethdb.Database, error)
NewBadgerDatabase creates a new BadgerDB with optional ancient store support
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 DatabaseFormat ¶
type DatabaseFormat int
DatabaseFormat represents the database format type
const ( UnknownFormat DatabaseFormat = iota SubnetEVMFormat GethFormat )
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
}
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) 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 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 LuxAPI ¶ added in v1.18.2
type LuxAPI struct {
// contains filtered or unexported fields
}
LuxAPI provides Lux-specific RPC API
func (*LuxAPI) ReplayStatus ¶ added in v1.18.2
ReplayStatus returns the status of database replay
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 NetAPI ¶
type NetAPI struct {
// contains filtered or unexported fields
}
NetAPI provides network RPC API
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) 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) UpdateBlock ¶ added in v1.18.2
func (p *ReplayProgress) UpdateBlock(blockNum uint64)
UpdateBlock updates the current block number
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 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 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
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)
}
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
func (*UnifiedReplayer) ExtractGenesis ¶
func (r *UnifiedReplayer) ExtractGenesis() (*types.Block, error)
ExtractGenesis extracts the genesis block from the source database
func (*UnifiedReplayer) ParallelReplay ¶
func (r *UnifiedReplayer) ParallelReplay() error
ParallelReplay performs optimized parallel replay of the entire database
func (*UnifiedReplayer) Run ¶
func (r *UnifiedReplayer) Run() error
Run executes the database replay
func (*UnifiedReplayer) SetProgressTracker ¶ added in v1.18.2
func (r *UnifiedReplayer) SetProgressTracker(progress *ReplayProgress)
SetProgressTracker sets the progress tracker for the replayer
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) 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) 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) SetPreference ¶
SetPreference implements the block.ChainVM interface
type Web3API ¶
type Web3API struct{}
Web3API provides web3 RPC API
func (*Web3API) ClientVersion ¶
ClientVersion returns the node client version