Closed SvenMeyer closed 9 months ago
Hi. Could you provide some more info about your dependencies?
Maybe yarn list ethers
or yarn list @ethersproject/bignumber
or..... so we can figure what's wrong here.
$ yarn info ethers
└─ ethers@npm:5.4.4
├─ Version: 5.4.4
│
└─ Dependencies
├─ @ethersproject/abi@npm:^5.4.0 → npm:5.4.0
├─ @ethersproject/abstract-provider@npm:5.4.1 → npm:5.4.1
├─ @ethersproject/abstract-signer@npm:5.4.1 → npm:5.4.1
├─ @ethersproject/address@npm:5.4.0 → npm:5.4.0
├─ @ethersproject/base64@npm:5.4.0 → npm:5.4.0
├─ @ethersproject/basex@npm:5.4.0 → npm:5.4.0
├─ @ethersproject/bignumber@npm:5.4.1 → npm:5.4.1
├─ @ethersproject/bytes@npm:5.4.0 → npm:5.4.0
├─ @ethersproject/constants@npm:5.4.0 → npm:5.4.0
├─ @ethersproject/contracts@npm:5.4.1 → npm:5.4.1
├─ @ethersproject/hash@npm:5.4.0 → npm:5.4.0
├─ @ethersproject/hdnode@npm:5.4.0 → npm:5.4.0
├─ @ethersproject/json-wallets@npm:5.4.0 → npm:5.4.0
├─ @ethersproject/keccak256@npm:5.4.0 → npm:5.4.0
├─ @ethersproject/logger@npm:5.4.0 → npm:5.4.0
├─ @ethersproject/networks@npm:5.4.2 → npm:5.4.2
├─ @ethersproject/pbkdf2@npm:5.4.0 → npm:5.4.0
├─ @ethersproject/properties@npm:5.4.0 → npm:5.4.0
├─ @ethersproject/providers@npm:5.4.3 → npm:5.4.3
├─ @ethersproject/random@npm:5.4.0 → npm:5.4.0
├─ @ethersproject/rlp@npm:5.4.0 → npm:5.4.0
├─ @ethersproject/sha2@npm:5.4.0 → npm:5.4.0
├─ @ethersproject/signing-key@npm:5.4.0 → npm:5.4.0
├─ @ethersproject/solidity@npm:5.4.0 → npm:5.4.0
├─ @ethersproject/strings@npm:5.4.0 → npm:5.4.0
├─ @ethersproject/transactions@npm:5.4.0 → npm:5.4.0
├─ @ethersproject/units@npm:5.4.0 → npm:5.4.0
├─ @ethersproject/wallet@npm:^5.4.0 → npm:5.4.0
├─ @ethersproject/web@npm:5.4.0 → npm:5.4.0
└─ @ethersproject/wordlists@npm:5.4.0 → npm:5.4.0
$ yarn info @ethersproject/bignumber
└─ @ethersproject/bignumber@npm:5.4.1
├─ Version: 5.4.1
│
└─ Dependencies
├─ @ethersproject/bytes@npm:^5.4.0 → npm:5.4.0
├─ @ethersproject/logger@npm:^5.4.0 → npm:5.4.0
└─ bn.js@npm:^4.11.9 → npm:4.12.0
@cgewecke let me know if you need anything else - invite to repo ?
Ok thanks for the invite. Will try to repro.
@cgewecke thanks for looking into it. I just had a look again , and can currently re-produce two distinct errors ...
1) My project is based on the template from @paulrberg and currently I have the problem that I have (some times) to run yarn typechain
before yarn test
or yarn coverage
.. otherwise I get errors about module not found.
> Istanbul reports written to ./coverage/ and ./coverage.json
Error in plugin solidity-coverage: TSError: ⨯ Unable to compile TypeScript:
test/PolsStake.ts:5:35 - error TS2307: Cannot find module '../typechain/PolkastarterToken' or its corresponding type declarations.
5 import { PolkastarterToken } from "../typechain/PolkastarterToken";
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
test/PolsStake.ts:6:29 - error TS2307: Cannot find module '../typechain/RewardToken' or its corresponding type declarations.
6 import { RewardToken } from "../typechain/RewardToken";
~~~~~~~~~~~~~~~~~~~~~~~~~~
test/PolsStake.ts:7:27 - error TS2307: Cannot find module '../typechain/PolsStake' or its corresponding type declarations.
7 import { PolsStake } from "../typechain/PolsStake";
~~~~~~~~~~~~~~~~~~~~~~~~
I might have messed that up ...
2) Without initialBaseFeePerGas: 0,
in the hardhat network config, I get this error
1) PolsStake
"before all" hook in "PolsStake":
InvalidInputError: Transaction gasPrice (1) is too low for the next block, which has a baseFeePerGas of 875000000
at HardhatNode._validateAutominedTx (node_modules/hardhat/src/internal/hardhat-network/provider/node.ts:1526:17)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at runNextTicks (internal/process/task_queues.js:66:3)
at listOnTimeout (internal/timers.js:523:9)
at processTimers (internal/timers.js:497:7)
at async HardhatNode.sendTransaction (node_modules/hardhat/src/internal/hardhat-network/provider/node.ts:415:5)
at async EthModule._sendTransactionAndReturnHash (node_modules/hardhat/src/internal/hardhat-network/provider/modules/eth.ts:1500:18)
at async HardhatNetworkProvider.request (node_modules/hardhat/src/internal/hardhat-network/provider/provider.ts:106:18)
at async EthersProviderWrapper.send (node_modules/@nomiclabs/hardhat-ethers/src/internal/ethers-provider-wrapper.ts:13:20)
> Istanbul reports written to ./coverage/ and ./coverage.json
Error in plugin solidity-coverage: ❌ 1 test(s) failed under coverage.
Does setting TS_NODE_TRANSPILE_ONLY=true
help, @SvenMeyer?
Does setting
TS_NODE_TRANSPILE_ONLY=true
help, @SvenMeyer?
@paulrberg thanks, have set that , will monitor and report back
I can confirm that setting TS_NODE_TRANSPILE_ONLY
makes the error go away. But I would prefer not to have to set that flag, it's rather verbose.
What happens is that Hardhat uses ts-node
, which type checks the provided code before running it. If you happen to not have the TypeChain bindings already generated before running the coverage command, the command fails because the types do not exist and the imports in TypeScript fail. But that is odd because types are generated "in-flight" - that is, the latest TypeChain task overrides the compile
Hardhat task which is run bysolidity-coverage
. This is logged in the console before the "Network Info" section, which is before the TSError: ⨯ Unable to compile TypeScript
error.
Compiling 12 files with 0.8.9
Generating typings for: 12 artifacts in dir: src/types for target: ethers-v5
Successfully generated 27 typings!
Compilation finished successfully
Have added a trouble shooting section with the workarounds highlighted here. Closing for now.
yarn test
runs fine on my project,yarn coverage
was fine before (no idea what/when it broke) , but now it get this error :