Skip to content

Add support for EIP-712 transaction type (zkSync requirement) #4648

Open
@omurovec

Description

@omurovec

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:

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions