Skip to content
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

Support for IR #3365

Closed
4 tasks
fvictorio opened this issue Nov 21, 2022 · 16 comments
Closed
4 tasks

Support for IR #3365

fvictorio opened this issue Nov 21, 2022 · 16 comments
Labels
status:ready This issue is ready to be worked on type:epic A bigger effort that involves multiple issues and PRs

Comments

@fvictorio
Copy link
Member

fvictorio commented Nov 21, 2022

This is the tracking issue for having full support for solc's IR-based code generation.

We have already released a beta version with some basic support under the ir npm tag. This version can be installed with npm install hardhat@ir.

There are some pending things before we can release this in a stable version of Hardhat:

@fvictorio fvictorio added the type:epic A bigger effort that involves multiple issues and PRs label Nov 21, 2022
@github-actions
Copy link
Contributor

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: 2c88424e-5990-4136-afac-2adf63271e8b

@scotthconner
Copy link

The issue I'm having is my tests are now failing with viaIR: true, specifically the ones that check the revertedWith message. Which is a lot of them.

For now, I'm having to turn viaIR off. Help me help us get to the bottom of it!

@scotthconner
Copy link

scotthconner commented Nov 21, 2022

Also, turns out that hardhat@ir doesn't work with my version of solidity-coverage:

pm ERR! While resolving: @nomicfoundation/hardhat-toolbox@1.0.2
npm ERR! Found: solidity-coverage@0.8.2
npm ERR! node_modules/solidity-coverage
npm ERR!   dev solidity-coverage@"^0.8.2" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer solidity-coverage@"^0.7.21" from @nomicfoundation/hardhat-toolbox@1.0.2
npm ERR! node_modules/@nomicfoundation/hardhat-toolbox
npm ERR!   @nomicfoundation/hardhat-toolbox@"^1.0.2" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: solidity-coverage@0.7.22
npm ERR! node_modules/solidity-coverage
npm ERR!   peer solidity-coverage@"^0.7.21" from @nomicfoundation/hardhat-toolbox@1.0.2
npm ERR!   node_modules/@nomicfoundation/hardhat-toolbox
npm ERR!     @nomicfoundation/hardhat-toolbox@"^1.0.2" from the root project

@fvictorio
Copy link
Member Author

The issue I'm having is my tests are now failing with viaIR: true, specifically the ones that check the revertedWith message.

That's the first item in the checklist.

Also, turns out that hardhat@ir doesn't work with my version of solidity-coverage:

That's a llimitation of npm when a peer dependency and a pre-release version are mixed. You might need to use npm install --force when installing the hardhat@ir beta version.

@scotthconner
Copy link

Yup, thanks. I did --force and that worked.

It also works when running npm hardhat test. But when running coverage I get stack too deep.

plaintextpaco added a commit to alchemistcoin/aludel-factory that referenced this issue Dec 7, 2022
this has the advantage of making stack-too-deep errors much more
unlikely, but involves using a pre-release version of hardhat. YOLO.

in the future, we might encounter several unresolved issues with hardhat
that are be caused by this. Main issue tracking progress:
NomicFoundation/hardhat#3365
@github-actions github-actions bot added the Stale label Dec 21, 2022
@fvictorio fvictorio added status:ready This issue is ready to be worked on and removed Stale labels Dec 22, 2022
@fvictorio fvictorio removed their assignment Dec 27, 2022
@jmendiola222
Copy link

Is there a timeline for this to be included in the main release? Now that it's mark as ready I mean

@fvictorio
Copy link
Member Author

@jmendiola222 we want to release this ASAP. Hopefully this or next week; definitely January.

@fruiz08
Copy link

fruiz08 commented Jan 11, 2023

do you have any workaround to solve this issue? ethereum/solidity#13858

itirabasso pushed a commit to alchemistcoin/aludel-factory that referenced this issue Jan 11, 2023
this has the advantage of making stack-too-deep errors much more
unlikely, but involves using a pre-release version of hardhat. YOLO.

in the future, we might encounter several unresolved issues with hardhat
that are be caused by this. Main issue tracking progress:
NomicFoundation/hardhat#3365
@fvictorio
Copy link
Member Author

@fruiz08 that seems a solc thing, unrelated to Hardhat.

@hantuzun
Copy link

With IR, I get the following exception:

AssertionError: Expected transaction to be reverted with ABC, but other
exception was thrown: ProviderError: Error: Transaction reverted: function
was called with incorrect parameters

from a function as simple as:

function f() public {
  revert("ABC");
}

When IR is not used, or other parts of the contracts are tinkered, or YUL steps are tinkered, the issue resolves. This issue is very similar to #2453 so I suspect it's a Hardhat issue.

I tried many combinations of recent Solidity versions with Hardhat 2.12.6 and 2.12.1-ir.0. My compiler settings are:

viaIR: true,
optimizer: {
  enabled: true,
  runs: 200
}

Currently working around the issue with a custom order of YUL optimization steps.

Let me know if you think if this's a Solidity issue.

@hantuzun
Copy link

This's the stack trace from Hardhat 2.12.6:

eth_estimateGas
  Error: Transaction reverted: function was called with incorrect parameters
      at Contract.f
      at processTicksAndRejections (node:internal/process/task_queues:96:5)
      at async EthModule._estimateGasAction (node_modules/hardhat/src/internal/hardhat-network/provider/modules/eth.ts:429:7)
      at async HardhatNetworkProvider._sendWithLogging (node_modules/hardhat/src/internal/hardhat-network/provider/provider.ts:139:22)
      at async HardhatNetworkProvider.request (node_modules/hardhat/src/internal/hardhat-network/provider/provider.ts:116:18)
      at async JsonRpcHandler._handleRequest (node_modules/hardhat/src/internal/hardhat-network/jsonrpc/handler.ts:188:20)
      at async JsonRpcHandler._handleSingleRequest (node_modules/hardhat/src/internal/hardhat-network/jsonrpc/handler.ts:167:17)
      at async Server.JsonRpcHandler.handleHttp (node_modules/hardhat/src/internal/hardhat-network/jsonrpc/handler.ts:52:21)

@jmendiola222
Copy link

@jmendiola222 we want to release this ASAP. Hopefully this or next week; definitely January.

It didn't make it to the last release. :( Any update on the plan? @fvictorio

@fvictorio
Copy link
Member Author

I'm planning on merging that PR today, so it will definitely be included in the next release (this time for real 😅).

@codetit4n
Copy link

is this fixed?

@fvictorio
Copy link
Member Author

Released in Hardhat v2.13.0 🚀

@thedavidmeister
Copy link

this warning when running tests

Your solidity settings have viaIR enabled, which is not fully supported yet. You can still use Hardhat, but some features, like stack traces, might not work correctly.

and losing information about error strings

AssertionError: error string Error: Transaction reverted and Hardhat couldn't infer the reason.

with 2.13.0

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
status:ready This issue is ready to be worked on type:epic A bigger effort that involves multiple issues and PRs
Projects
Archived in project
Development

No branches or pull requests

7 participants