I have been developing with Hardhat without problem. When I deploy my smart contracts to a test network (Ropsten or Rinkeby), none of my view
methods work. For example:
function testView() public virtual view returns(bool) {
return true;
}
This function will always revert on all test networks, even though my transaction functions work just fine. The revert exception is:
An unexpected error occurred:
Error: call revert exception (method="testView()", errorArgs=null, errorName=null, errorSignature=null, reason=null, code=CALL_EXCEPTION, version=abi/5.4.1)
at Logger.makeError (/Users/zaneclaes/zdrive/zaneclaes/Programming/Furballs/node_modules/@ethersproject/logger/src.ts/index.ts:225:28)
at Logger.throwError (/Users/zaneclaes/zdrive/zaneclaes/Programming/Furballs/node_modules/@ethersproject/logger/src.ts/index.ts:237:20)
at Interface.decodeFunctionResult (/Users/zaneclaes/zdrive/zaneclaes/Programming/Furballs/node_modules/@ethersproject/abi/src.ts/interface.ts:425:23)
at Contract.<anonymous> (/Users/zaneclaes/zdrive/zaneclaes/Programming/Furballs/node_modules/@ethersproject/contracts/src.ts/index.ts:332:44)
at step (/Users/zaneclaes/zdrive/zaneclaes/Programming/Furballs/node_modules/@ethersproject/contracts/lib/index.js:48:23)
at Object.next (/Users/zaneclaes/zdrive/zaneclaes/Programming/Furballs/node_modules/@ethersproject/contracts/lib/index.js:29:53)
at fulfilled (/Users/zaneclaes/zdrive/zaneclaes/Programming/Furballs/node_modules/@ethersproject/contracts/lib/index.js:20:58)
at processTicksAndRejections (node:internal/process/task_queues:96:5) {
reason: null,
code: 'CALL_EXCEPTION',
method: 'testView()',
errorArgs: null,
errorName: null,
errorSignature: null,
address: '0x27AbaB051007f7325ac2246187DD92b513B26d39',
args: [ ],
transaction: {
data: '0x24d7806c000000000000000000000000809e2b319e4d398f9282167271ed2f69d63ef6be',
to: '0x27AbaB051007f7325ac2246187DD92b513B26d39',
gasLimit: BigNumber { _hex: '0x05f5e100', _isBigNumber: true },
from: 'xxxxxx'
}
}
AFAICT, this may be related to a similar error, where transactions require a gasLimit. If I try to run certain transactions upon deploying, the first time (only) I receive:
Error: cannot estimate gas; transaction may fail or may require manual gas limit
Adding a { gasLimit }
does indeed fix that problem.