|
| 1 | +# EVM Test Suite |
| 2 | + |
| 3 | +The commands (script) will clone and run the contract tests [compound, synthetix, uniswap, ...] against the Ethermint's EVM. This test will comprehensively check the EVM against that of Ethereum's to verify that the results show the exact same behaviour. |
| 4 | + |
| 5 | +## Test Suites |
| 6 | +The following are instructions on how to run the specified EVM test suite on the Ethermint network. |
| 7 | + |
| 8 | +### Synthetix |
| 9 | +```bash |
| 10 | +# Start the ethermint node and expose rpc endpoint on :8545 |
| 11 | +# this can be done by running `./init.sh` in the ethermint dir |
| 12 | + |
| 13 | +# Synthetix |
| 14 | +git clone https://github.com/Synthetixio/synthetix.git |
| 15 | +cd synthetix |
| 16 | +npm install |
| 17 | +npm install web3 |
| 18 | +npm i -g yarn |
| 19 | +yarn add hardhat |
| 20 | +npx hardhat compile |
| 21 | +npx hardhat test --network development |
| 22 | +``` |
| 23 | + |
| 24 | +### Uniswap |
| 25 | +```bash |
| 26 | +# Start the ethermint node and expose rpc endpoint on :8545 |
| 27 | +# this can be done by running `./init.sh` in the ethermint dir |
| 28 | + |
| 29 | +# Uniswap v3 |
| 30 | +git clone https://github.com/Uniswap/uniswap-v3-core.git |
| 31 | +yarn install |
| 32 | +npx hardhat compile |
| 33 | +``` |
| 34 | + |
| 35 | +Add ethermint network in hardhat.config.ts |
| 36 | +``` |
| 37 | +networks: { |
| 38 | + ethermint: { |
| 39 | + url: 'http://127.0.0.1:8545', |
| 40 | + accounts: 'remote', |
| 41 | + gas: 'auto', |
| 42 | + gasPrice: 'auto', |
| 43 | + gasMultiplier: 1, |
| 44 | + timeout: 20000 |
| 45 | + } |
| 46 | + } |
| 47 | +``` |
| 48 | + |
| 49 | +```bash |
| 50 | +# run the test suite |
| 51 | +npx hardhat test --network ethermint |
| 52 | +``` |
| 53 | + |
| 54 | +### Compound |
| 55 | +```bash |
| 56 | +# Start the ethermint node and expose rpc endpoint on :8545 |
| 57 | +# this can be done by running `./init.sh` in the ethermint dir |
| 58 | + |
| 59 | +git clone https://github.com/compound-finance/compound-protocol.git |
| 60 | +npm install |
| 61 | +npx addle compile |
| 62 | +``` |
| 63 | + |
| 64 | +Add ethermint network in saddle.config.ts |
| 65 | +``` |
| 66 | +networks: { |
| 67 | + ethermint: { |
| 68 | + providers: [ |
| 69 | + {env: "PROVIDER"}, |
| 70 | + {http: "http://127.0.0.1:8545"} |
| 71 | + ], |
| 72 | + web3: { |
| 73 | + gas: [ |
| 74 | + {env: "GAS"}, |
| 75 | + {default: "4600000"} |
| 76 | + ], |
| 77 | + gas_price: [ |
| 78 | + {env: "GAS_PRICE"}, |
| 79 | + {default: "12000000000"} |
| 80 | + ], |
| 81 | + options: { |
| 82 | + transactionConfirmationBlocks: 1, |
| 83 | + transactionBlockTimeout: 5 |
| 84 | + } |
| 85 | + }, |
| 86 | + accounts: [ |
| 87 | + {env: "ACCOUNT"}, |
| 88 | + {unlocked: 0} |
| 89 | + ] |
| 90 | + }, |
| 91 | + } |
| 92 | +``` |
| 93 | + |
| 94 | +```bash |
| 95 | +# run the test suite |
| 96 | +npx saddle test -n ethermint |
| 97 | +``` |
| 98 | + |
| 99 | +## Known Issues: |
| 100 | + |
| 101 | +1. `ether.js` is not compatible with Ethermint. |
| 102 | +Currently, Ethermint is unable to interact with the test suites and there is a slight incompatibility with ethers.js. The issue has been documented and has been in the `icebox` for some time ([https://github.com/cosmos/ethermint/issues/349](https://github.com/cosmos/ethermint/issues/349)). |
| 103 | + |
| 104 | +In the future, when compatible with `ethers.js`, the test suites can be run with the simple command and will be run against the Ethermint EVM. If the all of the tests pass without incident, the Ethermint EVM implementation can be deemed to produce the same output as the Ethereum EVM. |
| 105 | + |
| 106 | +2. For `Uniswap V3`, Hardhat tests only work for hardhat test network when loading the node accounts. |
| 107 | +3. For `Compound`, some tests are failing in their CI. |
0 commit comments