-
Notifications
You must be signed in to change notification settings - Fork 11
Lo2302 timeout #41
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
Draft
dai1975
wants to merge
6
commits into
v0.5
Choose a base branch
from
lo2302-timeout
base: v0.5
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Lo2302 timeout #41
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
7220f20
allowCloseChannel(true) in App contract
87f14e6
add timeout test and ordered channel test in eth2eth
5062ac4
add test-timeout to tm2tm
a6f077a
add timeout test cases
2af0802
update ibc-mock-client
96cbf6b
long interval
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| { | ||
| "src": { | ||
| "chain-id": "ibc0", | ||
| "client-id": "", | ||
| "connection-id": "", | ||
| "channel-id": "", | ||
| "port-id": "mockapp", | ||
| "order": "ordered", | ||
| "version": "mockapp-1" | ||
| }, | ||
| "dst": { | ||
| "chain-id": "ibc1", | ||
| "client-id": "", | ||
| "connection-id": "", | ||
| "channel-id": "", | ||
| "port-id": "mockapp", | ||
| "order": "ordered", | ||
| "version": "mockapp-1" | ||
| }, | ||
| "strategy": { | ||
| "type": "naive" | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| #!/bin/bash | ||
|
|
||
| set -eux | ||
|
|
||
| SCRIPT_DIR=$(cd $(dirname ${BASH_SOURCE:-$0}); pwd) | ||
| FIXTURES_DIR=${SCRIPT_DIR}/../fixtures | ||
|
|
||
| source ${SCRIPT_DIR}/util/relayer-util | ||
|
|
||
| ADDRESSES_DIR_A="${FIXTURES_DIR}/ethereum/ibc0/addresses" | ||
| ADDRESSES_DIR_B="${FIXTURES_DIR}/ethereum/ibc1/addresses" | ||
| MOCKAPP_A=`cat ${ADDRESSES_DIR_A}/AppV1` | ||
| MOCKAPP_B=`cat ${ADDRESSES_DIR_B}/AppV1` | ||
|
|
||
| CONFIG_JSON=${RELAYER_CONF}/config/config.json | ||
|
|
||
| MNEMONIC_A=$(jq -r '.chains[] | select(.chain.chain_id == "ibc0").chain.signer.mnemonic' ${CONFIG_JSON}) | ||
| MNEMONIC_B=$(jq -r '.chains[] | select(.chain.chain_id == "ibc1").chain.signer.mnemonic' ${CONFIG_JSON}) | ||
|
|
||
| RPC_ADDRESS_A=$(jq -r '.chains[] | select(.chain.chain_id == "ibc0").chain.rpc_addr' ${CONFIG_JSON}) | ||
| RPC_ADDRESS_B=$(jq -r '.chains[] | select(.chain.chain_id == "ibc1").chain.rpc_addr' ${CONFIG_JSON}) | ||
|
|
||
| PORT_A=$(jq -r '.paths.ibc01.src."port-id"' ${CONFIG_JSON}) | ||
| PORT_B=$(jq -r '.paths.ibc01.dst."port-id"' ${CONFIG_JSON}) | ||
| CHANNEL_A=$(jq -r '.paths.ibc01.src."channel-id"' ${CONFIG_JSON}) | ||
| CHANNEL_B=$(jq -r '.paths.ibc01.dst."channel-id"' ${CONFIG_JSON}) | ||
|
|
||
| # send a packet from ibc0 to ibc1 | ||
| echo "!!! ibc0 alice -> ibc1 bob !!!" | ||
| ALICE_INDEX=1 | ||
| cast send \ | ||
| --rpc-url $RPC_ADDRESS_A \ | ||
| --mnemonic "$MNEMONIC_A" \ | ||
| --mnemonic-index ${ALICE_INDEX} \ | ||
| $MOCKAPP_A \ | ||
| 'sendPacket(bytes,string,string,(uint64,uint64),uint64)' \ | ||
| $(cast from-utf8 'mock packet data') \ | ||
| $PORT_A \ | ||
| $CHANNEL_A \ | ||
| '(0,100000)' \ | ||
| $(date -d 1sec +%s%N) | ||
|
|
||
| sleep 5 | ||
| TMPFILE=$0.log | ||
| waitRelay "sendPacket" "unrelayed-packets" "src" | ||
| ${RLY} tx relay ${PATH_NAME} 2>&1 | tee $TMPFILE | ||
| if grep -i 'Error' $TMPFILE; then exit 1; fi | ||
| grep -e 'core\.(\*RelayMsgs)\.Send' $TMPFILE | grep ProofUnreceived | ||
|
|
||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| #!/bin/bash | ||
|
|
||
| set -eux | ||
|
|
||
| TMPFILE=$0.log | ||
| SCRIPT_DIR=$(cd $(dirname ${BASH_SOURCE:-$0}); pwd) | ||
| FIXTURES_DIR=${SCRIPT_DIR}/../fixtures | ||
|
|
||
| RELAYER_CONF="$HOME/.yui-relayer" | ||
| RLY_BINARY=${SCRIPT_DIR}/../../../../build/yrly | ||
| RLY="${RLY_BINARY} --debug" | ||
|
|
||
| PATH_NAME=mockapp-path | ||
|
|
||
| ADDRESSES_DIR_B="${FIXTURES_DIR}/ethereum/ibc1/addresses" | ||
| MOCKAPP_CONTRACT_B=`cat ${ADDRESSES_DIR_B}/AppV1` | ||
|
|
||
| MNEMONIC_B=$($RLY config show | jq -r '.chains[] | select(.chain.chain_id == "ibc1").chain.signer.mnemonic') | ||
| RPC_ADDRESS_B=$($RLY config show | jq -r '.chains[] | select(.chain.chain_id == "ibc1").chain.rpc_addr') | ||
| PORT_B=$($RLY paths list --json | jq -r --arg path $PATH_NAME '.[$path].dst."port-id"') | ||
| CHANNEL_B=$($RLY paths list --json | jq -r --arg path $PATH_NAME '.[$path].dst."channel-id"') | ||
|
|
||
| TX_INTERVAL=10 | ||
|
|
||
| echo "!!! ibc0 -> ibc1 !!!" | ||
| TM_ADDRESS=$(${RLY} tendermint keys show ibc0 testkey) | ||
| docker exec tendermint-chain0-mock sh -c "simd --home /root/data/ibc0 tx --keyring-backend=test --from ${TM_ADDRESS} --chain-id ibc0 mockapp send --packet-timeout-height 0-1 mockapp ${CHANNEL_B} 'mock packet data' --yes" | ||
| sleep ${TX_INTERVAL} | ||
| ${RLY} tx relay $PATH_NAME 2>&1 | tee $TMPFILE | ||
| sleep ${TX_INTERVAL} | ||
| if grep -i 'Error' $TMPFILE; then exit 1; fi | ||
| grep -e 'core\.(\*RelayMsgs)\.Send' $TMPFILE | grep ProofUnreceived | ||
|
|
||
| echo "!!! ibc1 -> ibc0 !!!" | ||
| BOB_INDEX=2 | ||
| cast send \ | ||
| --rpc-url $RPC_ADDRESS_B \ | ||
| --mnemonic "$MNEMONIC_B" \ | ||
| --mnemonic-index ${BOB_INDEX} \ | ||
| $MOCKAPP_CONTRACT_B \ | ||
| 'sendPacket(bytes,string,string,(uint64,uint64),uint64)' \ | ||
| $(cast from-utf8 'mock packet data') \ | ||
| $PORT_B \ | ||
| $CHANNEL_B \ | ||
| '(0,100000)' \ | ||
| $(date -d 1sec +%s%N) | ||
| sleep ${TX_INTERVAL} | ||
| ${RLY} tx relay $PATH_NAME 2>&1 | tee $TMPFILE | ||
| sleep ${TX_INTERVAL} | ||
| if grep -i 'Error' $TMPFILE; then exit 1; fi | ||
| grep -e 'core\.(\*RelayMsgs)\.Send' $TMPFILE | grep ProofUnreceived |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| { | ||
| "src": { | ||
| "chain-id": "ibc0", | ||
| "client-id": "", | ||
| "connection-id": "", | ||
| "channel-id": "", | ||
| "port-id": "mockapp", | ||
| "order": "ordered", | ||
| "version": "mockapp-1" | ||
| }, | ||
| "dst": { | ||
| "chain-id": "ibc1", | ||
| "client-id": "", | ||
| "connection-id": "", | ||
| "channel-id": "", | ||
| "port-id": "mockapp", | ||
| "order": "ordered", | ||
| "version": "mockapp-1" | ||
| }, | ||
| "strategy": { | ||
| "type": "naive" | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| #!/bin/bash | ||
|
|
||
| set -eux | ||
|
|
||
| SCRIPT_DIR=$(cd $(dirname $0); pwd) | ||
| APP=$1 | ||
| RLY_BINARY=${SCRIPT_DIR}/../../../../build/yrly | ||
| RLY="${RLY_BINARY} --debug" | ||
|
|
||
| # XXX set proper value | ||
| TX_INTERVAL=3 | ||
|
|
||
| TM_ADDRESS0=$(${RLY} tendermint keys show ibc0 testkey) | ||
| TM_ADDRESS1=$(${RLY} tendermint keys show ibc1 testkey) | ||
|
|
||
| echo "!!! ibc0 -> ibc1 !!!" | ||
|
|
||
| echo "Before ibc0 balance: $(${RLY} query balance ibc0 ${TM_ADDRESS0})" | ||
| echo "Before ibc1 balance: $(${RLY} query balance ibc1 ${TM_ADDRESS1})" | ||
|
|
||
| PATH_NAME=ibc01 | ||
| if [[ $APP = "transfer" ]]; then | ||
| ${RLY} tx transfer --timeout-height-offset 1 ibc01 ibc0 ibc1 100samoleans ${TM_ADDRESS1} | ||
| else | ||
| CHANNEL_NAME=$(${RLY} query channel ${PATH_NAME} ibc0 | jq -r '.counterparty.channelId') | ||
| docker exec tendermint-chain0 sh -c "simd --home /root/data/ibc0 tx --keyring-backend=test --from ${TM_ADDRESS0} --chain-id ibc0 mockapp send --packet-timeout-height 0-1 mockapp ${CHANNEL_NAME} 'mock packet data' --yes" | ||
| fi | ||
| sleep ${TX_INTERVAL} | ||
|
|
||
| TMPFILE=$0.log | ||
| ${RLY} tx relay ibc01 2>&1 | tee $TMPFILE | ||
| sleep ${TX_INTERVAL} | ||
|
|
||
| if grep -i 'Error' $TMPFILE; then exit 1; fi | ||
| grep -e 'core\.(\*RelayMsgs)\.Send' $TMPFILE | grep ProofUnreceived | ||
|
|
||
| echo "After ibc0 balance: $(${RLY} query balance ibc0 ${TM_ADDRESS0})" | ||
| echo "After ibc1 balance: $(${RLY} query balance ibc1 ${TM_ADDRESS1})" | ||
|
|
||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,6 +10,7 @@ contract AppV1 is IBCContractUpgradableUUPSMockApp { | |
|
|
||
| function __AppV1_init(string memory initialVersion) public initializer { | ||
| __IBCContractUpgradableUUPSMockApp_init(initialVersion); | ||
| allowCloseChannel(true); | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. An ordered channel is to close when it receive a timeout notify, so this granting is required. |
||
| } | ||
| } | ||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There may be better checking method.