foundry-rs / foundry-rs/foundry
Add support for EIP-712 transaction type (zkSync requirement)
- Dominant language
- Rust
- Stars
- 10.6k
- Forks
- 2.6k
- Avg merge
- 18h 20m
- Merged PRs (30d)
- 510
Description
### Component
Forge
### Describe the feature you would like
## Overview
zkSync deployments use an EIP-712 style transaction for contract deployments rather than the standard EIP-1559. As far as I know this is only used by zkSync but it would be very helpful to have for deployments. Without support for this transaction type, deployment to zkSync with foundry is not possible other than deploying from L1 through the bridge.
## Details
The EIP-712 transaction type defined by zkSync follows the format below:
```js
const EIP712_TYPE = "0x71";
const data = EIP712_TYPE + RLP.encode([
nonce,
maxPriorityFeePerGas,
maxFeePerGas,
gasLimit,
to,
value,
data,
chainId,
0x,
0x,
chainId,
from,
gasPerPubData,
factoryDeps[],
customSignature, // EIP712 signature
[paymaster, paymasterInput]
]);
sendTransaction(data);
```
where `customSignature` is a signature of the following struct:
Field name | Type
-- | --
txType | uint256
from | uint256
to | uint256
gasLimit | uint256
gasPerPubdataByteLimit | uint256
maxFeePerGas | uint256
maxPriorityFeePerGas | uint256
paymaster | uint256
nonce | uint256
value | uint256
data | bytes
factoryDeps | bytes32[]
paymasterInput | bytes
### Additional context
Implementation wise it would not make sense to add support for this specific transaction type, but it may be feasible to add a cheatcode for generic `sendTransaction` or any other RPC calls.
Leaving the proper implementation open to discussion.
Contributor guide
Assessment
This issue has not been assessed yet.