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

Better API for Plugin is needed #1374

Closed
wighawag opened this issue Apr 6, 2021 · 3 comments
Closed

Better API for Plugin is needed #1374

wighawag opened this issue Apr 6, 2021 · 3 comments

Comments

@wighawag
Copy link
Contributor

wighawag commented Apr 6, 2021

Issues across plugins keep popping up and part of it is due to no clear semantic of the HRE's field

example of issues :

Here the issue is that some field are supposed to be static while some are dynamic. it would be great to clearly differentiate between the 2 or even better make sure hardhat always support the dynamic case (which make more interesting plugin possible)

This issue arise from the fact that solidity-coverage assume no plugin is accessing the hre.network field before end.
To go around the issue hardhat-deploy which was proviously accessing it at import time, is now wrapping it in a lazyObject.

It would be great if hardhat expose a strict plugin api that resolve this by ensuring plugin can access and transform each field in turn.

We could for example have a hook so plugin can transform the network field. The current hook (extendEnvironment) is probably not that well suited as for example, in the case of coverage it must be triggered on task invocation

I curently do not have a clear way forward in mind, but would be great to get a discussion going among plugin developer to help make hardhat even better

@cgewecke
Copy link
Contributor

cgewecke commented Apr 6, 2021

Agree this would be really useful. Even just a list of best practices we should all follow would be great to have.

Another place plugins have come into conflict is around wrapping the provider, (example here) ... would love a guide for the best way of doing this.

@alcuadrado
Copy link
Member

Thanks for opening this issue, @wighawag! And also for your feedback, @cgewecke! We won't be able to address this super soon, as we are at full capacity keeping up with the upcoming hardforks and solidity changes, but eventually we will.

As Chris mentioned, I think the first step would be to provide some kind of guidelines about what is expected from plugins and what is not. These guidelines will probably discourage things that some plugins are already doing, but that's fine, as this will help us understand the limitations of the plugin system and guide the design of new APIs.

@fvictorio
Copy link
Member

I'm going to close this issue in favor of #3491 (about having a better guide for this) and #3492 (for discussing the future of the plugin system in the next major version). Thanks a lot @wighawag and @cgewecke!

@fvictorio fvictorio closed this as not planned Won't fix, can't repro, duplicate, stale Dec 29, 2022
@github-project-automation github-project-automation bot moved this to Done in Hardhat Dec 29, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 30, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
Archived in project
Development

No branches or pull requests

4 participants