-
Notifications
You must be signed in to change notification settings - Fork 2
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
Conversation
Uplevel your code reviews with CodeRabbit ProCodeRabbit ProIf 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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
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.
There was a problem hiding this 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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
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.
…oncurrency, disable endpoints if they fail
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
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.
…etEndpoint web3Pool
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
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.
Closes #73