Minimal repo to deploy an EIP-712 verifier and fuzz it live against zkSync Era Sepolia via eth_call (positive + negative cases).
Create a .env at the repo root with:
# RPC + deploy key
ZKSYNC_SEPOLIA_RPC_URL=https://...
PRIVATE_KEY=0x...
# Optional: customize domain
EIP712_NAME=EIP712Verifier
EIP712_VERSION=1
# After deploy, set the contract address
VERIFIER_ADDRESS=0x...
# Optional: used for the "wrong signer" negative test
ALT_PRIVATE_KEY=0x...
Deploy src/EIP712Verifier.sol to zkSync Sepolia using Foundry:
forge script script/DeployEIP712Verifier.s.sol:DeployEIP712Verifier \
--rpc-url zksync_sepolia \
--broadcastAfter completion, export VERIFIER_ADDRESS in your .env.
The fuzz/ crate calls the live verifier with manual ABI-encoded eth_call (mirrors cast) for robust tuple handling.
Run:
cd fuzz
cargo run --releaseWhat it does:
- Positive baseline: build valid Permit, sign
calculateDigest,verifymust be true. - Positive fuzz (N runs): random
spender,value,deadline ≥ now+bufferwith same nonce (stateless) must be true. - Negative fuzz (N runs): one-at-a-time mutations (value/nonce/deadline), wrong signer, empty/short signatures must be false.
- Additional negatives: domain mismatches (chainId, verifyingContract, name, version) and invalid signature sizes or v must be false.
Notes:
- The fuzz tool snapshots the latest block timestamp once per batch and sleeps briefly per iteration to reduce RPC 429s.
- Adjust runs/sleep in
fuzz/src/main.rsif needed.