Skip to content

Conversation

@NikhilSharmaWe
Copy link
Collaborator

@NikhilSharmaWe NikhilSharmaWe commented Apr 30, 2025

Changes for fast-sync

Summary by CodeRabbit

  • New Features

    • Introduced separate database and state socket paths for improved connection handling.
    • Added support for querying Ethereum-compatible state roots and proofs via a dedicated network protocol.
    • Enhanced execution client with Cosmos SDK client integration and syncing status querying.
  • Improvements

    • Refactored configuration flags and Docker Compose setup for greater flexibility and clarity.
    • Streamlined state and database router logic for better maintainability.
    • Centralized cursor state management and standardized store access.
  • Bug Fixes

    • Fixed potential nil dereferences in execution client handlers.
    • Improved error handling and input validation for state queries.
  • Chores

    • Updated Docker images, port mappings, and added new services for testnet environments.
    • Added new script options for testnet node startup.
    • Removed debug print statements and unused code for cleaner logs.

…ommitted and empty the cursor map on each write request

Signed-off-by: Nikhil Sharma <[email protected]>
…, Balance and CodeHash in Account proof response

Signed-off-by: Nikhil Sharma <[email protected]>
…ng-up, for processing blocks during fast-sync

Signed-off-by: Nikhil Sharma <[email protected]>
@coderabbitai
Copy link

coderabbitai bot commented Apr 30, 2025

Walkthrough

This update introduces significant enhancements and refactoring across the codebase to support distinct database and state socket paths, improve modularity, and enable new state query capabilities. The application now differentiates between database and state routers, each with its own Unix socket, and adds robust Ethereum-compatible state query handling. The EVM client is extended to integrate with a Cosmos SDK RPC client, supporting syncing status queries and improved state management. Docker and testnet scripts are updated to accommodate new services, ports, and configuration options. Debug prints and unused code are removed, and several constants and global variables are reorganized for clarity and encapsulation.

Changes

File(s) Change Summary
Dockerfile, start-testnet-node.sh Added copy step for init.sh in Dockerfile; updated script to use user-relative home directory.
start-testnet-reth-bootnode.sh, start-testnet-reth-miner-node.sh Added --rpc.eth-proof-window 1209600 flag to reth node startup commands.
docker-testnet-compose.yml Updated port mappings, images, and added new services (scalerizednode4, rethnode3), and new volume.
app/params/flags.go, cmd/scalerized/cmd/commands.go, execution/evm/config.go Split single socket path flag into FlagDBSocketPath and FlagStateSocketPath; updated defaults and registration.
app/app.go, app/db_transport.go, app/state_transport.go Refactored to use separate DB and state socket paths; added state router; removed debug prints and unused code; modularized connection handling.
app/client.go, execution/evm/client.go, execution/evm/utils.go Extended ExecutionClient and EVMClient with methods and fields for app reference, Cosmos RPC client, and syncing status.
app/constants.go, execution/evm/constants.go Moved cursor key map and lock from app to EVM package; introduced CursorIDBytes constant in EVM package.
app/db_eth.go Centralized cursor state management in EVM package; unified cursor ID size usage; removed debug output; standardized store access.
app/state_eth.go Added Ethereum state query handler, supporting state root and proof queries over network connections.
app/state_eth_query_utils.go Changed storage value type to *uint256.Int; improved proof handling; added support for querying latest block.
execution/evm/abci_handler.go Initialized syncStatus; removed debug prints; improved syncing logic in block handlers; reset iterator state.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant App
    participant DBRouter
    participant StateRouter
    participant EVMClient
    participant CosmosRPC

    User->>App: Start Application
    App->>DBRouter: Start DB Router (dbSocketPath)
    App->>StateRouter: Start State Router (stateSocketPath)
    App->>EVMClient: Set BaseApp reference
    App->>EVMClient: Set Cosmos RPC Client (cometBFTRPCAddress)
    User->>StateRouter: Connect for state query
    StateRouter->>EVMClient: ethHandleStateConnection
    EVMClient->>CosmosRPC: Query State Root / Proof
    CosmosRPC-->>EVMClient: Return state data
    EVMClient-->>StateRouter: Return query result
    StateRouter-->>User: Send response
Loading

Poem

In burrows deep, we split our ways,
Two sockets now for brighter days!
State and DB, each with their door,
Rabbits hop, and features soar.
Proofs and roots, we fetch with glee,
Docker nodes in harmony.
With every change, our warren grows—
Onward, Scalerize, the rabbit knows!

((\
( -.-)
o_(")(")


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Free

📥 Commits

Reviewing files that changed from the base of the PR and between 284e812 and cdf4ab2.

📒 Files selected for processing (20)
  • Dockerfile (1 hunks)
  • app/app.go (3 hunks)
  • app/client.go (1 hunks)
  • app/constants.go (0 hunks)
  • app/db_eth.go (42 hunks)
  • app/db_transport.go (2 hunks)
  • app/params/flags.go (1 hunks)
  • app/state_eth.go (1 hunks)
  • app/state_eth_query_utils.go (6 hunks)
  • app/state_transport.go (1 hunks)
  • cmd/scalerized/cmd/commands.go (1 hunks)
  • docker-testnet-compose.yml (8 hunks)
  • execution/evm/abci_handler.go (6 hunks)
  • execution/evm/client.go (3 hunks)
  • execution/evm/config.go (1 hunks)
  • execution/evm/constants.go (2 hunks)
  • execution/evm/utils.go (2 hunks)
  • start-testnet-node.sh (1 hunks)
  • start-testnet-reth-bootnode.sh (1 hunks)
  • start-testnet-reth-miner-node.sh (1 hunks)
💤 Files with no reviewable changes (1)
  • app/constants.go

Note

🎁 Summarized by CodeRabbit Free

Your organization is on the Free plan. CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please upgrade your subscription to CodeRabbit Pro by visiting https://app.coderabbit.ai/login.

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@NikhilSharmaWe NikhilSharmaWe force-pushed the feat/state-sync branch 2 times, most recently from 748ed2c to 0e1d434 Compare May 2, 2025 06:23
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.

2 participants