Actual revert error message being swallowed by relayer

Hi,
When a transaction is being reverted due some failure, the revert message is not being sent. Instead there is this standard error which is being sent in all cases. It will be extremely useful to see the error message.

2021-09-22T09:52:35.510Z        0a63919d-7840-4d11-b3d6-d91b66a28991    INFO    Error: cannot estimate gas; transaction may fail or may require manual gas limit (error={"code":3,"data":"0x08c379a00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000e496e76616c69642063616c6c6572000000000000000000000000000000000000"}, method="call", transaction={"from":"0xcF2487870ed6f53d59984E70FD6ae76c50BA4c7F","to":"0x39dc7228A29Bf242F2a05f920a82b548733078ff","data":"0xdd    at processTicksAndRejections (internal/process/task_queues.js:95:5)on-rpc-provider.js:21:65):53)pc-provider.js:633:47)version=providers/5.4.5)
2021-09-22T09:52:35.511Z        0a63919d-7840-4d11-b3d6-d91b66a28991    ERROR   Invoke Error    {"errorType":"Error","errorMessage":"Error: cannot estimate gas; transaction may fail or may require manual gas limit (error={\"code\":3,\"data\":\"0x08c379a00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000e496e76616c69642063616c6c6572000000000000000000000000000000000000\"}, method=\"call\", transaction={\"from\":\"0xcF2487870ed6f53d59984E70FD6ae76c50BA4c7F\",\"to\":\"0x39dc7228A29Bf242F2a05f920a82b548733078ff\",\"data\":\"0xddc632620000000000000000000000000000000000000000000000000000000000000000\",\"accessList\":null}, code=UNPREDICTABLE_GAS_LIMIT, version=providers/5.4.5)\n    at Logger.makeError (/var/task/node_modules/@ethersproject/logger/lib/index.js:199:21)\n    at Logger.throwError (/var/task/node_modules/@ethersproject/logger/lib/index.js:208:20)\n    at checkError (/var/task/node_modules/@ethersproject/providers/lib/json-rpc-provider.js:118:16)\n    at DefenderRelayProvider.<anonymous> (/var/task/node_modules/@ethersproject/providers/lib/json-rpc-provider.js:633:47)\n    at step (/var/task/node_modules/@ethersproject/providers/lib/json-rpc-provider.js:48:23)\n    at Object.throw (/var/task/node_modules/@ethersproject/providers/lib/json-rpc-provider.js:29:53)\n    at rejected (/var/task/node_modules/@ethersproject/providers/lib/json-rpc-provider.js:21:65)\n    at processTicksAndRejections (internal/process/task_queues.js:95:5)","stack":["Error: Error: cannot estimate gas; transaction may fail or may require manual gas limit (error={\"code\":3,\"data\":\"0x08c379a00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000e496e76616c69642063616c6c6572000000000000000000000000000000000000\"}, method=\"call\", transaction={\"from\":\"0xcF2487870ed6f53d59984E70FD6ae76c50BA4c7F\",\"to\":\"0x39dc7228A29Bf242F2a05f920a82b548733078ff\",\"data\":\"0xddc632620000000000000000000000000000000000000000000000000000000000000000\",\"accessList\":null}, code=UNPREDICTABLE_GAS_LIMIT, version=providers/5.4.5)","    at Logger.makeError (/var/task/node_modules/@ethersproject/logger/lib/index.js:199:21)","    at Logger.throwError (/var/task/node_modules/@ethersproject/logger/lib/index.js:208:20)","    at checkError (/var/task/node_modules/@ethersproject/providers/lib/json-rpc-provider.js:118:16)","    at DefenderRelayProvider.<anonymous> (/var/task/node_modules/@ethersproject/providers/lib/json-rpc-provider.js:633:47)","    at step (/var/task/node_modules/@ethersproject/providers/lib/json-rpc-provider.js:48:23)","    at Object.throw (/var/task/node_modules/@ethersproject/providers/lib/json-rpc-provider.js:29:53)","    at rejected (/var/task/node_modules/@ethersproject/providers/lib/json-rpc-provider.js:21:65)","    at processTicksAndRejections (internal/process/task_queues.js:95:5)","    at processEvent (/var/task/index.js:73:11)","    at processTicksAndRejections (internal/process/task_queues.js:95:5)","    at async Runtime.exports.handler (/var/task/index.js:51:20)"]}
{"errorType":"Error","errorMessage":"Error: cannot estimate gas; transaction may fail or may require manual gas limit (error={\"code\":3,\"data\":\"0x08c379a00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000e496e76616c69642063616c6c6572000000000000000000000000000000000000\"}, method=\"call\", transaction={\"from\":\"0xcF2487870ed6f53d59984E70FD6ae76c50BA4c7F\",\"to\":\"0x39dc7228A29Bf242F2a05f920a82b548733078ff\",\"data\":\"0xddc632620000000000000000000000000000000000000000000000000000000000000000\",\"accessList\":null}, code=UNPREDICTABLE_GAS_LIMIT, version=providers/5.4.5)\n    at Logger.makeError (/var/task/node_modules/@ethersproject/logger/lib/index.js:199:21)\n    at Logger.throwError (/var/task/node_modules/@ethersproject/logger/lib/index.js:208:20)\n    at checkError (/var/task/node_modules/@ethersproject/providers/lib/json-rpc-provider.js:118:16)\n    at DefenderRelayProvider.<anonymous> (/var/task/node_modules/@ethersproject/providers/lib/json-rpc-provider.js:633:47)\n    at step (/var/task/node_modules/@ethersproject/providers/lib/json-rpc-provider.js:48:23)\n    at Object.throw (/var/task/node_modules/@ethersproject/providers/lib/json-rpc-provider.js:29:53)\n    at rejected (/var/task/node_modules/@ethersproject/providers/lib/json-rpc-provider.js:21:65)\n    at processTicksAndRejections (internal/process/task_queues.js:95:5)","trace":["Error: Error: cannot estimate gas; transaction may fail or may require manual gas limit (error={\"code\":3,\"data\":\"0x08c379a00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000e496e76616c69642063616c6c6572000000000000000000000000000000000000\"}, method=\"call\", transaction={\"from\":\"0xcF2487870ed6f53d59984E70FD6ae76c50BA4c7F\",\"to\":\"0x39dc7228A29Bf242F2a05f920a82b548733078ff\",\"data\":\"0xddc632620000000000000000000000000000000000000000000000000000000000000000\",\"accessList\":null}, code=UNPREDICTABLE_GAS_LIMIT, version=providers/5.4.5)","    at Logger.makeError (/var/task/node_modules/@ethersproject/logger/lib/index.js:199:21)","    at Logger.throwError (/var/task/node_modules/@ethersproject/logger/lib/index.js:208:20)","    at checkError (/var/task/node_modules/@ethersproject/providers/lib/json-rpc-provider.js:118:16)","    at DefenderRelayProvider.<anonymous> (/var/task/node_modules/@ethersproject/providers/lib/json-rpc-provider.js:633:47)","    at step (/var/task/node_modules/@ethersproject/providers/lib/json-rpc-provider.js:48:23)","    at Object.throw (/var/task/node_modules/@ethersproject/providers/lib/json-rpc-provider.js:29:53)","    at rejected (/var/task/node_modules/@ethersproject/providers/lib/json-rpc-provider.js:21:65)","    at processTicksAndRejections (internal/process/task_queues.js:95:5)","    at processEvent (/var/task/index.js:73:11)","    at processTicksAndRejections (internal/process/task_queues.js:95:5)","    at async Runtime.exports.handler (/var/task/index.js:51:20)"]}END RequestId: 0a63919d-7840-4d11-b3d6-d91b66a28991
REPORT RequestId: 0a63919d-7840-4d11-b3d6-d91b66a28991  Init Duration: 0.08 ms  Duration: 10351.81 ms   Billed Duration: 10400 ms       Memory Size: 128 MB     Max Memory Used: 128 MB

:computer: Environment
Invoking a simple transaction via Relayer

:1234: Code to reproduce
Invoke harvest with incorrect strategist in the following smart contract.

// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.0;

contract Simulator {
    event Harvest(uint256 lpTokens);
     address private strategist;
    mapping(address => bool) private Owners;
    // Access restriction to registered rollover
    modifier onlyStrategist() {
        require(
        msg.sender == strategist,
        "Invalid caller"
        );
        _;
    }
    modifier onlyOwner() {
        require(
        Owners[msg.sender] == true,
        "Invalid caller"
        );
        _;
    }    
    constructor()
    {
        Owners[msg.sender] = true;
    }
    function harvest(uint256 _minLp) onlyStrategist public returns (uint256)
    {
        uint256 lpAmount = _minLp + 1;
        require(lpAmount >= _minLp, "Exceeds maximum slippage");
        emit Harvest(lpAmount);
        return lpAmount;
    }
    function setStrategist(address _strategist) external onlyOwner{
        strategist = _strategist;
    }
    function setOwner(address _owner) external onlyOwner{
        Owners[_owner] = true;
    }
}

Normally it shows the error message 'Invalid caller' as below. However, when called via relayer this error message is lost.

Gas estimation errored with the following message (see below). The transaction execution will likely fail. Do you want to force sending?
execution reverted: Invalid caller { "originalError": { "code": 3, "data": "0x08c379a00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000e496e76616c69642063616c6c6572000000000000000000000000000000000000", "message": "execution reverted: Invalid caller" } }

Hey @Bhanu_Ratnakaram! Thanks for reporting this. Can you share whether you're using the vanilla Relay class from defender-relay-client, or the ethers or web3js integration? Also, if you're using ethers, are you using the DefenderRelaySigner, or also the DefenderRelayProvider? If you are willing to share your Autotask code (at least the setup), that would help!

sure, here you go

  gasLimit = GAS_LIMIT / 1;
  relayer = { apiKey: API_KEY, apiSecret: apiSecretDecrypted };
  provider = new DefenderRelayProvider(relayer);
  signer = new DefenderRelaySigner(relayer, provider, { speed: TXN_SPEED });
  ethAdapter = new EthersAdapter({
    ethers,
    signer
  });  
  strategyContract = new ethers.Contract(
    STRATEGY_ADDRESS,
    StrategyABI,
    provider
  );
  await strategyContract.connect(signer).harvest(0, {gasLimit});

Thanks @Bhanu_Ratnakaram! We'll take a look and get back to you. Could you clarify what is the EthersAdapter class in your snippet?

Also, what network is this in?

Also, could you clarify how you are sending the tx in this case? And does the tx get sent in either case?

Hi @spalladino , thanks for your response.
I faced this issue with rinkeby and mainnet networks. EthersAdapter is the class provided by gnosis. We are using gnosis multisig wallet for strategist.

i am sending this on remix. It give the error even before siging the transaction with metamask

1 Like