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

Don't include stub contracts in NPM packages #3569

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

michalinacienciala
Copy link
Contributor

@michalinacienciala michalinacienciala commented May 16, 2023

If hardhat deploy is run with TEST_USE_STUBS_ECDSA environment variable set to true, the deployment will include deployment of stub contracts, which are needed for testing purposes (execution of unit tests). So far we've been running hardhat deploy TEST_USE_STUBS_ECDSA=true together with USE_EXTERNAL_DEPLOY=true in ecdsa in the deploy:test script. The USE_EXTERNAL_DEPLOY variable specifies how the contracts of the dependencies should be deployed - whether to deploy them from scratch (true) or reuse the already deployed artifacts (false).
We were using the deploy:test script in ecdsa in two places - when running contracts-deployment-dry-run job (test of deployment on hardhat local network) and in npm-compile-publish-contracts job (publishing of development-tagged NPM package). This second use proved to be problematic, as the development-tagged package is used to generate the client bindings when running make all, resulting in the presence of unneeded (and unwanted) functionalities (like forceAddWallet and getDkgData from WalletRegistryStub). The first use is not causing such problems, but it should still be modified, as it's better to run the dry-run of deploy on the real contracts and not on the stubs.
What we decided to do is to replace

"deploy:test": "USE_EXTERNAL_DEPLOY=true TEST_USE_STUBS_ECDSA=true hardhat deploy",

with

"deploy:local": "USE_EXTERNAL_DEPLOY=true hardhat deploy",

and use the new deploy:local script in both jobs that previously used deploy:test.
This way we'll no longer include stub functionalities in NPM packages (and hence in the clinet bindings) and we'll execute dry-run of the unmodified contracts. Scripts in random-beacon also got updated to follow the new naming.

Refs:
#3531
keep-network/tbtc-v2#623

If `hardhat deploy` is run with `TEST_USE_STUBS_ECDSA` environment variable set
to `true`, the deployment will include deployment of stub contracts, which are
needed for testing purposes (execution of unit tests). So far we've been running
`hardhat deploy TEST_USE_STUBS_ECDSA=true` together with
`USE_EXTERNAL_DEPLOY=true` in `ecdsa` in the `deploy:test` script. The
`USE_EXTERNAL_DEPLOY` variable specifies how the contracts of the dependencies
should be deployed - whether to deploy them from scratch (`true`) or reuse the
already deployed artifacts (`false`).
We were using the `deploy:test` script in `ecdsa` in two places - when running
`contracts-deployment-dry-run` job (test of deployment on `hardhat` local
network) and in `npm-compile-publish-contracts` job (publishing of
`development`-tagged NPM package). This second use proved to be problematic, as
the `development`-tagged package is used to generate the client
bindings when running `make all`, resulting in the presence of unneeded (and
unwanted) functionalities (like `forceAddWallet` and `getDkgData` from
`WalletRegistryStub`). The first use is not causing such problems, but it should
still be modified, as it's better to run the dry-run of deploy on the real
contracts and not on the stubs.
What we decided to do is to replace
```
"deploy:test": "USE_EXTERNAL_DEPLOY=true TEST_USE_STUBS_ECDSA=true hardhat deploy",
```
with
```
"deploy:local": "USE_EXTERNAL_DEPLOY=true hardhat deploy",
```
and use the new `deploy:local` script in both jobs that previously used
`deploy:test`.
This way we'll no longer include stub functionalities in NPM packages (and hence
in the clinet bindings) and we'll execute dry-run of the unmodified contracts.
Scripts in `random-beacon` also got updated to follow the new naming.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove *Stub contracts from @development NPM package
1 participant