zksync-sdk / zksync-ethers

zksync-ethers is an ethers.js library adapted to work with the ZKsync Era.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Paymaster validation error

infra403 opened this issue Β· comments

πŸ› Bug Report for zksync2-js JavaScript SDK

πŸ“ Description

Encountering errors when paying gas with Paymaster

πŸ”„ Reproduction Steps

const paymasterAddress = "0xf2a173643ca958213714712ce195f6f6e9c686e7"
      paymasterParams = utils.getPaymasterParams(paymasterAddress, {
        type: "ApprovalBased",
        token: gasPayTokenAddress,
        minimalAllowance: ethers.constants.MaxUint256,
        innerInput: "0x0000000000000000000000000000000000000000000000000000000000000001",
      });
      let populatedTx = {
        from: wallet.address,
        data: swapDataHex,
        to: newRouteAddr,
        // gasPrice: gasPrice,
        gasLimit: 1000000,
        // type: EIP712_TX_TYPE;
        value:  ethers.BigNumber.from(0),
        customData: customData
      }
      const response =  await wallet.sendTransaction(populatedTx);
      result = await response.wait();

πŸ€” Expected Behavior

Paying gas with Paymaster

😯 Current Behavior

processing response error (body="{"jsonrpc":"2.0","error":{"code":3,"message":"failed to validate the transaction. reason: Validation revert: Paymaster validation error: Error function_selector = 0x, data = 0x","data":"0x"},"id":94}", error={"code":3,"data":"0x"}, requestBody="{"method":"eth_sendRawTransaction","params":[""],"id":94,"jsonrpc":"2.0"}", requestMethod="POST", url="", code=SERVER_ERROR, version=web/5.7.1),

πŸ–₯️ Environment

  • Node version: [v20.0]
  • Operating System & Version: [docker]
  • Other relevant environment details: zksync-ethers@5.3.0

πŸ“‹ Additional Context

πŸ“Ž Log Output

processing response error (body="{\"jsonrpc\":\"2.0\",\"error\":{\"code\":3,\"message\":\"failed to validate the transaction. reason: Validation revert: Paymaster validation error: Error function_selector = 0x, data = 0x\",\"data\":\"0x\"},\"id\":94}", error={"code":3,"data":"0x"}, requestBody="{\"method\":\"eth_sendRawTransaction\",\"params\":[\"\"],\"id\":94,\"jsonrpc\":\"2.0\"}", requestMethod="POST", url="", code=SERVER_ERROR, version=web/5.7.1),

This issue is not related to the SDK itself. There is a discussion about this error available here. Also zksync2-js has been deprecated, please switch to zksync-ethers.