Closed skosito closed 2 months ago
This update includes various improvements and modifications across different parts of the project. A new network configuration was added to Hardhat, the documentation was updated to include an additional command, contract addresses were updated in several tasks to reflect new interaction setups, and testing scripts were enhanced with new environment reset functionalities.
Files | Change Summaries |
---|---|
hardhat.config.ts |
Added a new network configuration named hardhat to the networks section. |
scripts/readme.md |
Added the command yarn compile before starting the localnet. |
tasks/localnet.ts |
Updated contract addresses for various tasks to reflect modifications in contract interaction setups. |
test/ZetaTokenConsumer.spec.ts |
Added environment reset functionality using reset from @nomicfoundation/hardhat-network-helpers . |
test/ZetaTokenConsumerZEVM.spec.ts |
Added environment reset functionality and modified imports to include MAINNET_FORK_BLOCK and MAINNET_FORK_URL . |
test/test.helpers.ts |
Added constants MAINNET_FORK_URL and MAINNET_FORK_BLOCK . |
In code we trust, a rabbit's glee,
New networks bloom, compile with spree,
Contract paths, now clear and bright,
Tests reset, to set things right.
Hardhat shines, our guide anew,
Hopping forward, coding crew! 🐇
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
@fadeev could you please check locally if this fixes issues?
@andresaiello could you please check this one, especially about hardhat network having fork by default, do you see some issues with this change?
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 58.29%. Comparing base (
a92fb24
) to head (44c1fd8
).
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
yarn localnet
[NODE] Account #19: 0x8626f6940E2eb28930eFb4CeF49B2d1F2C9C1199 (10000 ETH)
[NODE] Private Key: 0xdf57089febbacf7ba0bc227dafbffa9fc08a93fdc68e1e42411a14efcf23656e
[NODE]
[NODE] WARNING: These accounts, and their private keys, are publicly known.
[NODE] Any funds sent to them on Mainnet or any other live network WILL BE LOST.
[NODE]
$ npx hardhat run scripts/worker.ts --network localhost
[WORKER] Warning: Unused function parameter. Remove or comment out the variable name to silence this warning.
[WORKER] --> contracts/prototypes/evm/GatewayEVMUpgradeTest.sol:106:45:
[WORKER] |
[WORKER] 106 | function send(bytes calldata recipient, uint256 amount) external payable {
[WORKER] | ^^^^^^^^^^^^^^
[WORKER]
[WORKER]
[WORKER] Compiled 15 Solidity files successfully (evm target: london).
[NODE] eth_accounts
[NODE] eth_chainId
[NODE] hardhat_impersonateAccount
[NODE] hardhat_setBalance
[NODE] eth_accounts
[NODE] eth_accounts (2)
[NODE] eth_chainId
[NODE] anvil_metadata - Method not supported
[NODE] hardhat_metadata
[NODE] eth_chainId
[NODE] anvil_metadata - Method not supported
[NODE] hardhat_metadata
[NODE] eth_blockNumber
[NODE] eth_chainId
[NODE] eth_chainId (2)
[NODE] eth_estimateGas
[NODE] eth_getBlockByNumber
[NODE] eth_feeHistory
[NODE] eth_sendTransaction
[NODE]
[NODE] Transaction maxFeePerGas (10752568781) is too low for the next block, which has a baseFeePerGas of 37327126355
[NODE]
[WORKER] Failed to deploy contracts or set up listeners: ProviderError: Transaction maxFeePerGas (10752568781) is too low for the next block, which has a baseFeePerGas of 37327126355
[WORKER] at HttpProvider.request (/Users/fadeev/github.com/zeta-chain/protocol-contracts/node_modules/hardhat/src/internal/core/providers/http.ts:96:21)
[WORKER] at processTicksAndRejections (node:internal/process/task_queues:95:5)
[WORKER] at async EthersProviderWrapper.send (/Users/fadeev/github.com/zeta-chain/protocol-contracts/node_modules/@nomiclabs/hardhat-ethers/src/internal/ethers-provider-wrapper.ts:13:20)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
[WORKER] wait-on tcp:8545 && yarn worker exited with code 1
node -v
v20.15.1
fixes problem with localnet hanging and throwing errors, please use node 20 when running
also it fixes issues we have with
yarn test
timing out in CI constantly and also sometimes locallyreason is hardhat network config in zetachain/networks package (NOTE: this also makes localnet not working properly sometimes)
we don't need to fork on every unit test, it is really slow and unit test should not fork network in general
in this PR, i used
reset
function from hardhat to only apply forking to default hardhat network where it is needed (consumer tests) - to further improve this, is there a reason why we need to fork for these tests, can we rewrite them to be pure unit tests?Summary by CodeRabbit
New Features
hardhat
for easier local development and testing.Documentation
yarn compile
command before starting the local network.Bug Fixes
Tests
reset
functionality, ensuring a consistent environment for each test run.