Skip to content

Commit

Permalink
Fix eth2eth
Browse files Browse the repository at this point in the history
Signed-off-by: Dongri Jin <dongri.jin@speee.jp>
  • Loading branch information
dongrie committed Sep 7, 2023
1 parent 013195f commit 03230db
Show file tree
Hide file tree
Showing 9 changed files with 191 additions and 28 deletions.
23 changes: 19 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ replace (
)

require (
github.com/datachainlab/ethereum-ibc-relay-chain v0.2.1
github.com/hyperledger-labs/yui-relayer v0.4.3
github.com/datachainlab/ethereum-ibc-relay-chain v0.2.3
github.com/hyperledger-labs/yui-relayer v0.4.7
)

require (
Expand Down Expand Up @@ -45,6 +45,9 @@ require (
github.com/cespare/xxhash v1.1.0 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/chzyer/readline v1.5.1 // indirect
github.com/cockroachdb/errors v1.9.1 // indirect
github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b // indirect
github.com/cockroachdb/redact v1.1.3 // indirect
github.com/coinbase/rosetta-sdk-go/types v1.0.0 // indirect
github.com/cometbft/cometbft v0.37.2 // indirect
github.com/cometbft/cometbft-db v0.8.0 // indirect
Expand Down Expand Up @@ -75,9 +78,12 @@ require (
github.com/ethereum/go-ethereum v1.12.0 // indirect
github.com/felixge/httpsnoop v1.0.2 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/getsentry/sentry-go v0.18.0 // indirect
github.com/go-kit/kit v0.12.0 // indirect
github.com/go-kit/log v0.2.1 // indirect
github.com/go-logfmt/logfmt v0.6.0 // indirect
github.com/go-logr/logr v1.2.4 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-ole/go-ole v1.2.1 // indirect
github.com/go-stack/stack v1.8.1 // indirect
github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 // indirect
Expand Down Expand Up @@ -118,6 +124,8 @@ require (
github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/jmhodges/levigo v1.0.0 // indirect
github.com/klauspost/compress v1.16.3 // indirect
github.com/kr/pretty v0.3.1 // indirect
github.com/kr/text v0.2.0 // indirect
github.com/lib/pq v1.10.7 // indirect
github.com/libp2p/go-buffer-pool v0.1.0 // indirect
github.com/linxGnu/grocksdb v1.7.16 // indirect
Expand All @@ -136,12 +144,13 @@ require (
github.com/petermattis/goid v0.0.0-20230317030725-371a4b8eda08 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/prometheus/client_golang v1.14.0 // indirect
github.com/prometheus/client_model v0.3.0 // indirect
github.com/prometheus/client_golang v1.15.1 // indirect
github.com/prometheus/client_model v0.4.0 // indirect
github.com/prometheus/common v0.42.0 // indirect
github.com/prometheus/procfs v0.9.0 // indirect
github.com/rakyll/statik v0.1.7 // indirect
github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect
github.com/rogpeppe/go-internal v1.10.0 // indirect
github.com/rs/cors v1.8.3 // indirect
github.com/rs/zerolog v1.29.1 // indirect
github.com/sasha-s/go-deadlock v0.3.1 // indirect
Expand All @@ -165,6 +174,12 @@ require (
github.com/zondax/ledger-go v0.14.1 // indirect
go.etcd.io/bbolt v1.3.7 // indirect
go.opencensus.io v0.24.0 // indirect
go.opentelemetry.io/otel v1.16.0 // indirect
go.opentelemetry.io/otel/exporters/prometheus v0.39.0 // indirect
go.opentelemetry.io/otel/metric v1.16.0 // indirect
go.opentelemetry.io/otel/sdk v1.16.0 // indirect
go.opentelemetry.io/otel/sdk/metric v0.39.0 // indirect
go.opentelemetry.io/otel/trace v1.16.0 // indirect
golang.org/x/crypto v0.9.0 // indirect
golang.org/x/exp v0.0.0-20230515195305-f3d0a9c9a5cc // indirect
golang.org/x/net v0.10.0 // indirect
Expand Down
151 changes: 139 additions & 12 deletions go.sum

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion tests/cases/eth2eth/configs/chains/ibc-0.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"initial_recv_checkpoint": 1
},
"prover": {
"@type": "/relayer.provers.mock.config.ProverConfig"
"@type": "/relayer.provers.mock.config.ProverConfig",
"finality_delay": 3
}
}
3 changes: 2 additions & 1 deletion tests/cases/eth2eth/configs/chains/ibc-1.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"initial_recv_checkpoint": 1
},
"prover": {
"@type": "/relayer.provers.mock.config.ProverConfig"
"@type": "/relayer.provers.mock.config.ProverConfig",
"finality_delay": 3
}
}
16 changes: 8 additions & 8 deletions tests/cases/eth2eth/scripts/test-tx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ if ! which ${ICS20_CLI} > /dev/null 2>&1; then
fi
git clone https://github.com/datachainlab/ethereum-ics20-cli.git ${TMP_DIR}/ethereum-ics20-cli
cd ${TMP_DIR}/ethereum-ics20-cli
git checkout v0.0.3
git checkout v0.0.4
go install
export PATH=$PATH:$(go env GOPATH)/bin
fi
Expand Down Expand Up @@ -65,7 +65,7 @@ TRANSFER_AMOUNT=10
echo "!!! ibc0 deployer -> ibc0 alice !!!"

# transfer token from deployer to alice
${ICS20_CLI} erc20 transfer --rpc-address=${RPC_ADDRESS_A} --mnemonic="${MNEMONIC_A}" --ics20-bank-address=${ICS20_BANK_ADDRESS} --ics20-transfer-bank-address=${ICS20_TRANSFER_BANK_ADDRESS} --from-index=${DEPLOYER_INDEX} --to-address=${WALLET_ADDRESS_A} --amount=${TRANSFER_AMOUNT} --denom=${DENOM}
${ICS20_CLI} erc20 transfer --rpc-address=${RPC_ADDRESS_A} --mnemonic="${MNEMONIC_A}" --from-index=${DEPLOYER_INDEX} --to-address=${WALLET_ADDRESS_A} --amount=${TRANSFER_AMOUNT} --denom=${DENOM}

echo "!!! ibc0 alice -> ibc1 bob !!!"

Expand All @@ -78,11 +78,11 @@ TIMEOUT_HEIGHT=$((CHAIN_B_HEIGHT + 1000))
# transfer token from alice (ibc0) to bob (ibc1)
${ICS20_CLI} ics20 transfer --rpc-address=${RPC_ADDRESS_A} --mnemonic="${MNEMONIC_A}" --ics20-bank-address=${ICS20_BANK_ADDRESS} --ics20-transfer-bank-address=${ICS20_TRANSFER_BANK_ADDRESS} --from-index=${ALICE_INDEX} --to-address=${WALLET_ADDRESS_B} --amount=${TRANSFER_AMOUNT} --denom=${DENOM} --port-id=${PORT_ID} --channel-id=${CHANNEL_ID} --timeout-height=${TIMEOUT_HEIGHT}

sleep ${TX_INTERVAL}
waitRelay "sendPacket" "unrelayed-packets" "src"
${RLY} tx relay ${PATH_NAME}
sleep ${TX_INTERVAL}

waitRelay "recvPacket" "unrelayed-acknowledgements" "dst"
${RLY} tx acks ${PATH_NAME}
sleep ${TX_INTERVAL}

# create chain b token address
CHAIN_B_DENOM="${PORT_ID}/${CHANNEL_ID}/${DENOM}"
Expand All @@ -99,11 +99,11 @@ echo "!!! ibc1 bob -> ibc0 alice !!!"
# transfer token from bob (ibc1) to alice (ibc0)
${ICS20_CLI} ics20 transfer --rpc-address=${RPC_ADDRESS_B} --mnemonic="${MNEMONIC_B}" --ics20-bank-address=${ICS20_BANK_ADDRESS} --ics20-transfer-bank-address=${ICS20_TRANSFER_BANK_ADDRESS} --from-index=${BOB_INDEX} --to-address=${WALLET_ADDRESS_A} --amount=${TRANSFER_AMOUNT} --denom=${CHAIN_B_DENOM} --port-id=${PORT_ID} --channel-id=${CHANNEL_ID} --timeout-height=${TIMEOUT_HEIGHT}

sleep ${TX_INTERVAL}
waitRelay "sendPacket" "unrelayed-packets" "dst"
${RLY} tx relay ${PATH_NAME}
sleep ${TX_INTERVAL}

waitRelay "recvPacket" "unrelayed-acknowledgements" "src"
${RLY} tx acks ${PATH_NAME}
sleep ${TX_INTERVAL}

show_balance After ${RPC_ADDRESS_A} ${WALLET_ADDRESS_A} ${DENOM} alice
show_balance After ${RPC_ADDRESS_A} ${WALLET_ADDRESS_B} ${DENOM} bob
Expand Down
18 changes: 18 additions & 0 deletions tests/cases/eth2eth/scripts/util/relayer-util
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,21 @@ CHAINID_TWO=ibc1
RLYKEY=testkey
PATH_NAME=ibc01

RETRY_COUNT=5
RETRY_INTERVAL=1

waitRelay() {
label=$1
query_type=$2
filter=".$3 | length"
for i in `seq $RETRY_COUNT`
do
echo "[try:$i] waiting for ${label} finalization ..."
sleep $RETRY_INTERVAL
unrelayed=$(${RLY} query ${query_type} ${PATH_NAME} | jq "${filter}")
if [ $unrelayed -gt 0 ]
then
break
fi
done
}
1 change: 1 addition & 0 deletions tests/chains/ethereum/Dockerfiles/ganache/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ node "/app/ganache-core.docker.cli.js" \
--db /root/.ethereum \
--defaultBalanceEther 10000 \
--mnemonic "math razor capable expose worth grape metal sunset metal sudden usage scheme" \
--blockTime 1 \
$@
2 changes: 1 addition & 1 deletion tests/chains/ethereum/contract/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tests/chains/ethereum/contract/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"clean": "rimraf build"
},
"dependencies": {
"@hyperledger-labs/yui-ibc-solidity": "git+https://github.com/hyperledger-labs/yui-ibc-solidity.git#v0.3.8",
"@hyperledger-labs/yui-ibc-solidity": "git+https://github.com/hyperledger-labs/yui-ibc-solidity.git#v0.3.10",
"@truffle/hdwallet-provider": "1.4.1",
"truffle": "^5.4.3",
"truffle-contract-size": "^2.0.1"
Expand Down

0 comments on commit 03230db

Please sign in to comment.