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
Environment
Invoking a simple transaction via Relayer
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" } }