fix(envelope): split abi.encode to avoid viaIR, add deploy+verify scripts#117
Merged
Conversation
…ipts EnvelopeLinks._feeAuthorizationDigest had 15 parameters in a single abi.encode() call, which exceeds solc's stack limit without viaIR. The ZkSync verifier cannot handle viaIR contracts (crashes with 'internal error' on zksolc >=1.5.13, ignores viaIR on <=1.5.1). Fix: split into abi.encodePacked(abi.encode(8), abi.encode(7)) which produces byte-identical output (abi.encode pads to 32 bytes) and compiles without viaIR. Also adds: - ops/verify_hardhat_zksync.py: verification script for Hardhat builds (BFS import graph, filtered standard JSON, API submission) - ops/deploy_envelope_zksync.sh: one-command deploy+verify workflow - hardhat-deploy/DeployEnvelope.ts: auto-select .env-prod on mainnet - .github/copilot-instructions.md: document Hardhat path and split trick Deployed & verified on ZkSync Era mainnet: - EnvelopeLinks: 0xff735c70f33ca4eF1768F527B5f230b76A61A89b - EnvelopePaymaster: 0x5396e4F349D863C0AD577bd9E752293524460C36
LCOV of commit
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes ZkSync source verification for EnvelopeLinks by eliminating the need for
viaIRcompilation, and adds reproducible deploy+verify scripts.Problem
EnvelopeLinks._feeAuthorizationDigesthad 15 parameters in a singleabi.encode()call, exceeding solc's stack limit withoutviaIR. The ZkSync verifier cannot handle viaIR contracts:viaIRflag → stack-too-deep errorviaIRthrough → internal error (verifier crashes)Solution
Split the
abi.encodeinto two parts joined byabi.encodePacked:This produces byte-identical output and preserves EIP-712 signature compatibility while compiling without viaIR.
Changes
src/envelope/EnvelopeLinks.sol_feeAuthorizationDigestabi.encode (8+7 params)ops/verify_hardhat_zksync.pyops/deploy_envelope_zksync.shhardhat-deploy/DeployEnvelope.ts.env-prodon mainnetsrc/envelope/doc/EnvelopeLinks.md.github/copilot-instructions.mdDeployed & Verified (ZkSync Era Mainnet)
0xff735c70f33ca4eF1768F527B5f230b76A61A89b0x5396e4F349D863C0AD577bd9E752293524460C36Paymaster is not funded — will be funded separately after review.
Testing
yarn spellcheck: 0 issues