The error with which a contract call reverts can be tested positively as follows:
import { expect } from "chai";
await expect(
contract.foo(-1)
).to.be.revertedWith("OUT_OF_RANGE");
If the contract reverts with another error an AssertionError like the following is normally in hardhat:
AssertionError: Expected transaction to be reverted with OUT_OF_RANGE, but other exception was thrown: Error: VM Exception while processing transaction: reverted with custom error 'OutOfRange()'
The response from a contract call that reverted using @hashgraph/hardhat-hethers does not have parity with the default hardhat functionality and instead throws the follows AssertionError:
AssertionError: Expected transaction to be reverted with OUT_OF_RANGE, but other exception was thrown: Error: receipt for transaction 0.0.1002@1661713061.964268246 contained error status CONTRACT_REVERT_EXECUTED (code=CONTRACT_REVERT_EXECUTED, version=providers/1.2.0)
Solution
Have hedera-hardhat-ethers decode and handle CONTRACT_REVERT_EXECUTED calls identically to hardhat-ethers
Problem
The error with which a contract call reverts can be tested positively as follows:
If the contract reverts with another error an
AssertionError
like the following is normally in hardhat:The response from a contract call that reverted using
@hashgraph/hardhat-hethers
does not have parity with the default hardhat functionality and instead throws the follows AssertionError:Solution
hedera-hardhat-ethers
decode and handleCONTRACT_REVERT_EXECUTED
calls identically tohardhat-ethers
Alternatives
No response