Repository navigation
Conversation
deposit read the bridge addresses, the bridgehub, the base token, the fees, the token metadata and the asset id one after another, and requested zks_getBridgeContracts twice. The independent reads now start together and are awaited in their original order, so errors surface in the same order, and the bridge addresses are reused for the L2 gas limit estimate. Co-authored-by: jxom <[email protected]> Amp-Thread-ID: https://ampcode.com/threads/T-01a1e1b3-ba60-755b-bfd0-1a31a4a5bf1e
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
🦋 Changeset detectedLatest commit: 5357729 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 |
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: 77be8ce1a2
ℹ️ 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".
| if (fn) | ||
| return { | ||
| result: encodeFunctionResult({ | ||
| abi: [fn], | ||
| functionName: fn.name, |
There was a problem hiding this comment.
Replace canned RPC replies with real chain behavior
The new concurrency test intercepts every RPC request and supplies canned contract results, gas estimates, and a transaction hash without executing the transaction. Although the HTTP server is real, these responses are stubs, which the root AGENTS.md explicitly prohibits. Forward requests to the configured test chain, adding delays where needed, and verify the resulting deposit behavior rather than substituting all RPC results.
AGENTS.md reference: AGENTS.md:L155-L158
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Keeping this. The suite has no ZKsync L1 bridge to run against: anvilZksync has no fork, and the existing deposit tests replace client.request outright. createRpcProxy is a real HTTP server driven by a real Viem client, the same pattern the repo already uses for RPC failure cases. To show behavior is unchanged, the test snapshots the signed transaction, which is byte-for-byte the same as on main.
| "transaction": "0x02f902b501078405f5e100845f5e10008303a98094303a465b659cbb0ab36ee643ea362c509eeb521384075bcd15b9024424fd57fb0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000014400000000000000000000000000000000000000000000000000000000075bcd150000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000007a12000000000000000000000000000000000000000000000000000000000000003200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000d7f9f54194c633f36ccd5f3da84ad4a1c38cb2cb0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000000c101abababababababababababababababababababababababababababababababab0000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000f4240000000000000000000000000f39fd6e51aad88f6f4ce6ab8827279cfffb92266000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb4800000000000000000000000000000000000000000000000000000000000000c080a0d8cf95db4d162958b68f8ff0e6835f38d8673ec33e062cc1e934f6f8d8a6b5d6a013374e2232332f2ead963be2f95f02d179118328e4bf277683ae5677144d5ef5", | ||
| } | ||
| `) | ||
| expect(rounds.map((names) => names.sort())).toMatchInlineSnapshot(` |
There was a problem hiding this comment.
Assert concurrency behavior without snapshotting call tracking
The rounds snapshot asserts the exact sequence and grouping of internal RPC calls, so changes such as batching or using another equivalent fee-estimation path can fail this test even when concurrency and the resulting transaction remain correct. The root AGENTS.md explicitly requires testing observable behavior instead of call-tracking. Keep the transaction assertion and replace the method-round snapshot with a behavioral concurrency check that does not prescribe the internal call sequence.
AGENTS.md reference: AGENTS.md:L204-L208
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Keeping this. Recording which requests overlap through a real http transport is how the concurrency rule for these changes is enforced (same approach as the landed #5505 tests). The result alone can't tell a concurrent implementation from a sequential one, since both return the same value. The snapshot records rounds of requests, not hook invocations, so it fails exactly when a waterfall comes back.
| http, | ||
| parseAbi, | ||
| toFunctionSelector, | ||
| } from '../../index.js' |
There was a problem hiding this comment.
Import the new public test APIs through package aliases
The newly added public API imports, including createClient, http, and encodeFunctionResult, use the relative source entrypoint instead of the required viem alias. The root AGENTS.md explicitly requires package-entrypoint aliases in public-surface tests; change this import to 'viem' and import the newly added erc20Abi through that entrypoint as well. The exception for relative chain definitions does not cover these APIs.
AGENTS.md reference: AGENTS.md:L188-L193
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 5357729: the new public imports, including erc20Abi and parseAbi, now come from 'viem'.
|
Published pnpm add viem@pr-5531
pnpm add [email protected] |
|
Bundled into #5543 as its own commit, so this PR is superseded. Closing in favour of the bundle. |
The ZKsync
depositAction read the bridge addresses, the bridgehub, the base token, the fees, the token metadata and the asset id one after another, and requestedzks_getBridgeContractstwice. It took 12 round trips before it could build the transaction.depositstarts the bridge addresses, the bridgehub and base token, and the fee estimate together.getBridgeAddressesreads a missingL1_NULLIFIERandnativeTokenVaulttogether.getL1DepositTxstarts the second bridge calldata (assetId) before it awaits the fees.encodeDefaultBridgeDatareadsname,symbolanddecimalstogether, and the custom bridge path readsl2BridgeAddressalongside them.zks_getBridgeContractsagain.Effect
Real in-process
node:httpJSON-RPC server adding 50 ms per request, canned responses, real Viem clients overhttp(url). ERC-20 deposit to an ETH-based chain with a local account, end to end.maindepositdeposit, node withoutl1Nullifier/l1NativeTokenVaultThe signed transaction is byte-for-byte the same as on
main.Behavior
.catch(() => {})attached when it is created and is awaited in its original order, so a read whose error used to surface first still does. For example,BaseFeeHigherThanValueErroris still thrown before anassetIderror.estimateGasandsendTransactionare unchanged.Tests
createRpcProxyserver answers every request after 20 ms and records each request's depth. It snapshots the depths and the signed transaction. Onmainthe transaction snapshot matches and the depth snapshot fails.zks_getBridgeContractsstill wins over failingzks_getBridgehubContractandeth_getBlockByNumber.deposit.test.tspasses.