- Docker engine
- Node.js version 16
Clone neutron and relayer to the parent directory:
git clone git@github.com:neutron-org/neutron.git
git clone git@github.com:neutron-org/neutron-query-relayer.gitWe use the Gaia network as a host network, so you need to clone it next to the neutron repos. We use v9.0.3 for the tests.
git clone git@github.com:cosmos/gaia.git
git checkout v9.0.3For the first run it's required to run make build-all in the setup/ directory to build all the docker images before you run the tests with yarn test
yarnThe pre-build contracts for specific commits are stored in the publicly available Google Cloud Bucket. One can download them via following commands:
node download_artifacts.js neutron-dao neutron-dev-contracts
node download_artifacts.js neutron-tge-contracts -b mainIf you want to specify any specific branch/commit, use the following command to get more info on how to do that:
node download_artifacts.js --helpIf the contracts version you need is unavailable, or you need a custom one, you can easily use the contracts built by yourself.
To do so, build the contracts from neutron-dev-contracts and neutron-dao by following respective instructions.
After artifacts build, put all built .wasm files to contracts/ directory.
yarn test # all tests
yarn test:simple # basic tests
yarn test:interchaintx # interchain txs test
yarn test:interchain_tx_query # interchain tx query test
yarn test:interchain_kv_query # interchain kv query testNOTE: To speed up tests you can run the cosmopark by youself with make start-cosmopark in the setup dir. To run test with the already running cosmopark use NO_DOCKER env variable.
NO_DOCKER=1 yarn test # all tests
...Since docker-compose doesn't rebuild images on file changing, there is a chance for one to launch the tests with an outdated version of code if one changed something. To rebuild the images from scratch, do the following:
cd ../neutron
docker rmi neutron-node
docker rmi neutron-org/neutron-query-relayer
docker-compose build
NEUTRON_DENOM - neutron network denom
COSMOS_DENOM - gaia (cosmoshub) network denom
CONTRACTS_PATH - path to contracts that will be used in tests
NEUTRON_ADDRESS_PREFIX - address prefix for neutron controller network
COSMOS_ADDRESS_PREFIX - address prefix for gaia (cosmoshub) host network
NODE1_URL - url to the first node
NODE1_WS_URL - url to websocket of the first node
NODE2_URL - url to the second node
NODE2_WS_URL - url to websocket of the second node
BLOCKS_COUNT_BEFORE_START - how many blocks we wait before start first test
NO_DOCKER - do not start cosmopark for tests
NO_REBUILD - skip containers rebuildingsrc/config.json
Change neutron/network/init-gaiad.sh to include
sed -i -e 's/"allow_messages":./"allow_messages": ["/cosmos.bank.v1beta1.MsgSend", "/cosmos.staking.v1beta1.MsgDelegate", "/cosmos.staking.v1beta1.MsgUndelegate", "/cosmos.distribution.v1beta1.MsgSetWithdrawAddress", "/cosmos.staking.v1beta1.MsgBeginRedelegate", "/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward", "/ibc.applications.transfer.v1.MsgTransfer", "/cosmos.gov.v1beta1.MsgVoteWeighted"]/g' "$CHAIN_DIR/config/genesis.json" sed -i -e 's/"unbonding_time":./"unbonding_time": "600s",/g' "$CHAIN_DIR/config/genesis.json"