diff --git a/Makefile b/Makefile index 5b43e3e..d3028c7 100644 --- a/Makefile +++ b/Makefile @@ -142,7 +142,7 @@ enclave: .PHONY: clean clean: @rm -f $(RustEnclave_Name) $(Signed_RustEnclave_Name) enclave/*_t.* lib/*.a - @cd enclave && cargo clean && rm -f Cargo.lock + @cd enclave && cargo clean .PHONY: fmt fmt: diff --git a/README.md b/README.md index d7fd4cd..3e4d1e6 100644 --- a/README.md +++ b/README.md @@ -42,14 +42,14 @@ This repository contains multiple modules: ## Supported Versions -- [ibc-solidity v0.3.29](https://github.com/hyperledger-labs/yui-ibc-solidity/releases/tag/v0.3.29) +- [ibc-solidity v0.3.35](https://github.com/hyperledger-labs/yui-ibc-solidity/releases/tag/v0.3.35) - [lcp v0.2.9](https://github.com/datachainlab/lcp/releases/tag/v0.2.9) - [ethereum-elc v0.0.16](https://github.com/datachainlab/ethereum-elc/releases/tag/v0.0.16) - [lcp-go v0.2.10](https://github.com/datachainlab/lcp-go/releases/tag/v0.2.10) - [lcp-solidity v0.1.14](https://github.com/datachainlab/lcp-solidity/releases/tag/v0.1.14) -- [yui-relayer v0.5.4](https://github.com/hyperledger-labs/yui-relayer/releases/tag/v0.5.4) -- [ethereum-ibc-relay-chain v0.3.4](https://github.com/datachainlab/ethereum-ibc-relay-chain/releases/tag/v0.3.4) -- [ethereum-ibc-relay-prover v0.3.1](https://github.com/datachainlab/ethereum-ibc-relay-prover/releases/tag/v0.3.1) +- [yui-relayer v0.5.8](https://github.com/hyperledger-labs/yui-relayer/releases/tag/v0.5.8) +- [ethereum-ibc-relay-chain v0.3.10](https://github.com/datachainlab/ethereum-ibc-relay-chain/releases/tag/v0.3.10) +- [ethereum-ibc-relay-prover v0.3.2](https://github.com/datachainlab/ethereum-ibc-relay-prover/releases/tag/v0.3.2) ## Build enclave and run E2E test diff --git a/enclave/Cargo.lock b/enclave/Cargo.lock index 761e967..19430aa 100644 --- a/enclave/Cargo.lock +++ b/enclave/Cargo.lock @@ -953,8 +953,7 @@ checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" [[package]] name = "ibc" version = "0.29.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "044ca92959973f4298efb14633c21772b592e7236b06789ba2e787fb952ce607" +source = "git+https://github.com/datachainlab/ibc-rs?rev=v0.29.0-channel-upgrade-path#c49870d1aa5d71a45ef36dae9f635e5fd7d2275e" dependencies = [ "bytes", "derive_more", diff --git a/enclave/Cargo.toml b/enclave/Cargo.toml index f678f44..ce07be9 100644 --- a/enclave/Cargo.toml +++ b/enclave/Cargo.toml @@ -46,6 +46,7 @@ getrandom = { git = "https://github.com/datachainlab/getrandom-sgx", branch = "v # TODO these patches would be better as optional sha2-0106 = { git = "https://github.com/bluele/hashes", branch = "0.10.6-sha256-hwa-disabled", package = "sha2" } sha2-098 = { git = "https://github.com/bluele/hashes", branch = "0.9.8-sha256-hwa-disabled", package = "sha2" } +ibc = { git = "https://github.com/datachainlab/ibc-rs", rev = "v0.29.0-channel-upgrade-path" } [profile.release] opt-level = 3 diff --git a/go.mod b/go.mod index 03a6f81..4406f5c 100644 --- a/go.mod +++ b/go.mod @@ -3,10 +3,11 @@ module github.com/datachainlab/cosmos-ethereum-ibc-lcp go 1.21 require ( - github.com/datachainlab/ethereum-ibc-relay-chain v0.3.4 - github.com/datachainlab/ethereum-ibc-relay-prover v0.3.1 + github.com/datachainlab/ethereum-ibc-relay-chain v0.3.10 + github.com/datachainlab/ethereum-ibc-relay-prover v0.3.2 + github.com/datachainlab/ibc-hd-signer v0.1.0 github.com/datachainlab/lcp-go v0.2.10 - github.com/hyperledger-labs/yui-relayer v0.5.4 + github.com/hyperledger-labs/yui-relayer v0.5.8 ) require ( diff --git a/go.sum b/go.sum index e300a2c..3a942f9 100644 --- a/go.sum +++ b/go.sum @@ -430,10 +430,12 @@ github.com/d4l3k/messagediff v1.2.1 h1:ZcAIMYsUg0EAp9X+tt8/enBE/Q8Yd5kzPynLyKptt github.com/d4l3k/messagediff v1.2.1/go.mod h1:Oozbb1TVXFac9FtSIxHBMnBCq2qeH/2KkEQxENCrlLo= github.com/danieljoos/wincred v1.1.2 h1:QLdCxFs1/Yl4zduvBdcHB8goaYk9RARS2SgLLRuAyr0= github.com/danieljoos/wincred v1.1.2/go.mod h1:GijpziifJoIBfYh+S7BbkdUTU4LfM+QnGqR5Vl2tAx0= -github.com/datachainlab/ethereum-ibc-relay-chain v0.3.4 h1:2mbvy6W/lm11SeQBgj1100A6D/70Wk9DooMoZfE8oXU= -github.com/datachainlab/ethereum-ibc-relay-chain v0.3.4/go.mod h1:PdSsegkRJiMWVGq+afDtXKRKg4p8hnmR1Yj5BgXkit0= -github.com/datachainlab/ethereum-ibc-relay-prover v0.3.1 h1:/a4O7oFDs3Crlm8VkOY8HCM+2eLCCSvTbGLHnFttlLY= -github.com/datachainlab/ethereum-ibc-relay-prover v0.3.1/go.mod h1:OfuufukSThjjZXQtFyZqwY9csQNrJ/wIm0VLAUw3l4g= +github.com/datachainlab/ethereum-ibc-relay-chain v0.3.10 h1:ce7/EiUZDjTWGHr8VGwP8Maqqur0koxK2qCOLty6gJs= +github.com/datachainlab/ethereum-ibc-relay-chain v0.3.10/go.mod h1:7goF50HLpKyL6bmisyY7t9QV338WC+68GqGpaZ9Te24= +github.com/datachainlab/ethereum-ibc-relay-prover v0.3.2 h1:E1gWclbzDoPMkZNSq7p0ifWrOTfv+p2RZ+CsZjUOPD0= +github.com/datachainlab/ethereum-ibc-relay-prover v0.3.2/go.mod h1:OfuufukSThjjZXQtFyZqwY9csQNrJ/wIm0VLAUw3l4g= +github.com/datachainlab/ibc-hd-signer v0.1.0 h1:dmnFTAwFpl0m7Lx6+b+N/rrNpHQnXpyJAYnM25GhDi0= +github.com/datachainlab/ibc-hd-signer v0.1.0/go.mod h1:wUbLb2EryMCY+GfEsziU0T032Gch04jmrN0D4XGAfOI= github.com/datachainlab/lcp-go v0.2.10 h1:1c8C+HR+tC/4NjCjpuz+Nkk3I/uIQ3PNRcvJKsSU948= github.com/datachainlab/lcp-go v0.2.10/go.mod h1:0ivRb4qUiZz5UQxsbRKygQyFz0XC6TIC6YpEUdOc1So= github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -809,8 +811,8 @@ github.com/huandu/skiplist v1.2.0/go.mod h1:7v3iFjLcSAzO4fN5B8dvebvo/qsfumiLiDXM github.com/hudl/fargo v1.3.0/go.mod h1:y3CKSmjA+wD2gak7sUSXTAoopbhU08POFhmITJgmKTg= github.com/huin/goupnp v1.3.0 h1:UvLUlWDNpoUdYzb2TCn+MuTWtcjXKSza2n6CBdQ0xXc= github.com/huin/goupnp v1.3.0/go.mod h1:gnGPsThkYa7bFi/KWmEysQRf48l2dvR5bxr2OFckNX8= -github.com/hyperledger-labs/yui-relayer v0.5.4 h1:yhvWI28Rcel55UsdmYWX0QE0W3P9aBSRetQh1k8VpZA= -github.com/hyperledger-labs/yui-relayer v0.5.4/go.mod h1:GeCb1dtZjtQdkBNw1L9+LAUHzNQQhQK+kkoOnZYffw0= +github.com/hyperledger-labs/yui-relayer v0.5.8 h1:rIgWXSyKIVg/xjbfYjQ2biQaoL7jAoGIjJFgqLWWanY= +github.com/hyperledger-labs/yui-relayer v0.5.8/go.mod h1:GeCb1dtZjtQdkBNw1L9+LAUHzNQQhQK+kkoOnZYffw0= github.com/iancoleman/strcase v0.3.0 h1:nTXanmYxhfFAMjZL34Ov6gkzEsSJZ5DbhxWjvSASxEI= github.com/iancoleman/strcase v0.3.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho= github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= diff --git a/relayer/main.go b/relayer/main.go index 5198e23..544d16e 100644 --- a/relayer/main.go +++ b/relayer/main.go @@ -5,8 +5,8 @@ import ( "os" "github.com/datachainlab/ethereum-ibc-relay-chain/pkg/relay/ethereum" - "github.com/datachainlab/ethereum-ibc-relay-chain/pkg/relay/ethereum/signers/hd" ethereumlc "github.com/datachainlab/ethereum-ibc-relay-prover/relay" + "github.com/datachainlab/ibc-hd-signer/pkg/hd" lcp "github.com/datachainlab/lcp-go/relay" rawsigner "github.com/datachainlab/lcp-go/relay/signers/raw" lcptm "github.com/datachainlab/lcp-go/relay/tendermint" diff --git a/tests/e2e/cases/tm2eth/Makefile b/tests/e2e/cases/tm2eth/Makefile index 85ffc2e..c9b47b2 100644 --- a/tests/e2e/cases/tm2eth/Makefile +++ b/tests/e2e/cases/tm2eth/Makefile @@ -21,6 +21,10 @@ setup: handshake: RLY_BIN=$(RLY_BIN) ./scripts/handshake +.PHONY: test-channel-upgrade +test-channel-upgrade: + RLY_BIN=$(RLY_BIN) ./scripts/test-channel-upgrade + .PHONY: test test: RLY_BIN=$(RLY_BIN) ./scripts/test-tx diff --git a/tests/e2e/cases/tm2eth/configs/templates/ibc-1.json.tpl b/tests/e2e/cases/tm2eth/configs/templates/ibc-1.json.tpl index 3ae026f..8586d00 100644 --- a/tests/e2e/cases/tm2eth/configs/templates/ibc-1.json.tpl +++ b/tests/e2e/cases/tm2eth/configs/templates/ibc-1.json.tpl @@ -5,7 +5,7 @@ "eth_chain_id": 15, "rpc_addr": "http://localhost:8546", "signer": { - "@type": "/relayer.chains.ethereum.signers.hd.SignerConfig", + "@type": "/relayer.signers.hd.SignerConfig", "mnemonic": "math razor capable expose worth grape metal sunset metal sudden usage scheme", "path": "m/44'/60'/0'/0/0" }, diff --git a/tests/e2e/cases/tm2eth/scripts/test-channel-upgrade b/tests/e2e/cases/tm2eth/scripts/test-channel-upgrade new file mode 100755 index 0000000..7821542 --- /dev/null +++ b/tests/e2e/cases/tm2eth/scripts/test-channel-upgrade @@ -0,0 +1,198 @@ +#!/bin/bash + +set -eux + +SCRIPT_DIR=$(cd $(dirname $0); pwd) +source "$SCRIPT_DIR/../../../scripts/util" + +RELAYER_CONF="$HOME/.yui-relayer" +RLY="${RLY_BIN} --debug" + +PATH_NAME=ibc01 + +checkEq() { + typ=$1 + a=$2 + b=$3 + if [ $a != $b ] + then + echo "${typ} mismatch: ${a} != ${b}" + exit 1 + fi + echo $a +} + +# back up the original channel fields +a=$($RLY paths list --json | jq --raw-output --arg path_name "$PATH_NAME" '.[$path_name].src."connection-id"') +b=$($RLY paths list --json | jq --raw-output --arg path_name "$PATH_NAME" '.[$path_name].dst."connection-id"') +origConnectionId=$(checkEq "original connection id" $a $b) + +a=$($RLY paths list --json | jq --raw-output --arg path_name "$PATH_NAME" '.[$path_name].src."version"') +b=$($RLY paths list --json | jq --raw-output --arg path_name "$PATH_NAME" '.[$path_name].dst."version"') +origVersion=$(checkEq "original version" $a $b) + +a=$($RLY paths list --json | jq --raw-output --arg path_name "$PATH_NAME" '.[$path_name].src."order"') +b=$($RLY paths list --json | jq --raw-output --arg path_name "$PATH_NAME" '.[$path_name].dst."order"') +origOrder=$(checkEq "original ordering" $a $b) + +# back up the original config.json and make connection identifiers empty +origconfig=`mktemp` +cp "$RELAYER_CONF/config/config.json" $origconfig +$RLY paths edit $PATH_NAME src connection-id '' +$RLY paths edit $PATH_NAME dst connection-id '' + +# create a new connection and save the new connection identifiers +retry 5 $RLY tx update-clients $PATH_NAME +sleep 60 +retry 20 $RLY tx connection $PATH_NAME -o 20s +a=$($RLY paths list --json | jq --raw-output --arg path_name "$PATH_NAME" '.[$path_name].src."connection-id"') +b=$($RLY paths list --json | jq --raw-output --arg path_name "$PATH_NAME" '.[$path_name].dst."connection-id"') +altConnectionId=$(checkEq "alternative connection id" $a $b) +altOrder=ordered + +# resume the original config.json +mv $origconfig "$RELAYER_CONF/config/config.json" + +# the function that checks which of orig or alt the channel has finally settled +checkResult() { + expectedSide=$1 + expectedVersion=$2 + + a=$($RLY paths list --json | jq --raw-output --arg path_name "$PATH_NAME" '.[$path_name].src."connection-id"') + b=$($RLY paths list --json | jq --raw-output --arg path_name "$PATH_NAME" '.[$path_name].dst."connection-id"') + connectionId=$(checkEq "path config connection id" $a $b) + + a=$($RLY paths list --json | jq --raw-output --arg path_name "$PATH_NAME" '.[$path_name].src."version"') + b=$($RLY paths list --json | jq --raw-output --arg path_name "$PATH_NAME" '.[$path_name].dst."version"') + version=$(checkEq "path config version" $a $b) + + a=$($RLY paths list --json | jq --raw-output --arg path_name "$PATH_NAME" '.[$path_name].src."order"') + b=$($RLY paths list --json | jq --raw-output --arg path_name "$PATH_NAME" '.[$path_name].dst."order"') + order=$(checkEq "path config ordering" $a $b) + + if [ "$expectedSide" = orig ] + then + expectedConnectionId=$origConnectionId + expectedOrder=$origOrder + elif [ $expectedSide = alt ] + then + expectedConnectionId=$altConnectionId + expectedOrder=$altOrder + else + echo "expectedSide is invalid value: $expectedSide" + exit 1 + fi + + if [ "$connectionId" != "$expectedConnectionId" -o "$order" != "$expectedOrder" -o "$version" != "$expectedVersion" ] + then + echo "unexpected channel fields: $connectionId(expected: $expectedConnectionId), $order(expected: $expectedOrder), $version(expected: $expectedVersion)" + exit 1 + fi + + # confirm src chain is not upgrading + upg=$($RLY query channel-upgrade ibc01 ibc0) + if [ $(echo "$upg" | jq '.fields|length') -ne 0 ] + then + echo "src chain still in the process of upgrade: $upg" + exit 1 + fi + + # confirm dst chain is not upgrading + upg=$($RLY query channel-upgrade ibc01 ibc1) + if [ $(echo "$upg" | jq '.fields|length') -ne 0 ] + then + echo "dst chain is still in the process of upgrade: $upg" + exit 1 + fi +} + +# constant variables +#TIMEOUT_FLAGS="--timeout-height 0-0 --timeout-timestamp `date -d 2030/01/01 +%s`" +TIMEOUT_FLAGS="--timeout-height 0-100000000" +ORIG_FIELDS="--ordering $origOrder --connection-hops $origConnectionId" +ALT_FIELDS="--ordering $altOrder --connection-hops $altConnectionId" + +echo '##### case 1 #####' +fields="$ALT_FIELDS --version mockapp-2" +$RLY tx channel-upgrade init ibc01 ibc0 $fields +$RLY eth upgrade propose ibc01 ibc1 $fields $TIMEOUT_FLAGS +$RLY tx channel-upgrade init ibc01 ibc1 $fields +retry 10 $RLY tx channel-upgrade execute ibc01 --target-src-state FLUSHCOMPLETE --target-dst-state FLUSHING +$RLY eth upgrade allow ibc01 ibc1 --upgrade-sequence 1 +retry 10 $RLY tx channel-upgrade execute ibc01 +checkResult alt mockapp-2 + +echo '##### case 2 #####' +fields="$ORIG_FIELDS --version mockapp-3" +$RLY tx channel-upgrade init ibc01 ibc0 $fields +$RLY tx channel-upgrade init ibc01 ibc0 $fields +$RLY eth upgrade propose ibc01 ibc1 $fields $TIMEOUT_FLAGS +$RLY tx channel-upgrade init ibc01 ibc1 $fields +retry 10 $RLY tx channel-upgrade execute ibc01 +checkResult orig mockapp-3 + +echo '##### case 3 #####' +fields="$ALT_FIELDS --version mockapp-4" +$RLY tx channel-upgrade init ibc01 ibc0 $fields +$RLY eth upgrade propose ibc01 ibc1 $fields $TIMEOUT_FLAGS +$RLY tx channel-upgrade init ibc01 ibc1 $fields +retry 10 $RLY tx channel-upgrade cancel ibc01 ibc0 # create situation where ibc0.error_receipt.sequence >= ibc1.channel.upgrade_sequence +retry 10 $RLY tx channel-upgrade execute ibc01 # the channel upgrade of ibc1 should be cancelled +checkResult orig mockapp-3 + +echo '##### case 4 #####' +$RLY tx channel-upgrade init ibc01 ibc0 $fields +$RLY eth upgrade propose ibc01 ibc1 $fields $TIMEOUT_FLAGS +retry 10 $RLY tx channel-upgrade execute ibc01 --target-src-state INIT --target-dst-state FLUSHING +retry 10 $RLY tx channel-upgrade cancel ibc01 ibc0 # ibc0 returns to UNINIT. ibc1 is FLUSHING. +retry 10 $RLY tx channel-upgrade execute ibc01 # ibc1's upgrade should be cancelled +checkResult orig mockapp-3 + +echo '##### case 5 #####' +$RLY tx channel-upgrade init ibc01 ibc0 $fields +$RLY eth upgrade propose ibc01 ibc1 $fields $TIMEOUT_FLAGS +retry 10 $RLY tx channel-upgrade execute ibc01 --target-src-state INIT --target-dst-state FLUSHING +retry 10 $RLY tx channel-upgrade cancel ibc01 ibc0 # ibc0 returns to UNINIT. ibc1 is FLUSHING. +$RLY tx channel-upgrade init ibc01 ibc0 --unsafe $fields # ibc0 re-initiates new upgrade. +retry 10 $RLY tx channel-upgrade execute ibc01 --target-src-state FLUSHCOMPLETE --target-dst-state FLUSHING +$RLY eth upgrade allow ibc01 ibc1 --upgrade-sequence 7 +retry 10 $RLY tx channel-upgrade execute ibc01 # The upgrade initiated by ibc0 should be completed after ibc1's one is cancelled. +checkResult alt mockapp-4 + +echo '##### case 6 #####' +fields="$ORIG_FIELDS --version mockapp-5" +$RLY tx channel-upgrade init ibc01 ibc0 $fields +$RLY eth upgrade propose ibc01 ibc1 $fields $TIMEOUT_FLAGS +retry 10 $RLY tx channel-upgrade execute ibc01 --target-src-state FLUSHCOMPLETE --target-dst-state FLUSHING +retry 10 $RLY tx channel-upgrade cancel ibc01 ibc1 # ibc1 returns to UNINIT. ibc0 is FLUSHCOMPLETE. +retry 10 $RLY tx channel-upgrade execute ibc01 # ibc0's upgrade (in FLUSHCOMPLETE) should be cancelled. +checkResult alt mockapp-4 + +echo '##### case 7 #####' +$RLY tx channel-upgrade init ibc01 ibc0 $fields +$RLY eth upgrade propose ibc01 ibc1 $fields $TIMEOUT_FLAGS +retry 10 $RLY tx channel-upgrade execute ibc01 --target-src-state FLUSHCOMPLETE --target-dst-state FLUSHING +retry 10 $RLY tx channel-upgrade cancel ibc01 ibc1 # ibc1 returns to UNINIT. ibc0 is FLUSHCOMPLETE. +$RLY eth upgrade propose ibc01 ibc1 $fields $TIMEOUT_FLAGS +$RLY tx channel-upgrade init ibc01 ibc1 --unsafe $fields # ibc1 re-initiates new upgrade. +retry 10 $RLY tx channel-upgrade execute ibc01 # The upgrade initiated by ibc1 should be completed after ibc0's one is cancelled. +checkResult orig mockapp-5 + +echo '##### case 8 #####' +fields="$ALT_FIELDS --version mockapp-6" +$RLY tx channel-upgrade init ibc01 ibc0 $fields +$RLY eth upgrade propose ibc01 ibc1 $fields $TIMEOUT_FLAGS +$RLY tx channel-upgrade init ibc01 ibc1 $fields +retry 10 $RLY tx channel-upgrade execute ibc01 --target-src-state FLUSHCOMPLETE --target-dst-state FLUSHING +sleep 480 # ibc1 exceeds upgrade.timeout.timestamp +retry 10 $RLY tx channel-upgrade execute ibc01 # ibc0 <= chanUpgradeTimeout, ibc1 <= chanUpgradeCancel +checkResult orig mockapp-5 + +echo '##### case 9 #####' +$RLY tx channel-upgrade init ibc01 ibc0 $fields +$RLY eth upgrade propose ibc01 ibc1 $fields $TIMEOUT_FLAGS --timeout-height 0-0 --timeout-timestamp `date -d 480sec +%s%N` +$RLY tx channel-upgrade init ibc01 ibc1 $fields +retry 10 $RLY tx channel-upgrade execute ibc01 --target-src-state FLUSHING --target-dst-state FLUSHING +sleep 480 # Both chains exceed upgrade.timeout.timestamp +retry 10 $RLY tx channel-upgrade execute ibc01 # ibc0,ibc1 <= chanUpgradeTimeout +checkResult orig mockapp-5 diff --git a/tests/e2e/cases/tm2eth/scripts/test-tx b/tests/e2e/cases/tm2eth/scripts/test-tx index 6c88c7a..6548a9b 100755 --- a/tests/e2e/cases/tm2eth/scripts/test-tx +++ b/tests/e2e/cases/tm2eth/scripts/test-tx @@ -27,7 +27,7 @@ retry() { echo "!!! ibc0 -> ibc1 !!!" -docker exec -it tendermint-chain sh -c "simd --home /root/data/ibc0 tx --keyring-backend=test --from ${TM_USER_ADDRESS} --chain-id ibc0 mockapp send mockapp channel-0 msg0 --yes" +docker exec tendermint-chain sh -c "simd --home /root/data/ibc0 tx --keyring-backend=test --from ${TM_USER_ADDRESS} --chain-id ibc0 mockapp send mockapp channel-0 'mock packet data' --yes" sleep 5 retry 10 ${RLY} tx relay --do-refresh ibc01 sleep ${TX_INTERNAL} diff --git a/tests/e2e/chains/ethereum/contracts/.gitignore b/tests/e2e/chains/ethereum/contracts/.gitignore index 76bcba5..8334389 100644 --- a/tests/e2e/chains/ethereum/contracts/.gitignore +++ b/tests/e2e/chains/ethereum/contracts/.gitignore @@ -3,3 +3,4 @@ cache/ node_modules/ abis/ addresses/ +.openzeppelin/ diff --git a/tests/e2e/chains/ethereum/contracts/contracts/App.sol b/tests/e2e/chains/ethereum/contracts/contracts/App.sol new file mode 100644 index 0000000..c575c58 --- /dev/null +++ b/tests/e2e/chains/ethereum/contracts/contracts/App.sol @@ -0,0 +1,80 @@ +// SPDX-License-Identifier: Apache-2.0 +pragma solidity ^0.8.20; + +import {IIBCHandler} from "@hyperledger-labs/yui-ibc-solidity/contracts/core/25-handler/IIBCHandler.sol"; +import {IBCContractUpgradableUUPSMockApp} from "@datachainlab/ethereum-ibc-relay-chain/contracts/IBCContractUpgradableUUPSMockApp.sol"; + +contract AppV1 is IBCContractUpgradableUUPSMockApp { + /// @custom:oz-upgrades-unsafe-allow constructor + constructor(IIBCHandler ibcHandler_) IBCContractUpgradableUUPSMockApp(ibcHandler_) {} + + function __AppV1_init(string memory initialVersion) public initializer { + __IBCContractUpgradableUUPSMockApp_init(initialVersion); + } +} + +contract AppV2 is AppV1 { + string public val2; + + /// @custom:oz-upgrades-unsafe-allow constructor + constructor(IIBCHandler ibcHandler_) AppV1(ibcHandler_) {} + + function __AppV2_init(string memory v_) public reinitializer(2) { + val2 = v_; + } +} + +contract AppV3 is AppV2 { + string public val3; + + /// @custom:oz-upgrades-unsafe-allow constructor + constructor(IIBCHandler ibcHandler_) AppV2(ibcHandler_) {} + + function __AppV3_init(string memory v_) public reinitializer(3) { + val3 = v_; + } +} + +contract AppV4 is AppV3 { + string public val4; + + /// @custom:oz-upgrades-unsafe-allow constructor + constructor(IIBCHandler ibcHandler_) AppV3(ibcHandler_) {} + + function __AppV4_init(string memory v_) public reinitializer(4) { + val4 = v_; + } +} + +contract AppV5 is AppV4 { + string public val5; + + /// @custom:oz-upgrades-unsafe-allow constructor + constructor(IIBCHandler ibcHandler_) AppV4(ibcHandler_) {} + + function __AppV5_init(string memory v_) public reinitializer(5) { + val5 = v_; + } +} + +contract AppV6 is AppV5 { + string public val6; + + /// @custom:oz-upgrades-unsafe-allow constructor + constructor(IIBCHandler ibcHandler_) AppV5(ibcHandler_) {} + + function __AppV6_init(string memory v_) public reinitializer(6) { + val6 = v_; + } +} + +contract AppV7 is AppV6 { + string public val7; + + /// @custom:oz-upgrades-unsafe-allow constructor + constructor(IIBCHandler ibcHandler_) AppV6(ibcHandler_) {} + + function __AppV7_init(string memory v_) public reinitializer(7) { + val7 = v_; + } +} diff --git a/tests/e2e/chains/ethereum/contracts/contracts/Dependencies.sol b/tests/e2e/chains/ethereum/contracts/contracts/Dependencies.sol index 23af3ca..5cc0167 100644 --- a/tests/e2e/chains/ethereum/contracts/contracts/Dependencies.sol +++ b/tests/e2e/chains/ethereum/contracts/contracts/Dependencies.sol @@ -11,8 +11,9 @@ import {IBCChannelPacketTimeout} from "@hyperledger-labs/yui-ibc-solidity/contracts/core/04-channel/IBCChannelPacketTimeout.sol"; import { IBCChannelUpgradeInitTryAck, - IBCChannelUpgradeConfirmTimeoutCancel + IBCChannelUpgradeConfirmOpenTimeoutCancel } from "@hyperledger-labs/yui-ibc-solidity/contracts/core/04-channel/IBCChannelUpgrade.sol"; + import {IIBCHandler} from "@hyperledger-labs/yui-ibc-solidity/contracts/core/25-handler/IIBCHandler.sol"; import {OwnableIBCHandler} from "@hyperledger-labs/yui-ibc-solidity/contracts/core/25-handler/OwnableIBCHandler.sol"; import {MockClient} from "@hyperledger-labs/yui-ibc-solidity/contracts/clients/mock/MockClient.sol"; @@ -20,3 +21,7 @@ import {MockClient} from "@hyperledger-labs/yui-ibc-solidity/contracts/clients/m import {LCPProtoMarshaler} from "@datachainlab/lcp-solidity/contracts/LCPProtoMarshaler.sol"; import {AVRValidator} from "@datachainlab/lcp-solidity/contracts/AVRValidator.sol"; import {LCPClient} from "@datachainlab/lcp-solidity/contracts/LCPClient.sol"; + +import {IBCContractUpgradableUUPSMockApp} from "@datachainlab/ethereum-ibc-relay-chain/contracts/IBCContractUpgradableUUPSMockApp.sol"; + +import {AppV1, AppV2, AppV3, AppV4, AppV5, AppV6, AppV7} from "./App.sol"; diff --git a/tests/e2e/chains/ethereum/contracts/contracts/MockApp.sol b/tests/e2e/chains/ethereum/contracts/contracts/MockApp.sol deleted file mode 100644 index cda4035..0000000 --- a/tests/e2e/chains/ethereum/contracts/contracts/MockApp.sol +++ /dev/null @@ -1,82 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -pragma solidity ^0.8.12; - -import {Height} from "@hyperledger-labs/yui-ibc-solidity/contracts/proto/Client.sol"; -import {Packet} from "@hyperledger-labs/yui-ibc-solidity/contracts/core/04-channel/IIBCChannel.sol"; -import {IIBCHandler} from "@hyperledger-labs/yui-ibc-solidity/contracts/core/25-handler/IIBCHandler.sol"; -import {IIBCModule} from "@hyperledger-labs/yui-ibc-solidity/contracts/core/26-router/IIBCModule.sol"; -import {IBCAppBase} from "@hyperledger-labs/yui-ibc-solidity/contracts/apps/commons/IBCAppBase.sol"; - -contract MockApp is IBCAppBase { - string public constant MOCKAPP_VERSION = "mockapp-1"; - - IIBCHandler immutable ibcHandler; - - constructor(IIBCHandler ibcHandler_) { - ibcHandler = ibcHandler_; - } - - function ibcAddress() public view virtual override returns (address) { - return address(ibcHandler); - } - - function sendPacket( - string calldata message, - string calldata sourcePort, - string calldata sourceChannel, - uint64 timeoutHeight, - uint64 timeoutTimestamp - ) external { - ibcHandler.sendPacket( - sourcePort, - sourceChannel, - Height.Data({revision_number: 0, revision_height: timeoutHeight}), - 0, - bytes(message) - ); - } - - function onRecvPacket(Packet calldata packet, address relayer) - external - virtual - override - onlyIBC - returns (bytes memory acknowledgement) - { - return packet.data; - } - - function onAcknowledgementPacket(Packet calldata packet, bytes calldata acknowledgement, address relayer) - external - virtual - override - onlyIBC - { - require(keccak256(packet.data) == keccak256(acknowledgement), "message mismatch"); - } - - function onChanOpenInit(IIBCModule.MsgOnChanOpenInit calldata msg_) - external - virtual - override - onlyIBC - returns (string memory) - { - require( - bytes(msg_.version).length == 0 || keccak256(bytes(msg_.version)) == keccak256(bytes(MOCKAPP_VERSION)), - "version mismatch" - ); - return MOCKAPP_VERSION; - } - - function onChanOpenTry(IIBCModule.MsgOnChanOpenTry calldata msg_) - external - virtual - override - onlyIBC - returns (string memory) - { - require(keccak256(bytes(msg_.counterpartyVersion)) == keccak256(bytes(MOCKAPP_VERSION)), "version mismatch"); - return MOCKAPP_VERSION; - } -} diff --git a/tests/e2e/chains/ethereum/contracts/hardhat.config.js b/tests/e2e/chains/ethereum/contracts/hardhat.config.js index e351747..a5919d4 100644 --- a/tests/e2e/chains/ethereum/contracts/hardhat.config.js +++ b/tests/e2e/chains/ethereum/contracts/hardhat.config.js @@ -1,4 +1,5 @@ require("@nomicfoundation/hardhat-toolbox"); +require("@openzeppelin/hardhat-upgrades"); /** * @type import('hardhat/config').HardhatUserConfig diff --git a/tests/e2e/chains/ethereum/contracts/package-lock.json b/tests/e2e/chains/ethereum/contracts/package-lock.json index 20288d0..a866675 100644 --- a/tests/e2e/chains/ethereum/contracts/package-lock.json +++ b/tests/e2e/chains/ethereum/contracts/package-lock.json @@ -9,9 +9,11 @@ "version": "1.0.0", "license": "TBD", "devDependencies": { + "@datachainlab/ethereum-ibc-relay-chain": "git+https://github.com/datachainlab/ethereum-ibc-relay-chain.git#semver:v0.3.10", "@datachainlab/lcp-solidity": "git+https://github.com/datachainlab/lcp-solidity.git#v0.1.14", - "@hyperledger-labs/yui-ibc-solidity": "git+https://github.com/hyperledger-labs/yui-ibc-solidity.git#v0.3.29", + "@hyperledger-labs/yui-ibc-solidity": "git+https://github.com/hyperledger-labs/yui-ibc-solidity.git#semver:v0.3.35", "@nomicfoundation/hardhat-toolbox": "^4.0.0", + "@openzeppelin/hardhat-upgrades": "^3.2.1", "hardhat": "^2.19.1" } }, @@ -22,6 +24,75 @@ "dev": true, "peer": true }, + "node_modules/@aws-crypto/sha256-js": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/@aws-crypto/sha256-js/-/sha256-js-1.2.2.tgz", + "integrity": "sha512-Nr1QJIbW/afYYGzYvrF70LtaHrIRtd4TNAglX8BvlfxJLZ45SAmueIKYl5tWoNBPzp65ymXGFK0Bb1vZUpuc9g==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@aws-crypto/util": "^1.2.2", + "@aws-sdk/types": "^3.1.0", + "tslib": "^1.11.1" + } + }, + "node_modules/@aws-crypto/sha256-js/node_modules/tslib": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", + "dev": true, + "license": "0BSD" + }, + "node_modules/@aws-crypto/util": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/@aws-crypto/util/-/util-1.2.2.tgz", + "integrity": "sha512-H8PjG5WJ4wz0UXAFXeJjWCW1vkvIJ3qUUD+rGRwJ2/hj+xT58Qle2MTql/2MGzkU+1JLAFuR6aJpLAjHwhmwwg==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@aws-sdk/types": "^3.1.0", + "@aws-sdk/util-utf8-browser": "^3.0.0", + "tslib": "^1.11.1" + } + }, + "node_modules/@aws-crypto/util/node_modules/tslib": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", + "dev": true, + "license": "0BSD" + }, + "node_modules/@aws-sdk/types": { + "version": "3.609.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/types/-/types-3.609.0.tgz", + "integrity": "sha512-+Tqnh9w0h2LcrUsdXyT1F8mNhXz+tVYBtP19LpeEGntmvHwa2XzvLUCWpoIAIVsHp5+HdB2X9Sn0KAtmbFXc2Q==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@smithy/types": "^3.3.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=16.0.0" + } + }, + "node_modules/@aws-sdk/types/node_modules/tslib": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.7.0.tgz", + "integrity": "sha512-gLXCKdN1/j47AiHiOkJN69hJmcbGTHI0ImLmbYLHykhgeN0jVGola9yVjFgzCUklsZQMW55o+dW7IXv3RCXDzA==", + "dev": true, + "license": "0BSD" + }, + "node_modules/@aws-sdk/util-utf8-browser": { + "version": "3.259.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/util-utf8-browser/-/util-utf8-browser-3.259.0.tgz", + "integrity": "sha512-UvFa/vR+e19XookZF8RzFZBrw2EUkQWxiBW0yYQAhvk3C+QVGl0H3ouca8LDBlBfQKXwmW3huo/59H8rwb1wJw==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "tslib": "^2.3.1" + } + }, "node_modules/@cspotcode/source-map-support": { "version": "0.8.1", "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz", @@ -35,6 +106,17 @@ "node": ">=12" } }, + "node_modules/@datachainlab/ethereum-ibc-relay-chain": { + "name": "ethereum-ibc-relay-chain", + "version": "1.0.0", + "resolved": "git+ssh://git@github.com/datachainlab/ethereum-ibc-relay-chain.git#b2579e90b67f671db932032af2ca5cac6e693244", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@hyperledger-labs/yui-ibc-solidity": "git+https://github.com/hyperledger-labs/yui-ibc-solidity.git#semver:v0.3.35", + "@openzeppelin/contracts-upgradeable": "^5.0.2" + } + }, "node_modules/@datachainlab/lcp-solidity": { "name": "lcp-solidity", "version": "0.1.0", @@ -902,7 +984,7 @@ "node_modules/@hyperledger-labs/yui-ibc-solidity": { "name": "ibc-solidity", "version": "0.1.0", - "resolved": "git+ssh://git@github.com/hyperledger-labs/yui-ibc-solidity.git#ea3d73dfd7dccbb8e1cdcc6b5654d0d12e8507f6", + "resolved": "git+ssh://git@github.com/hyperledger-labs/yui-ibc-solidity.git#cd49bc000d99b498026706ed028a89123a8e05a2", "dev": true, "dependencies": { "@openzeppelin/contracts": "^5.0.1" @@ -1303,6 +1385,117 @@ "hardhat": "^2.0.4" } }, + "node_modules/@nomicfoundation/slang": { + "version": "0.17.0", + "resolved": "https://registry.npmjs.org/@nomicfoundation/slang/-/slang-0.17.0.tgz", + "integrity": "sha512-1GlkGRcGpVnjFw9Z1vvDKOKo2mzparFt7qrl2pDxWp+jrVtlvej98yCMX52pVyrYE7ZeOSZFnx/DtsSgoukStQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@nomicfoundation/slang-darwin-arm64": "0.17.0", + "@nomicfoundation/slang-darwin-x64": "0.17.0", + "@nomicfoundation/slang-linux-arm64-gnu": "0.17.0", + "@nomicfoundation/slang-linux-arm64-musl": "0.17.0", + "@nomicfoundation/slang-linux-x64-gnu": "0.17.0", + "@nomicfoundation/slang-linux-x64-musl": "0.17.0", + "@nomicfoundation/slang-win32-arm64-msvc": "0.17.0", + "@nomicfoundation/slang-win32-ia32-msvc": "0.17.0", + "@nomicfoundation/slang-win32-x64-msvc": "0.17.0" + }, + "engines": { + "node": ">= 10" + } + }, + "node_modules/@nomicfoundation/slang-darwin-arm64": { + "version": "0.17.0", + "resolved": "https://registry.npmjs.org/@nomicfoundation/slang-darwin-arm64/-/slang-darwin-arm64-0.17.0.tgz", + "integrity": "sha512-O0q94EUtoWy9A5kOTOa9/khtxXDYnLqmuda9pQELurSiwbQEVCPQL8kb34VbOW+ifdre66JM/05Xw9JWhIZ9sA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 10" + } + }, + "node_modules/@nomicfoundation/slang-darwin-x64": { + "version": "0.17.0", + "resolved": "https://registry.npmjs.org/@nomicfoundation/slang-darwin-x64/-/slang-darwin-x64-0.17.0.tgz", + "integrity": "sha512-IaDbHzvT08sBK2HyGzonWhq1uu8IxdjmTqAWHr25Oh/PYnamdi8u4qchZXXYKz/DHLoYN3vIpBXoqLQIomhD/g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 10" + } + }, + "node_modules/@nomicfoundation/slang-linux-arm64-gnu": { + "version": "0.17.0", + "resolved": "https://registry.npmjs.org/@nomicfoundation/slang-linux-arm64-gnu/-/slang-linux-arm64-gnu-0.17.0.tgz", + "integrity": "sha512-Lj4anvOsQZxs1SycG8VyT2Rl2oqIhyLSUCgGepTt3CiJ/bM+8r8bLJIgh8vKkki4BWz49YsYIgaJB2IPv8FFTw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 10" + } + }, + "node_modules/@nomicfoundation/slang-linux-arm64-musl": { + "version": "0.17.0", + "resolved": "https://registry.npmjs.org/@nomicfoundation/slang-linux-arm64-musl/-/slang-linux-arm64-musl-0.17.0.tgz", + "integrity": "sha512-/xkTCa9d5SIWUBQE3BmLqDFfJRr4yUBwbl4ynPiGUpRXrD69cs6pWKkwjwz/FdBpXqVo36I+zY95qzoTj/YhOA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 10" + } + }, + "node_modules/@nomicfoundation/slang-linux-x64-gnu": { + "version": "0.17.0", + "resolved": "https://registry.npmjs.org/@nomicfoundation/slang-linux-x64-gnu/-/slang-linux-x64-gnu-0.17.0.tgz", + "integrity": "sha512-oe5IO5vntOqYvTd67deCHPIWuSuWm6aYtT2/0Kqz2/VLtGz4ClEulBSRwfnNzBVtw2nksWipE1w8BzhImI7Syg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 10" + } + }, + "node_modules/@nomicfoundation/slang-linux-x64-musl": { + "version": "0.17.0", + "resolved": "https://registry.npmjs.org/@nomicfoundation/slang-linux-x64-musl/-/slang-linux-x64-musl-0.17.0.tgz", + "integrity": "sha512-PpYCI5K/kgLAMXaPY0V4VST5gCDprEOh7z/47tbI8kJQumI5odjsj/Cs8MpTo7/uRH6flKYbVNgUzcocWVYrAQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 10" + } + }, + "node_modules/@nomicfoundation/slang-win32-arm64-msvc": { + "version": "0.17.0", + "resolved": "https://registry.npmjs.org/@nomicfoundation/slang-win32-arm64-msvc/-/slang-win32-arm64-msvc-0.17.0.tgz", + "integrity": "sha512-u/Mkf7OjokdBilP7QOJj6QYJU4/mjkbKnTX21wLyCIzeVWS7yafRPYpBycKIBj2pRRZ6ceAY5EqRpb0aiCq+0Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 10" + } + }, + "node_modules/@nomicfoundation/slang-win32-ia32-msvc": { + "version": "0.17.0", + "resolved": "https://registry.npmjs.org/@nomicfoundation/slang-win32-ia32-msvc/-/slang-win32-ia32-msvc-0.17.0.tgz", + "integrity": "sha512-XJBVQfNnZQUv0tP2JSJ573S+pmgrLWgqSZOGaMllnB/TL1gRci4Z7dYRJUF2s82GlRJE+FHSI2Ro6JISKmlXCg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 10" + } + }, + "node_modules/@nomicfoundation/slang-win32-x64-msvc": { + "version": "0.17.0", + "resolved": "https://registry.npmjs.org/@nomicfoundation/slang-win32-x64-msvc/-/slang-win32-x64-msvc-0.17.0.tgz", + "integrity": "sha512-zPGsAeiTfqfPNYHD8BfrahQmYzA78ZraoHKTGraq/1xwJwzBK4bu/NtvVA4pJjBV+B4L6DCxVhSbpn40q26JQA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 10" + } + }, "node_modules/@nomicfoundation/solidity-analyzer": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/@nomicfoundation/solidity-analyzer/-/solidity-analyzer-0.1.2.tgz", @@ -1397,6 +1590,306 @@ "integrity": "sha512-ytPc6eLGcHHnapAZ9S+5qsdomhjo6QBHTDRRBFfTxXIpsicMhVPouPgmUPebZZZGX7vt9USA+Z+0M0dSVtSUEA==", "dev": true }, + "node_modules/@openzeppelin/contracts-upgradeable": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/@openzeppelin/contracts-upgradeable/-/contracts-upgradeable-5.0.2.tgz", + "integrity": "sha512-0MmkHSHiW2NRFiT9/r5Lu4eJq5UJ4/tzlOgYXNAIj/ONkQTVnz22pLxDvp4C4uZ9he7ZFvGn3Driptn1/iU7tQ==", + "dev": true, + "license": "MIT", + "peerDependencies": { + "@openzeppelin/contracts": "5.0.2" + } + }, + "node_modules/@openzeppelin/defender-sdk-base-client": { + "version": "1.14.3", + "resolved": "https://registry.npmjs.org/@openzeppelin/defender-sdk-base-client/-/defender-sdk-base-client-1.14.3.tgz", + "integrity": "sha512-4yG9E8N1c/ZP2jNR+Ah19wi7SBKpauAV/VcYcm7rg1dltDbzbH/oZnnXJlymT7IfjTPXkKHW8TPsaqz3EjS7tA==", + "dev": true, + "license": "MIT", + "dependencies": { + "amazon-cognito-identity-js": "^6.3.6", + "async-retry": "^1.3.3" + } + }, + "node_modules/@openzeppelin/defender-sdk-deploy-client": { + "version": "1.14.3", + "resolved": "https://registry.npmjs.org/@openzeppelin/defender-sdk-deploy-client/-/defender-sdk-deploy-client-1.14.3.tgz", + "integrity": "sha512-51WIZJz251lndK7uQU4gBE0gBX+2ZNTgf+hemtJUEPCpHtkooBRFFMID3EPGMKXVqf872pU8K3Huu9PyYQu6bw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@openzeppelin/defender-sdk-base-client": "1.14.3", + "axios": "^1.7.2", + "lodash": "^4.17.21" + } + }, + "node_modules/@openzeppelin/defender-sdk-network-client": { + "version": "1.14.3", + "resolved": "https://registry.npmjs.org/@openzeppelin/defender-sdk-network-client/-/defender-sdk-network-client-1.14.3.tgz", + "integrity": "sha512-qrJLs2ubKSwrhP0x4V2QOPhlc1q8TYnkAcvjvk34VXMS8lhY1cpXSGoxnTw3Mi+eCSE1xOzKWISLi1UAOQOJIw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@openzeppelin/defender-sdk-base-client": "1.14.3", + "axios": "^1.7.2", + "lodash": "^4.17.21" + } + }, + "node_modules/@openzeppelin/hardhat-upgrades": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/@openzeppelin/hardhat-upgrades/-/hardhat-upgrades-3.2.1.tgz", + "integrity": "sha512-Zy5M3QhkzwGdpzQmk+xbWdYOGJWjoTvwbBKYLhctu9B91DoprlhDRaZUwCtunwTdynkTDGdVfGr0kIkvycyKjw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@openzeppelin/defender-sdk-base-client": "^1.10.0", + "@openzeppelin/defender-sdk-deploy-client": "^1.10.0", + "@openzeppelin/defender-sdk-network-client": "^1.10.0", + "@openzeppelin/upgrades-core": "^1.35.0", + "chalk": "^4.1.0", + "debug": "^4.1.1", + "ethereumjs-util": "^7.1.5", + "proper-lockfile": "^4.1.1", + "undici": "^6.11.1" + }, + "bin": { + "migrate-oz-cli-project": "dist/scripts/migrate-oz-cli-project.js" + }, + "peerDependencies": { + "@nomicfoundation/hardhat-ethers": "^3.0.0", + "@nomicfoundation/hardhat-verify": "^2.0.0", + "ethers": "^6.6.0", + "hardhat": "^2.0.2" + }, + "peerDependenciesMeta": { + "@nomicfoundation/hardhat-verify": { + "optional": true + } + } + }, + "node_modules/@openzeppelin/hardhat-upgrades/node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "license": "MIT", + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/@openzeppelin/hardhat-upgrades/node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/@openzeppelin/hardhat-upgrades/node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/@openzeppelin/hardhat-upgrades/node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true, + "license": "MIT" + }, + "node_modules/@openzeppelin/hardhat-upgrades/node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/@openzeppelin/hardhat-upgrades/node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "license": "MIT", + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/@openzeppelin/hardhat-upgrades/node_modules/undici": { + "version": "6.19.8", + "resolved": "https://registry.npmjs.org/undici/-/undici-6.19.8.tgz", + "integrity": "sha512-U8uCCl2x9TK3WANvmBavymRzxbfFYG+tAu+fgx3zxQy3qdagQqBLwJVrdyO1TBfUXvfKveMKJZhpvUYoOjM+4g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18.17" + } + }, + "node_modules/@openzeppelin/upgrades-core": { + "version": "1.37.0", + "resolved": "https://registry.npmjs.org/@openzeppelin/upgrades-core/-/upgrades-core-1.37.0.tgz", + "integrity": "sha512-vpxe60KrbFubY09vlGZqBJdBXs0IqvZmH7+UueFiM0xK/V12lMwxyiNXkFv8+HZ7K8abRevYphVtEzrUWelQhQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@nomicfoundation/slang": "^0.17.0", + "cbor": "^9.0.0", + "chalk": "^4.1.0", + "compare-versions": "^6.0.0", + "debug": "^4.1.1", + "ethereumjs-util": "^7.0.3", + "minimatch": "^9.0.5", + "minimist": "^1.2.7", + "proper-lockfile": "^4.1.1", + "solidity-ast": "^0.4.51" + }, + "bin": { + "openzeppelin-upgrades-core": "dist/cli/cli.js" + } + }, + "node_modules/@openzeppelin/upgrades-core/node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "license": "MIT", + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/@openzeppelin/upgrades-core/node_modules/brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/@openzeppelin/upgrades-core/node_modules/cbor": { + "version": "9.0.2", + "resolved": "https://registry.npmjs.org/cbor/-/cbor-9.0.2.tgz", + "integrity": "sha512-JPypkxsB10s9QOWwa6zwPzqE1Md3vqpPc+cai4sAecuCsRyAtAl/pMyhPlMbT/xtPnm2dznJZYRLui57qiRhaQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "nofilter": "^3.1.0" + }, + "engines": { + "node": ">=16" + } + }, + "node_modules/@openzeppelin/upgrades-core/node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/@openzeppelin/upgrades-core/node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/@openzeppelin/upgrades-core/node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true, + "license": "MIT" + }, + "node_modules/@openzeppelin/upgrades-core/node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/@openzeppelin/upgrades-core/node_modules/minimatch": { + "version": "9.0.5", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz", + "integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/@openzeppelin/upgrades-core/node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "license": "MIT", + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/@scure/base": { "version": "1.1.7", "resolved": "https://registry.npmjs.org/@scure/base/-/base-1.1.7.tgz", @@ -1612,6 +2105,26 @@ "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", "dev": true }, + "node_modules/@smithy/types": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/@smithy/types/-/types-3.3.0.tgz", + "integrity": "sha512-IxvBBCTFDHbVoK7zIxqA1ZOdc4QfM5HM7rGleCuHi7L1wnKv5Pn69xXJQ9hgxH60ZVygH9/JG0jRgtUncE3QUA==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=16.0.0" + } + }, + "node_modules/@smithy/types/node_modules/tslib": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.7.0.tgz", + "integrity": "sha512-gLXCKdN1/j47AiHiOkJN69hJmcbGTHI0ImLmbYLHykhgeN0jVGola9yVjFgzCUklsZQMW55o+dW7IXv3RCXDzA==", + "dev": true, + "license": "0BSD" + }, "node_modules/@solidity-parser/parser": { "version": "0.14.5", "resolved": "https://registry.npmjs.org/@solidity-parser/parser/-/parser-0.14.5.tgz", @@ -1891,6 +2404,20 @@ "url": "https://github.com/sponsors/epoberezkin" } }, + "node_modules/amazon-cognito-identity-js": { + "version": "6.3.12", + "resolved": "https://registry.npmjs.org/amazon-cognito-identity-js/-/amazon-cognito-identity-js-6.3.12.tgz", + "integrity": "sha512-s7NKDZgx336cp+oDeUtB2ZzT8jWJp/v2LWuYl+LQtMEODe22RF1IJ4nRiDATp+rp1pTffCZcm44Quw4jx2bqNg==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@aws-crypto/sha256-js": "1.2.2", + "buffer": "4.9.2", + "fast-base64-decode": "^1.0.0", + "isomorphic-unfetch": "^3.0.0", + "js-cookie": "^2.2.1" + } + }, "node_modules/amdefine": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/amdefine/-/amdefine-1.0.1.tgz", @@ -2053,12 +2580,21 @@ "dev": true, "peer": true }, + "node_modules/async-retry": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/async-retry/-/async-retry-1.3.3.tgz", + "integrity": "sha512-wfr/jstw9xNi/0teMHrRW7dsz3Lt5ARhYNZ2ewpadnhaIp5mbALhOAP+EAdsC7t4Z6wqsDVv9+W6gm1Dk9mEyw==", + "dev": true, + "license": "MIT", + "dependencies": { + "retry": "0.13.1" + } + }, "node_modules/asynckit": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==", - "dev": true, - "peer": true + "dev": true }, "node_modules/at-least-node": { "version": "1.0.0", @@ -2075,7 +2611,6 @@ "resolved": "https://registry.npmjs.org/axios/-/axios-1.7.2.tgz", "integrity": "sha512-2A8QhOMrbomlDuiLeK9XibIBzuHeRcqqNOHp0Cyp5EoJ1IFDh+XZH3A6BkXtv0K4gFGCI0Y4BM7B1wOEi0Rmgw==", "dev": true, - "peer": true, "dependencies": { "follow-redirects": "^1.15.6", "form-data": "^4.0.0", @@ -2104,6 +2639,27 @@ "integrity": "sha512-Z951TWkV5LDzQcRjbhl2Icy3xC+jOuX6UxeAbMW6EMNo0cOpjrZGM9I8uxFztHFuFU95UhhSWP5kAaGPRpj9AA==", "dev": true }, + "node_modules/base64-js": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", + "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" + }, "node_modules/bech32": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/bech32/-/bech32-1.1.4.tgz", @@ -2307,6 +2863,18 @@ "safe-buffer": "^5.1.2" } }, + "node_modules/buffer": { + "version": "4.9.2", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-4.9.2.tgz", + "integrity": "sha512-xq+q3SRMOxGivLhBNaUdC64hDTQwejJ+H0T/NB1XMtTVEwNTrfFF3gAxiyW0Bu/xWEGhjVKgUcMhCrUy2+uCWg==", + "dev": true, + "license": "MIT", + "dependencies": { + "base64-js": "^1.0.2", + "ieee754": "^1.1.4", + "isarray": "^1.0.0" + } + }, "node_modules/buffer-from": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", @@ -2615,7 +3183,6 @@ "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", "dev": true, - "peer": true, "dependencies": { "delayed-stream": "~1.0.0" }, @@ -2687,6 +3254,13 @@ "integrity": "sha512-Gar0ASD4BDyKC4hl4DwHqDrmvjoxWKZigVnAbn5H1owvm4CxCPdb0HQDehwNYMJpla5+M2tPmPARzhtYuwpHow==", "dev": true }, + "node_modules/compare-versions": { + "version": "6.1.1", + "resolved": "https://registry.npmjs.org/compare-versions/-/compare-versions-6.1.1.tgz", + "integrity": "sha512-4hm4VPpIecmlg59CHXnRDnqGplJFrbLG4aFEl5vl6cK1u76ws3LLvX7ikFnTDl5vo39sjWD6AaDPYodJp/NNHg==", + "dev": true, + "license": "MIT" + }, "node_modules/concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", @@ -2891,7 +3465,6 @@ "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", "dev": true, - "peer": true, "engines": { "node": ">=0.4.0" } @@ -3330,7 +3903,6 @@ "resolved": "https://registry.npmjs.org/ethereumjs-util/-/ethereumjs-util-7.1.5.tgz", "integrity": "sha512-SDl5kKrQAudFBUe5OJM9Ac6WmMyYmXX/6sTmLZ3ffG2eY6ZIGBes3pEDxNN6V72WyOw4CPD5RomKdsa8DAAwLg==", "dev": true, - "peer": true, "dependencies": { "@types/bn.js": "^5.1.0", "bn.js": "^5.1.2", @@ -3424,6 +3996,13 @@ "safe-buffer": "^5.1.1" } }, + "node_modules/fast-base64-decode": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fast-base64-decode/-/fast-base64-decode-1.0.0.tgz", + "integrity": "sha512-qwaScUgUGBYeDNRnbc/KyllVU88Jk1pRHPStuF/lO7B0/RTRLj7U0lkdTAutlBblY08rwZDff6tNU9cjv6j//Q==", + "dev": true, + "license": "MIT" + }, "node_modules/fast-deep-equal": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", @@ -3536,7 +4115,6 @@ "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", "dev": true, - "peer": true, "dependencies": { "asynckit": "^0.4.0", "combined-stream": "^1.0.8", @@ -4183,6 +4761,27 @@ "node": ">=0.10.0" } }, + "node_modules/ieee754": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "BSD-3-Clause" + }, "node_modules/ignore": { "version": "5.3.1", "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.1.tgz", @@ -4337,8 +4936,7 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==", - "dev": true, - "peer": true + "dev": true }, "node_modules/isexe": { "version": "2.0.0", @@ -4347,6 +4945,24 @@ "dev": true, "peer": true }, + "node_modules/isomorphic-unfetch": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/isomorphic-unfetch/-/isomorphic-unfetch-3.1.0.tgz", + "integrity": "sha512-geDJjpoZ8N0kWexiwkX8F9NkTsXhetLPVbZFQ+JTW239QNOwvB0gniuR1Wc6f0AMTn7/mFGyXvHTifrCp/GH8Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "node-fetch": "^2.6.1", + "unfetch": "^4.2.0" + } + }, + "node_modules/js-cookie": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/js-cookie/-/js-cookie-2.2.1.tgz", + "integrity": "sha512-HvdH2LzI/EAZcUwA8+0nKNtWHqS+ZmijLA30RwZA0bo7ToCckjK5MkGhjED9KoRcXO6BaGI3I9UIzSA1FKFPOQ==", + "dev": true, + "license": "MIT" + }, "node_modules/js-sha3": { "version": "0.8.0", "resolved": "https://registry.npmjs.org/js-sha3/-/js-sha3-0.8.0.tgz", @@ -4662,7 +5278,6 @@ "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", "dev": true, - "peer": true, "engines": { "node": ">= 0.6" } @@ -4672,7 +5287,6 @@ "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", "dev": true, - "peer": true, "dependencies": { "mime-db": "1.52.0" }, @@ -4709,7 +5323,6 @@ "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", "dev": true, - "peer": true, "funding": { "url": "https://github.com/sponsors/ljharb" } @@ -5012,6 +5625,27 @@ "lodash": "^4.17.21" } }, + "node_modules/node-fetch": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz", + "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==", + "dev": true, + "license": "MIT", + "dependencies": { + "whatwg-url": "^5.0.0" + }, + "engines": { + "node": "4.x || >=6.0.0" + }, + "peerDependencies": { + "encoding": "^0.1.0" + }, + "peerDependenciesMeta": { + "encoding": { + "optional": true + } + } + }, "node_modules/node-gyp-build": { "version": "4.8.1", "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.8.1.tgz", @@ -5028,7 +5662,6 @@ "resolved": "https://registry.npmjs.org/nofilter/-/nofilter-3.1.0.tgz", "integrity": "sha512-l2NNj07e9afPnhAhvgVrCD/oy2Ai1yfLpuo3EpiO1jFTsB4sFz6oIfAfSZyQzVpkZQ9xS8ZS5g1jCBgq4Hwo0g==", "dev": true, - "peer": true, "engines": { "node": ">=12.19" } @@ -5326,12 +5959,33 @@ "asap": "~2.0.6" } }, + "node_modules/proper-lockfile": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/proper-lockfile/-/proper-lockfile-4.1.2.tgz", + "integrity": "sha512-TjNPblN4BwAWMXU8s9AEz4JmQxnD1NNL7bNOY/AKUzyamc379FWASUhc/K1pL2noVb+XmZKLL68cjzLsiOAMaA==", + "dev": true, + "license": "MIT", + "dependencies": { + "graceful-fs": "^4.2.4", + "retry": "^0.12.0", + "signal-exit": "^3.0.2" + } + }, + "node_modules/proper-lockfile/node_modules/retry": { + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/retry/-/retry-0.12.0.tgz", + "integrity": "sha512-9LkiTwjUh6rT555DtE9rTX+BKByPfrMzEAtnlEtdEwr3Nkffwiihqe2bWADg+OQRjt9gl6ICdmB/ZFDCGAtSow==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 4" + } + }, "node_modules/proxy-from-env": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==", - "dev": true, - "peer": true + "dev": true }, "node_modules/punycode": { "version": "2.3.1", @@ -5532,6 +6186,16 @@ "node": ">=4" } }, + "node_modules/retry": { + "version": "0.13.1", + "resolved": "https://registry.npmjs.org/retry/-/retry-0.13.1.tgz", + "integrity": "sha512-XQBQ3I8W1Cge0Seh+6gjj03LbmRFWuoszgK9ooCpwYIrhhoO80pfq4cUkU5DkknwfOfFteRwlZ56PYOGYyFWdg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 4" + } + }, "node_modules/reusify": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", @@ -5873,6 +6537,13 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/signal-exit": { + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", + "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", + "dev": true, + "license": "ISC" + }, "node_modules/slash": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", @@ -5991,6 +6662,13 @@ "semver": "bin/semver" } }, + "node_modules/solidity-ast": { + "version": "0.4.58", + "resolved": "https://registry.npmjs.org/solidity-ast/-/solidity-ast-0.4.58.tgz", + "integrity": "sha512-fiAEDlMEc+xziMn0IpZf2vUbqxyXYZK4BqBiTaz2ZUqOP0p1fdJzUc9xpv74Jdxb5BLAiCUFv5UenkXIpHn3cA==", + "dev": true, + "license": "MIT" + }, "node_modules/solidity-coverage": { "version": "0.8.12", "resolved": "https://registry.npmjs.org/solidity-coverage/-/solidity-coverage-0.8.12.tgz", @@ -6392,6 +7070,13 @@ "node": ">=0.6" } }, + "node_modules/tr46": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", + "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==", + "dev": true, + "license": "MIT" + }, "node_modules/ts-command-line-args": { "version": "2.5.1", "resolved": "https://registry.npmjs.org/ts-command-line-args/-/ts-command-line-args-2.5.1.tgz", @@ -6552,8 +7237,7 @@ "version": "2.4.0", "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.0.tgz", "integrity": "sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ==", - "dev": true, - "peer": true + "dev": true }, "node_modules/tsort": { "version": "0.0.1", @@ -6766,6 +7450,13 @@ "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==", "dev": true }, + "node_modules/unfetch": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/unfetch/-/unfetch-4.2.0.tgz", + "integrity": "sha512-F9p7yYCn6cIW9El1zi0HI6vqpeIvBsr3dSuRO6Xuppb1u5rXpCPmMvLSyECLhybr9isec8Ohl0hPekMVrEinDA==", + "dev": true, + "license": "MIT" + }, "node_modules/universalify": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.1.tgz", @@ -6883,6 +7574,24 @@ "@scure/bip39": "1.3.0" } }, + "node_modules/webidl-conversions": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", + "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==", + "dev": true, + "license": "BSD-2-Clause" + }, + "node_modules/whatwg-url": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", + "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", + "dev": true, + "license": "MIT", + "dependencies": { + "tr46": "~0.0.3", + "webidl-conversions": "^3.0.0" + } + }, "node_modules/which": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", diff --git a/tests/e2e/chains/ethereum/contracts/package.json b/tests/e2e/chains/ethereum/contracts/package.json index f3a1244..6e8b021 100644 --- a/tests/e2e/chains/ethereum/contracts/package.json +++ b/tests/e2e/chains/ethereum/contracts/package.json @@ -8,9 +8,11 @@ }, "license": "TBD", "devDependencies": { - "@hyperledger-labs/yui-ibc-solidity": "git+https://github.com/hyperledger-labs/yui-ibc-solidity.git#v0.3.29", + "@datachainlab/ethereum-ibc-relay-chain": "git+https://github.com/datachainlab/ethereum-ibc-relay-chain.git#semver:v0.3.10", "@datachainlab/lcp-solidity": "git+https://github.com/datachainlab/lcp-solidity.git#v0.1.14", + "@hyperledger-labs/yui-ibc-solidity": "git+https://github.com/hyperledger-labs/yui-ibc-solidity.git#semver:v0.3.35", "@nomicfoundation/hardhat-toolbox": "^4.0.0", + "@openzeppelin/hardhat-upgrades": "^3.2.1", "hardhat": "^2.19.1" } } diff --git a/tests/e2e/chains/ethereum/contracts/scripts/deploy.js b/tests/e2e/chains/ethereum/contracts/scripts/deploy.js index 5c2a3cb..1d956ab 100644 --- a/tests/e2e/chains/ethereum/contracts/scripts/deploy.js +++ b/tests/e2e/chains/ethereum/contracts/scripts/deploy.js @@ -40,7 +40,7 @@ async function deployIBC(deployer) { "IBCChannelPacketSendRecv", "IBCChannelPacketTimeout", "IBCChannelUpgradeInitTryAck", - "IBCChannelUpgradeConfirmTimeoutCancel" + "IBCChannelUpgradeConfirmOpenTimeoutCancel" ]; const logics = []; for (const name of logicNames) { @@ -50,6 +50,64 @@ async function deployIBC(deployer) { return deploy(deployer, "OwnableIBCHandler", logics.map(l => l.target)); } +async function deployProxy(deployer, contractName, constructorArgs, unsafeAllow, initializer, initialArgs) { + const factory = await hre.ethers.getContractFactory(contractName).then(f => f.connect(deployer)); + const proxyOptions /* : DeployProxyOptions */ = { + txOverrides: {}, + unsafeAllow: unsafeAllow ?? [], + constructorArgs, + initializer: initializer ?? false, + redeployImplementation: 'always' + }; + const proxyContract = await upgrades.deployProxy( + factory, + initialArgs ?? [], + proxyOptions + ); + await proxyContract.waitForDeployment(); + return proxyContract.connect(deployer); +} + +async function prepareImplementation(deployer, proxy, contractName, constructorArgs, unsafeAllow) { + const factory = await hre.ethers.getContractFactory(contractName).then(f => f.connect(deployer)); + const implOptions /* : DeployImplementationOptions */ = { + constructorArgs, + txOverrides: {}, + unsafeAllow: unsafeAllow ?? [], + redeployImplementation: 'always', + getTxResponse: true + }; + const tx = await hre.upgrades.prepareUpgrade(proxy, factory, implOptions); + const receipt = await tx.wait(3); + const implContract = await hre.ethers.getContractAt(contractName, receipt.contractAddress); + return implContract.connect(deployer); +} + +async function deployApp(deployer, ibcHandler) { + // const txOverrides = { unsafeAllow: ["constructor"] }; + const unsafeAllow = [ + "constructor", // IBCChannelUpgradableMockApp, IBCMockApp, Ownable + "state-variable-immutable", // ibcHandler + "state-variable-assignment", //closeChannelAllowed + ]; + const proxyV1 = await deployProxy(deployer, "AppV1", [ibcHandler.target], unsafeAllow, "__AppV1_init(string)", ["mockapp-1"]); + saveAddress("AppV1", proxyV1); + + for (let i = 2; i <= 7; i++) { + const contractName = `AppV${i}`; + const impl = await prepareImplementation(deployer, proxyV1, contractName, [ibcHandler.target], unsafeAllow); + saveAddress(contractName, impl); + + await proxyV1.proposeAppVersion(`mockapp-${i}`, { + implementation: impl.target, + initialCalldata: impl.interface.encodeFunctionData(`__${contractName}_init(string)`, [contractName]), + consumed: false, + }).then(tx => tx.wait()); + } + + return proxyV1; +} + async function main() { // This is just a convenience check if (network.name === "hardhat") { @@ -92,10 +150,9 @@ async function main() { saveAddress("LCPClient", lcpClient) await ibcHandler.registerClient(lcpClientType, lcpClient.target); - const mockApp = await deploy(deployer, "MockApp", [ibcHandler.target]); - saveAddress("MockApp", mockApp) + const app = await deployApp(deployer, ibcHandler); - await ibcHandler.bindPort(portMock, mockApp.target); + await ibcHandler.bindPort(portMock, app.target).then(tx => tx.wait()); } if (require.main === module) { diff --git a/tests/e2e/chains/ethereum/scripts/extract-abi.sh b/tests/e2e/chains/ethereum/scripts/extract-abi.sh index afbfb97..0c2fe1d 100755 --- a/tests/e2e/chains/ethereum/scripts/extract-abi.sh +++ b/tests/e2e/chains/ethereum/scripts/extract-abi.sh @@ -6,14 +6,12 @@ ABIS=contracts/abis mkdir -p $ABIS -for f in `find $ARTIFACTS -type d -name '*.sol'` +for soldir in `find $ARTIFACTS -type d -name '*.sol'` do - contract=`basename $f | sed s/\.sol$//` - jsonfile=$f/$contract.json - if [ -e $jsonfile ] - then - abifile=`echo $f | sed "s#^$ARTIFACTS#$ABIS#" | sed s/\.sol$/.json/` + for jsonfile in `find $soldir -type f -name '*.json' ! -name '*.dbg.json'` + do + abifile=`echo $jsonfile | sed "s#^$ARTIFACTS#$ABIS#"` mkdir -p `dirname $abifile` jq .abi $jsonfile > $abifile - fi + done done diff --git a/tests/e2e/chains/tendermint/docker-compose.yml b/tests/e2e/chains/tendermint/docker-compose.yml index 1fe2b86..b1ab8a9 100644 --- a/tests/e2e/chains/tendermint/docker-compose.yml +++ b/tests/e2e/chains/tendermint/docker-compose.yml @@ -8,6 +8,7 @@ services: image: tendermint-chain:latest environment: - LCP_RA_ROOT_CERT_HEX=${LCP_RA_ROOT_CERT_HEX} + - IBC_CHANNEL_UPGRADE_TIMEOUT=480000000000 ports: - 26656:26656 - 26657:26657 diff --git a/tests/e2e/chains/tendermint/go.mod b/tests/e2e/chains/tendermint/go.mod index 2636096..cad2334 100644 --- a/tests/e2e/chains/tendermint/go.mod +++ b/tests/e2e/chains/tendermint/go.mod @@ -6,7 +6,6 @@ require ( cosmossdk.io/api v0.7.3 cosmossdk.io/client/v2 v2.0.0-beta.1 cosmossdk.io/core v0.11.0 - cosmossdk.io/errors v1.0.1 cosmossdk.io/log v1.3.1 cosmossdk.io/store v1.0.2 cosmossdk.io/tools/confix v0.1.0 @@ -21,12 +20,11 @@ require ( github.com/cosmos/gogoproto v1.4.11 github.com/cosmos/ibc-go/modules/capability v1.0.0 github.com/cosmos/ibc-go/v8 v8.2.0 + github.com/datachainlab/ibc-mock-app v0.1.0 github.com/datachainlab/lcp-go v0.2.10 - github.com/grpc-ecosystem/grpc-gateway v1.16.0 github.com/spf13/cast v1.6.0 github.com/spf13/cobra v1.8.0 github.com/spf13/viper v1.18.2 - google.golang.org/grpc v1.62.0 ) require ( @@ -37,6 +35,7 @@ require ( cloud.google.com/go/storage v1.36.0 // indirect cosmossdk.io/collections v0.4.0 // indirect cosmossdk.io/depinject v1.0.0-alpha.4 // indirect + cosmossdk.io/errors v1.0.1 // indirect cosmossdk.io/math v1.3.0 // indirect filippo.io/edwards25519 v1.0.0 // indirect github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect @@ -110,6 +109,7 @@ require ( github.com/gorilla/mux v1.8.1 // indirect github.com/gorilla/websocket v1.5.0 // indirect github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 // indirect + github.com/grpc-ecosystem/grpc-gateway v1.16.0 // indirect github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c // indirect github.com/hashicorp/go-cleanhttp v0.5.2 // indirect github.com/hashicorp/go-getter v1.7.1 // indirect @@ -196,6 +196,7 @@ require ( google.golang.org/genproto v0.0.0-20240213162025-012b6fc9bca9 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20240205150955-31a09d347014 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240221002015-b0ce06bbee7c // indirect + google.golang.org/grpc v1.62.0 // indirect google.golang.org/protobuf v1.33.0 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect diff --git a/tests/e2e/chains/tendermint/go.sum b/tests/e2e/chains/tendermint/go.sum index 52daf67..6ca8c06 100644 --- a/tests/e2e/chains/tendermint/go.sum +++ b/tests/e2e/chains/tendermint/go.sum @@ -388,6 +388,8 @@ github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7Do github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/danieljoos/wincred v1.1.2 h1:QLdCxFs1/Yl4zduvBdcHB8goaYk9RARS2SgLLRuAyr0= github.com/danieljoos/wincred v1.1.2/go.mod h1:GijpziifJoIBfYh+S7BbkdUTU4LfM+QnGqR5Vl2tAx0= +github.com/datachainlab/ibc-mock-app v0.1.0 h1:lWgNj+7JlLsV4fDnp3YGvknRt0dAr8hyoFm1JJRmcWE= +github.com/datachainlab/ibc-mock-app v0.1.0/go.mod h1:wXISY/ZuXJter33Qv7Suul0WMteDP1UlRk+HixIjAHY= github.com/datachainlab/lcp-go v0.2.10 h1:1c8C+HR+tC/4NjCjpuz+Nkk3I/uIQ3PNRcvJKsSU948= github.com/datachainlab/lcp-go v0.2.10/go.mod h1:0ivRb4qUiZz5UQxsbRKygQyFz0XC6TIC6YpEUdOc1So= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= diff --git a/tests/e2e/chains/tendermint/simapp/app.go b/tests/e2e/chains/tendermint/simapp/app.go index 2c505ed..406f6b8 100644 --- a/tests/e2e/chains/tendermint/simapp/app.go +++ b/tests/e2e/chains/tendermint/simapp/app.go @@ -6,6 +6,7 @@ import ( "io" "os" "path/filepath" + "strconv" dbm "github.com/cosmos/cosmos-db" "github.com/cosmos/gogoproto/proto" @@ -136,9 +137,9 @@ import ( lcp "github.com/datachainlab/lcp-go/light-clients/lcp" lcptypes "github.com/datachainlab/lcp-go/light-clients/lcp/types" - "github.com/datachainlab/cosmos-ethereum-ibc-lcp/tests/e2e/chains/tendermint/simapp/mockapp" - mockappkeeper "github.com/datachainlab/cosmos-ethereum-ibc-lcp/tests/e2e/chains/tendermint/simapp/mockapp/keeper" - mockapptypes "github.com/datachainlab/cosmos-ethereum-ibc-lcp/tests/e2e/chains/tendermint/simapp/mockapp/types" + mockapp "github.com/datachainlab/ibc-mock-app" + mockappkeeper "github.com/datachainlab/ibc-mock-app/keeper" + mockapptypes "github.com/datachainlab/ibc-mock-app/types" ) const appName = "SimApp" @@ -420,8 +421,13 @@ func NewSimApp( // set the governance module account as the authority for conducting upgrades app.UpgradeKeeper = upgradekeeper.NewKeeper(skipUpgradeHeights, runtime.NewKVStoreService(keys[upgradetypes.StoreKey]), appCodec, homePath, app.BaseApp, authtypes.NewModuleAddress(govtypes.ModuleName).String()) + ibcAuthority := authtypes.NewModuleAddress(govtypes.ModuleName).String() + if authority, found := os.LookupEnv("IBC_AUTHORITY"); found && len(authority) > 0 { + ibcAuthority = authority + } + ibcKeeper := ibckeeper.NewKeeper( - appCodec, keys[ibcexported.StoreKey], app.GetSubspace(ibcexported.ModuleName), app.StakingKeeper, app.UpgradeKeeper, scopedIBCKeeper, authtypes.NewModuleAddress(govtypes.ModuleName).String(), + appCodec, keys[ibcexported.StoreKey], app.GetSubspace(ibcexported.ModuleName), app.StakingKeeper, app.UpgradeKeeper, scopedIBCKeeper, ibcAuthority, ) // this is a workaround in case the counterparty chain uses mock-client app.IBCKeeper = overrideIBCClientKeeper(*ibcKeeper, appCodec, keys[ibcexported.StoreKey], app.GetSubspace(ibcexported.ModuleName)) @@ -891,8 +897,16 @@ func (app *SimApp) InitChainer(ctx sdk.Context, req *abci.RequestInitChain) (*ab ibcGenesisState.ClientGenesis.Params.AllowedClients = append( ibcGenesisState.ClientGenesis.Params.AllowedClients, lcptypes.ClientTypeLCP) - genesisState[ibcexported.ModuleName] = app.appCodec.MustMarshalJSON(&ibcGenesisState) + + } + if upgTimeout, found := os.LookupEnv("IBC_CHANNEL_UPGRADE_TIMEOUT"); found && len(upgTimeout) > 0 { + upgTimeoutTimestampNsec, err := strconv.ParseInt(upgTimeout, 10, 64) + if err != nil { + panic(err) + } + ibcGenesisState.ChannelGenesis.Params.UpgradeTimeout.Timestamp = uint64(upgTimeoutTimestampNsec) } + genesisState[ibcexported.ModuleName] = app.appCodec.MustMarshalJSON(&ibcGenesisState) } if err := app.UpgradeKeeper.SetModuleVersionMap(ctx, app.ModuleManager.GetVersionMap()); err != nil { diff --git a/tests/e2e/chains/tendermint/simapp/entrypoint.sh b/tests/e2e/chains/tendermint/simapp/entrypoint.sh index 0aafae3..1b32eb6 100755 --- a/tests/e2e/chains/tendermint/simapp/entrypoint.sh +++ b/tests/e2e/chains/tendermint/simapp/entrypoint.sh @@ -1,4 +1,11 @@ #!/bin/sh set -x +if [ -z "$IBC_AUTHORITY" ] +then + export IBC_AUTHORITY=`jq -r .address ${CHAINDIR}/${CHAINID}/key_seed.json` +else + unset IBC_AUTHORITY +fi + simd --home ${CHAINDIR}/${CHAINID} start --pruning=nothing diff --git a/tests/e2e/chains/tendermint/simapp/mockapp/client/cli/cli.go b/tests/e2e/chains/tendermint/simapp/mockapp/client/cli/cli.go deleted file mode 100644 index 39883f2..0000000 --- a/tests/e2e/chains/tendermint/simapp/mockapp/client/cli/cli.go +++ /dev/null @@ -1,23 +0,0 @@ -package cli - -import ( - "github.com/cosmos/cosmos-sdk/client" - "github.com/spf13/cobra" -) - -// NewTxCmd returns the transaction commands for IBC fungible token transfer -func NewTxCmd() *cobra.Command { - txCmd := &cobra.Command{ - Use: "mockapp", - Short: "IBC MockApp transaction subcommands", - DisableFlagParsing: true, - SuggestionsMinimumDistance: 2, - RunE: client.ValidateCmd, - } - - txCmd.AddCommand( - NewSendPacketTxCmd(), - ) - - return txCmd -} diff --git a/tests/e2e/chains/tendermint/simapp/mockapp/client/cli/tx.go b/tests/e2e/chains/tendermint/simapp/mockapp/client/cli/tx.go deleted file mode 100644 index cbe7034..0000000 --- a/tests/e2e/chains/tendermint/simapp/mockapp/client/cli/tx.go +++ /dev/null @@ -1,104 +0,0 @@ -package cli - -import ( - "errors" - "time" - - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/cosmos/cosmos-sdk/client/tx" - "github.com/spf13/cobra" - - clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" - channelutils "github.com/cosmos/ibc-go/v8/modules/core/04-channel/client/utils" - - "github.com/datachainlab/cosmos-ethereum-ibc-lcp/tests/e2e/chains/tendermint/simapp/mockapp/types" -) - -const ( - flagPacketTimeoutHeight = "packet-timeout-height" - flagPacketTimeoutTimestamp = "packet-timeout-timestamp" - flagAbsoluteTimeouts = "absolute-timeouts" -) - -func NewSendPacketTxCmd() *cobra.Command { - cmd := &cobra.Command{ - Use: "send [src-port] [src-channel] [message]", - Short: "Send an arbitrary message through IBC", - Args: cobra.ExactArgs(3), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, err := client.GetClientTxContext(cmd) - if err != nil { - return err - } - sender := clientCtx.GetFromAddress().String() - srcPort := args[0] - srcChannel := args[1] - message := args[2] - - timeoutHeightStr, err := cmd.Flags().GetString(flagPacketTimeoutHeight) - if err != nil { - return err - } - timeoutHeight, err := clienttypes.ParseHeight(timeoutHeightStr) - if err != nil { - return err - } - - timeoutTimestamp, err := cmd.Flags().GetUint64(flagPacketTimeoutTimestamp) - if err != nil { - return err - } - - absoluteTimeouts, err := cmd.Flags().GetBool(flagAbsoluteTimeouts) - if err != nil { - return err - } - - // if the timeouts are not absolute, retrieve latest block height and block timestamp - // for the consensus state connected to the destination port/channel - if !absoluteTimeouts { - consensusState, height, _, err := channelutils.QueryLatestConsensusState(clientCtx, srcPort, srcChannel) - if err != nil { - return err - } - - if !timeoutHeight.IsZero() { - absoluteHeight := height - absoluteHeight.RevisionNumber += timeoutHeight.RevisionNumber - absoluteHeight.RevisionHeight += timeoutHeight.RevisionHeight - timeoutHeight = absoluteHeight - } - - if timeoutTimestamp != 0 { - // use local clock time as reference time if it is later than the - // consensus state timestamp of the counter party chain, otherwise - // still use consensus state timestamp as reference - now := time.Now().UnixNano() - consensusStateTimestamp := consensusState.GetTimestamp() - if now > 0 { - now := uint64(now) - if now > consensusStateTimestamp { - timeoutTimestamp = now + timeoutTimestamp - } else { - timeoutTimestamp = consensusStateTimestamp + timeoutTimestamp - } - } else { - return errors.New("local clock time is not greater than Jan 1st, 1970 12:00 AM") - } - } - } - msg := types.NewMsgSendPacket( - srcPort, srcChannel, sender, message, timeoutHeight, timeoutTimestamp, - ) - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) - }, - } - - cmd.Flags().String(flagPacketTimeoutHeight, types.DefaultRelativePacketTimeoutHeight, "Packet timeout block height. The timeout is disabled when set to 0-0.") - cmd.Flags().Uint64(flagPacketTimeoutTimestamp, types.DefaultRelativePacketTimeoutTimestamp, "Packet timeout timestamp in nanoseconds from now. Default is 10 minutes. The timeout is disabled when set to 0.") - cmd.Flags().Bool(flagAbsoluteTimeouts, false, "Timeout flags are used as absolute timeouts.") - flags.AddTxFlagsToCmd(cmd) - - return cmd -} diff --git a/tests/e2e/chains/tendermint/simapp/mockapp/ibc_module.go b/tests/e2e/chains/tendermint/simapp/mockapp/ibc_module.go deleted file mode 100644 index 29d2186..0000000 --- a/tests/e2e/chains/tendermint/simapp/mockapp/ibc_module.go +++ /dev/null @@ -1,182 +0,0 @@ -package mockapp - -import ( - "bytes" - "fmt" - "strings" - - errorsmod "cosmossdk.io/errors" - sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" - - channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" - porttypes "github.com/cosmos/ibc-go/v8/modules/core/05-port/types" - host "github.com/cosmos/ibc-go/v8/modules/core/24-host" - ibcexported "github.com/cosmos/ibc-go/v8/modules/core/exported" - "github.com/datachainlab/cosmos-ethereum-ibc-lcp/tests/e2e/chains/tendermint/simapp/mockapp/keeper" - "github.com/datachainlab/cosmos-ethereum-ibc-lcp/tests/e2e/chains/tendermint/simapp/mockapp/types" -) - -// IBCModule implements the ICS26 interface for mockapp given the mockapp keeper. -type IBCModule struct { - keeper keeper.Keeper -} - -// NewIBCModule creates a new IBCModule given the keeper -func NewIBCModule(k keeper.Keeper) IBCModule { - return IBCModule{ - keeper: k, - } -} - -// ValidateChannelParams does validation of a newly created mockapp channel. -func ValidateChannelParams( - ctx sdk.Context, - keeper keeper.Keeper, - order channeltypes.Order, - portID string, - channelID string, -) error { - // Require portID is the portID transfer module is bound to - boundPort := keeper.GetPort(ctx) - if boundPort != portID { - return errorsmod.Wrapf(porttypes.ErrInvalidPort, "invalid port: %s, expected %s", portID, boundPort) - } - - return nil -} - -// OnChanOpenInit implements the IBCModule interface -func (im IBCModule) OnChanOpenInit( - ctx sdk.Context, - order channeltypes.Order, - connectionHops []string, - portID string, - channelID string, - chanCap *capabilitytypes.Capability, - counterparty channeltypes.Counterparty, - version string, -) (string, error) { - if err := ValidateChannelParams(ctx, im.keeper, order, portID, channelID); err != nil { - return "", err - } - - if strings.TrimSpace(version) == "" { - version = types.Version - } - - if version != types.Version { - return "", errorsmod.Wrapf(types.ErrInvalidVersion, "got %s, expected %s", version, types.Version) - } - - // Claim channel capability passed back by IBC module - if err := im.keeper.ClaimCapability(ctx, chanCap, host.ChannelCapabilityPath(portID, channelID)); err != nil { - return "", err - } - - return version, nil -} - -// OnChanOpenTry implements the IBCModule interface. -func (im IBCModule) OnChanOpenTry( - ctx sdk.Context, - order channeltypes.Order, - connectionHops []string, - portID, - channelID string, - chanCap *capabilitytypes.Capability, - counterparty channeltypes.Counterparty, - counterpartyVersion string, -) (string, error) { - if err := ValidateChannelParams(ctx, im.keeper, order, portID, channelID); err != nil { - return "", err - } - - if counterpartyVersion != types.Version { - return "", errorsmod.Wrapf(types.ErrInvalidVersion, "invalid counterparty version: got: %s, expected %s", counterpartyVersion, types.Version) - } - - // OpenTry must claim the channelCapability that IBC passes into the callback - if err := im.keeper.ClaimCapability(ctx, chanCap, host.ChannelCapabilityPath(portID, channelID)); err != nil { - return "", err - } - - return types.Version, nil -} - -// OnChanOpenAck implements the IBCModule interface -func (im IBCModule) OnChanOpenAck( - ctx sdk.Context, - portID, - channelID string, - _ string, - counterpartyVersion string, -) error { - if counterpartyVersion != types.Version { - return errorsmod.Wrapf(types.ErrInvalidVersion, "invalid counterparty version: %s, expected %s", counterpartyVersion, types.Version) - } - return nil -} - -// OnChanOpenConfirm implements the IBCModule interface -func (im IBCModule) OnChanOpenConfirm( - ctx sdk.Context, - portID, - channelID string, -) error { - return nil -} - -// OnChanCloseInit implements the IBCModule interface -func (im IBCModule) OnChanCloseInit( - ctx sdk.Context, - portID, - channelID string, -) error { - // Disallow user-initiated channel closing for transfer channels - return errorsmod.Wrap(sdkerrors.ErrInvalidRequest, "user cannot close channel") -} - -// OnChanCloseConfirm implements the IBCModule interface -func (im IBCModule) OnChanCloseConfirm( - ctx sdk.Context, - portID, - channelID string, -) error { - return nil -} - -// OnRecvPacket implements the IBCModule interface. A successful acknowledgement -// is returned if the packet data is successfully decoded and the receive application -// logic returns without error. -func (im IBCModule) OnRecvPacket( - ctx sdk.Context, - packet channeltypes.Packet, - relayer sdk.AccAddress, -) ibcexported.Acknowledgement { - return types.NewAcknowledgement(packet.GetData()) -} - -// OnAcknowledgementPacket implements the IBCModule interface -func (im IBCModule) OnAcknowledgementPacket( - ctx sdk.Context, - packet channeltypes.Packet, - acknowledgement []byte, - relayer sdk.AccAddress, -) error { - if bytes.Equal(packet.GetData(), acknowledgement) { - return nil - } else { - return fmt.Errorf("unexpected acknowledgement: expected=%v actual=%v", packet.GetData(), acknowledgement) - } -} - -// OnTimeoutPacket implements the IBCModule interface -func (im IBCModule) OnTimeoutPacket( - ctx sdk.Context, - packet channeltypes.Packet, - relayer sdk.AccAddress, -) error { - return nil -} diff --git a/tests/e2e/chains/tendermint/simapp/mockapp/keeper/genesis.go b/tests/e2e/chains/tendermint/simapp/mockapp/keeper/genesis.go deleted file mode 100644 index d1a9ffb..0000000 --- a/tests/e2e/chains/tendermint/simapp/mockapp/keeper/genesis.go +++ /dev/null @@ -1,31 +0,0 @@ -package keeper - -import ( - "fmt" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/datachainlab/cosmos-ethereum-ibc-lcp/tests/e2e/chains/tendermint/simapp/mockapp/types" -) - -// InitGenesis initializes the ibc-transfer state and binds to PortID. -func (k Keeper) InitGenesis(ctx sdk.Context, state types.GenesisState) { - k.SetPort(ctx, state.PortId) - - // Only try to bind to port if it is not already bound, since we may already own - // port capability from capability InitGenesis - if !k.IsBound(ctx, state.PortId) { - // transfer module binds to the transfer port on InitChain - // and claims the returned capability - err := k.BindPort(ctx, state.PortId) - if err != nil { - panic(fmt.Sprintf("could not claim port capability: %v", err)) - } - } -} - -// ExportGenesis exports ibc-transfer module's portID and denom trace info into its genesis state. -func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState { - return &types.GenesisState{ - PortId: k.GetPort(ctx), - } -} diff --git a/tests/e2e/chains/tendermint/simapp/mockapp/keeper/keeper.go b/tests/e2e/chains/tendermint/simapp/mockapp/keeper/keeper.go deleted file mode 100644 index cd83f48..0000000 --- a/tests/e2e/chains/tendermint/simapp/mockapp/keeper/keeper.go +++ /dev/null @@ -1,73 +0,0 @@ -package keeper - -import ( - storetypes "cosmossdk.io/store/types" - "github.com/cosmos/cosmos-sdk/codec" - sdk "github.com/cosmos/cosmos-sdk/types" - capabilitykeeper "github.com/cosmos/ibc-go/modules/capability/keeper" - capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" - - host "github.com/cosmos/ibc-go/v8/modules/core/24-host" - "github.com/datachainlab/cosmos-ethereum-ibc-lcp/tests/e2e/chains/tendermint/simapp/mockapp/types" -) - -type Keeper struct { - storeKey storetypes.StoreKey - cdc codec.BinaryCodec - - channelKeeper types.ChannelKeeper - ics4Wrapper types.ICS4Wrapper - portKeeper types.PortKeeper - scopedKeeper capabilitykeeper.ScopedKeeper -} - -func NewKeeper( - cdc codec.BinaryCodec, key storetypes.StoreKey, - channelKeeper types.ChannelKeeper, ics4Wrapper types.ICS4Wrapper, portKeeper types.PortKeeper, - scopedKeeper capabilitykeeper.ScopedKeeper, -) Keeper { - return Keeper{ - cdc: cdc, - storeKey: key, - channelKeeper: channelKeeper, - ics4Wrapper: ics4Wrapper, - portKeeper: portKeeper, - scopedKeeper: scopedKeeper, - } -} - -// IsBound checks if the IBC app module is already bound to the desired port -func (k Keeper) IsBound(ctx sdk.Context, portID string) bool { - _, ok := k.scopedKeeper.GetCapability(ctx, host.PortPath(portID)) - return ok -} - -// BindPort defines a wrapper function for the port Keeper's function in -// order to expose it to module's InitGenesis function -func (k Keeper) BindPort(ctx sdk.Context, portID string) error { - cap := k.portKeeper.BindPort(ctx, portID) - return k.ClaimCapability(ctx, cap, host.PortPath(portID)) -} - -// GetPort returns the portID for the IBC app module. Used in ExportGenesis -func (k Keeper) GetPort(ctx sdk.Context) string { - store := ctx.KVStore(k.storeKey) - return string(store.Get(types.PortKey)) -} - -// SetPort sets the portID for the IBC app module. Used in InitGenesis -func (k Keeper) SetPort(ctx sdk.Context, portID string) { - store := ctx.KVStore(k.storeKey) - store.Set(types.PortKey, []byte(portID)) -} - -// AuthenticateCapability wraps the scopedKeeper's AuthenticateCapability function -func (k Keeper) AuthenticateCapability(ctx sdk.Context, cap *capabilitytypes.Capability, name string) bool { - return k.scopedKeeper.AuthenticateCapability(ctx, cap, name) -} - -// ClaimCapability allows the IBC app module to claim a capability that core IBC -// passes to it -func (k Keeper) ClaimCapability(ctx sdk.Context, cap *capabilitytypes.Capability, name string) error { - return k.scopedKeeper.ClaimCapability(ctx, cap, name) -} diff --git a/tests/e2e/chains/tendermint/simapp/mockapp/keeper/msg_server.go b/tests/e2e/chains/tendermint/simapp/mockapp/keeper/msg_server.go deleted file mode 100644 index 9029278..0000000 --- a/tests/e2e/chains/tendermint/simapp/mockapp/keeper/msg_server.go +++ /dev/null @@ -1,27 +0,0 @@ -package keeper - -import ( - "context" - - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/datachainlab/cosmos-ethereum-ibc-lcp/tests/e2e/chains/tendermint/simapp/mockapp/types" -) - -var _ types.MsgServer = Keeper{} - -// Transfer defines a rpc handler method for MsgTransfer. -func (k Keeper) SendPacket(goCtx context.Context, msg *types.MsgSendPacket) (*types.MsgSendPacketResponse, error) { - ctx := sdk.UnwrapSDKContext(goCtx) - - sender, err := sdk.AccAddressFromBech32(msg.Sender) - if err != nil { - return nil, err - } - - if err := k.sendPacket(ctx, msg.SourcePort, msg.SourceChannel, msg.Message, sender, msg.TimeoutHeight, msg.TimeoutTimestamp); err != nil { - return nil, err - } - - return &types.MsgSendPacketResponse{}, nil -} diff --git a/tests/e2e/chains/tendermint/simapp/mockapp/keeper/relay.go b/tests/e2e/chains/tendermint/simapp/mockapp/keeper/relay.go deleted file mode 100644 index 8d11cb3..0000000 --- a/tests/e2e/chains/tendermint/simapp/mockapp/keeper/relay.go +++ /dev/null @@ -1,37 +0,0 @@ -package keeper - -import ( - errorsmod "cosmossdk.io/errors" - sdk "github.com/cosmos/cosmos-sdk/types" - - clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" - channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" - host "github.com/cosmos/ibc-go/v8/modules/core/24-host" -) - -func (k Keeper) sendPacket( - ctx sdk.Context, - sourcePort, - sourceChannel string, - message string, - sender sdk.AccAddress, - timeoutHeight clienttypes.Height, - timeoutTimestamp uint64, -) error { - // begin createOutgoingPacket logic - // See spec for this logic: https://github.com/cosmos/ibc/tree/master/spec/app/ics-020-fungible-token-transfer#packet-relay - channelCap, ok := k.scopedKeeper.GetCapability(ctx, host.ChannelCapabilityPath(sourcePort, sourceChannel)) - if !ok { - return errorsmod.Wrap(channeltypes.ErrChannelCapabilityNotFound, "module does not own channel capability") - } - - _, err := k.ics4Wrapper.SendPacket( - ctx, - channelCap, - sourcePort, - sourceChannel, - timeoutHeight, - timeoutTimestamp, - []byte(message)) - return err -} diff --git a/tests/e2e/chains/tendermint/simapp/mockapp/module.go b/tests/e2e/chains/tendermint/simapp/mockapp/module.go deleted file mode 100644 index d7bcf17..0000000 --- a/tests/e2e/chains/tendermint/simapp/mockapp/module.go +++ /dev/null @@ -1,161 +0,0 @@ -package mockapp - -import ( - "encoding/json" - "fmt" - - "github.com/grpc-ecosystem/grpc-gateway/runtime" - "github.com/spf13/cobra" - - "cosmossdk.io/core/appmodule" - - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/codec" - codectypes "github.com/cosmos/cosmos-sdk/codec/types" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/module" - simtypes "github.com/cosmos/cosmos-sdk/types/simulation" - - porttypes "github.com/cosmos/ibc-go/v8/modules/core/05-port/types" - - "github.com/datachainlab/cosmos-ethereum-ibc-lcp/tests/e2e/chains/tendermint/simapp/mockapp/client/cli" - "github.com/datachainlab/cosmos-ethereum-ibc-lcp/tests/e2e/chains/tendermint/simapp/mockapp/keeper" - "github.com/datachainlab/cosmos-ethereum-ibc-lcp/tests/e2e/chains/tendermint/simapp/mockapp/types" -) - -var ( - _ module.AppModule = (*AppModule)(nil) - _ module.AppModuleBasic = (*AppModuleBasic)(nil) - _ module.AppModuleSimulation = (*AppModule)(nil) - _ module.HasGenesis = (*AppModule)(nil) - _ module.HasName = (*AppModule)(nil) - _ module.HasConsensusVersion = (*AppModule)(nil) - _ module.HasInvariants = (*AppModule)(nil) - _ module.HasServices = (*AppModule)(nil) - _ module.HasProposalMsgs = (*AppModule)(nil) - _ appmodule.AppModule = (*AppModule)(nil) - - _ porttypes.IBCModule = (*IBCModule)(nil) -) - -// AppModuleBasic is the Mock App AppModuleBasic -type AppModuleBasic struct{} - -// Name implements AppModuleBasic interface -func (AppModuleBasic) Name() string { - return "mockapp" -} - -// IsOnePerModuleType implements the depinject.OnePerModuleType interface. -func (AppModule) IsOnePerModuleType() {} - -// IsAppModule implements the appmodule.AppModule interface. -func (AppModule) IsAppModule() {} - -// RegisterLegacyAminoCodec implements AppModuleBasic interface -func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { - types.RegisterLegacyAminoCodec(cdc) -} - -// RegisterInterfaces registers module concrete types into protobuf Any. -func (AppModuleBasic) RegisterInterfaces(registry codectypes.InterfaceRegistry) { - types.RegisterInterfaces(registry) -} - -// DefaultGenesis returns default genesis state as raw bytes for the mock -// app module. -func (AppModuleBasic) DefaultGenesis(_ codec.JSONCodec) json.RawMessage { - bz, err := json.Marshal(types.DefaultGenesisState()) - if err != nil { - panic(err) - } - return bz -} - -// ValidateGenesis performs genesis state validation for the mock app module. -func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncodingConfig, bz json.RawMessage) error { - var gs types.GenesisState - if err := json.Unmarshal(bz, &gs); err != nil { - return fmt.Errorf("failed to unmarshal %s genesis state: %w", types.ModuleName, err) - } - - return gs.Validate() -} - -// RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the mock app module. -func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux) {} - -// GetTxCmd implements AppModuleBasic interface -func (AppModuleBasic) GetTxCmd() *cobra.Command { - return cli.NewTxCmd() -} - -// GetQueryCmd implements AppModuleBasic interface -func (AppModuleBasic) GetQueryCmd() *cobra.Command { - return nil -} - -// AppModule represents the AppModule for this module -type AppModule struct { - AppModuleBasic - keeper keeper.Keeper -} - -// NewAppModule creates a new mockapp module -func NewAppModule(k keeper.Keeper) AppModule { - return AppModule{ - keeper: k, - } -} - -// RegisterInvariants implements the AppModule interface -func (AppModule) RegisterInvariants(ir sdk.InvariantRegistry) { - // TODO -} - -// RegisterServices registers module services. -func (am AppModule) RegisterServices(cfg module.Configurator) { - types.RegisterMsgServer(cfg.MsgServer(), am.keeper) -} - -// InitGenesis performs genesis initialization for the mock app module. It returns -// no validator updates. -func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, data json.RawMessage) { - var genesisState types.GenesisState - if err := json.Unmarshal(data, &genesisState); err != nil { - panic(err) - } - am.keeper.InitGenesis(ctx, genesisState) -} - -// ExportGenesis returns the exported genesis state as raw bytes for the mock app -// module. -func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.RawMessage { - gs := am.keeper.ExportGenesis(ctx) - bz, err := json.Marshal(gs) - if err != nil { - panic(err) - } - return bz -} - -// ConsensusVersion implements AppModule/ConsensusVersion defining the current version of mock app. -func (AppModule) ConsensusVersion() uint64 { return 2 } - -// AppModuleSimulation functions - -// GenerateGenesisState creates a randomized GenState of the mock app module. -func (AppModule) GenerateGenesisState(simState *module.SimulationState) {} - -// ProposalMsgs doesn't return any msgs for governance proposals. -func (AppModule) ProposalMsgs(simState module.SimulationState) []simtypes.WeightedProposalMsg { - return nil -} - -// RegisterStoreDecoder registers a decoder for mock app module's types -func (am AppModule) RegisterStoreDecoder(_ simtypes.StoreDecoderRegistry) {} - -// WeightedOperations returns the all the mock app module operations with their respective weights. -func (am AppModule) WeightedOperations(_ module.SimulationState) []simtypes.WeightedOperation { - return nil -} diff --git a/tests/e2e/chains/tendermint/simapp/mockapp/types/codec.go b/tests/e2e/chains/tendermint/simapp/mockapp/types/codec.go deleted file mode 100644 index ef1e3b2..0000000 --- a/tests/e2e/chains/tendermint/simapp/mockapp/types/codec.go +++ /dev/null @@ -1,41 +0,0 @@ -package types - -import ( - "github.com/cosmos/cosmos-sdk/codec" - codectypes "github.com/cosmos/cosmos-sdk/codec/types" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/msgservice" -) - -// RegisterLegacyAminoCodec registers the necessary x/ibc transfer interfaces and concrete types -// on the provided LegacyAmino codec. These types are used for Amino JSON serialization. -func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { - cdc.RegisterConcrete(&MsgSendPacket{}, "cosmos-sdk/MsgSendPacket", nil) -} - -// RegisterInterfaces register the ibc transfer module interfaces to protobuf -// Any. -func RegisterInterfaces(registry codectypes.InterfaceRegistry) { - registry.RegisterImplementations((*sdk.Msg)(nil), &MsgSendPacket{}) - - msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) -} - -var ( - amino = codec.NewLegacyAmino() - - // ModuleCdc references the global x/ibc-transfer module codec. Note, the codec - // should ONLY be used in certain instances of tests and for JSON encoding. - // - // The actual codec used for serialization should be provided to x/ibc transfer and - // defined at the application level. - ModuleCdc = codec.NewProtoCodec(codectypes.NewInterfaceRegistry()) - - // AminoCdc is a amino codec created to support amino json compatible msgs. - AminoCdc = codec.NewAminoCodec(amino) -) - -func init() { - RegisterLegacyAminoCodec(amino) - amino.Seal() -} diff --git a/tests/e2e/chains/tendermint/simapp/mockapp/types/errors.go b/tests/e2e/chains/tendermint/simapp/mockapp/types/errors.go deleted file mode 100644 index e0f22b6..0000000 --- a/tests/e2e/chains/tendermint/simapp/mockapp/types/errors.go +++ /dev/null @@ -1,17 +0,0 @@ -package types - -import ( - errorsmod "cosmossdk.io/errors" -) - -// IBC transfer sentinel errors -var ( - ErrInvalidPacketTimeout = errorsmod.Register(ModuleName, 2, "invalid packet timeout") - ErrInvalidDenomForTransfer = errorsmod.Register(ModuleName, 3, "invalid denomination for cross-chain transfer") - ErrInvalidVersion = errorsmod.Register(ModuleName, 4, "invalid ICS20 version") - ErrInvalidAmount = errorsmod.Register(ModuleName, 5, "invalid token amount") - ErrTraceNotFound = errorsmod.Register(ModuleName, 6, "denomination trace not found") - ErrSendDisabled = errorsmod.Register(ModuleName, 7, "fungible token transfers from this chain are disabled") - ErrReceiveDisabled = errorsmod.Register(ModuleName, 8, "fungible token transfers to this chain are disabled") - ErrMaxTransferChannels = errorsmod.Register(ModuleName, 9, "max transfer channels") -) diff --git a/tests/e2e/chains/tendermint/simapp/mockapp/types/expected_keepers.go b/tests/e2e/chains/tendermint/simapp/mockapp/types/expected_keepers.go deleted file mode 100644 index 0827e93..0000000 --- a/tests/e2e/chains/tendermint/simapp/mockapp/types/expected_keepers.go +++ /dev/null @@ -1,45 +0,0 @@ -package types - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" - - clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" - connectiontypes "github.com/cosmos/ibc-go/v8/modules/core/03-connection/types" - channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" - ibcexported "github.com/cosmos/ibc-go/v8/modules/core/exported" -) - -// ICS4Wrapper defines the expected ICS4Wrapper for middleware -type ICS4Wrapper interface { - SendPacket( - ctx sdk.Context, - chanCap *capabilitytypes.Capability, - sourcePort string, - sourceChannel string, - timeoutHeight clienttypes.Height, - timeoutTimestamp uint64, - data []byte, - ) (sequence uint64, err error) -} - -// ChannelKeeper defines the expected IBC channel keeper -type ChannelKeeper interface { - GetChannel(ctx sdk.Context, srcPort, srcChan string) (channel channeltypes.Channel, found bool) - GetNextSequenceSend(ctx sdk.Context, portID, channelID string) (uint64, bool) -} - -// ClientKeeper defines the expected IBC client keeper -type ClientKeeper interface { - GetClientConsensusState(ctx sdk.Context, clientID string) (connection ibcexported.ConsensusState, found bool) -} - -// ConnectionKeeper defines the expected IBC connection keeper -type ConnectionKeeper interface { - GetConnection(ctx sdk.Context, connectionID string) (connection connectiontypes.ConnectionEnd, found bool) -} - -// PortKeeper defines the expected IBC port keeper -type PortKeeper interface { - BindPort(ctx sdk.Context, portID string) *capabilitytypes.Capability -} diff --git a/tests/e2e/chains/tendermint/simapp/mockapp/types/genesis.go b/tests/e2e/chains/tendermint/simapp/mockapp/types/genesis.go deleted file mode 100644 index bc541cb..0000000 --- a/tests/e2e/chains/tendermint/simapp/mockapp/types/genesis.go +++ /dev/null @@ -1,29 +0,0 @@ -package types - -import ( - host "github.com/cosmos/ibc-go/v8/modules/core/24-host" -) - -type GenesisState struct { - PortId string `json:"port_id,omitempty"` -} - -// NewGenesisState creates a new ibc-transfer GenesisState instance. -func NewGenesisState(portID string) *GenesisState { - return &GenesisState{ - PortId: portID, - } -} - -// DefaultGenesisState returns a GenesisState with "transfer" as the default PortID. -func DefaultGenesisState() *GenesisState { - return &GenesisState{ - PortId: PortID, - } -} - -// Validate performs basic genesis state validation returning an error upon any -// failure. -func (gs GenesisState) Validate() error { - return host.PortIdentifierValidator(gs.PortId) -} diff --git a/tests/e2e/chains/tendermint/simapp/mockapp/types/keys.go b/tests/e2e/chains/tendermint/simapp/mockapp/types/keys.go deleted file mode 100644 index a473423..0000000 --- a/tests/e2e/chains/tendermint/simapp/mockapp/types/keys.go +++ /dev/null @@ -1,27 +0,0 @@ -package types - -const ( - // ModuleName defines the IBC transfer name - ModuleName = "mockapp" - - // Version defines the current version the IBC tranfer - // module supports - Version = "mockapp-1" - - // PortID is the default port id that transfer module binds to - PortID = "mockapp" - - // StoreKey is the store key string for IBC transfer - StoreKey = ModuleName - - // RouterKey is the message route for IBC transfer - RouterKey = ModuleName - - // QuerierRoute is the querier route for IBC transfer - QuerierRoute = ModuleName -) - -var ( - // PortKey defines the key to store the port ID in store - PortKey = []byte{0x01} -) diff --git a/tests/e2e/chains/tendermint/simapp/mockapp/types/msgs.go b/tests/e2e/chains/tendermint/simapp/mockapp/types/msgs.go deleted file mode 100644 index f7209b0..0000000 --- a/tests/e2e/chains/tendermint/simapp/mockapp/types/msgs.go +++ /dev/null @@ -1,76 +0,0 @@ -package types - -import ( - errorsmod "cosmossdk.io/errors" - sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - - clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" - host "github.com/cosmos/ibc-go/v8/modules/core/24-host" -) - -// msg types -const ( - TypeMsgSendPacket = "sendpacket" -) - -// NewMsgTransfer creates a new MsgTransfer instance -// -//nolint:interfacer -func NewMsgSendPacket( - sourcePort, sourceChannel string, sender string, - message string, - timeoutHeight clienttypes.Height, timeoutTimestamp uint64, -) *MsgSendPacket { - return &MsgSendPacket{ - SourcePort: sourcePort, - SourceChannel: sourceChannel, - Message: message, - Sender: sender, - TimeoutHeight: timeoutHeight, - TimeoutTimestamp: timeoutTimestamp, - } -} - -// Route implements sdk.Msg -func (MsgSendPacket) Route() string { - return RouterKey -} - -// Type implements sdk.Msg -func (MsgSendPacket) Type() string { - return TypeMsgSendPacket -} - -// ValidateBasic performs a basic check of the MsgTransfer fields. -// NOTE: timeout height or timestamp values can be 0 to disable the timeout. -// NOTE: The recipient addresses format is not validated as the format defined by -// the chain is not known to IBC. -func (msg MsgSendPacket) ValidateBasic() error { - if err := host.PortIdentifierValidator(msg.SourcePort); err != nil { - return errorsmod.Wrap(err, "invalid source port ID") - } - if err := host.ChannelIdentifierValidator(msg.SourceChannel); err != nil { - return errorsmod.Wrap(err, "invalid source channel ID") - } - // NOTE: sender format must be validated as it is required by the GetSigners function. - _, err := sdk.AccAddressFromBech32(msg.Sender) - if err != nil { - return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "string could not be parsed as address: %v", err) - } - return nil -} - -// GetSignBytes implements sdk.Msg. -func (msg MsgSendPacket) GetSignBytes() []byte { - return sdk.MustSortJSON(AminoCdc.MustMarshalJSON(&msg)) -} - -// GetSigners implements sdk.Msg -func (msg MsgSendPacket) GetSigners() []sdk.AccAddress { - signer, err := sdk.AccAddressFromBech32(msg.Sender) - if err != nil { - panic(err) - } - return []sdk.AccAddress{signer} -} diff --git a/tests/e2e/chains/tendermint/simapp/mockapp/types/packet.go b/tests/e2e/chains/tendermint/simapp/mockapp/types/packet.go deleted file mode 100644 index 51254dd..0000000 --- a/tests/e2e/chains/tendermint/simapp/mockapp/types/packet.go +++ /dev/null @@ -1,16 +0,0 @@ -package types - -import "time" - -var ( - // DefaultRelativePacketTimeoutHeight is the default packet timeout height (in blocks) relative - // to the current block height of the counterparty chain provided by the client state. The - // timeout is disabled when set to 0. - DefaultRelativePacketTimeoutHeight = "0-1000" - - // DefaultRelativePacketTimeoutTimestamp is the default packet timeout timestamp (in nanoseconds) - // relative to the current block timestamp of the counterparty chain provided by the client - // state. The timeout is disabled when set to 0. The default is currently set to a 10 minute - // timeout. - DefaultRelativePacketTimeoutTimestamp = uint64((time.Duration(10) * time.Minute).Nanoseconds()) -) diff --git a/tests/e2e/chains/tendermint/simapp/mockapp/types/tx.pb.go b/tests/e2e/chains/tendermint/simapp/mockapp/types/tx.pb.go deleted file mode 100644 index 3b8c746..0000000 --- a/tests/e2e/chains/tendermint/simapp/mockapp/types/tx.pb.go +++ /dev/null @@ -1,759 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: ibc/applications/mockapp/v1/tx.proto - -package types - -import ( - context "context" - fmt "fmt" - _ "github.com/cosmos/cosmos-sdk/types/msgservice" - _ "github.com/cosmos/gogoproto/gogoproto" - grpc1 "github.com/cosmos/gogoproto/grpc" - proto "github.com/cosmos/gogoproto/proto" - types "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" - io "io" - math "math" - math_bits "math/bits" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -// MsgTransfer defines a msg to transfer fungible tokens (i.e Coins) between -// ICS20 enabled chains. See ICS Spec here: -// https://github.com/cosmos/ibc/tree/master/spec/app/ics-020-fungible-token-transfer#data-structures -type MsgSendPacket struct { - // the port on which the packet will be sent - SourcePort string `protobuf:"bytes,1,opt,name=source_port,json=sourcePort,proto3" json:"source_port,omitempty" yaml:"source_port"` - // the channel by which the packet will be sent - SourceChannel string `protobuf:"bytes,2,opt,name=source_channel,json=sourceChannel,proto3" json:"source_channel,omitempty" yaml:"source_channel"` - // the message - Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty" yaml:"message"` - // the sender address - Sender string `protobuf:"bytes,4,opt,name=sender,proto3" json:"sender,omitempty" yaml:"sender"` - // Timeout height relative to the current block height. - // The timeout is disabled when set to 0. - TimeoutHeight types.Height `protobuf:"bytes,5,opt,name=timeout_height,json=timeoutHeight,proto3" json:"timeout_height" yaml:"timeout_height"` - // Timeout timestamp in absolute nanoseconds since unix epoch. - // The timeout is disabled when set to 0. - TimeoutTimestamp uint64 `protobuf:"varint,6,opt,name=timeout_timestamp,json=timeoutTimestamp,proto3" json:"timeout_timestamp,omitempty" yaml:"timeout_timestamp"` -} - -func (m *MsgSendPacket) Reset() { *m = MsgSendPacket{} } -func (m *MsgSendPacket) String() string { return proto.CompactTextString(m) } -func (*MsgSendPacket) ProtoMessage() {} -func (*MsgSendPacket) Descriptor() ([]byte, []int) { - return fileDescriptor_25430e89edfab170, []int{0} -} -func (m *MsgSendPacket) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgSendPacket) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgSendPacket.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *MsgSendPacket) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgSendPacket.Merge(m, src) -} -func (m *MsgSendPacket) XXX_Size() int { - return m.Size() -} -func (m *MsgSendPacket) XXX_DiscardUnknown() { - xxx_messageInfo_MsgSendPacket.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgSendPacket proto.InternalMessageInfo - -// MsgTransferResponse defines the Msg/Transfer response type. -type MsgSendPacketResponse struct { -} - -func (m *MsgSendPacketResponse) Reset() { *m = MsgSendPacketResponse{} } -func (m *MsgSendPacketResponse) String() string { return proto.CompactTextString(m) } -func (*MsgSendPacketResponse) ProtoMessage() {} -func (*MsgSendPacketResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_25430e89edfab170, []int{1} -} -func (m *MsgSendPacketResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgSendPacketResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgSendPacketResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *MsgSendPacketResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgSendPacketResponse.Merge(m, src) -} -func (m *MsgSendPacketResponse) XXX_Size() int { - return m.Size() -} -func (m *MsgSendPacketResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgSendPacketResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgSendPacketResponse proto.InternalMessageInfo - -func init() { - proto.RegisterType((*MsgSendPacket)(nil), "ibc.applications.mockapp.v1.MsgSendPacket") - proto.RegisterType((*MsgSendPacketResponse)(nil), "ibc.applications.mockapp.v1.MsgSendPacketResponse") -} - -func init() { - proto.RegisterFile("ibc/applications/mockapp/v1/tx.proto", fileDescriptor_25430e89edfab170) -} - -var fileDescriptor_25430e89edfab170 = []byte{ - // 523 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x93, 0x31, 0x6f, 0xd3, 0x40, - 0x14, 0xc7, 0x6d, 0xd2, 0x06, 0x71, 0x55, 0x22, 0x6a, 0x28, 0x35, 0x01, 0xec, 0xc8, 0x62, 0x08, - 0x11, 0xf1, 0x29, 0x61, 0x40, 0xea, 0x84, 0xc2, 0x02, 0x43, 0xa5, 0xca, 0x30, 0xb1, 0xb4, 0xe7, - 0xcb, 0x93, 0x7d, 0xaa, 0xcf, 0x67, 0xf9, 0x2e, 0x11, 0xed, 0x84, 0x98, 0x18, 0xf9, 0x08, 0x5d, - 0xd8, 0xfb, 0x31, 0x3a, 0x76, 0x64, 0xb2, 0x50, 0x32, 0x94, 0x39, 0x9f, 0x00, 0xd9, 0xbe, 0x40, - 0xb2, 0xa0, 0x4e, 0xbe, 0x7b, 0xff, 0xdf, 0xff, 0x3d, 0xdf, 0xbb, 0x77, 0xe8, 0x39, 0x0b, 0x29, - 0x26, 0x59, 0x96, 0x30, 0x4a, 0x14, 0x13, 0xa9, 0xc4, 0x5c, 0xd0, 0x53, 0x92, 0x65, 0x78, 0x36, - 0xc4, 0xea, 0xb3, 0x9f, 0xe5, 0x42, 0x09, 0xeb, 0x09, 0x0b, 0xa9, 0xbf, 0x4e, 0xf9, 0x9a, 0xf2, - 0x67, 0xc3, 0xce, 0xc3, 0x48, 0x44, 0xa2, 0xe2, 0x70, 0xb9, 0xaa, 0x2d, 0x9d, 0x7d, 0x2a, 0x24, - 0x17, 0x12, 0x73, 0x19, 0x95, 0xa9, 0xb8, 0x8c, 0xb4, 0xe0, 0x96, 0x15, 0xa9, 0xc8, 0x01, 0xd3, - 0x84, 0x41, 0xaa, 0x4a, 0xb5, 0x5e, 0xd5, 0x80, 0xf7, 0xa3, 0x81, 0x5a, 0x87, 0x32, 0xfa, 0x00, - 0xe9, 0xe4, 0x88, 0xd0, 0x53, 0x50, 0xd6, 0x6b, 0xb4, 0x23, 0xc5, 0x34, 0xa7, 0x70, 0x9c, 0x89, - 0x5c, 0xd9, 0x66, 0xd7, 0xec, 0xdd, 0x1b, 0x3f, 0x5a, 0x16, 0xae, 0x75, 0x46, 0x78, 0x72, 0xe0, - 0xad, 0x89, 0x5e, 0x80, 0xea, 0xdd, 0x91, 0xc8, 0x95, 0xf5, 0x06, 0xb5, 0xb5, 0x46, 0x63, 0x92, - 0xa6, 0x90, 0xd8, 0x77, 0x2a, 0xef, 0xe3, 0x65, 0xe1, 0xee, 0x6d, 0x78, 0xb5, 0xee, 0x05, 0xad, - 0x3a, 0xf0, 0xb6, 0xde, 0x5b, 0x2f, 0xd1, 0x5d, 0x0e, 0x52, 0x92, 0x08, 0xec, 0x46, 0x65, 0xb5, - 0x96, 0x85, 0xdb, 0xae, 0xad, 0x5a, 0xf0, 0x82, 0x15, 0x62, 0xbd, 0x40, 0x4d, 0x09, 0xe9, 0x04, - 0x72, 0x7b, 0xab, 0x82, 0x77, 0x97, 0x85, 0xdb, 0xd2, 0x75, 0xaa, 0xb8, 0x17, 0x68, 0xc0, 0x3a, - 0x41, 0x6d, 0xc5, 0x38, 0x88, 0xa9, 0x3a, 0x8e, 0x81, 0x45, 0xb1, 0xb2, 0xb7, 0xbb, 0x66, 0x6f, - 0x67, 0xd4, 0xf1, 0xcb, 0x5e, 0x97, 0xfd, 0xf1, 0x75, 0x57, 0x66, 0x43, 0xff, 0x5d, 0x45, 0x8c, - 0x9f, 0x5d, 0x15, 0xae, 0xf1, 0xef, 0xd7, 0x37, 0xfd, 0x5e, 0xd0, 0xd2, 0x81, 0x9a, 0xb6, 0xde, - 0xa3, 0xdd, 0x15, 0x51, 0x7e, 0xa5, 0x22, 0x3c, 0xb3, 0x9b, 0x5d, 0xb3, 0xb7, 0x35, 0x7e, 0xba, - 0x2c, 0x5c, 0x7b, 0x33, 0xc9, 0x5f, 0xc4, 0x0b, 0xee, 0xeb, 0xd8, 0xc7, 0x55, 0xe8, 0xe0, 0xc1, - 0xb7, 0x0b, 0xd7, 0xf8, 0x7d, 0xe1, 0x1a, 0x5f, 0x6f, 0x2e, 0xfb, 0xfa, 0x04, 0xde, 0x3e, 0xda, - 0xdb, 0xb8, 0xa6, 0x00, 0x64, 0x26, 0x52, 0x09, 0xa3, 0x73, 0xd4, 0x38, 0x94, 0x91, 0x95, 0x20, - 0xb4, 0x76, 0x87, 0x7d, 0xff, 0x3f, 0x33, 0xe4, 0x6f, 0x24, 0xea, 0x8c, 0x6e, 0xcf, 0xae, 0x8a, - 0x76, 0xb6, 0xbf, 0xdc, 0x5c, 0xf6, 0xcd, 0xf1, 0xf9, 0xd5, 0xdc, 0x31, 0xaf, 0xe7, 0x8e, 0xf9, - 0x6b, 0xee, 0x98, 0xdf, 0x17, 0x8e, 0x71, 0xbd, 0x70, 0x8c, 0x9f, 0x0b, 0xc7, 0xf8, 0x74, 0x12, - 0x31, 0x15, 0x4f, 0x43, 0x9f, 0x0a, 0x8e, 0x27, 0x44, 0x11, 0x1a, 0x13, 0x96, 0x26, 0x24, 0xc4, - 0xf5, 0xa0, 0x0e, 0x40, 0xc5, 0x90, 0xc3, 0x94, 0x0f, 0x58, 0x48, 0x07, 0x09, 0xcd, 0xb0, 0x02, - 0xa9, 0x24, 0x86, 0x11, 0xe0, 0x0a, 0x95, 0x58, 0x55, 0xe7, 0xe6, 0x2c, 0x55, 0x58, 0x32, 0x5e, - 0xbe, 0x91, 0xd5, 0x5b, 0x51, 0x67, 0x19, 0xc8, 0xb0, 0x59, 0xcd, 0xef, 0xab, 0x3f, 0x01, 0x00, - 0x00, 0xff, 0xff, 0x6d, 0xb0, 0xdf, 0x59, 0x54, 0x03, 0x00, 0x00, -} - -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConn - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion4 - -// MsgClient is the client API for Msg service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type MsgClient interface { - // Transfer defines a rpc handler method for MsgTransfer. - SendPacket(ctx context.Context, in *MsgSendPacket, opts ...grpc.CallOption) (*MsgSendPacketResponse, error) -} - -type msgClient struct { - cc grpc1.ClientConn -} - -func NewMsgClient(cc grpc1.ClientConn) MsgClient { - return &msgClient{cc} -} - -func (c *msgClient) SendPacket(ctx context.Context, in *MsgSendPacket, opts ...grpc.CallOption) (*MsgSendPacketResponse, error) { - out := new(MsgSendPacketResponse) - err := c.cc.Invoke(ctx, "/ibc.applications.mockapp.v1.Msg/SendPacket", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// MsgServer is the server API for Msg service. -type MsgServer interface { - // Transfer defines a rpc handler method for MsgTransfer. - SendPacket(context.Context, *MsgSendPacket) (*MsgSendPacketResponse, error) -} - -// UnimplementedMsgServer can be embedded to have forward compatible implementations. -type UnimplementedMsgServer struct { -} - -func (*UnimplementedMsgServer) SendPacket(ctx context.Context, req *MsgSendPacket) (*MsgSendPacketResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method SendPacket not implemented") -} - -func RegisterMsgServer(s grpc1.Server, srv MsgServer) { - s.RegisterService(&_Msg_serviceDesc, srv) -} - -func _Msg_SendPacket_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgSendPacket) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).SendPacket(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/ibc.applications.mockapp.v1.Msg/SendPacket", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).SendPacket(ctx, req.(*MsgSendPacket)) - } - return interceptor(ctx, in, info, handler) -} - -var _Msg_serviceDesc = grpc.ServiceDesc{ - ServiceName: "ibc.applications.mockapp.v1.Msg", - HandlerType: (*MsgServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "SendPacket", - Handler: _Msg_SendPacket_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "ibc/applications/mockapp/v1/tx.proto", -} - -func (m *MsgSendPacket) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *MsgSendPacket) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgSendPacket) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.TimeoutTimestamp != 0 { - i = encodeVarintTx(dAtA, i, uint64(m.TimeoutTimestamp)) - i-- - dAtA[i] = 0x30 - } - { - size, err := m.TimeoutHeight.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x2a - if len(m.Sender) > 0 { - i -= len(m.Sender) - copy(dAtA[i:], m.Sender) - i = encodeVarintTx(dAtA, i, uint64(len(m.Sender))) - i-- - dAtA[i] = 0x22 - } - if len(m.Message) > 0 { - i -= len(m.Message) - copy(dAtA[i:], m.Message) - i = encodeVarintTx(dAtA, i, uint64(len(m.Message))) - i-- - dAtA[i] = 0x1a - } - if len(m.SourceChannel) > 0 { - i -= len(m.SourceChannel) - copy(dAtA[i:], m.SourceChannel) - i = encodeVarintTx(dAtA, i, uint64(len(m.SourceChannel))) - i-- - dAtA[i] = 0x12 - } - if len(m.SourcePort) > 0 { - i -= len(m.SourcePort) - copy(dAtA[i:], m.SourcePort) - i = encodeVarintTx(dAtA, i, uint64(len(m.SourcePort))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *MsgSendPacketResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *MsgSendPacketResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgSendPacketResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func encodeVarintTx(dAtA []byte, offset int, v uint64) int { - offset -= sovTx(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *MsgSendPacket) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.SourcePort) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.SourceChannel) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.Message) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.Sender) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = m.TimeoutHeight.Size() - n += 1 + l + sovTx(uint64(l)) - if m.TimeoutTimestamp != 0 { - n += 1 + sovTx(uint64(m.TimeoutTimestamp)) - } - return n -} - -func (m *MsgSendPacketResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func sovTx(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozTx(x uint64) (n int) { - return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *MsgSendPacket) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MsgSendPacket: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgSendPacket: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SourcePort", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.SourcePort = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SourceChannel", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.SourceChannel = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Message", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Message = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Sender = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TimeoutHeight", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.TimeoutHeight.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 6: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field TimeoutTimestamp", wireType) - } - m.TimeoutTimestamp = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.TimeoutTimestamp |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgSendPacketResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MsgSendPacketResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgSendPacketResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipTx(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowTx - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowTx - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowTx - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthTx - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupTx - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthTx - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthTx = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowTx = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupTx = fmt.Errorf("proto: unexpected end of group") -) diff --git a/tests/e2e/chains/tendermint/simapp/mockapp/types/types.go b/tests/e2e/chains/tendermint/simapp/mockapp/types/types.go deleted file mode 100644 index fc7fb1e..0000000 --- a/tests/e2e/chains/tendermint/simapp/mockapp/types/types.go +++ /dev/null @@ -1,23 +0,0 @@ -package types - -import ( - ibcexported "github.com/cosmos/ibc-go/v8/modules/core/exported" -) - -type Acknowledgement struct { - data []byte -} - -var _ ibcexported.Acknowledgement = (*Acknowledgement)(nil) - -func NewAcknowledgement(data []byte) Acknowledgement { - return Acknowledgement{data: data} -} - -func (ack Acknowledgement) Success() bool { - return true -} - -func (ack Acknowledgement) Acknowledgement() []byte { - return ack.data -} diff --git a/tests/e2e/scripts/run_e2e_test.sh b/tests/e2e/scripts/run_e2e_test.sh index 4767024..6c3082a 100755 --- a/tests/e2e/scripts/run_e2e_test.sh +++ b/tests/e2e/scripts/run_e2e_test.sh @@ -26,6 +26,8 @@ retry 20 curl -fsL http://localhost:19596/eth/v1/beacon/light_client/finality_up make -C tests/e2e/cases/tm2eth setup handshake +make -C tests/e2e/cases/tm2eth test-channel-upgrade + # test for restore ELC state kill $LCP_PID ./tests/e2e/scripts/init_lcp.sh