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

feat(rpc): Rewrite Ethereum client for subs-based state updates #2224

Merged
merged 10 commits into from
Sep 11, 2024

Conversation

t00ts
Copy link
Contributor

@t00ts t00ts commented Sep 6, 2024

Introduces a comprehensive rewrite of the Ethereum client, transitioning to a subscription-based approach using the Alloy library.

This translates to efficiency improvements when tracking and updating Ethereum state in real-time, especially for L1 to L2 interactions.

Key features include:

  • Subscription-based State Updates: Replaces the previous polling mechanism with a new subscription-based approach. State updates are emitted as soon as they belong to a finalized block.

See also:
#2182
#2216

@t00ts t00ts force-pushed the t00ts/ethereum-ws branch 2 times, most recently from 538e5fb to b027edd Compare September 6, 2024 11:48
@t00ts t00ts marked this pull request as ready for review September 6, 2024 11:51
@t00ts t00ts requested a review from a team as a code owner September 6, 2024 11:51
crates/ethereum/src/lib.rs Outdated Show resolved Hide resolved
crates/ethereum/src/lib.rs Outdated Show resolved Hide resolved
crates/ethereum/src/utils.rs Outdated Show resolved Hide resolved
crates/pathfinder/src/state/sync.rs Outdated Show resolved Hide resolved
crates/ethereum/src/lib.rs Outdated Show resolved Hide resolved
Copy link
Contributor

@sistemd sistemd left a comment

Choose a reason for hiding this comment

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

LGTM, but I also agree with everything that @kkovaacs said

@t00ts t00ts force-pushed the t00ts/ethereum-ws branch 3 times, most recently from c53fcc5 to a98867a Compare September 10, 2024 10:55
@t00ts t00ts changed the title feat(rpc): Rewrite Ethereum client for subs-based state updates and L1 to L2 tx mapping feat(rpc): Rewrite Ethereum client for subs-based state updates Sep 10, 2024
Copy link
Contributor

@kkovaacs kkovaacs left a comment

Choose a reason for hiding this comment

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

LGTM % some nits.

There are also some missing parts:

  • This is an incompatible change (we now explicitly require a Websocket URL). We should probably add more refined handling of that: updating the documentation for the --ethereum.url argument, or maybe trying to update the scheme of the URL from http->ws and https->wss and printing a big fat warning. In any case, we should make sure that we exit with a very clear error message in case the URL does not work. In general we should be doing everything we can to make the life of end users easier.
  • Updating the CHANGELOG file with information about the incompatible change (we now require a Websocket URL for the Ethereum API).

@@ -126,7 +126,6 @@ impl Transaction<'_> {
":idx": &idx,
])?;
}

Copy link
Contributor

Choose a reason for hiding this comment

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

This is probably just a leftover.

crates/pathfinder/src/state/sync/l1.rs Show resolved Hide resolved
crates/pathfinder/src/state/sync/l1.rs Show resolved Hide resolved
CHANGELOG.md Outdated Show resolved Hide resolved
Copy link
Contributor

@kkovaacs kkovaacs left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@t00ts t00ts merged commit 2aa6204 into main Sep 11, 2024
7 checks passed
@t00ts t00ts deleted the t00ts/ethereum-ws branch September 11, 2024 12:58
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.

3 participants