cchainvm

package
v1.21.21 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 11, 2025 License: BSD-3-Clause Imports: 52 Imported by: 0

Documentation ¶

Overview ¶

Database key format helpers for both EVM and geth formats

Index ¶

Constants ¶

View Source
const (
	// BadgerBackend uses Badger database
	BadgerBackend = "badger"
	// PebbleBackend uses Pebble database
	PebbleBackend = "pebble"
	// AutoDetectBackend automatically detects backend
	AutoDetectBackend = "auto"
)

Database backend types

Variables ¶

View Source
var EVMNamespace = []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,
}

EVM namespace for LUX mainnet (blockchain ID 4aYc2FXx...)

View Source
var UseNetNamespace = false

Flag to enable net namespace handling (set when using --genesis-db)

Functions ¶

func InitializeCChainWithReplay ¶ added in v1.20.6

func InitializeCChainWithReplay(blockchain *gethcore.BlockChain, db ethdb.Database) error

InitializeCChainWithReplay imports blocks from migrated database using runtime replay NOTE: This assumes genesis has already been properly initialized via SetupGenesisBlock

func LoadEVMDatabase ¶ added in v1.20.3

func LoadEVMDatabase(targetDB ethdb.Database) error

LoadEVMDatabase 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 NewNetNamespaceStripper ¶ added in v1.20.3

func NewNetNamespaceStripper(db ethdb.Database) ethdb.Database

NewNetNamespaceStripper creates a new namespace stripping wrapper

func NewPebbleWithAncient ¶ added in v1.20.0

func NewPebbleWithAncient(db *pebble.Database) ethdb.Database

NewPebbleWithAncient wraps a PebbleDB database with Ancient store stubs

func OpenPebbleDB ¶ added in v1.20.0

func OpenPebbleDB(path string) (database.Database, error)

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

func TriggerRuntimeReplay(vm *VM) error

TriggerRuntimeReplay is the main entry point to trigger replay at runtime

func WrapDatabase ¶

func WrapDatabase(db database.Database) ethdb.Database

WrapDatabase creates a new database wrapper

Types ¶

type BadgerDatabaseConfig ¶

type BadgerDatabaseConfig struct {
	DataDir         string
	EnableAncient   bool
	AncientDir      string
	ReadOnly        bool
	SharedAncient   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) Reset ¶

func (b *BatchWrapper) Reset()

Reset resets the batch for reuse

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) Accept ¶

func (b *Block) Accept(ctx context.Context) error

Accept implements the chain.Block interface

func (*Block) Bytes ¶

func (b *Block) Bytes() []byte

Bytes implements the chain.Block interface

func (*Block) EpochBit ¶ added in v1.17.2

func (b *Block) EpochBit() bool

EpochBit implements the chain.Block interface Returns the epoch fence bit for FPC

func (*Block) FPCVotes ¶ added in v1.17.2

func (b *Block) FPCVotes() [][]byte

FPCVotes implements the chain.Block interface Returns embedded fast-path consensus vote references

func (*Block) Height ¶

func (b *Block) Height() uint64

Height implements the chain.Block interface

func (*Block) ID ¶

func (b *Block) ID() ids.ID

ID implements the chain.Block interface

func (*Block) Parent ¶

func (b *Block) Parent() ids.ID

Parent implements the chain.Block interface

func (*Block) ParentID ¶ added in v1.17.2

func (b *Block) ParentID() ids.ID

ParentID implements the chain.Block interface (alias for Parent)

func (*Block) Reject ¶

func (b *Block) Reject(ctx context.Context) error

Reject implements the chain.Block interface

func (*Block) Status ¶

func (b *Block) Status() uint8

Status implements the chain.Block interface

func (*Block) Timestamp ¶

func (b *Block) Timestamp() time.Time

Timestamp implements the chain.Block interface

func (*Block) Verify ¶

func (b *Block) Verify(ctx context.Context) error

Verify implements the chain.Block interface

type DatabaseBackend ¶ added in v1.18.26

type DatabaseBackend = string

DatabaseBackend type alias for backend selection

type DatabaseFormat ¶

type DatabaseFormat int

DatabaseFormat represents the database format type

const (
	UnknownFormat DatabaseFormat = iota
	EVMFormat
	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

	// Net-EVM replay configuration
	NetReplayEnabled   bool   `json:"subnet-replay-enabled"`    // Enable replay from Net-EVM via RPC
	NetReplaySourceURL string `json:"subnet-replay-source-url"` // RPC URL e.g. http://127.0.0.1:9630/ext/bc/<chainID>/rpc
	NetReplayStart     uint64 `json:"subnet-replay-start"`      // Start block (default 0)
	NetReplayEnd       uint64 `json:"subnet-replay-end"`        // End block (0 = tip)
	NetReplayBatch     uint64 `json:"subnet-replay-batch"`      // Batch size (default 1000)
	NetReplayResume    bool   `json:"subnet-replay-resume"`     // Resume from checkpoint (default true)
}

DatabaseReplayConfig holds configuration for database replay

type DatabaseType ¶

type DatabaseType string

DatabaseType represents database format type

const (
	// AutoDetect automatically detects database type
	AutoDetect DatabaseType = "auto"
	// Namespaced uses namespace-prefixed database
	Namespaced DatabaseType = "namespaced"
	// Standard uses standard database format
	Standard DatabaseType = "standard"
	// StandardDB is an alias for Standard
	StandardDB DatabaseType = "standard"
	// NamespacedDB is an alias for Namespaced
	NamespacedDB DatabaseType = "namespaced"
)

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) AncientBytes ¶ added in v1.20.3

func (d *DatabaseWrapper) AncientBytes(kind string, id, offset, length uint64) ([]byte, error)

AncientBytes retrieves the value segment of the element specified by the id and value offsets

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) Close ¶

func (d *DatabaseWrapper) Close() error

Close closes the database

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

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 ¶

func (d *DatabaseWrapper) MigrateTable(string, func([]byte) ([]byte, error)) error

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 DebugAPI ¶ added in v1.20.5

type DebugAPI struct {
	// contains filtered or unexported fields
}

DebugAPI provides debug RPC API

func NewDebugAPI ¶ added in v1.20.5

func NewDebugAPI(backend *MinimalEthBackend) *DebugAPI

NewDebugAPI creates a new Debug RPC API

func (*DebugAPI) TraceBlock ¶ added in v1.20.5

func (api *DebugAPI) TraceBlock(ctx context.Context, blockRlp hexutil.Bytes) (interface{}, error)

TraceBlock returns traces for all transactions in a block

func (*DebugAPI) TraceBlockByHash ¶ added in v1.20.5

func (api *DebugAPI) TraceBlockByHash(ctx context.Context, hash common.Hash) (interface{}, error)

TraceBlockByHash returns traces for all transactions in a block by hash

func (*DebugAPI) TraceBlockByNumber ¶ added in v1.20.5

func (api *DebugAPI) TraceBlockByNumber(ctx context.Context, number rpc.BlockNumber) (interface{}, error)

TraceBlockByNumber returns traces for all transactions in a block by number

func (*DebugAPI) TraceTransaction ¶ added in v1.20.5

func (api *DebugAPI) TraceTransaction(ctx context.Context, txHash common.Hash) (interface{}, error)

TraceTransaction returns the trace of a transaction

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) Accounts ¶ added in v1.20.5

func (api *EthAPI) Accounts() []common.Address

Accounts returns the list of accounts owned by the client

func (*EthAPI) BlockNumber ¶

func (api *EthAPI) BlockNumber() (hexutil.Uint64, error)

BlockNumber returns the current block number

func (*EthAPI) Call ¶ added in v1.20.5

func (api *EthAPI) Call(ctx context.Context, args TransactionArgs, blockNrOrHash rpc.BlockNumberOrHash) (hexutil.Bytes, error)

Call executes a message call immediately without creating a transaction

func (*EthAPI) ChainId ¶

func (api *EthAPI) ChainId() (*hexutil.Big, error)

ChainId returns the chain ID

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) GasPrice ¶

func (api *EthAPI) GasPrice(ctx context.Context) (*hexutil.Big, error)

GasPrice returns the current gas price

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) GetLogs ¶ added in v1.20.5

func (api *EthAPI) GetLogs(ctx context.Context, criteria map[string]interface{}) ([]*types.Log, error)

GetLogs returns logs matching the filter criteria

func (*EthAPI) GetStorageAt ¶ added in v1.20.5

func (api *EthAPI) GetStorageAt(ctx context.Context, address common.Address, key string, blockNrOrHash rpc.BlockNumberOrHash) (hexutil.Bytes, error)

GetStorageAt returns the value from a storage position at a given address

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

func (*EthAPI) GetTransactionReceipt ¶

func (api *EthAPI) GetTransactionReceipt(ctx context.Context, hash common.Hash) (map[string]interface{}, error)

GetTransactionReceipt returns the receipt of a transaction

func (*EthAPI) GetUncleCountByBlockHash ¶ added in v1.20.5

func (api *EthAPI) GetUncleCountByBlockHash(ctx context.Context, hash common.Hash) *hexutil.Uint

GetUncleCountByBlockHash returns the number of uncles in a block by hash

func (*EthAPI) GetUncleCountByBlockNumber ¶ added in v1.20.5

func (api *EthAPI) GetUncleCountByBlockNumber(ctx context.Context, number rpc.BlockNumber) *hexutil.Uint

GetUncleCountByBlockNumber returns the number of uncles in a block by number

func (*EthAPI) Hashrate ¶ added in v1.20.5

func (api *EthAPI) Hashrate() hexutil.Uint64

Hashrate returns the client's hashrate

func (*EthAPI) Mining ¶ added in v1.20.5

func (api *EthAPI) Mining() bool

Mining returns whether the client is actively mining

func (*EthAPI) SendRawTransaction ¶

func (api *EthAPI) SendRawTransaction(ctx context.Context, input hexutil.Bytes) (common.Hash, error)

SendRawTransaction sends a raw transaction

func (*EthAPI) SendTransaction ¶ added in v1.20.5

func (api *EthAPI) SendTransaction(ctx context.Context, args TransactionArgs) (common.Hash, error)

SendTransaction sends a transaction (creates and signs if needed)

func (*EthAPI) Sign ¶ added in v1.20.5

func (api *EthAPI) Sign(addr common.Address, data hexutil.Bytes) (hexutil.Bytes, error)

Sign signs data with the given account

func (*EthAPI) SignTransaction ¶ added in v1.20.5

func (api *EthAPI) SignTransaction(args TransactionArgs) (hexutil.Bytes, error)

SignTransaction signs a transaction

func (*EthAPI) Syncing ¶ added in v1.20.5

func (api *EthAPI) Syncing() (interface{}, error)

Syncing returns the syncing status

type Factory ¶

type Factory struct{}

Factory creates new instances of the C-Chain VM

func (*Factory) New ¶

func (f *Factory) New(logger log.Logger) (interface{}, error)

New creates a new C-Chain VM instance

type FetchedBlock ¶ added in v1.20.5

type FetchedBlock struct {
	Num      uint64
	Header   *types.Header
	Txs      types.Transactions
	Receipts types.Receipts
}

FetchedBlock contains block data from RPC

type ImportAccountState ¶ added in v1.21.4

type ImportAccountState struct {
	Balance  string            `json:"balance"`
	Nonce    uint64            `json:"nonce"`
	Code     string            `json:"code,omitempty"`
	Storage  map[string]string `json:"storage,omitempty"`
	CodeHash string            `json:"codeHash,omitempty"`
}

ImportAccountState represents account state to import

type ImportBlockEntry ¶ added in v1.20.6

type ImportBlockEntry struct {
	Height       uint64                         `json:"height"`
	Hash         string                         `json:"hash"`
	Header       string                         `json:"header"`
	Body         string                         `json:"body"`
	Receipts     string                         `json:"receipts"`
	StateChanges map[string]*ImportAccountState `json:"stateChanges,omitempty"`
}

ImportBlockEntry represents a single block to import

type ImportBlocksRequest ¶ added in v1.20.6

type ImportBlocksRequest struct {
	Blocks []ImportBlockEntry `json:"blocks"`
}

ImportBlocksRequest represents the request for importing blocks

type ImportBlocksResponse ¶ added in v1.20.6

type ImportBlocksResponse struct {
	Imported      int      `json:"imported"`
	Failed        int      `json:"failed"`
	FirstHeight   uint64   `json:"firstHeight"`
	LastHeight    uint64   `json:"lastHeight"`
	Errors        []string `json:"errors,omitempty"`
	HeadBlockHash string   `json:"headBlockHash"`
}

ImportBlocksResponse represents the response from importing blocks

type ImportJSONBlocksResponse ¶ added in v1.20.6

type ImportJSONBlocksResponse struct {
	Imported      int      `json:"imported"`
	Failed        int      `json:"failed"`
	FirstHeight   uint64   `json:"firstHeight"`
	LastHeight    uint64   `json:"lastHeight"`
	Errors        []string `json:"errors,omitempty"`
	HeadBlockHash string   `json:"headBlockHash"`
}

ImportJSONBlocksResponse represents the response from importing JSON blocks

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 JSONBlock ¶ added in v1.20.6

type JSONBlock struct {
	BaseFeePerGas    string                 `json:"baseFeePerGas,omitempty"`
	BlockGasCost     string                 `json:"blockGasCost,omitempty"`
	Difficulty       string                 `json:"difficulty"`
	ExtraData        string                 `json:"extraData"`
	GasLimit         string                 `json:"gasLimit"`
	GasUsed          string                 `json:"gasUsed"`
	Hash             string                 `json:"hash"`
	LogsBloom        string                 `json:"logsBloom"`
	Miner            string                 `json:"miner"`
	MixHash          string                 `json:"mixHash"`
	Nonce            string                 `json:"nonce"`
	Number           string                 `json:"number"`
	ParentHash       string                 `json:"parentHash"`
	ReceiptsRoot     string                 `json:"receiptsRoot"`
	Sha3Uncles       string                 `json:"sha3Uncles"`
	StateRoot        string                 `json:"stateRoot"`
	Timestamp        string                 `json:"timestamp"`
	TransactionsRoot string                 `json:"transactionsRoot"`
	Transactions     []JSONBlockTransaction `json:"transactions"`
	Uncles           []string               `json:"uncles"`
}

JSONBlock represents a block in JSON-RPC format (eth_getBlockByNumber response)

type JSONBlockTransaction ¶ added in v1.20.6

type JSONBlockTransaction struct {
	BlockHash        string `json:"blockHash"`
	BlockNumber      string `json:"blockNumber"`
	From             string `json:"from"`
	Gas              string `json:"gas"`
	GasPrice         string `json:"gasPrice"`
	MaxFeePerGas     string `json:"maxFeePerGas,omitempty"`
	MaxPriorityFee   string `json:"maxPriorityFeePerGas,omitempty"`
	Hash             string `json:"hash"`
	Input            string `json:"input"`
	Nonce            string `json:"nonce"`
	To               string `json:"to"`
	TransactionIndex string `json:"transactionIndex"`
	Value            string `json:"value"`
	Type             string `json:"type,omitempty"`
	ChainId          string `json:"chainId,omitempty"`
	V                string `json:"v"`
	R                string `json:"r"`
	S                string `json:"s"`
	// Access list for EIP-2930/EIP-1559 transactions
	AccessList json.RawMessage `json:"accessList,omitempty"`
}

JSONBlockTransaction represents a transaction in JSON-RPC format

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 EVM fields
}

LegacyHeader represents the EVM 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 NewLuxAPI ¶ added in v1.18.2

func NewLuxAPI(vm *VM) *LuxAPI

NewLuxAPI creates a new Lux RPC API

func (*LuxAPI) Mine ¶ added in v1.20.6

func (api *LuxAPI) Mine() (map[string]interface{}, error)

Mine manually triggers block building and acceptance for dev mode This is useful when the consensus engine isn't running to auto-mine Accessible as lux_mine

func (*LuxAPI) ReloadBlockchain ¶ added in v1.20.0

func (api *LuxAPI) ReloadBlockchain() (map[string]interface{}, error)

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

func (api *LuxAPI) ReplayStatus() map[string]interface{}

ReplayStatus returns the status of database replay

func (*LuxAPI) VerifyBlockchain ¶ added in v1.20.0

func (api *LuxAPI) VerifyBlockchain() (map[string]interface{}, error)

VerifyBlockchain checks the integrity of the blockchain

type MigrateAPI ¶ added in v1.20.6

type MigrateAPI struct {
	// contains filtered or unexported fields
}

MigrateAPI provides migration RPC API for block import operations

func NewMigrateAPI ¶ added in v1.20.6

func NewMigrateAPI(vm *VM) *MigrateAPI

NewMigrateAPI creates a new Migrate RPC API

func (*MigrateAPI) ImportBlocks ¶ added in v1.20.6

func (api *MigrateAPI) ImportBlocks(blocks []ImportBlockEntry) (*ImportBlocksResponse, error)

ImportBlocks imports an array of blocks into the C-Chain database Each block should have header, body, and receipts as RLP hex-encoded data This is the migrate_importBlocks RPC method Note: Accepts array directly (not wrapped in struct) for CLI compatibility

func (*MigrateAPI) ImportJSONBlocks ¶ added in v1.20.6

func (api *MigrateAPI) ImportJSONBlocks(blocks []json.RawMessage) (*ImportJSONBlocksResponse, error)

ImportJSONBlocks imports an array of blocks in JSON-RPC format into the C-Chain database This accepts the raw output from eth_getBlockByNumber and converts to RLP internally This is the migrate_importJSONBlocks RPC method

func (*MigrateAPI) SetGenesis ¶ added in v1.20.6

func (api *MigrateAPI) SetGenesis(req SetGenesisRequest) (*SetGenesisResponse, error)

SetGenesis sets the genesis block from imported data and reloads the blockchain This should be called BEFORE importing other blocks to ensure the chain is consistent This is the migrate_setGenesis RPC method

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) AncientBytes ¶ added in v1.20.3

func (m *MigratedDataAdapter) AncientBytes(kind string, id, offset, length uint64) ([]byte, error)

AncientBytes retrieves the value segment of the element specified by the id and value offsets.

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 (*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

func (*NetAPI) Listening ¶

func (api *NetAPI) Listening() bool

Listening returns whether the node is listening for network connections

func (*NetAPI) PeerCount ¶

func (api *NetAPI) PeerCount() hexutil.Uint

PeerCount returns the number of connected peers

func (*NetAPI) Version ¶

func (api *NetAPI) Version() string

Version returns the network ID

type NetNamespaceStripper ¶ added in v1.20.3

type NetNamespaceStripper struct {
	// contains filtered or unexported fields
}

NetNamespaceStripper wraps a database and strips the 32-byte namespace prefix from EVM migrated data, making it readable by C-Chain

func (*NetNamespaceStripper) Ancient ¶ added in v1.20.3

func (s *NetNamespaceStripper) Ancient(kind string, number uint64) ([]byte, error)

Ancient store methods (delegate to underlying)

func (*NetNamespaceStripper) AncientBytes ¶ added in v1.20.3

func (s *NetNamespaceStripper) AncientBytes(kind string, id, offset, length uint64) ([]byte, error)

func (*NetNamespaceStripper) AncientDatadir ¶ added in v1.20.3

func (s *NetNamespaceStripper) AncientDatadir() (string, error)

func (*NetNamespaceStripper) AncientRange ¶ added in v1.20.3

func (s *NetNamespaceStripper) AncientRange(kind string, start, count, maxBytes uint64) ([][]byte, error)

func (*NetNamespaceStripper) AncientSize ¶ added in v1.20.3

func (s *NetNamespaceStripper) AncientSize(kind string) (uint64, error)

func (*NetNamespaceStripper) Ancients ¶ added in v1.20.3

func (s *NetNamespaceStripper) Ancients() (uint64, error)

func (*NetNamespaceStripper) Close ¶ added in v1.20.3

func (s *NetNamespaceStripper) Close() error

func (*NetNamespaceStripper) Compact ¶ added in v1.20.3

func (s *NetNamespaceStripper) Compact(start []byte, limit []byte) error

func (*NetNamespaceStripper) Delete ¶ added in v1.20.3

func (s *NetNamespaceStripper) Delete(key []byte) error

Delete removes a key

func (*NetNamespaceStripper) DeleteRange ¶ added in v1.20.3

func (s *NetNamespaceStripper) DeleteRange(start, end []byte) error

func (*NetNamespaceStripper) Get ¶ added in v1.20.3

func (s *NetNamespaceStripper) Get(key []byte) ([]byte, error)

Get retrieves a value, handling namespace translation

func (*NetNamespaceStripper) Has ¶ added in v1.20.3

func (s *NetNamespaceStripper) Has(key []byte) (bool, error)

Has checks if a key exists

func (*NetNamespaceStripper) LoadLastBlock ¶ added in v1.20.3

func (s *NetNamespaceStripper) LoadLastBlock() (*types.Block, error)

LoadLastBlock loads the highest block from the migrated database

func (*NetNamespaceStripper) ModifyAncients ¶ added in v1.20.3

func (s *NetNamespaceStripper) ModifyAncients(fn func(ethdb.AncientWriteOp) error) (int64, error)

func (*NetNamespaceStripper) NewBatch ¶ added in v1.20.3

func (s *NetNamespaceStripper) NewBatch() ethdb.Batch

NewBatch creates a new batch

func (*NetNamespaceStripper) NewBatchWithSize ¶ added in v1.20.3

func (s *NetNamespaceStripper) NewBatchWithSize(size int) ethdb.Batch

NewBatchWithSize creates a batch with size hint

func (*NetNamespaceStripper) NewIterator ¶ added in v1.20.3

func (s *NetNamespaceStripper) NewIterator(prefix []byte, start []byte) ethdb.Iterator

NewIterator creates an iterator

func (*NetNamespaceStripper) Put ¶ added in v1.20.3

func (s *NetNamespaceStripper) Put(key []byte, value []byte) error

Put stores a value (no namespace manipulation on writes)

func (*NetNamespaceStripper) ReadAncients ¶ added in v1.20.3

func (s *NetNamespaceStripper) ReadAncients(fn func(ethdb.AncientReaderOp) error) error

func (*NetNamespaceStripper) Stat ¶ added in v1.20.3

func (s *NetNamespaceStripper) Stat() (string, error)

func (*NetNamespaceStripper) SyncAncient ¶ added in v1.20.3

func (s *NetNamespaceStripper) SyncAncient() error

func (*NetNamespaceStripper) SyncKeyValue ¶ added in v1.20.3

func (s *NetNamespaceStripper) SyncKeyValue() error

func (*NetNamespaceStripper) Tail ¶ added in v1.20.3

func (s *NetNamespaceStripper) Tail() (uint64, error)

func (*NetNamespaceStripper) TruncateHead ¶ added in v1.20.3

func (s *NetNamespaceStripper) TruncateHead(n uint64) (uint64, error)

func (*NetNamespaceStripper) TruncateTail ¶ added in v1.20.3

func (s *NetNamespaceStripper) TruncateTail(n uint64) (uint64, error)

type PebbleWithAncient ¶ added in v1.20.0

type PebbleWithAncient struct {
	*pebble.Database
}

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) AncientBytes ¶ added in v1.20.3

func (db *PebbleWithAncient) AncientBytes(kind string, id, offset, length uint64) ([]byte, error)

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"` // EVM specific, may be empty or 32 bytes
}

PreShanghaiHeader represents header format from EVM before Shanghai upgrade EVM 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 RPCBlock ¶ added in v1.20.5

type RPCBlock struct {
	Number       *hexutil.Big     `json:"number"`
	Hash         common.Hash      `json:"hash"`
	ParentHash   common.Hash      `json:"parentHash"`
	Nonce        types.BlockNonce `json:"nonce"`
	MixHash      common.Hash      `json:"mixHash"`
	Miner        common.Address   `json:"miner"`
	Difficulty   *hexutil.Big     `json:"difficulty"`
	ExtraData    hexutil.Bytes    `json:"extraData"`
	Size         hexutil.Uint64   `json:"size"`
	GasLimit     hexutil.Uint64   `json:"gasLimit"`
	GasUsed      hexutil.Uint64   `json:"gasUsed"`
	Timestamp    hexutil.Uint64   `json:"timestamp"`
	Transactions []RPCTx          `json:"transactions"`
	Uncles       []common.Hash    `json:"uncles"`
	Root         common.Hash      `json:"stateRoot"`
	TxRoot       common.Hash      `json:"transactionsRoot"`
	ReceiptRoot  common.Hash      `json:"receiptsRoot"`
	Bloom        types.Bloom      `json:"logsBloom"`
	BaseFee      *hexutil.Big     `json:"baseFeePerGas,omitempty"`
}

RPCBlock is the JSON-RPC block structure

type RPCLog ¶ added in v1.20.5

type RPCLog struct {
	Address          common.Address `json:"address"`
	Topics           []common.Hash  `json:"topics"`
	Data             hexutil.Bytes  `json:"data"`
	BlockNumber      hexutil.Uint64 `json:"blockNumber"`
	TransactionHash  common.Hash    `json:"transactionHash"`
	TransactionIndex hexutil.Uint64 `json:"transactionIndex"`
	BlockHash        common.Hash    `json:"blockHash"`
	LogIndex         hexutil.Uint64 `json:"logIndex"`
	Removed          bool           `json:"removed"`
}

RPCLog is the JSON-RPC log structure

type RPCReceipt ¶ added in v1.20.5

type RPCReceipt struct {
	TransactionHash   common.Hash     `json:"transactionHash"`
	TransactionIndex  hexutil.Uint64  `json:"transactionIndex"`
	BlockHash         common.Hash     `json:"blockHash"`
	BlockNumber       *hexutil.Big    `json:"blockNumber"`
	From              common.Address  `json:"from"`
	To                *common.Address `json:"to"`
	CumulativeGasUsed hexutil.Uint64  `json:"cumulativeGasUsed"`
	GasUsed           hexutil.Uint64  `json:"gasUsed"`
	ContractAddress   *common.Address `json:"contractAddress,omitempty"`
	Logs              []RPCLog        `json:"logs"`
	LogsBloom         types.Bloom     `json:"logsBloom"`
	Type              hexutil.Uint64  `json:"type"`
	Status            hexutil.Uint64  `json:"status"`
}

RPCReceipt is the JSON-RPC receipt structure

type RPCReplayProgress ¶ added in v1.20.5

type RPCReplayProgress struct {
	LastImported uint64      `json:"lastImported"`
	LastHash     common.Hash `json:"lastHash"`
	Timestamp    time.Time   `json:"timestamp"`
}

type RPCReplayer ¶ added in v1.20.5

type RPCReplayer struct {
	// contains filtered or unexported fields
}

RPCReplayer fetches blocks via RPC and executes into blockchain

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 RPCTx ¶ added in v1.20.5

type RPCTx struct {
	Hash             common.Hash     `json:"hash"`
	Nonce            hexutil.Uint64  `json:"nonce"`
	From             common.Address  `json:"from"`
	To               *common.Address `json:"to"`
	Value            *hexutil.Big    `json:"value"`
	GasPrice         *hexutil.Big    `json:"gasPrice"`
	MaxFeePerGas     *hexutil.Big    `json:"maxFeePerGas,omitempty"`
	MaxPriorityFee   *hexutil.Big    `json:"maxPriorityFeePerGas,omitempty"`
	Gas              hexutil.Uint64  `json:"gas"`
	Input            hexutil.Bytes   `json:"input"`
	V                *hexutil.Big    `json:"v"`
	R                *hexutil.Big    `json:"r"`
	S                *hexutil.Big    `json:"s"`
	Type             hexutil.Uint64  `json:"type,omitempty"`
	AccessList       []interface{}   `json:"accessList,omitempty"`
	ChainID          *hexutil.Big    `json:"chainId,omitempty"`
	TransactionIndex hexutil.Uint64  `json:"transactionIndex"`
}

RPCTx is the JSON-RPC transaction structure

type ReplayConfig ¶ added in v1.16.15

type ReplayConfig struct {
	URL                string        // Source subnet RPC endpoint
	Start              uint64        // Start block (0 = auto-detect)
	End                uint64        // End block (0 = fetch tip)
	Batch              int           // Blocks per batch (default: 500)
	FetchConcurrency   int           // Parallel fetchers (default: 8)
	MaxRetries         int           // Retry attempts (default: 8)
	BackoffMin         time.Duration // Min backoff (default: 300ms)
	BackoffMax         time.Duration // Max backoff (default: 5s)
	ResumePath         string        // Progress checkpoint file
	VerifyRoots        bool          // Verify tx/receipt roots (default: true)
	VerifySigs         bool          // Verify signatures (default: true)
	HardStopOnMismatch bool          // Stop on verification failure (default: true)
}

ReplayConfig for RPC-based block replay

func DefaultReplayConfig ¶ added in v1.20.5

func DefaultReplayConfig(url string) ReplayConfig

DefaultReplayConfig returns safe defaults

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 SetGenesisRequest ¶ added in v1.20.6

type SetGenesisRequest struct {
	Height   uint64 `json:"height"`
	Hash     string `json:"hash"`
	Header   string `json:"header"`
	Body     string `json:"body"`
	Receipts string `json:"receipts"`
}

SetGenesisRequest represents the request for setting genesis from imported block 0

type SetGenesisResponse ¶ added in v1.20.6

type SetGenesisResponse struct {
	Success        bool   `json:"success"`
	OldGenesisHash string `json:"oldGenesisHash"`
	NewGenesisHash string `json:"newGenesisHash"`
	Error          string `json:"error,omitempty"`
}

SetGenesisResponse represents the response from setting genesis

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 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 TxPoolAPI ¶ added in v1.20.5

type TxPoolAPI struct {
	// contains filtered or unexported fields
}

TxPoolAPI provides transaction pool RPC API

func NewTxPoolAPI ¶ added in v1.20.5

func NewTxPoolAPI(backend *MinimalEthBackend) *TxPoolAPI

NewTxPoolAPI creates a new TxPool RPC API

func (*TxPoolAPI) Content ¶ added in v1.20.5

func (api *TxPoolAPI) Content() map[string]map[string]map[string]interface{}

Content returns the transactions in the pool

func (*TxPoolAPI) Inspect ¶ added in v1.20.5

func (api *TxPoolAPI) Inspect() map[string]map[string]map[string]string

Inspect returns a summary of the pool

func (*TxPoolAPI) Status ¶ added in v1.20.5

func (api *TxPoolAPI) Status() map[string]hexutil.Uint

Status returns the status of the transaction pool

type UnifiedReplayConfig ¶

type UnifiedReplayConfig struct {
	SourcePath               string
	DatabaseType             DatabaseType
	ExtractGenesisFromSource bool
	TestMode                 bool
	TestLimit                uint64
	CopyAllState             bool
	DatabaseBackend          string      // Database backend type
	TargetHeight             uint64      // Target block height
	TargetWallet             interface{} // Target wallet address (can be string or common.Address)
	ReplayTransactions       bool        // Whether to replay transactions
	VerifyStateRoots         bool        // Whether to verify state roots
	LogInterval              uint64      // Logging interval
	ChainConfig              interface{} // Chain configuration
}

UnifiedReplayConfig configures the unified replayer

type UnifiedReplayer ¶

type UnifiedReplayer struct {
	// contains filtered or unexported fields
}

UnifiedReplayer is a stub - needs proper implementation

func NewUnifiedReplayer ¶

func NewUnifiedReplayer(config *UnifiedReplayConfig, db ethdb.Database, chain *gethcore.BlockChain) (*UnifiedReplayer, error)

NewUnifiedReplayer creates a new replayer - STUB IMPLEMENTATION

func NewUnifiedReplayerWithTrieDB ¶ added in v1.20.0

func NewUnifiedReplayerWithTrieDB(config *UnifiedReplayConfig, db ethdb.Database, chain *gethcore.BlockChain, trieDB interface{}, stateCache state.Database) (*UnifiedReplayer, error)

NewUnifiedReplayerWithTrieDB creates replayer with trie database - STUB IMPLEMENTATION

func (*UnifiedReplayer) Close ¶

func (r *UnifiedReplayer) Close() error

Close cleans up resources - STUB IMPLEMENTATION

func (*UnifiedReplayer) ExtractGenesis ¶

func (r *UnifiedReplayer) ExtractGenesis() (*types.Block, error)

ExtractGenesis extracts genesis block from source - STUB IMPLEMENTATION

func (*UnifiedReplayer) ReplayWithEVM ¶ added in v1.18.26

func (r *UnifiedReplayer) ReplayWithEVM() error

ReplayWithEVM executes replay using the provided EVM - STUB IMPLEMENTATION

func (*UnifiedReplayer) Run ¶

func (r *UnifiedReplayer) Run() error

Run executes the replay - STUB IMPLEMENTATION

type VM ¶

type VM struct {
	// contains filtered or unexported fields
}

VM implements the C-Chain VM interface using geth

func (*VM) AppGossip ¶

func (vm *VM) AppGossip(ctx context.Context, nodeID ids.NodeID, msg []byte) error

AppGossip implements the block.ChainVM interface

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 *consensuscore.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 ¶

func (vm *VM) BuildBlock(ctx context.Context) (block.Block, error)

BuildBlock implements the block.ChainVM interface

func (*VM) Connected ¶

func (vm *VM) Connected(ctx context.Context, nodeID ids.NodeID, version interface{}) error

Connected implements the block.ChainVM interface

func (*VM) CreateHandlers ¶

func (vm *VM) CreateHandlers(ctx context.Context) (map[string]http.Handler, error)

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 *consensuscore.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 ¶

func (vm *VM) Disconnected(ctx context.Context, nodeID ids.NodeID) error

Disconnected implements the block.ChainVM interface

func (*VM) ForceBlockchainReload ¶ added in v1.20.0

func (vm *VM) ForceBlockchainReload(targetHeight uint64, targetHash common.Hash) error

ForceBlockchainReload forces the blockchain to recognize replayed blocks This is called after replay completes to ensure eth_blockNumber returns the correct value

func (*VM) GetBlock ¶

func (vm *VM) GetBlock(ctx context.Context, blkID ids.ID) (block.Block, error)

GetBlock implements the block.ChainVM interface

func (*VM) GetBlockIDAtHeight ¶

func (vm *VM) GetBlockIDAtHeight(ctx context.Context, height uint64) (ids.ID, error)

GetBlockIDAtHeight implements the block.ChainVM interface

func (*VM) HealthCheck ¶

func (vm *VM) HealthCheck(ctx context.Context) (interface{}, error)

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

func (vm *VM) InitializeWithReplay() error

InitializeWithReplay initializes the VM with migrated blockchain data

func (*VM) LastAccepted ¶

func (vm *VM) LastAccepted(ctx context.Context) (ids.ID, error)

LastAccepted implements the block.ChainVM interface

func (*VM) NewHTTPHandler ¶

func (vm *VM) NewHTTPHandler(ctx context.Context) (interface{}, error)

NewHTTPHandler implements the block.ChainVM interface

func (*VM) ParseBlock ¶

func (vm *VM) ParseBlock(ctx context.Context, blockBytes []byte) (block.Block, error)

ParseBlock implements the block.ChainVM interface

func (*VM) RecreateBackendAfterReplay ¶ added in v1.20.0

func (vm *VM) RecreateBackendAfterReplay(genesis *gethcore.Genesis) error

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

func (vm *VM) ReloadBlockchainState() error

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 EVM to C-Chain This method is called by the lux_replayStart RPC method

func (*VM) SetPreference ¶

func (vm *VM) SetPreference(ctx context.Context, blkID ids.ID) error

SetPreference implements the block.ChainVM interface

func (*VM) SetState ¶

func (vm *VM) SetState(ctx context.Context, state uint32) error

SetState implements the block.ChainVM interface

func (*VM) Shutdown ¶

func (vm *VM) Shutdown(ctx context.Context) error

Shutdown implements the block.ChainVM interface

func (*VM) StartRPCReplay ¶ added in v1.20.5

func (vm *VM) StartRPCReplay(ctx context.Context, cfg ReplayConfig) error

StartRPCReplay begins RPC-based block replay

func (*VM) VerifyBlockchainIntegrity ¶ added in v1.20.0

func (vm *VM) VerifyBlockchainIntegrity() error

VerifyBlockchainIntegrity checks that the blockchain properly recognizes replayed data

func (*VM) Version ¶

func (vm *VM) Version(ctx context.Context) (string, error)

Version implements the block.ChainVM interface

func (*VM) WaitForEvent ¶

func (vm *VM) WaitForEvent(ctx context.Context) (interface{}, error)

WaitForEvent implements the block.ChainVM interface

type Web3API ¶

type Web3API struct{}

Web3API provides web3 RPC API

func (*Web3API) ClientVersion ¶

func (api *Web3API) ClientVersion() string

ClientVersion returns the node client version

func (*Web3API) Sha3 ¶

func (api *Web3API) Sha3(input hexutil.Bytes) hexutil.Bytes

Sha3 returns the Keccak-256 hash of the given data

Directories ¶

Path Synopsis
cmd
replay command
replay-standalone command
replay-standalone is a standalone tool for replaying EVM 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 EVM data into C-Chain format It doesn't depend on the node package, making it more portable.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL