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 transport Module to ethrpc #699

Merged
merged 1 commit into from
Nov 5, 2022
Merged

Conversation

nlordell
Copy link
Contributor

@nlordell nlordell commented Nov 1, 2022

In refactoring for configurable max batch size, I wanted to move all Web3 related code into a parent module. transport felt like the right place, but with the wrong name.

This PR just renames the transport module to ethrpc and moves the Web3* types to this new module. I felt like this name was slightly more appropriate because:

  • transport is very generic and web3-crate-specific terminology
  • ethrpc more accurately represents what the module is for (i.e. all Ethereum RPC related code: the Web3 "connection" instance, underlying Transport implementations, Ethereum RPC extensions, etc.)

Test Plan

CI. No logic changes, just moved code.

@nlordell nlordell requested a review from a team as a code owner November 1, 2022 19:01
@@ -43,7 +43,7 @@ impl Default for Configuration {
/// Buffered `Transport` implementation that implements automatic batching of
/// JSONRPC requests.
#[derive(Clone, Debug)]
pub struct Buffered<Inner> {
pub struct BufferedTransport<Inner> {
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

Copy link
Contributor

Choose a reason for hiding this comment

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

Although I do think BatchingTransport might be a slightly better name. BatchTransport is a name already used by the web3 crate to mean something different (a transport allowing batches), but I don't think that's a problem.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I called it Buffered instead of Batched just because it does primarily request buffering (and, as a side-effect, automatically groups buffered requests into batches).

For example:

Configuration {
    max_batch_size: 1,
    max_concurrent_requests: 5,
    ..Default::default()
}

Will just buffer requests and make sure only 5 at a time are sent to the node, but never make any batched RPC requests.

Don't know if this makes sense. Also fine with changing it, I'm not too attached to the name (and "buffered" is quite generic lacking specificity).

@nlordell nlordell force-pushed the use-buffered-transport branch 4 times, most recently from 3a6961c to a2c46a5 Compare November 5, 2022 19:09
Base automatically changed from use-buffered-transport to main November 5, 2022 19:13
@nlordell nlordell enabled auto-merge (squash) November 5, 2022 19:22
@nlordell nlordell merged commit 1f8e6e0 into main Nov 5, 2022
@nlordell nlordell deleted the refactor-ethrpc-module branch November 5, 2022 19:25
@github-actions github-actions bot locked and limited conversation to collaborators Nov 5, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants