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

improve(LineaFinalizer): Force RPC calls through custom provider #1931

Merged
merged 20 commits into from
Dec 17, 2024

Conversation

nicholaspai
Copy link
Member

@nicholaspai nicholaspai commented Nov 26, 2024

The functions that we use in the Linea SDK make event queries from block 0 to "latest" by default which means that some of our RPC's can't be used with the Finalizer. Additionally, we're missing out our custom provider retry and caching logic.

This PR removes all instances of making RPC calls via the Linea SDK's provider and replace with making the same call through our custom Provider.

The latest Linea SDK code looks like it'll support injecting custom providers but its not released yet on NPM. So this code should be removed eventually once a later SDK version is released.

This PR also fixes a bug where the existing SDK's interface doesn't match what's on chain: 12e872e

The functions that we use in the Linea SDK make event queries from block 0 to "latest" by default which means that some of our RPC's can't be used with the Finalizer. Additionally, we're missing out our custom provider retry and caching logic.

This PR removes all instances of making RPC calls via the Linea SDK's provider and replace with making the same call through our custom Provider.

The latest [Linea SDK](https://github.com/Consensys/linea-monorepo/blob/3fbe660683a318b6fa1b63ec518f948791536352/sdk/src/sdk/LineaSDK.ts#L56) code looks like it'll support injecting custom providers but its not released yet on NPM. So this code should be removed eventually once a later SDK version is released.
@nicholaspai nicholaspai marked this pull request as draft November 26, 2024 17:54
@nicholaspai nicholaspai marked this pull request as ready for review November 26, 2024 19:27
Copy link
Contributor

@pxrl pxrl left a comment

Choose a reason for hiding this comment

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

No showstoppers for me here. I do worry a bit about the long-term maintainability of this though. Feels like we need to upstream some of this feedback.

src/finalizer/utils/linea/common.ts Outdated Show resolved Hide resolved
src/finalizer/utils/linea/common.ts Outdated Show resolved Hide resolved
src/finalizer/utils/linea/l1ToL2.ts Outdated Show resolved Hide resolved
src/finalizer/utils/linea/l1ToL2.ts Outdated Show resolved Hide resolved
Copy link
Contributor

@bmzig bmzig left a comment

Choose a reason for hiding this comment

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

This looks good to me. Have you been able to finalize a L2 -> L1 message?

@nicholaspai
Copy link
Member Author

This looks good to me. Have you been able to finalize a L2 -> L1 message?

I haven't been able to time it well. I think one way to do it is i can temporarily pause the production finalizer for linea and run this locally.

Copy link
Contributor

@james-a-morris james-a-morris left a comment

Choose a reason for hiding this comment

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

This makes sense but I think we should avoid accessing the Linea package in an unintended way. We've forked/patched packages before so that they play nicely with our imports - this could be a viable workaround.

Otherwise there's nothing that stands out - I'll approve pending my comments

src/finalizer/utils/arbStack.ts Outdated Show resolved Hide resolved
src/finalizer/utils/linea/common.ts Outdated Show resolved Hide resolved
@nicholaspai
Copy link
Member Author

This looks good to me. Have you been able to finalize a L2 -> L1 message?

Yes, now I have: https://etherscan.io/tx/0xdd512394eb0aed5b44ae4c9ed6619937555d8d67d7f8795e4c82f060cdbcce94

Copy link
Contributor

@james-a-morris james-a-morris left a comment

Choose a reason for hiding this comment

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

Does this finalize the messages that are throwing errors? I've left a few nits as code makes sense.

As a general thought I think we should co-locate all of the code that will be removed when Linea releases 1.0.

src/finalizer/utils/arbStack.ts Show resolved Hide resolved
src/finalizer/utils/linea/common.ts Show resolved Hide resolved
src/finalizer/utils/linea/l1ToL2.ts Show resolved Hide resolved
src/finalizer/utils/linea/l1ToL2.ts Outdated Show resolved Hide resolved
@nicholaspai
Copy link
Member Author

As a general thought I think we should co-locate all of the code that will be removed when Linea releases 1.0.

I think the issue here is that the entire linea/ folder will change, the code is very different

@nicholaspai nicholaspai merged commit 92775a0 into master Dec 17, 2024
4 checks passed
@nicholaspai nicholaspai deleted the linea-finalizer-sdk branch December 17, 2024 01:09
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.

4 participants