Skip to content

♻️ refactor(utils): retire Phase 0 compatibility exports - #2086

Open
roninjin10 wants to merge 1 commit into
mainfrom
quality/utils-phase0
Open

♻️ refactor(utils): retire Phase 0 compatibility exports#2086
roninjin10 wants to merge 1 commit into
mainfrom
quality/utils-phase0

Conversation

@roninjin10

@roninjin10 roninjin10 commented Jul 30, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Implements Phase 0 from the @tevm/utils retirement assessment at /Users/williamcory/Desktop/tevm-stack-readiness/utils-voltaire.html.
  • Removes the self-declared GenesisState and AsyncEventEmitter compatibility types from @tevm/utils.
  • Keeps canonical bytesToBigInt, removes bytesToBigint, and updates the top-level tevm runtime, declaration, and documentation artifacts.
  • Migrates internal callers to GenesisState from @evmts/zevm/common and EventEmitter from eventemitter3.

Breaking change and migration

These exports were described as backward-compatibility shims but were not marked deprecated-for-removal, so this PR honestly requests major bumps for @tevm/utils and tevm. The repository's linked release group consequently resolves affected packages at the major level.

  • GenesisState: import from @evmts/zevm/common.
  • AsyncEventEmitter: use EventEmitter from eventemitter3.
  • bytesToBigint: rename to bytesToBigInt.

Scope and concurrency

This deliberately does not migrate the ~119 viem/abitype/zevm pass-through call sites or move signature.js; those remain later phases.

pnpm-lock.yaml is also touched by open work. This PR's lockfile change is limited to the three-line eventemitter3 importer entry required by @tevm/blockchain.

Verification

  • pnpm install --frozen-lockfile
  • pnpm --dir packages/utils typecheck
  • pnpm --dir packages/blockchain typecheck
  • pnpm --dir packages/vm typecheck
  • pnpm --dir tevm typecheck
  • pnpm --dir packages/utils exec vitest run — 7 files passed; 59 passed, 1 skipped
  • pnpm --dir packages/blockchain exec vitest run — 16 files passed; 83 passed
  • pnpm exec vitest run packages/vm/src --config vitest.config.ts — Vitest ran 12 files/28 tests successfully, but 9 suites cannot load because they import bun:test (Cannot find package 'bun:test'). I did not substitute the prohibited bare bun test.
  • Focused Biome check — 5 files checked, no fixes applied
  • Runtime/export audit — bytesToBigInt: function bytesToBigint: false; removed compatibility types absent from generated declarations
  • pnpm changeset status

Summary by CodeRabbit

  • Breaking Changes

    • Removed legacy GenesisState and AsyncEventEmitter exports.
    • Renamed bytesToBigint to bytesToBigInt; update imports accordingly.
    • Blockchain and VM event properties now use the standard event emitter type.
  • Documentation

    • Updated API references and examples to reflect the renamed utility and removed legacy types.
  • Chores

    • Updated package version ranges to reflect these compatibility changes.

<prompt>Execute Phase 0 of the @tevm/utils retirement.</prompt>
@changeset-bot

changeset-bot Bot commented Jul 30, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 1f8ae20

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

💥 An error occurred when fetching the changed packages and changesets in this PR
Some errors occurred when validating the changesets config:
The package or glob expression "@evmts/*" is specified in the `ignore` option but it is not found in the project. You may have misspelled the package name or provided an invalid glob expression. Note that glob expressions must be defined according to https://www.npmjs.com/package/micromatch

@vercel

vercel Bot commented Jul 30, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
node Ready Ready Preview Jul 30, 2026 2:20am
tevm-monorepo-app Ready Ready Preview Jul 30, 2026 2:20am
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
tevm-monorepo-tevm Ignored Ignored Jul 30, 2026 2:20am

Request Review

@coderabbitai

coderabbitai Bot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The PR removes legacy @tevm/utils exports, adopts canonical GenesisState and EventEmitter types, corrects bytesToBigInt casing across package entrypoints, updates documentation, and adds eventemitter3 to blockchain dependencies.

Changes

Utility export cleanup

Layer / File(s) Summary
Canonical utility exports and types
packages/utils/src/index.ts, packages/utils/src/viem.js, packages/utils/docs/*, tevm/docs/utils/*
Replaces bytesToBigint with bytesToBigInt and removes the GenesisState and AsyncEventEmitter compatibility exports and documentation references.

Emitter and type contracts

Layer / File(s) Summary
Native emitter and genesis type adoption
packages/blockchain/package.json, packages/blockchain/src/Chain.ts, packages/vm/src/BaseVm.ts, packages/vm/src/utils/VMOpts.ts, tevm/docs/blockchain/*, tevm/docs/vm/*
Uses eventemitter3 for blockchain and VM event types and imports GenesisState from @evmts/zevm/common.

Top-level API synchronization

Layer / File(s) Summary
Top-level exports and release documentation
tevm/index.*, tevm/docs/index/*, .changeset/tidy-utils-retire.md
Updates top-level runtime and type exports, documentation names and links, and package version-change notes.

Estimated code review effort: 2 (Simple) | ~10 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: retiring compatibility exports from @tevm/utils.
Description check ✅ Passed It covers summary, migration, scope, and verification, but it doesn't follow the template headings or include the Additional Information checkbox/address.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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 💡 1
🛠️ Fix failing CI checks 💡
  • Fix failing CI checks
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch quality/utils-phase0

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint install failed: dependency version conflict. Check your lock file or package.json.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@claude

claude Bot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Claude encountered an error —— View job


I'll analyze this and get back to you.

@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.

Actionable comments posted: 1

🤖 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.

Inline comments:
In `@tevm/index.js`:
- Line 3: Update the public bytesToBigInt export by adding complete JSDoc with
inline type imports, `@throws` documentation, and a valid working `@example`.
Reformat the export declaration containing bytesToBigInt to comply with Biome’s
120-character line width, preserving all existing exports.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 03654848-1110-4d5c-a580-192ef888ba86

📥 Commits

Reviewing files that changed from the base of the PR and between c1ad08e and 1f8ae20.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (22)
  • .changeset/tidy-utils-retire.md
  • packages/blockchain/package.json
  • packages/blockchain/src/Chain.ts
  • packages/utils/docs/globals.md
  • packages/utils/docs/type-aliases/AsyncEventEmitter.md
  • packages/utils/docs/type-aliases/GenesisState.md
  • packages/utils/src/index.ts
  • packages/utils/src/viem.js
  • packages/vm/src/BaseVm.ts
  • packages/vm/src/utils/VMOpts.ts
  • tevm/docs/blockchain/type-aliases/Chain.md
  • tevm/docs/index/README.md
  • tevm/docs/index/functions/bytesToBigInt.md
  • tevm/docs/utils/README.md
  • tevm/docs/utils/type-aliases/AsyncEventEmitter.md
  • tevm/docs/utils/type-aliases/GenesisState.md
  • tevm/docs/vm/interfaces/VMOpts.md
  • tevm/index.cjs
  • tevm/index.d.cts
  • tevm/index.d.ts
  • tevm/index.js
  • tevm/index.ts
💤 Files with no reviewable changes (9)
  • packages/utils/docs/type-aliases/GenesisState.md
  • tevm/docs/utils/type-aliases/GenesisState.md
  • tevm/docs/utils/type-aliases/AsyncEventEmitter.md
  • tevm/index.cjs
  • packages/utils/docs/type-aliases/AsyncEventEmitter.md
  • packages/utils/src/viem.js
  • tevm/index.ts
  • packages/utils/docs/globals.md
  • packages/utils/src/index.ts

Comment thread tevm/index.js
export { definePredeploy } from '@tevm/predeploys';
export { createContract } from '@tevm/contract';
export { PREFUNDED_ACCOUNTS, PREFUNDED_PRIVATE_KEYS, PREFUNDED_PUBLIC_KEYS, PREFUNDED_SEED, boolToBytes, boolToHex, bytesToBigInt, bytesToBigint, bytesToBool, bytesToHex, bytesToNumber, createMemoryDb, decodeAbiParameters, decodeErrorResult, decodeEventLog, decodeFunctionData, decodeFunctionResult, encodeAbiParameters, encodeDeployData, encodeErrorResult, encodeEventTopics, encodeFunctionData, encodeFunctionResult, encodePacked, formatAbi, formatEther, formatGwei, formatLog, fromBytes, fromHex, fromRlp, getAddress, hexToBigInt, hexToBool, hexToBytes, hexToNumber, hexToString, isAddress, isBytes, isHex, keccak256, mnemonicToAccount, numberToHex, parseAbi, parseEther, parseGwei, stringToHex, toBytes, toHex, toRlp } from '@tevm/utils';
export { PREFUNDED_ACCOUNTS, PREFUNDED_PRIVATE_KEYS, PREFUNDED_PUBLIC_KEYS, PREFUNDED_SEED, boolToBytes, boolToHex, bytesToBigInt, bytesToBool, bytesToHex, bytesToNumber, createMemoryDb, decodeAbiParameters, decodeErrorResult, decodeEventLog, decodeFunctionData, decodeFunctionResult, encodeAbiParameters, encodeDeployData, encodeErrorResult, encodeEventTopics, encodeFunctionData, encodeFunctionResult, encodePacked, formatAbi, formatEther, formatGwei, formatLog, fromBytes, fromHex, fromRlp, getAddress, hexToBigInt, hexToBool, hexToBytes, hexToNumber, hexToString, isAddress, isBytes, isHex, keccak256, mnemonicToAccount, numberToHex, parseAbi, parseEther, parseGwei, stringToHex, toBytes, toHex, toRlp } from '@tevm/utils';

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.

📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win

Document and format the changed public export.

The new bytesToBigInt export has no complete JSDoc and the export list exceeds the configured 120-character Biome width. Add JSDoc with inline type imports, @throws, and a working @example, then let Biome wrap the export declaration.

🤖 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 `@tevm/index.js` at line 3, Update the public bytesToBigInt export by adding
complete JSDoc with inline type imports, `@throws` documentation, and a valid
working `@example`. Reformat the export declaration containing bytesToBigInt to
comply with Biome’s 120-character line width, preserving all existing exports.

Source: Coding guidelines

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.

1 participant