Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix fee in example contracts #80

Merged
merged 3 commits into from
Apr 10, 2023
Merged

Fix fee in example contracts #80

merged 3 commits into from
Apr 10, 2023

Conversation

foxpy
Copy link
Contributor

@foxpy foxpy commented Jan 31, 2023

This PR also fixes bash test scripts and makes them more beautiful. Try them out!

It is currently a little tricky to test because of issues in ICQ relayer, which I didn't fix yet (I will do that later).
Instructions:

  1. the usual, go to neutron:main and run make init && make start-rly, wait until hermes starts printing messages like these:
2023-03-29T08:51:00.533853Z TRACE ThreadId(44) spawn:chain{chain=test-1}:wallet{chain=test-1}: wallet balance amount=99999999998927 denom=untrn account=neutron1mjk79fjjgpplak5wq838w0yd982gzkyf8fxu8u
2023-03-29T08:51:00.890361Z TRACE ThreadId(47) spawn:chain{chain=test-2}:wallet{chain=test-2}: wallet balance amount=99999999995571 denom=uatom account=cosmos17dtl0mjt3t77kpuhg2edqzjpszulwhgzuj9ljs
  1. go to neutron-query-relayer:main and replace .env contents with following lines:
# This is an example env configuration for running the relayer with `make dev`

RELAYER_NEUTRON_CHAIN_CHAIN_PREFIX=neutron
RELAYER_NEUTRON_CHAIN_RPC_ADDR=tcp://127.0.0.1:26657
RELAYER_NEUTRON_CHAIN_REST_ADDR=http://127.0.0.1:1317
RELAYER_NEUTRON_CHAIN_CHAIN_ID=test-1
RELAYER_NEUTRON_CHAIN_GAS_PRICES=0.5untrn
RELAYER_NEUTRON_CHAIN_HOME_DIR=../neutron/data/test-1
RELAYER_NEUTRON_CHAIN_SIGN_KEY_NAME=demowallet3
RELAYER_NEUTRON_CHAIN_TIMEOUT=1000s
RELAYER_NEUTRON_CHAIN_GAS_ADJUSTMENT=2.0
RELAYER_NEUTRON_CHAIN_TX_BROADCAST_TYPE=BroadcastTxCommit
RELAYER_NEUTRON_CHAIN_CONNECTION_ID=connection-0
RELAYER_NEUTRON_CHAIN_CLIENT_ID=07-tendermint-0
RELAYER_NEUTRON_CHAIN_DEBUG=true
RELAYER_NEUTRON_CHAIN_KEY=demowallet1
RELAYER_NEUTRON_CHAIN_ACCOUNT_PREFIX=neutron
RELAYER_NEUTRON_CHAIN_KEYRING_BACKEND=test
RELAYER_NEUTRON_CHAIN_OUTPUT_FORMAT=json
RELAYER_NEUTRON_CHAIN_SIGN_MODE_STR=direct
RELAYER_NEUTRON_CHAIN_ALLOW_KV_CALLBACKS=true

RELAYER_TARGET_CHAIN_RPC_ADDR=tcp://127.0.0.1:16657
RELAYER_TARGET_CHAIN_CHAIN_ID=test-2
RELAYER_TARGET_CHAIN_GAS_PRICES=0.5uatom
RELAYER_TARGET_CHAIN_HOME_DIR=../neutron/data/test-2
RELAYER_TARGET_CHAIN_TIMEOUT=1000s
RELAYER_TARGET_CHAIN_GAS_ADJUSTMENT=1.0
RELAYER_TARGET_CHAIN_CONNECTION_ID=connection-0
RELAYER_TARGET_CHAIN_CLIENT_ID=07-tendermint-0
RELAYER_TARGET_CHAIN_DEBUG=true
RELAYER_TARGET_CHAIN_ACCOUNT_PREFIX=neutron
RELAYER_TARGET_CHAIN_VALIDATOR_ACCOUNT_PREFIX=neutronvaloper
RELAYER_TARGET_CHAIN_KEYRING_BACKEND=test
RELAYER_TARGET_CHAIN_OUTPUT_FORMAT=json
RELAYER_TARGET_CHAIN_SIGN_MODE_STR=direct

RELAYER_REGISTRY_ADDRESSES=

RELAYER_ALLOW_TX_QUERIES=true
RELAYER_ALLOW_KV_CALLBACKS=true
RELAYER_MIN_KV_UPDATE_PERIOD=1
RELAYER_STORAGE_PATH=storage/leveldb
RELAYER_QUERIES_TASK_QUEUE_CAPACITY=10000
RELAYER_CHECK_SUBMITTED_TX_STATUS_DELAY=10s
RELAYER_WEBSERVER_PORT=127.0.0.1:9999

#LOGGER_LEVEL=info
#LOGGER_OUTPUTPATHS=stdout, /tmp/logs
#LOGGER_ERROROUTPUTPATHS=stderr
  1. now run ICQ relayer using export $(grep -v '^#' .env | xargs) && make dev
  2. go to neutron-sdk:fix/example-contracts-fee and run make build
  3. go to neutron-sdk:fix/example-contracts-fee, cd into scripts folder. Now, you want to run tests exactly in this order: ./test_ibc_transfer.sh, ./test_interchain_txs.sh, ./test_kv_query.sh and finally ./test_tx_query.sh. Do not restart relayer or node between tests, or you will trigger bugs in ICQ relayer. Once again, I will fix these bugs soon…

Don't worry, these tests are designed to be run individually, I am asking you to run them in exact order only because of bugs in ICQ relayer.

@foxpy foxpy force-pushed the fix/example-contracts-fee branch from ce84ae1 to a57fe4e Compare March 20, 2023 12:10
quasisamurai
quasisamurai previously approved these changes Mar 20, 2023
Copy link
Contributor

@sotnikov-s sotnikov-s left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

scripts doesn't work:

++ neutrond tx wasm store ../artifacts/ibc_transfer.wasm --from demowallet1 -y --chain-id test-1 --gas 50000000 --gas-prices 0.0025untrn --broadcast-mode=block --keyring-backend=test --output json --home ../../neutron/data/test-1/ --node tcp://127.0.0.1:16657
++ jq -r '.logs[0].events[] | select(.type == "store_code").attributes[] | select(.key == "code_id").value'
...
invalid Bech32 prefix; expected cosmos, got neutron: invalid request
+ code_id=

seems like the nodes ports are not as expected

scripts/test_ibc_transfer.sh Outdated Show resolved Hide resolved
Copy link
Contributor

@sotnikov-s sotnikov-s left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

scripts doesn't work:

++ neutrond tx wasm store ../artifacts/ibc_transfer.wasm --from demowallet1 -y --chain-id test-1 --gas 50000000 --gas-prices 0.0025untrn --broadcast-mode=block --keyring-backend=test --output json --home ../../neutron/data/test-1/ --node tcp://127.0.0.1:16657
++ jq -r '.logs[0].events[] | select(.type == "store_code").attributes[] | select(.key == "code_id").value'
...
invalid Bech32 prefix; expected cosmos, got neutron: invalid request
+ code_id=

seems like the nodes ports are not as expected

@foxpy foxpy force-pushed the fix/example-contracts-fee branch from a57fe4e to 432ecef Compare March 28, 2023 08:39
@foxpy foxpy changed the base branch from neutron_audit_informal_17_01_2023 to main March 28, 2023 08:40
@foxpy foxpy dismissed quasisamurai’s stale review March 28, 2023 08:40

The base branch was changed.

@foxpy foxpy marked this pull request as draft March 28, 2023 08:41
@foxpy foxpy force-pushed the fix/example-contracts-fee branch 2 times, most recently from 4c892f1 to d6c3283 Compare March 29, 2023 08:40
@foxpy foxpy force-pushed the fix/example-contracts-fee branch from d6c3283 to 4a464b4 Compare March 29, 2023 08:49
@foxpy foxpy marked this pull request as ready for review March 29, 2023 08:56
sotnikov-s
sotnikov-s previously approved these changes Mar 29, 2023
@zavgorodnii zavgorodnii merged commit f34a245 into main Apr 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants