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 Settings (a.k.a. Input JSON Description) in @nomiclabs/hardhat-vyper #4872

Merged
merged 14 commits into from
Apr 8, 2024

Conversation

ChristopherDedominici
Copy link
Contributor

@ChristopherDedominici ChristopherDedominici commented Feb 15, 2024

See issue here

Added properties evmVersion and optimize.
Follow this issue to track additional settings properties that we might consider adding.

Copy link

changeset-bot bot commented Feb 15, 2024

🦋 Changeset detected

Latest commit: 598acb2

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@nomiclabs/hardhat-vyper Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

vercel bot commented Feb 15, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
hardhat ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 8, 2024 8:27pm

Copy link
Member

@schaable schaable left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

packages/hardhat-vyper/src/compiler.ts Outdated Show resolved Hide resolved
packages/hardhat-vyper/src/index.ts Outdated Show resolved Hide resolved
packages/hardhat-vyper/src/types.ts Outdated Show resolved Hide resolved
@fvictorio
Copy link
Member

I pushed a commit using VyperPluginError instead of plain errors. This is necessary to get proper error output in the CLI.

Before:

image

After:

image

@fvictorio
Copy link
Member

I'm trying several combinations of versions and settings. This is what I got:

  • 0.3.0
    • optimize: true: throws a proper error ✅
    • optimize: false: compiler error ❌
    • optimize: "gas": throws a proper error ✅
  • 0.3.1
    • optimize: true: works ✅
    • optimize: false: works ✅
    • optimize: "gas": throws a proper error ✅
  • 0.3.10
    • optimize: true: throws a proper error ✅
    • optimize: false: works ✅
    • optimize: "gas": works ✅

So mostly good. We should just fix that combination that produces a compiler error.

Copy link
Member

@fvictorio fvictorio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Just some minor comments. I'll let @kanej decide if he wants to review it or if @schaable's previous code review is enough (my guess is that it is).

);
useEnvironment();

it("should compile successfully", async function () {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
it("should compile successfully", async function () {
it("should fail to compile", async function () {

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are other test descriptions below like this one that don't match what the test does.

semver.lt(compilerVersion, "0.3.1")
) {
throw new VyperPluginError(
`The 'optimize' setting with value 'true' is not supported for versions of the Vyper compiler older than 0.3.1 or newer than 0.3.10. You are currently using version ${compilerVersion}.`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This message has an off-by-one error, right? You should either say newer than 0.3.9 or newer than or equal to 0.3.10. (I prefer the former.)

semver.lte(compilerVersion, "0.3.0")
) {
throw new VyperPluginError(
`The 'optimize' setting with value 'true' is not supported for versions of the Vyper compiler older than or equal to 0.3.0 or newer than or equal to 0.3.10. You are currently using version ${compilerVersion}.`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe it's just me, but I find that error message a bit too verbose, how about something like: "The 'optimize' setting with value 'true' is supported only for Vyper versions >0.3.0 and <0.3.10. You are currently using version ${compilerVersion}."
Feel free to ignore it if you think the current message is better 😁

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(same for the rest of the error messages)

Copy link
Member

@schaable schaable left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Included a few minor suggestions, but none are merge blockers.

@@ -7,10 +10,18 @@ export class Compiler {
*
* @param inputPaths array of paths to contracts to be compiled
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should add the new parameters.

Copy link
Member

@kanej kanej left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had one small comment on some missing param docs, but pre-approving. Looks good!

@ChristopherDedominici ChristopherDedominici merged commit f0e6389 into main Apr 8, 2024
32 checks passed
@ChristopherDedominici ChristopherDedominici deleted the feature/4566-support-settings-in-vyper branch April 8, 2024 21:15
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 9, 2024
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
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Support Settings (a.k.a. Input JSON Description) in @nomiclabs/hardhat-vyper
5 participants