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

[WIP]: Experimentally use Viem in OpStack finalizer #1798

Draft
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

nicholaspai
Copy link
Member

@nicholaspai nicholaspai commented Aug 30, 2024

Currently showing my WIP trying to use the Viem client to support limited finalizer functionality:

  • check withdrawal status
  • build proveWithdrawalTransaction and finalizeWithdrawal args

Current limitations of Viem:

  • No easy way to convert ethers Provider to Viem transport, meaning that RPC calls won't go through our custom RetryProvider. The Viem transport does have retry and fallback logic natively but not caching built-in. I think we'll need a larger refactor to support this migration if we wanted to use Viem more widely throughout the codebase. We can probably get away with Viem in the finalizer if we restrict its use only for the few RPC calls required to support finalizer functions (e.g. building transaction args requires querying contracts)
  • getWithdrawalStatus only supports querying a transaction with a single withdrawal. This isn't very useful for us today since we usually multicall our withdrawals. We need something like this PR in order to use Viem to finalize
  • Viem accounts don't seem to be obviously interoperable with ethers Signers

Suggested roadmap

  • Use Viem for optimism mainnet, and then a few op stack chains over time.
  • Build generalized Viem modules that could help us install viem into the broader codebase like:
    • converting between Ethers providers/signers and Viem transports/accounts

Resources

nicholaspai and others added 10 commits August 30, 2024 15:55
$$ Currently showing my WIP trying to use the Viem client to support limited finalizer functionality:
- check withdrawal status
- build proveWithdrawalTransaction and finalizeWithdrawal args

## Current limitations of Viem:
- No easy way to convert ethers Provider to [Viem transport](https://viem.sh/docs/clients/transports/custom), meaning that RPC calls won't go through our custom RetryProvider. The Viem transport does have retry and fallback logic natively but not caching built-in. I think we'll need a larger refactor to support this migration if we wanted to use Viem more widely throughout the codebase. We can probably get away with Viem in the finalizer if we restrict its use only for the few RPC calls required to support finalizer functions (e.g. building transaction args requires querying contracts)
- `getWithdrawalStatus` only supports querying a transaction with a single withdrawal. This isn't very useful for us today since we usually multicall our withdrawals.
- [Viem accounts](https://viem.sh/docs/clients/wallet#json-rpc-accounts) don't seem to be obviously interoperable with ethers Signers

## Suggested roadmap
- Use Viem for optimism mainnet, and then a few op stack chains over time.
- Build generalized Viem modules that could help us install viem into the broader codebase like:
    - converting between Ethers providers/signers and Viem transports/accounts
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.

2 participants