-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Calls returning data with a length multiple of 32 do not throw on failure #3438
Comments
This issue is also being tracked on Linear. We use Linear to manage our development process, but we keep the conversations on Github. LINEAR-ID: eb766a2a-19a2-49f4-b9fc-f2ea93df841d |
Thank you, I'll look into this as soon as I can |
@mikhailxyz can I close this in favor of #3446? I mean, does this only happen for |
@fvictorio in our case it's not empty, it's a method that reverts with the return data and the particular failing test has non-empty data |
If I add this log statement for return data in
I get this:
Which doesn't seem empty? |
Thank you @mikhailxyz. I looked into this and I believe it's a bug in ethers. I opened an issue about it. A (super ugly) temporary workaround would be something like this: it.only("should return estimate in revert", async () => {
const { safe, killLib } = await setupTests()
const tx = await safe.populateTransaction.simulateAndRevert(
killLib.address,
killLib.interface.encodeFunctionData("estimate", [safe.address, "0x"]),
)
let hasThrown = false
try {
await network.provider.send("eth_call", [
{
from: tx.from,
to: tx.to,
data: tx.data,
gas: tx.gasLimit.toHexString().replace("0x0", "0x"),
},
"latest",
])
} catch {
hasThrown = true
}
expect(hasThrown, "Expected call to revert").to.be.true
}) Hopefully this gets fixed in ethers soon and you don't have to do that. |
@fvictorio Interesting. I tried something similar, but I used
|
Thank you for checking this! 🙏 |
It's because |
I'm trying to update https://github.com/safe-global/safe-contracts to the latest hardhat version, but I can not get tests for read-only method reverts pass.
Here is an example of the tested method:
Any call to this method should revert and reverts with hardhat 2.2.1 but not 2.12.4. In 2.12.4 it returns an empty array.
I did some casual debugging and it seems like the node returns an error but it disappears on the way to the provider. I added some console logs to
packages/hardhat-core/src/internal/hardhat-network/provider/modules/eth.ts
:and here's the output:
To reproduce:
yarn && yarn test
The text was updated successfully, but these errors were encountered: