Skip to content

Upgrade viem to 2.54.0 and remove unused Viem bindings - #1365

Merged
DZakh merged 4 commits into
mainfrom
claude/viem-usage-review-i2kfbv
Jun 30, 2026
Merged

Upgrade viem to 2.54.0 and remove unused Viem bindings#1365
DZakh merged 4 commits into
mainfrom
claude/viem-usage-review-i2kfbv

Conversation

@DZakh

@DZakh DZakh commented Jun 30, 2026

Copy link
Copy Markdown
Member

Summary

Upgrades viem dependency to 2.54.0 across the codebase and removes unused event log decoding functionality from the Viem bindings module.

Key Changes

  • Dependency upgrade: Updated viem from 2.46.2 to 2.54.0 in:

    • packages/envio/package.json
    • scenarios/test_codegen/package.json
    • packages/cli/src/executor/init.rs (template initialization)
  • Removed unused Viem bindings (packages/envio/src/bindings/Viem.res):

    • Removed eventLog and decodedEvent type definitions
    • Removed decodeEventLogOrThrow external binding
    • Removed keccak256Bytes, encodePacked, and intToHex external bindings
    • Removed ParseError and UnknownContractName exceptions
    • Removed parseLogOrThrow function
  • Removed test file: Deleted scenarios/test_codegen/test/Viem_test.res which tested the removed event log decoding functionality

Implementation Details

The removal of event log decoding functionality suggests this capability is no longer needed or has been replaced by alternative mechanisms. The retained bindings (toHex, keccak256, pad, bigintToHex, stringToHex, boolToHex, bytesToHex, concat) cover the core hex encoding/decoding utilities that remain in use.

https://claude.ai/code/session_014mSDqCdjyqrXeUSLzgzQk2

Summary by CodeRabbit

  • Bug Fixes

    • Updated the project initialization flow to use a fixed, newer version of a core dependency for more consistent setup.
    • Aligned package versions across the codebase to the same newer release.
  • Chores

    • Cleaned up some internal API surface and removed outdated test coverage.

claude added 3 commits June 30, 2026 13:24
The production decode path runs through the native addon decoder
(HyperSyncClient.Decoder / EvmRpcClient), so viem's decodeEventLog and its
parseLogOrThrow wrapper had no callers. Drop them along with the eventLog/
decodedEvent types, the ParseError/UnknownContractName exceptions, the
test that only exercised the binding, and three unused hex externals
(keccak256Bytes, encodePacked, intToHex).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014mSDqCdjyqrXeUSLzgzQk2
The template injected viem@^2.0.0, a wide range that resolves to whatever
2.x is latest at install time. Pin it to an exact version so generated
indexers get a deterministic, tested viem.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014mSDqCdjyqrXeUSLzgzQk2
Align the envio runtime and test_codegen scenario with the external-calls
template so a generated indexer resolves a single viem copy instead of two.
The runtime only uses viem's stable hex/keccak/address-checksum helpers,
all verified against 2.54.0.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014mSDqCdjyqrXeUSLzgzQk2
@coderabbitai

coderabbitai Bot commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Upgrades viem to 2.54.0 in two package.json files, pins the exact version in the CLI EVM FeatureExternalCalls init branch, removes the keccak256Bytes, encodePacked, and intToHex external bindings from Viem.res, and deletes the associated Viem_test.res test file.

Changes

viem 2.54.0 upgrade

Layer / File(s) Summary
Version bumps and CLI pin
packages/envio/package.json, scenarios/test_codegen/package.json, packages/cli/src/executor/init.rs
Updates viem from 2.46.2 to 2.54.0 in both package files; changes the CLI EVM FeatureExternalCalls extra dependency pin from ^2.0.0 to the exact 2.54.0.
Remove unused Viem.res bindings and tests
packages/envio/src/bindings/Viem.res, scenarios/test_codegen/test/Viem_test.res
Removes keccak256Bytes, encodePacked, and intToHex external bindings from the top-level viem bindings file and deletes the Viem_test.res test suite.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main changes: upgrading viem to 2.54.0 and removing unused Viem bindings.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
packages/cli/src/executor/init.rs (1)

257-257: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Exact pin trades patch/security auto-updates for determinism — confirm this is intended.

Pinning generated projects to exact 2.54.0 (rather than ^2.54.0) means scaffolded indexers won't pick up viem patch/security fixes without a CLI release that bumps this literal. That matches the PR's determinism goal, but couples downstream users' viem security posture to your release cadence. If determinism is the priority, prefer committing a lockfile in the template over freezing the manifest, so security patches remain reachable via npm update.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/cli/src/executor/init.rs` at line 257, The generated project
dependency in init should not be hard-pinned to an exact viem version unless
that is intentionally trading away patch updates; review the dependency list
returned by the init generator and either switch the viem entry in the relevant
match arm to a range that still allows security updates or confirm this exact
pin is a deliberate template choice. If determinism is the goal, prefer handling
it via the template lockfile generation path rather than freezing the manifest
version literal.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@packages/cli/src/executor/init.rs`:
- Line 257: The generated project dependency in init should not be hard-pinned
to an exact viem version unless that is intentionally trading away patch
updates; review the dependency list returned by the init generator and either
switch the viem entry in the relevant match arm to a range that still allows
security updates or confirm this exact pin is a deliberate template choice. If
determinism is the goal, prefer handling it via the template lockfile generation
path rather than freezing the manifest version literal.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: f40049cb-e703-490c-b7c0-27c8339363dc

📥 Commits

Reviewing files that changed from the base of the PR and between 2d34499 and df2facf.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (5)
  • packages/cli/src/executor/init.rs
  • packages/envio/package.json
  • packages/envio/src/bindings/Viem.res
  • scenarios/test_codegen/package.json
  • scenarios/test_codegen/test/Viem_test.res
💤 Files with no reviewable changes (2)
  • scenarios/test_codegen/test/Viem_test.res
  • packages/envio/src/bindings/Viem.res

@DZakh
DZakh enabled auto-merge (squash) June 30, 2026 13:52
@DZakh
DZakh merged commit 6e72ab3 into main Jun 30, 2026
8 checks passed
@DZakh
DZakh deleted the claude/viem-usage-review-i2kfbv branch June 30, 2026 13:55
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