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 client to use interface #94

Merged
merged 1 commit into from
Oct 10, 2024
Merged

Conversation

iuwqyir
Copy link
Collaborator

@iuwqyir iuwqyir commented Oct 8, 2024

TL;DR

Refactored RPC client interface and updated related components for improved modularity and testability.

What changed?

  • Introduced IRPCClient interface in rpc.go to abstract RPC client functionality.
  • Updated Client struct to implement IRPCClient interface.
  • Modified Initialize() function to return IRPCClient instead of *Client.
  • Refactored Orchestrator, ChainTracker, Committer, FailureRecoverer, Poller, ReorgHandler, and Worker to use IRPCClient interface.
  • Moved GetLatestBlockNumber() method from Poller to Client.
  • Updated method calls and field accesses throughout the codebase to use the new interface.

How to test?

  1. Ensure indexing works after the refactoring.

Why make this change?

This refactoring improves the codebase by:

  1. Enhancing modularity and separation of concerns.
  2. Facilitating easier testing by allowing mock implementations of IRPCClient.
  3. Improving code maintainability and readability.
  4. Providing a clearer contract for RPC client functionality.
  5. Enabling easier future extensions or modifications to the RPC client implementation.

@iuwqyir iuwqyir changed the title create interface for rpc Refactor RPC client to use interface and improve error handling Oct 8, 2024
@iuwqyir iuwqyir changed the title Refactor RPC client to use interface and improve error handling Refactor RPC client to use interface Oct 8, 2024
@iuwqyir iuwqyir requested a review from AmineAfia October 8, 2024 16:41
@iuwqyir iuwqyir marked this pull request as ready for review October 8, 2024 16:41
@iuwqyir iuwqyir force-pushed the 10-04-handle_reorgs branch from 868d4fe to 6997e9c Compare October 8, 2024 23:32
@iuwqyir iuwqyir force-pushed the 10-08-create_interface_for_rpc branch from 147e153 to df18b17 Compare October 8, 2024 23:32
@iuwqyir iuwqyir force-pushed the 10-04-handle_reorgs branch from 6997e9c to cdaf53e Compare October 10, 2024 12:49
@iuwqyir iuwqyir force-pushed the 10-08-create_interface_for_rpc branch from df18b17 to 91f74a5 Compare October 10, 2024 12:49
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:12 AM EDT: Graphite rebased this pull request as part of a merge.
  • Oct 10, 10:13 AM EDT: A user merged this pull request with Graphite.

@iuwqyir iuwqyir changed the base branch from 10-04-handle_reorgs to graphite-base/94 October 10, 2024 14:08
@iuwqyir iuwqyir changed the base branch from graphite-base/94 to main October 10, 2024 14:10
@iuwqyir iuwqyir force-pushed the 10-08-create_interface_for_rpc branch from 91f74a5 to 35bdac6 Compare October 10, 2024 14:11
@iuwqyir iuwqyir merged commit 41414f3 into main Oct 10, 2024
4 checks passed
@iuwqyir iuwqyir deleted the 10-08-create_interface_for_rpc branch October 10, 2024 14:13
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