Repository navigation
fix(zksync): include dependency errors in two action error unions - #5587
Conversation
Import public types from entrypoints, replace tautological assertions with expectTypeOf<...>().toExtend<...>(), and check RPC error discriminants. Amp-Thread-ID: https://ampcode.com/threads/T-01a1f05b-6d85-706b-9dcc-4f07a520335d Co-authored-by: jxom <[email protected]>
🦋 Changeset detectedLatest commit: 621b366 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 903f258995
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| import type { ReadContractErrorType } from 'viem' | ||
| import { expectTypeOf, test } from 'vitest' | ||
|
|
||
| import type { GetL1TokenBalanceErrorType } from '../index.js' |
There was a problem hiding this comment.
Import the tested public types through viem/zksync
Both new public-surface type tests import their action error types through ../index.js, contrary to the root AGENTS.md requirement to use package aliases for public exports. This bypasses consumer-facing package-path resolution in tests intended to verify the public types. Change this import and the corresponding import in isWithdrawalFinalized.test-d.ts to 'viem/zksync'.
AGENTS.md reference: AGENTS.md:L188-L190
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Done in 0941678: both type tests now import from viem/zksync. The test tsconfig had no path for it, so I added viem/zksync next to the other viem/* mappings.
Map viem/zksync in the test tsconfig so type tests resolve the public entrypoint like the other viem/* aliases. Amp-Thread-ID: https://ampcode.com/threads/T-01a1f05b-6d85-706b-9dcc-4f07a520335d Co-authored-by: jxom <[email protected]>
|
Thanks for keeping my commit and improving the tests. During follow-up validation, I found that the withdrawal-log helpers can also propagate |
Cherry-picked from 5548d8c and adapted to the updated type tests. Amp-Thread-ID: https://ampcode.com/threads/T-01a1f05b-6d85-706b-9dcc-4f07a520335d Co-authored-by: jxom <[email protected]>
|
Thanks @mortezashojaei, good catch: both helpers pass RPC-provided addresses to |
|
Published pnpm add viem@pr-5587
pnpm add [email protected] |
Supersedes #5585 by @mortezashojaei (their commit is kept as-is).
GetL1TokenBalanceErrorTypeandIsWithdrawalFinalizedErrorTypenow compose the error types of the functions each action calls:getL1TokenBalance:ReadContractErrorTypereplacesBaseErrorType(readContractwraps every failure inContractFunctionExecutionError, and nothing on this path throws a plainBaseError).isWithdrawalFinalized: addsGetTransactionReceiptErrorType(viagetWithdrawalLogandgetWithdrawalL2ToL1Log),RequestErrorType(getLogProofandgetDefaultBridgeAddressescallclient.request), andReadContractErrorType.Runtime behavior is unchanged; only type aliases and imports change.
On top of #5585, the follow-up commit tightens the type tests: it imports public types from the
viemand zksync entrypoints, replaces assertions that only compared a value with its own declared type withexpectTypeOf<Dependency>().toExtend<ActionError>(), and checksHttpRequestErrorfields instead of re-asserting a narrowednameliteral. The tests fail againstmainand whenReadContractErrorTypeis removed fromIsWithdrawalFinalizedErrorType.