Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor rpc for easier reuse #88

Merged
merged 1 commit into from
Oct 10, 2024

Conversation

iuwqyir
Copy link
Collaborator

@iuwqyir iuwqyir commented Oct 4, 2024

TL;DR

Refactored RPC to wrap the needed rpc calls and return already serialized data. This way we don't have to repeat the request creation and response handling whenever we need it. We have fixed queries so maintaining wrappers doesn't seem like a problem

What changed?

  • Moved RPC-related functionality from common package to a new rpc package
  • Created a new Client struct in the rpc package to handle RPC operations
  • Refactored worker logic to use the new RPC client
  • Updated orchestrator components to use the new RPC client
  • Added utility functions for handling big.Int slices and RPC configurations

How to test?

  1. Run the indexer with the updated code
  2. Verify that block fetching, log retrieval, and trace processing work as expected
  3. Check that batch processing is functioning correctly by monitoring RPC calls
  4. Ensure that the orchestrator components (poller, committer, failure recoverer) are operating properly with the new RPC client

Why make this change?

This refactoring improves the overall structure and performance of the indexer:

  1. Better separation of concerns by moving RPC-related code to its own package
  2. Improved maintainability and readability of the codebase
  3. Easier extension and modification of RPC-related functionality in the future

@iuwqyir iuwqyir changed the title refactor rpc to a wrapper for easier reuse Refactor RPC client and improve batch processing Oct 4, 2024
@iuwqyir iuwqyir changed the title Refactor RPC client and improve batch processing Refactor rpc for easier reuse Oct 4, 2024
@iuwqyir iuwqyir requested a review from AmineAfia October 4, 2024 16:36
@iuwqyir iuwqyir marked this pull request as ready for review October 4, 2024 16:36
internal/rpc/rpc.go Outdated Show resolved Hide resolved
@iuwqyir iuwqyir force-pushed the 10-04-refactor_rpc_to_a_wrapper_for_easier_reuse branch 2 times, most recently from 8663df7 to 01aba8e Compare October 7, 2024 20:01
@iuwqyir iuwqyir force-pushed the 10-04-refactor_rpc_to_a_wrapper_for_easier_reuse branch from 01aba8e to 49fe94d Compare October 10, 2024 12:48
Copy link
Collaborator Author

iuwqyir commented Oct 10, 2024

Merge activity

  • Oct 10, 10:01 AM EDT: A user started a stack merge that includes this pull request via Graphite.
  • Oct 10, 10:01 AM EDT: A user merged this pull request with Graphite.

@iuwqyir iuwqyir merged commit e4b9b29 into main Oct 10, 2024
4 checks passed
@iuwqyir iuwqyir deleted the 10-04-refactor_rpc_to_a_wrapper_for_easier_reuse branch October 10, 2024 14:01
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