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

ECDSA: Workaround hardhat-gas-reporter bug #2970

Merged
merged 5 commits into from
May 10, 2022
Merged

Conversation

nkuba
Copy link
Member

@nkuba nkuba commented May 3, 2022

Depends on #2969 (draft until it's merged)
Refs #2955

There is a bug in hardhat-gas-reporter that we need to work around in
order to obtain a gas report for tests: cgewecke/hardhat-gas-reporter#86

Long story short: we cannot use hre.ethers in the deployment scripts.

Here we introduce an alternative deployment path just to get the report generated correctly. The alternative path usage is determined by the GAS_REPORTER_BUG_WORKAROUND env property set to true.

To run the tests with the alternative path to get the gas report execute yarn test:gas-reporter-workaround command. It will execute the same tests (upgrade tests were skipped as they are strictly related to the original deployment path).

yarn test is still a preferred way to run the tests, as it does the deployment exactly the way we want it to test for mainnet. Use the alternative path only if you wish to get the gas report.

Once a bug in the hardhat-gas-reporter is fixed, we should revert all the changes related to the workaround.

nkuba added 2 commits May 3, 2022 14:14
This version contains improvements from threshold-network/solidity-contracts#100
which help workaround problems with gas reporter.
There is a bug in hardhat-gas-reporter that we need to workaround in
order to obtain gas report for tests: cgewecke/hardhat-gas-reporter#86
Long story short: we cannot use `hre.ethers` in the deployment script.

Here we introduce an alternative deployment path just to get the report
generated correctly. The alternative path usage is determined by
`GAS_REPORTER_BUG_WORKAROUND` env property set to `true`.

To run the tests with the alternative path to get the gas report execute
`yarn test:gas-reporter-workaround`. It will execute the same test (upgrade
tests were skipped as they are strictly related to the original
deployment path).

`yarn test` is still a preferred way to run the tests, as it does the
deployment exactly the way we want it to test for mainnet. Use the
alternative path only if you wish to get the gas report.

Once a bug in the `hardhat-gas-reporter` is fixed, we should revert all
the changes from this commit.
@nkuba nkuba requested review from dimpar and pdyraga and removed request for dimpar May 3, 2022 12:26
@nkuba nkuba marked this pull request as draft May 3, 2022 12:27
@nkuba nkuba changed the title Ecdsa fix gas reporter Workaround gas reporter bug in ECDSA May 3, 2022
@nkuba nkuba requested a review from dimpar May 3, 2022 12:28
@nkuba nkuba changed the title Workaround gas reporter bug in ECDSA ECDSA: Workaround hardhat-gas-reporter bug May 3, 2022
solidity/ecdsa/deploy/02_deploy_reimbursement_pool.ts Outdated Show resolved Hide resolved
solidity/ecdsa/package.json Outdated Show resolved Hide resolved
@nkuba nkuba requested a review from dimpar May 10, 2022 13:38
Base automatically changed from deploy-updates to main May 10, 2022 14:23
@pdyraga pdyraga marked this pull request as ready for review May 10, 2022 14:24
Copy link
Member

@pdyraga pdyraga left a comment

Choose a reason for hiding this comment

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

Left one non-blocking comment. Let's address it in a separate PR @nkuba

We introduced an alternative deployment path as a workaround.
To execute tests with the alternative deployment path run `yarn test:gas-reporter-workaround`.
Please keep in mind that `yarn test` is preferred way for testing. Use alternative
path only if you want to get the gas report.
Copy link
Member

Choose a reason for hiding this comment

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

Can we clarify what are the differences between the alternative path and the default path?

My understanding is that the default one uses OpenZeppelin plugin for upgrades to deploy proxies and the alternative path is still deploying proxies but not using the OpenZeppelin plugin.

@pdyraga pdyraga merged commit 801cb68 into main May 10, 2022
@pdyraga pdyraga deleted the ecdsa-fix-gas-reporter branch May 10, 2022 15:17
nkuba added a commit that referenced this pull request May 11, 2022
In #2970 we introduced a
workaround for a bug in hardhat-gas-reporter plugin
cgewecke/hardhat-gas-reporter#86.

It turned out that there is a much simpler workaround, which is based on
just removing `--deploy-fixture` flag. With the flag removed it is
required that we load a global snapshot of the deployment
(`deployments.fixture()`) instead of loading a specific tag
(`deployments.fixture(<tag>)`. Which we do anyway after one of a
recent code updates.

We removed all the traces of the previous workaround.
pdyraga added a commit that referenced this pull request May 11, 2022
…orkaround

Workaround hardhat-gas-reporter bug with removing --deploy-fixture

In this PR we replace a previous workaround (#2970) for a bug in the
hardhat-gas-reporter plugin (cgewecke/hardhat-gas-reporter#86).

It turned out that there is a much simpler workaround, which is based on
just removing --deploy-fixture flag. With the flag removed it is required that
we load a global snapshot of the deployment (deployments.fixture()) instead
of loading a specific tag (deployments.fixture(<tag>). Which we do anyway
after one of a recent code updates.
@pdyraga pdyraga added this to the solidity/v2.0.0 milestone Jun 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants