Skip to content

Conversation

@carloskiron
Copy link
Contributor

Refactor Indexer for Ideal Network

This PR refactors the event indexer to focus solely on the Ideal Network, removing support for other chains and implementing proper configuration management. This is part of the ongoing work for issue #21, focusing on the initial refactoring and basic event support.

Updates #21

Changes

Core Changes

  • Renamed package from acuity-index-polkadot to acuity-index-ideal and reset version to 0.1.0
  • Removed implementation for other chains (Polkadot, Kusama, Rococo, Westend)
  • Added environment-based configuration for genesis hash and WebSocket URL
  • Updated event handling to focus on System and Balances events

Implementation Details

  1. Configuration Management

    • Added new config.rs module for environment-based configuration
    • Added support for IDN_GENESIS_HASH and IDN_WS_URL environment variables
    • Implemented safe fallbacks for local development
  2. Event Indexing

    • Updated ChainKey enum to handle relevant event types:
      • AccountId for balance events
      • BlockHash for system events
      • ExtrinsicHash for transaction events
    • Updated ChainTrees with appropriate storage trees
    • Removed parachain-specific event handling
  3. Testing

    • Updated test suite to focus on System and Balances events
    • Added test cases for account balance and system event indexing
    • Removed parachain-specific tests
  4. Documentation

    • Updated README with configuration instructions
    • Added example environment variable setup
    • Updated Docker instructions to include configuration

Breaking Changes

  • Removed support for other chains (Polkadot, Kusama, Rococo, Westend)
  • Changed database tree structure to match new event types
  • Changed configuration method to use environment variables

Remaining Work for #21

After this PR is merged, the following work remains for issue #21:

  • Implement pallet manager event handling
  • Add comprehensive test coverage for pallet manager events
  • Set up integration testing with an Ideal Network node

Testing Done

  • Verified all unit tests pass
  • Tested environment variable configuration
  • Verified build process works correctly

How to Test

  1. Set up environment variables:

    export IDN_GENESIS_HASH="your_genesis_hash"
    export IDN_WS_URL="ws://your.node.url:port"
  2. Build and run tests:

    cargo test
  3. Run the indexer:

    cargo run

- Rename package to acuity-index-ideal and set version to 0.1.0
- Remove other chain implementations (Polkadot, Kusama, Rococo, Westend)
- Update ChainKey and ChainTrees to handle System and Balances events
- Add environment-based configuration for genesis hash and WebSocket URL
- Update tests to focus on relevant event types
- Update documentation with configuration instructions

Updates #21
- Keep Ideal Network-focused changes
- Remove other chain implementations
- Use environment-based configuration
- Maintain consistent code formatting

Updates #21
- Switch from local path to git repository
- Fix GitHub Actions build error

Updates #21
- Remove other chain test implementations
- Keep tests focused on Ideal Network events
- Add test for extrinsic hash events
- Fix formatting issues

Updates #21
- Fix indentation in config.rs
- Fix imports formatting in ideal.rs
- Fix struct formatting in main.rs

Updates #21
- Enable format on save
- Configure rust-analyzer to use nightly rustfmt
- Add clippy check on save

Updates #21
- Fix clippy warning for unused braces in DEFAULT_URL
- Clean up code formatting

Updates #21
Copy link

@driemworks driemworks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@carloskiron carloskiron merged commit e7d992c into main Mar 11, 2025
1 check passed
@carloskiron carloskiron deleted the cm/idn-indexer-setup branch March 11, 2025 15:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants