A main repository for all types of tests in NEON for proxy and evm.
At first you need to setup a Python 3 virtualenv, and also need to have npm installed, and be able to install packages globally on it. You'll also need to install solc.
Then you need install a main dependency for CLI utility:
pip3 install click==8.0.3
After this you can use from project root directory:
./clickfile.py --help
This file contains a lot of utilities to work with this repository such as:
- update deps
- download test contracts
- run different tests
- prepare data and stand for run tests
Please use clickfile.py to install deps because our web3 has conflicts with solana package and this problem resolved in:
./clickfile.py requirements
To download test contracts from the neon-evm repo you need to use:
./clickfile.py contracts
To run OpenZeppelin tests just use next command:
./clickfile.py run oz --network <your-stand> --jobs 8
You can run all tests manual uif know which framework it uses. For example economy tests:
py.test integration/tests/economy/test_economics.py
- --network - which network uses for run tests (from file envs.json)
- --envs - change file name with networks
For our Proxy and EVM we need to use a lot of frameworks, languages, contracts and scenarios. For this I propose this structure:
- Top level we split for different types of tests by : loadtesting, integration, compatibility tests.
- utils - some python utils which can help write integration, loadtesting and another python tests
- deploy - directory with docker files, configs and files for deploy
- allure - directory with allure configs
- envs.yml - stand configurations
- clickfile.py - file with CLI interface with different tasks to run all tests and prepare it.
- Compatibility - we need to test our infrastructure for compatibility with different framework on different languages
- openzeppelin - directory with our openzeppelin fork (submodule). To run this tests manual use clickfile.py openzeppelin
- contracts - a directory for opensource contracts in solidity. We will deploy and run tests for it (if exists)
- frameworks - a directory for frameworks splitted by language. All this frameworks need to run integrated tests (if exist) or realize one basic scenario (like: create several accounts, get evm version, get blocks, make several transactions, deploy one contract). Each framework and language has private structure and we don't need to change it and use good practices for each language.
- Loadtesting - future tests for load testing
- Integration - integration tests for base functionalitiy; operator economy and so
To get neon operator reward address from solana private, we need to use:
import os
import json
from solana.account import Account
from common_neon.address import EthereumAddress
keys = []
for f in os.listdir("operator-keypairs"):
with open(f"operator-keypairs/{f}", "r") as key:
a = Account(json.load(key)[:32])
keys.append(str(EthereumAddress.from_private_key(a.secret_key())))
To get NEON address for oracles solana feeds:
print(f'0x{binascii.hexlify(base58.b58decode(solana_address)).decode()}')
This project include GHA Workflow for regular testing DApps like Uniswap V2, AAVE and more. This workflow is triggered by cron every Sunday at 01:00 UTC and run dapps tests, get cost report from this tests and show this report.
Each DApp generate report in json format and save it in GHA artifacts. Report has structure:
{
"name": "Saddle finance",
"actions": [
{
"name": "Remove liquidity",
"usedGas": "123456",
"gasPrice": "100000000",
"tx": "0xadasdasdas"
}
]
}
In "report" state workflow run clickfile command which print report