Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Add hardhat and viem based E2E test suite (#2016)
* chore: Add hardhat e2e test suite for precompiles This adds a tests/e2e-evm hardhat based e2e test suite for testing EVM and EVM<>Cosmos workflows. This will be used to drive and test the implementation of precompiles with a focus on e2e workflows. The hardhat and kvtool networks are configured to run in CI to ensure continuous support for both networks is not broken. The hardhat network is used to ensure compatibility between Kava and other EVM's, as well as offer better support for unit testing supporting and example contracts. The kvtool network runs a Kava network for testing the EVM implementation on Kava and testing stateful precompiles. * chore: Improve hardhat configuration We add correct solidity compiler settings for the kava network, add kvtool funded accounts, and match the accounts & balances on the hardhat network. The consistency of accounts across networks will be important for testing. * chore: Add hardhat viem extensions This adds customizations to the hardhat-viem extension to allow connections with kvtool (or other custom chains) and allow default values to be set when using viem from the hardhat runtime interface (hre). * chore: Add wallet tests for whale and user This adds two exported addresses matching the hardhat account configuration for the hardhat and kvtool network. In addition, we assert that both these addresses can sign and successfully send transactions which ensures the private keys and balances are correctly configured. * chore: Update npm test commands This adds a test-hardhat and test-kvtool command that selects the proper network and runs typechecks. In addition, npm test is updated to run test-hardhat, then test-kvtool. The hardhat tests are run first to fail fast, and the test-kvtool tests are run after as tests that pass hardhat should pass on kvtool. However, kvtool will target additional tests that will not be run on the hardhat network. * chore: Update to latest kvtool submodule This brings in a docker-compose.yaml update that removes the obsolete version field. * chore: Simpify and clean dependencies This removes the meta and setup toolbox package in favor of specifying major depdencies explicitly which allows finer grain control of dependency management in addition to removing dependencies that are not required for this project. * chore: Update tsconfig for node 20 support This updates the lib, target, and module configuration for the most up to date native support when compiling and running javascript against node 20. * chore: Add eslint with type checking support This adds and configures eslint with typescript and type checking support in addition to resolving all lint errors. * chore: Add prettier for ts/js/sol formatting This adds a prettier config and npm run commands to check and fix formatting issues. * chore: Add solhint for linting solidity contracts This adds solhint for linting future contracts used for testing. * chore: Ignore pretteier config for linting * chore: Add solidity plugin for prettier Prettier requires a plugin with configuration to format sol files. * chore: Finish e2e-evm continuous integration This refactors the e2e-evm tests to run in a single job with the hardhat network running first to fail fast and trigger any type errors. In addition, contracts used to test against kvtool may be unit testing only in the hardhat network, etc. In addition, a curl check is added to ensure the EVM JSON-RPC is serving requests. This endpoint can take ~30 seconds to come online after the kvtool server starts. Curl is configured to check every 5 seconds and retry 12 times over 60 seconds if the first request is not successful. Linting and formatting checks are also added via eslint, typescript-eslint with advanced type check rules, and prettier. Solhint is installed, but errors without any files so is not configured to run in CI yet. * chore: Rollback kvtool change to fix e2e tests The e2e tests have not yet been updated for the latest kvtool oops. * chore: Ignore unused expressions in test files Adding this ignore allows expressions like expect(foo).to.be.defined to pass linting that is common is chai assertions. We only ignore **/*.test.ts files since non-test files should not have assertions.
- Loading branch information