Closed Bobface closed 3 years ago
One to one support for @eth-optimism/plugins/hardhat/ethers
with @nomiclabs/hardhat-ethers
is not prioritized for the near future. The best way to develop would be with https://github.com/ethereum-optimism/optimism-integration. This prevents the possibility of a difference in the JS OVM and the actual in production OVM. If you would like to continue using the plugin, we would be happy to accept any pull requests for bugfixes
@tynes Thanks for your response, I'd like to continue using the plugin and have done some digging into what is going on. I think that I have identified the problem:
When a transaction reverts, Hardhat's fork of ethereumjs-vm
throws a VMError
exception. See here:
When receiving an exception during tx execution, Hardhat checks which type of exception was thrown. This is the where the bug can be located:
This if
-statement should not be entered, as the exception is a VmError
.
However, eth-optimism
provides its own fork of ethereumjs-vm
. This causes the instanceof
check to fail, and the if
-statement is entered. The exception is re-thrown though it should not, causing a crash in another part of the code, where another type of exception containing a message
field is expected, which VMError
does not have:
In summary, every test which includes a reverting transaction will cause Hardhat to crash. I hope that that's enough information to implement a fix for this problem. If you'd still like me to submit a PR, I would greatly appreciate some assistance on how to best fix this bug.
@Bobface fantastic analysis, I think you have it dead on. Submitting a PR to hardhat to loosen this check a bit might be our best option. I can't think of an easier way to do this other than introducing more hardhat-specific hacks. I'd prefer not to do that though :-(
Opened up an issue: https://github.com/nomiclabs/hardhat/issues/1317
The wonderful people at hardhat made a fix for this. Hopefully it'll be released soon and we can get this closed out.
@smartcontracts I saw that nomiclabs/hardhat#1317 was closed.
Is there anything that still needs to be done to close this issue?
Closing!
Summary
When running OVM tests using the
l2ethers
injected into Hardhat via the@eth-optimism/plugins/hardhat/ethers
plugin, an exception is caused byHardhatNode.mineBlock causes an exception during tests
:The error happens when deploying a contract:
https://github.com/Ideamarket/ideamarket-contracts/blob/0f0f253a9afc75469e916e90799a0a656eb14a6f/test/contracts/ovm/core/IdeaToken.test.js#L23-L24
Package versions
Reproduce