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

feature: Support for multiple endpoints by chainID #189

Merged
merged 18 commits into from
Apr 11, 2024

Conversation

lucasmenendez
Copy link
Collaborator

@lucasmenendez lucasmenendez commented Apr 8, 2024

Closes #73

@lucasmenendez lucasmenendez requested a review from p4u April 8, 2024 10:04
@lucasmenendez lucasmenendez self-assigned this Apr 8, 2024
@lucasmenendez lucasmenendez added the enhancement New feature or request label Apr 8, 2024
Copy link

github-actions bot commented Apr 8, 2024

Image description CodeRabbit


Uplevel your code reviews with CodeRabbit Pro

CodeRabbit Pro

If you like this project, please support us by purchasing the Pro version. The Pro version has advanced context, superior noise reduction and several proprietary improvements compared to the open source version. Moreover, CodeRabbit Pro is free for open source projects.

@lucasmenendez lucasmenendez linked an issue Apr 8, 2024 that may be closed by this pull request
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Image description CodeRabbit

Commits Files that changed from the base of the PR and between 0fa445d and 9adb3ca commits.
Files selected (13)
  • api/api.go (3)
  • cmd/census3/main.go (1)
  • scanner/providers/farcaster/provider.go (1)
  • scanner/providers/farcaster/types.go (2)
  • scanner/providers/web3/const.go (1)
  • scanner/providers/web3/endpoint.go (1)
  • scanner/providers/web3/endpoint_test.go (1)
  • scanner/providers/web3/erc20_provider.go (2)
  • scanner/providers/web3/erc721_provider.go (2)
  • scanner/providers/web3/erc777_provider.go (2)
  • scanner/providers/web3/networks.go (1)
  • scanner/providers/web3/web3_provider.go (1)
  • scanner/scanner.go (2)
Files not summarized due to errors (13)
  • api/api.go (nothing obtained from openai)
  • cmd/census3/main.go (nothing obtained from openai)
  • scanner/providers/farcaster/types.go (nothing obtained from openai)
  • scanner/providers/farcaster/provider.go (nothing obtained from openai)
  • scanner/providers/web3/endpoint.go (nothing obtained from openai)
  • scanner/providers/web3/networks.go (diff tokens exceeds limit)
  • scanner/providers/web3/const.go (nothing obtained from openai)
  • scanner/providers/web3/erc20_provider.go (nothing obtained from openai)
  • scanner/providers/web3/erc777_provider.go (nothing obtained from openai)
  • scanner/providers/web3/erc721_provider.go (nothing obtained from openai)
  • scanner/providers/web3/web3_provider.go (nothing obtained from openai)
  • scanner/scanner.go (nothing obtained from openai)
  • scanner/providers/web3/endpoint_test.go (nothing obtained from openai)
Files not reviewed due to errors (13)
  • api/api.go (no response)
  • cmd/census3/main.go (no response)
  • scanner/providers/web3/const.go (no response)
  • scanner/providers/farcaster/provider.go (no response)
  • scanner/providers/web3/endpoint.go (no response)
  • scanner/providers/farcaster/types.go (no response)
  • scanner/providers/web3/erc20_provider.go (no response)
  • scanner/providers/web3/erc721_provider.go (no response)
  • scanner/providers/web3/endpoint_test.go (no response)
  • scanner/providers/web3/web3_provider.go (no response)
  • scanner/providers/web3/erc777_provider.go (no response)
  • scanner/providers/web3/networks.go (no response)
  • scanner/scanner.go (no response)
Review comments generated (0)
  • Review: 0
  • LGTM: 0

Tips

Chat with Image description CodeRabbit Bot (@coderabbitai)

  • Reply on review comments left by this bot to ask follow-up questions. A review comment is a comment on a diff or a file.
  • Invite the bot into a review comment chain by tagging @coderabbitai in a reply.

Code suggestions

  • The bot may make code suggestions, but please review them carefully before committing since the line number ranges may be misaligned.
  • You can edit the comment made by the bot and manually tweak the suggestion if it is slightly off.

Pausing incremental reviews

  • Add @coderabbitai: ignore anywhere in the PR description to pause further reviews from the bot.

@lucasmenendez lucasmenendez marked this pull request as ready for review April 8, 2024 10:42
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Image description CodeRabbit

Commits Files that changed from the base of the PR and between 9adb3ca and a248038 commits.
Files selected (1)
  • api/api.go (3)
Files not summarized due to errors (1)
  • api/api.go (nothing obtained from openai)
Files not reviewed due to errors (1)
  • api/api.go (no response)
Review comments generated (0)
  • Review: 0
  • LGTM: 0

Tips

Chat with Image description CodeRabbit Bot (@coderabbitai)

  • Reply on review comments left by this bot to ask follow-up questions. A review comment is a comment on a diff or a file.
  • Invite the bot into a review comment chain by tagging @coderabbitai in a reply.

Code suggestions

  • The bot may make code suggestions, but please review them carefully before committing since the line number ranges may be misaligned.
  • You can edit the comment made by the bot and manually tweak the suggestion if it is slightly off.

Pausing incremental reviews

  • Add @coderabbitai: ignore anywhere in the PR description to pause further reviews from the bot.

Copy link
Member

@p4u p4u left a comment

Choose a reason for hiding this comment

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

I'm not sure this PR adds the functionality discussed previously. Since it does not distribute the RPC requests by each call, but instead distributes clients.

Ideally, the networksManager would implement a type Client with the following interface (networkmanager.Client(chainID)):

// ContractCaller defines the methods needed to allow operating with a contract on a read
// only basis.
type ContractCaller interface {
	// CodeAt returns the code of the given account. This is needed to differentiate
	// between contract internal errors and the local chain being out of sync.
	CodeAt(ctx context.Context, contract common.Address, blockNumber *big.Int) ([]byte, error)

	// CallContract executes an Ethereum contract call with the specified data as the
	// input.
	CallContract(ctx context.Context, call ethereum.CallMsg, blockNumber *big.Int) ([]byte, error)
}

Then on each CodeAt or CallContract, behind the scenes, the networkManager chooses a different web3 endpoint from the list of working endpoints for such chainID.

erc721.NewERC721Contract() then receives the network manager client and the magic happens automatically.

This is just an idea that tries to achieve the same functionality we have on the farcaster implementation. Feel free do discuss it.

PS: I think networksManager is a horrible name, web3pool or something like that would be more descriptive IMHO

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Image description CodeRabbit

Commits Files that changed from the base of the PR and between a248038 and 1a2483f commits.
Files selected (10)
  • api/api.go (3)
  • cmd/census3/main.go (1)
  • scanner/providers/farcaster/types.go (2)
  • scanner/providers/web3/const.go (1)
  • scanner/providers/web3/erc20_provider.go (2)
  • scanner/providers/web3/erc721_provider.go (2)
  • scanner/providers/web3/erc777_provider.go (2)
  • scanner/providers/web3/networks.go (1)
  • scanner/providers/web3/web3_provider.go (1)
  • scanner/scanner.go (2)
Files not summarized due to errors (10)
  • cmd/census3/main.go (nothing obtained from openai)
  • api/api.go (nothing obtained from openai)
  • scanner/providers/web3/networks.go (diff tokens exceeds limit)
  • scanner/providers/farcaster/types.go (nothing obtained from openai)
  • scanner/providers/web3/const.go (nothing obtained from openai)
  • scanner/providers/web3/erc20_provider.go (nothing obtained from openai)
  • scanner/providers/web3/erc721_provider.go (nothing obtained from openai)
  • scanner/scanner.go (nothing obtained from openai)
  • scanner/providers/web3/web3_provider.go (nothing obtained from openai)
  • scanner/providers/web3/erc777_provider.go (nothing obtained from openai)
Files not reviewed due to errors (10)
  • scanner/providers/web3/erc721_provider.go (no response)
  • cmd/census3/main.go (no response)
  • scanner/providers/farcaster/types.go (no response)
  • scanner/providers/web3/erc20_provider.go (no response)
  • api/api.go (no response)
  • scanner/providers/web3/const.go (no response)
  • scanner/scanner.go (no response)
  • scanner/providers/web3/erc777_provider.go (no response)
  • scanner/providers/web3/web3_provider.go (no response)
  • scanner/providers/web3/networks.go (no response)
Review comments generated (0)
  • Review: 0
  • LGTM: 0

Tips

Chat with Image description CodeRabbit Bot (@coderabbitai)

  • Reply on review comments left by this bot to ask follow-up questions. A review comment is a comment on a diff or a file.
  • Invite the bot into a review comment chain by tagging @coderabbitai in a reply.

Code suggestions

  • The bot may make code suggestions, but please review them carefully before committing since the line number ranges may be misaligned.
  • You can edit the comment made by the bot and manually tweak the suggestion if it is slightly off.

Pausing incremental reviews

  • Add @coderabbitai: ignore anywhere in the PR description to pause further reviews from the bot.

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Image description CodeRabbit

Commits Files that changed from the base of the PR and between 1a2483f and 12aeafd commits.
Files selected (2)
  • scanner/providers/web3/const.go (1)
  • scanner/providers/web3/web3_pool.go (1)
Files not summarized due to errors (2)
  • scanner/providers/web3/web3_pool.go (diff tokens exceeds limit)
  • scanner/providers/web3/const.go (nothing obtained from openai)
Files not reviewed due to errors (2)
  • scanner/providers/web3/const.go (no response)
  • scanner/providers/web3/web3_pool.go (no response)
Review comments generated (0)
  • Review: 0
  • LGTM: 0

Tips

Chat with Image description CodeRabbit Bot (@coderabbitai)

  • Reply on review comments left by this bot to ask follow-up questions. A review comment is a comment on a diff or a file.
  • Invite the bot into a review comment chain by tagging @coderabbitai in a reply.

Code suggestions

  • The bot may make code suggestions, but please review them carefully before committing since the line number ranges may be misaligned.
  • You can edit the comment made by the bot and manually tweak the suggestion if it is slightly off.

Pausing incremental reviews

  • Add @coderabbitai: ignore anywhere in the PR description to pause further reviews from the bot.

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Image description CodeRabbit

Commits Files that changed from the base of the PR and between 12aeafd and 5a6360a commits.
Files selected (8)
  • scanner/providers/farcaster/provider.go (1)
  • scanner/providers/farcaster/types.go (2)
  • scanner/providers/web3/erc20_provider.go (3)
  • scanner/providers/web3/erc721_provider.go (2)
  • scanner/providers/web3/erc777_provider.go (2)
  • scanner/providers/web3/web3_client.go (1)
  • scanner/providers/web3/web3_pool.go (1)
  • scanner/providers/web3/web3_provider.go (6)
Files not summarized due to errors (8)
  • scanner/providers/farcaster/provider.go (nothing obtained from openai)
  • scanner/providers/web3/web3_pool.go (diff tokens exceeds limit)
  • scanner/providers/web3/erc20_provider.go (nothing obtained from openai)
  • scanner/providers/farcaster/types.go (nothing obtained from openai)
  • scanner/providers/web3/web3_client.go (nothing obtained from openai)
  • scanner/providers/web3/erc721_provider.go (nothing obtained from openai)
  • scanner/providers/web3/erc777_provider.go (nothing obtained from openai)
  • scanner/providers/web3/web3_provider.go (nothing obtained from openai)
Files not reviewed due to errors (8)
  • scanner/providers/web3/erc20_provider.go (no response)
  • scanner/providers/farcaster/types.go (no response)
  • scanner/providers/web3/erc721_provider.go (no response)
  • scanner/providers/farcaster/provider.go (no response)
  • scanner/providers/web3/erc777_provider.go (no response)
  • scanner/providers/web3/web3_client.go (no response)
  • scanner/providers/web3/web3_provider.go (no response)
  • scanner/providers/web3/web3_pool.go (no response)
Review comments generated (0)
  • Review: 0
  • LGTM: 0

Tips

Chat with Image description CodeRabbit Bot (@coderabbitai)

  • Reply on review comments left by this bot to ask follow-up questions. A review comment is a comment on a diff or a file.
  • Invite the bot into a review comment chain by tagging @coderabbitai in a reply.

Code suggestions

  • The bot may make code suggestions, but please review them carefully before committing since the line number ranges may be misaligned.
  • You can edit the comment made by the bot and manually tweak the suggestion if it is slightly off.

Pausing incremental reviews

  • Add @coderabbitai: ignore anywhere in the PR description to pause further reviews from the bot.

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Image description CodeRabbit

Commits Files that changed from the base of the PR and between 5a6360a and 875b67f commits.
Files selected (1)
  • scanner/providers/web3/web3_client.go (1)
Files not summarized due to errors (1)
  • scanner/providers/web3/web3_client.go (nothing obtained from openai)
Files not reviewed due to errors (1)
  • scanner/providers/web3/web3_client.go (no response)
Review comments generated (0)
  • Review: 0
  • LGTM: 0

Tips

Chat with Image description CodeRabbit Bot (@coderabbitai)

  • Reply on review comments left by this bot to ask follow-up questions. A review comment is a comment on a diff or a file.
  • Invite the bot into a review comment chain by tagging @coderabbitai in a reply.

Code suggestions

  • The bot may make code suggestions, but please review them carefully before committing since the line number ranges may be misaligned.
  • You can edit the comment made by the bot and manually tweak the suggestion if it is slightly off.

Pausing incremental reviews

  • Add @coderabbitai: ignore anywhere in the PR description to pause further reviews from the bot.

@lucasmenendez lucasmenendez requested a review from p4u April 9, 2024 11:31
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Image description CodeRabbit

Commits Files that changed from the base of the PR and between 875b67f and 0a6f957 commits.
Files selected (3)
  • scanner/providers/web3/web3_client.go (1)
  • scanner/providers/web3/web3_pool.go (1)
  • scanner/providers/web3/web3_provider.go (7)
Files not summarized due to errors (3)
  • scanner/providers/web3/web3_client.go (diff tokens exceeds limit)
  • scanner/providers/web3/web3_pool.go (diff tokens exceeds limit)
  • scanner/providers/web3/web3_provider.go (nothing obtained from openai)
Files not reviewed due to errors (3)
  • scanner/providers/web3/web3_client.go (no response)
  • scanner/providers/web3/web3_pool.go (no response)
  • scanner/providers/web3/web3_provider.go (no response)
Review comments generated (0)
  • Review: 0
  • LGTM: 0

Tips

Chat with Image description CodeRabbit Bot (@coderabbitai)

  • Reply on review comments left by this bot to ask follow-up questions. A review comment is a comment on a diff or a file.
  • Invite the bot into a review comment chain by tagging @coderabbitai in a reply.

Code suggestions

  • The bot may make code suggestions, but please review them carefully before committing since the line number ranges may be misaligned.
  • You can edit the comment made by the bot and manually tweak the suggestion if it is slightly off.

Pausing incremental reviews

  • Add @coderabbitai: ignore anywhere in the PR description to pause further reviews from the bot.

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Image description CodeRabbit

Commits Files that changed from the base of the PR and between 0a6f957 and 9b02120 commits.
Files selected (1)
  • scanner/providers/web3/web3_pool.go (1)
Files not summarized due to errors (1)
  • scanner/providers/web3/web3_pool.go (diff tokens exceeds limit)
Files not reviewed due to errors (1)
  • scanner/providers/web3/web3_pool.go (no response)
Review comments generated (0)
  • Review: 0
  • LGTM: 0

Tips

Chat with Image description CodeRabbit Bot (@coderabbitai)

  • Reply on review comments left by this bot to ask follow-up questions. A review comment is a comment on a diff or a file.
  • Invite the bot into a review comment chain by tagging @coderabbitai in a reply.

Code suggestions

  • The bot may make code suggestions, but please review them carefully before committing since the line number ranges may be misaligned.
  • You can edit the comment made by the bot and manually tweak the suggestion if it is slightly off.

Pausing incremental reviews

  • Add @coderabbitai: ignore anywhere in the PR description to pause further reviews from the bot.

@lucasmenendez lucasmenendez requested a review from p4u April 10, 2024 09:22
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Image description CodeRabbit

Commits Files that changed from the base of the PR and between 9b02120 and 0ff59d8 commits.
Files selected (3)
  • scanner/providers/web3/web3_client.go (1)
  • scanner/providers/web3/web3_pool.go (1)
  • scanner/scanner.go (2)
Files not summarized due to errors (3)
  • scanner/providers/web3/web3_client.go (diff tokens exceeds limit)
  • scanner/providers/web3/web3_pool.go (diff tokens exceeds limit)
  • scanner/scanner.go (nothing obtained from openai)
Files not reviewed due to errors (3)
  • scanner/scanner.go (no response)
  • scanner/providers/web3/web3_client.go (no response)
  • scanner/providers/web3/web3_pool.go (no response)
Review comments generated (0)
  • Review: 0
  • LGTM: 0

Tips

Chat with Image description CodeRabbit Bot (@coderabbitai)

  • Reply on review comments left by this bot to ask follow-up questions. A review comment is a comment on a diff or a file.
  • Invite the bot into a review comment chain by tagging @coderabbitai in a reply.

Code suggestions

  • The bot may make code suggestions, but please review them carefully before committing since the line number ranges may be misaligned.
  • You can edit the comment made by the bot and manually tweak the suggestion if it is slightly off.

Pausing incremental reviews

  • Add @coderabbitai: ignore anywhere in the PR description to pause further reviews from the bot.

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Image description CodeRabbit

Commits Files that changed from the base of the PR and between 0ff59d8 and 5a35070 commits.
Files selected (4)
  • cmd/census3/main.go (8)
  • scanner/providers/manager/manager.go (1)
  • scanner/providers/web3/web3_pool.go (1)
  • scanner/scanner.go (8)
Files not summarized due to errors (4)
  • scanner/providers/web3/web3_pool.go (diff tokens exceeds limit)
  • scanner/scanner.go (nothing obtained from openai)
  • cmd/census3/main.go (nothing obtained from openai)
  • scanner/providers/manager/manager.go (nothing obtained from openai)
Files not reviewed due to errors (4)
  • scanner/scanner.go (no response)
  • scanner/providers/manager/manager.go (no response)
  • scanner/providers/web3/web3_pool.go (no response)
  • cmd/census3/main.go (no response)
Review comments generated (0)
  • Review: 0
  • LGTM: 0

Tips

Chat with Image description CodeRabbit Bot (@coderabbitai)

  • Reply on review comments left by this bot to ask follow-up questions. A review comment is a comment on a diff or a file.
  • Invite the bot into a review comment chain by tagging @coderabbitai in a reply.

Code suggestions

  • The bot may make code suggestions, but please review them carefully before committing since the line number ranges may be misaligned.
  • You can edit the comment made by the bot and manually tweak the suggestion if it is slightly off.

Pausing incremental reviews

  • Add @coderabbitai: ignore anywhere in the PR description to pause further reviews from the bot.

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Image description CodeRabbit

Commits Files that changed from the base of the PR and between 5a35070 and ece0db5 commits.
Files selected (7)
  • scanner/providers/farcaster/provider.go (1)
  • scanner/providers/web3/erc20_provider.go (3)
  • scanner/providers/web3/erc721_provider.go (2)
  • scanner/providers/web3/erc777_provider.go (2)
  • scanner/providers/web3/web3_client.go (1)
  • scanner/providers/web3/web3_iter.go (1)
  • scanner/providers/web3/web3_pool.go (1)
Files not summarized due to errors (7)
  • scanner/providers/web3/web3_client.go (diff tokens exceeds limit)
  • scanner/providers/web3/web3_iter.go (nothing obtained from openai)
  • scanner/providers/web3/erc777_provider.go (nothing obtained from openai)
  • scanner/providers/web3/erc20_provider.go (nothing obtained from openai)
  • scanner/providers/web3/erc721_provider.go (nothing obtained from openai)
  • scanner/providers/farcaster/provider.go (nothing obtained from openai)
  • scanner/providers/web3/web3_pool.go (nothing obtained from openai)
Files not reviewed due to errors (7)
  • scanner/providers/farcaster/provider.go (no response)
  • scanner/providers/web3/erc777_provider.go (no response)
  • scanner/providers/web3/erc721_provider.go (no response)
  • scanner/providers/web3/web3_client.go (no response)
  • scanner/providers/web3/web3_iter.go (no response)
  • scanner/providers/web3/erc20_provider.go (no response)
  • scanner/providers/web3/web3_pool.go (no response)
Review comments generated (0)
  • Review: 0
  • LGTM: 0

Tips

Chat with Image description CodeRabbit Bot (@coderabbitai)

  • Reply on review comments left by this bot to ask follow-up questions. A review comment is a comment on a diff or a file.
  • Invite the bot into a review comment chain by tagging @coderabbitai in a reply.

Code suggestions

  • The bot may make code suggestions, but please review them carefully before committing since the line number ranges may be misaligned.
  • You can edit the comment made by the bot and manually tweak the suggestion if it is slightly off.

Pausing incremental reviews

  • Add @coderabbitai: ignore anywhere in the PR description to pause further reviews from the bot.

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Image description CodeRabbit

Commits Files that changed from the base of the PR and between ece0db5 and d0752b3 commits.
Files selected (1)
  • scanner/providers/web3/web3_iter.go (1)
Files not summarized due to errors (1)
  • scanner/providers/web3/web3_iter.go (nothing obtained from openai)
Files not reviewed due to errors (1)
  • scanner/providers/web3/web3_iter.go (no response)
Review comments generated (0)
  • Review: 0
  • LGTM: 0

Tips

Chat with Image description CodeRabbit Bot (@coderabbitai)

  • Reply on review comments left by this bot to ask follow-up questions. A review comment is a comment on a diff or a file.
  • Invite the bot into a review comment chain by tagging @coderabbitai in a reply.

Code suggestions

  • The bot may make code suggestions, but please review them carefully before committing since the line number ranges may be misaligned.
  • You can edit the comment made by the bot and manually tweak the suggestion if it is slightly off.

Pausing incremental reviews

  • Add @coderabbitai: ignore anywhere in the PR description to pause further reviews from the bot.

@lucasmenendez lucasmenendez merged commit 4de4c85 into main Apr 11, 2024
7 checks passed
@lucasmenendez lucasmenendez deleted the f/multiple_endpoints_by_chain branch April 11, 2024 16:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feature: Support for multiple endpoints by chainID
2 participants