Skip to content

Don't include stub contracts in NPM packages#3569

Closed
michalinacienciala wants to merge 1 commit into
mainfrom
remove-stubs-from-dev-npm-packages
Closed

Don't include stub contracts in NPM packages#3569
michalinacienciala wants to merge 1 commit into
mainfrom
remove-stubs-from-dev-npm-packages

Conversation

@michalinacienciala
Copy link
Copy Markdown
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
threshold-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.
@lionakhnazarov
Copy link
Copy Markdown
Collaborator

Closing — targets solidity-v1 NPM packaging, which is being retired (#3947) and extracted (#3998). No longer applicable to current main.

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

2 participants