Skip to content

Conversation

@vineetpant
Copy link

@vineetpant vineetpant commented Nov 8, 2025

Introduction

EIP-7745 introduces Log Value Index to replace bloom filters with a more structured and efficient approach:

Benefits:

  • Better Query Efficiency: Direct lookups via indices vs. probabilistic bloom filters
  • Structured Data: Merkle roots enable efficient proofs and verification
  • Reduced False Positives: Exact matching vs. bloom filter collisions

Key Requirement: LogIndex must accumulate from genesis

Description

This PR implements EIP-7745 (Log Value Index), replacing traditional Ethereum bloom filters with a more efficient and structured LogIndexSummary after fork activation.

  • LogIndex data structures (LogMeta, LogIndexSummary, FilterMaps)
  • Block creation with LogIndexSummary (tx_packer.nim)
  • Block validation with LogIndexSummary verification (process_block.nim)
  • SSZ hash tree root calculations for all structures
  • Sparse FilterMap implementation
  • Fork activation for EIP 7745
  • LogIndex accumulation from genesis through all blocks

Core Implementation

  1. execution_chain/core/log_index.nim : Complete LogIndex implementation including:

Data Structures:

  • LogMeta: Individual log entry with address, topics, data hash, and indices
  • LogIndexSummary: 256-byte structure replacing bloom filter:
  • FilterMap: Sparse bitmap for efficient filtering with:
  • LogIndex: Accumulated state across all blocks:

Key Functions:

  • add_block_logs(): Accumulate logs from current block
  • createLogIndexSummary(): Generate 256-byte summary from LogIndex state
  • encodeLogIndexSummary(): Manual byte encoding (SSZ stack overflow workaround)
  • calculate_filter_maps(): Create sparse bitmaps for efficient queries
  • Hash tree root calculations using SSZ merkleization
  1. Integration in Block Creation in execution_chain/core/tx_pool/tx_packer.nim
  • Generate LogIndexSummary when packing blocks
  • Encode LogIndexSummary and store in header.logsBloom field
  1. Integration in Block Validation: execution_chain/core/executor/process_block.nim
  • Validate LogIndexSummary when processing blocks
  • Verify encoded LogIndexSummary matches header.logsBloom
  1. LogIndex Accumulation

LogIndex must accumulate from genesis - each block builds upon parent's state.

  • Preserve LogIndex across vmState reinit
  • Added logIndex: LogIndex field to BlockRef
  • Persist accumulated LogIndex state with each processed block

Following files are updated

  • execution_chain/evm/state.nim
  • execution_chain/core/chain/forked_chain/chain_branch.nim
  • execution_chain/core/chain/forked_chain/chain_private.nim
  • execution_chain/core/chain/forked_chain.nim
  • execution_chain/core/chain/forked_chain/chain_serialize.nim
  • execution_chain/core/tx_pool/tx_desc.nim
  1. Fork Activation
  • Added EIP-7745 fork configuration
  • Added eip7745Time configuration field
  • Added isEip7745OrLater() helper function

Unit Test Coverage

  • Unit tests for LogIndex operations
  • FilterMap coordinate calculations
  • Hash tree root verification
  • SSZ encoding/decoding
  • Fork activation logic

Breaking Changes

None - implementation is backward compatible:

  • Pre-EIP-7745 blocks: Traditional bloom filters in logsBloom field
  • Post-EIP-7745 blocks: LogIndexSummary encoded in logsBloom field

Known Issues / Future Work

  1. Code cleanup is required to remove debug statements and add more comments
  2. Activation Timestamp is currently set to test value - needs production activation block/timestamp
  3. Need proper reorg handling

Related

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant