Skip to content

Comments

refactor(evm): port EVM provider to viem#377

Merged
Sekhmet merged 6 commits intomasterfrom
sekhmet/viem
Sep 2, 2025
Merged

refactor(evm): port EVM provider to viem#377
Sekhmet merged 6 commits intomasterfrom
sekhmet/viem

Conversation

@Sekhmet
Copy link
Member

@Sekhmet Sekhmet commented Aug 28, 2025

Summary

Closes: https://github.com/snapshot-labs/workflow/issues/611

This PR ports EVM provider from ethers.js v5 to viem.

This brings some quality of live improvements.

Client timeout

Now calls made using viem client have 5s timeout. The same timeout is used in getLogs request when requesting logs by blockHash (single block request).

This should prevent issue of live syncing stopping due to hanging requests which we have experienced.

Timeout is not applied in preload stage as those requests tend to have long response times.

Typed events in writers

Now parsed events in writers can be fully typed. This requires constant JSON ABI. To enable this you can type your writers like this:

const writer: evm.Writer<typeof MyAbi, 'someEvent'> = ({ event }) => {
  if (!event) return

  event.args.id
  //    ^? - this is now typed using your ABI
}
Screen_Recording_2025-08-28_at_15.58.07.mov

Test plan

  • Link this PR to checkpoint-template here.
  • It still works, evm writers are typed.

Copy link
Member

@bonustrack bonustrack left a comment

Choose a reason for hiding this comment

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

tACK

@Sekhmet Sekhmet merged commit 8904d36 into master Sep 2, 2025
1 check passed
@Sekhmet Sekhmet deleted the sekhmet/viem branch September 2, 2025 10:26
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