From 8938b00ddd390bf9ea9f27ab76f869636e7c7f51 Mon Sep 17 00:00:00 2001 From: Tien Nguyen Date: Fri, 31 May 2024 17:28:07 +0700 Subject: [PATCH 1/4] Update and refactor docs (#202) --- README.md | 56 +++++++++++++++++++++--------------------------- sample_pool.json | 10 ++++----- testnode.sh | 10 +++++---- 3 files changed, 36 insertions(+), 40 deletions(-) diff --git a/README.md b/README.md index 74b42909..d5a8bd24 100644 --- a/README.md +++ b/README.md @@ -7,15 +7,10 @@ The concrete use cases which motivated this module include: - The desire to use IBC token as transaction fees on any chain instead of having to use native token as fee. - To fully take advantage of the newly represented Osmosis [``swap router``](https://github.com/osmosis-labs/osmosis/tree/main/cosmwasm/contracts) with the [``ibc-hooks``](https://github.com/osmosis-labs/osmosis/tree/main/x/ibc-hooks) module and the [``async-icq``](https://github.com/strangelove-ventures/async-icq) module. - ## Description Fee abstraction modules enable users on any Cosmos chain with IBC connections to pay fee using ibc token. -Fee-abs implementation: - -- Fee-abs module imported to the customer chain. - The implememtation also uses Osmosis swap router and async-icq module which are already deployed on Osmosis testnet. ## Prototype @@ -36,7 +31,7 @@ Fee-abs mechanism in a nutshell: We'll goes into all the details now: -#### Pulling `twap data` and update exchange rate +### Pulling `twap data` and update exchange rate For this to work, we first has to set up an ibc channel from `feeabs` to `async-icq`. This channel set-up process can be done by anyone, just like setting up an ibc transfer channel. Once that ibc channel is there, we'll use that channel to ibc-query Twap data. Let's call this the querying channel. @@ -44,32 +39,31 @@ The process of pulling Twap data and update exchange rate : ![Diagram of the process of pulling Twap data and updating exchange rate](https://i.imgur.com/HJ9a26H.png "Diagram of the process of pulling Twap data and updating exchange rate") -Description : - For every `update exchange rate period`, at fee-abs `BeginBlocker()` we submit a `InterchainQueryPacketData` which wrapped `QueryArithmeticTwapToNowRequest` to the querying channel on the customer chain's end. Then relayers will submit `MsgReceivePacket` so that our `QueryTwapPacket` which will be routed to `async-icq` module to be processed. `async-icq` module then unpack `InterchainQueryPacketData` and send query to TWAP module. The correspone response will be wrapped in the ibc acknowledgement. Relayers then submit `MsgAcknowledgement` to the customer chain so that the ibc acknowledgement is routed to fee-abs to be processed. Fee-abs then update exchange rate according to the Twap wrapped in the ibc acknowledgement. +**Description** : +For every `update exchange rate period`, at fee-abs `BeginBlocker()` we submit a `InterchainQueryPacketData` which wrapped `QueryArithmeticTwapToNowRequest` to the querying channel on the customer chain's end. Then relayers will submit `MsgReceivePacket` so that our `QueryTwapPacket` which will be routed to `async-icq` module to be processed. `async-icq` module then unpack `InterchainQueryPacketData` and send query to TWAP module. The correspone response will be wrapped in the ibc acknowledgement. Relayers then submit `MsgAcknowledgement` to the customer chain so that the ibc acknowledgement is routed to fee-abs to be processed. Fee-abs then update exchange rate according to the Twap wrapped in the ibc acknowledgement. -#### Handling txs with ibc-token fee +### Handling txs with ibc-token fee We modified `MempoolFeeDecorator` so that it can handle ibc-token as fee. If the tx has ibc-token fee, the AnteHandler will first check if that token is allowed (which is setup by Gov) we basically replace the amount of ibc-token with the equivalent native-token amount which is calculated by `exchange rate` * `ibc-token amount`. We have an account to manage the ibc-token user used to pay for tx fee. The collected ibc-token fee is sent to that account instead of community pool account. -#### Swap accumulated ibc-tokens fee +### Swap accumulated ibc-tokens fee Fee-abstraction will use osmosis's Cross chain Swap (XCS) feature to do this. We basically ibc transfer to the osmosis crosschain swap contract with custom memo to swap the osmosis fee back to customer chain's native-token and ibc transfer back to the customer chain. -##### How XCS work +#### How XCS work -###### Reverse With Path-unwinding to get Ibc-token on Osmosis +##### Reverse With Path-unwinding to get Ibc-token on Osmosis - Create a ibc transfer message with a specific MEMO to work with ibc [``packet-forward-middleware``](https://github.com/strangelove-ventures/packet-forward-middleware) which is path-unwinding (an ibc feature that allow to automatic define the path and ibc transfer multiple hop follow the defined path) - Ibc transfer the created packet to get the fee Ibc-token on Osmosis -Ex: When you sent STARS on Hub to Osmosis, you will get Osmosis(Hub(STARS)) which is different with STARS on Osmosis Osmosis(STARS). It will reverse back Osmosis(Hub(STARS)) to Osmosis(STARS): +Example: When you sent STARS on Hub to Osmosis, you will get Osmosis(Hub(STARS)) which is different with STARS on Osmosis Osmosis(STARS). It will reverse back Osmosis(Hub(STARS)) to Osmosis(STARS): ![Diagram of the process of swapping accumulated ibc-tokens fee](https://i.imgur.com/D1wSrMm.png "Diagram of the process of swapping accumulated ibc-tokens fee") - -###### Swap Ibc-token +##### Swap IBC token After reverse the ibc-token, XCS will : @@ -85,25 +79,25 @@ Current version of fee-abstraction working with XCSv2 This repository is branched by the cosmos-sdk versions and ibc-go versions used. Currently fee abstraction supports: - SDK v0.50.x & IBC-go v8.* - - branch: release/v8.0.x - - path: github.com/osmosis-labs/fee-abstraction/v8 + - branch: `release/v8.0.x` + - path: `github.com/osmosis-labs/fee-abstraction/v8` - SDK v0.47.x & IBC-go v7.* - - branch: release/v7.0.x - - path: github.com/osmosis-labs/fee-abstraction/v7 + - branch: `release/v7.0.x` + - path: `github.com/osmosis-labs/fee-abstraction/v7` - SDK v0.46.x (Obsolete) - - branch: release/v6.0.x - - path: github.com/osmosis-labs/fee-abstraction/v6 + - branch: `release/v6.0.x` + - path: `github.com/osmosis-labs/fee-abstraction/v6` - SDK v0.45.x (Obsolete) - - branch: release/v4.0.x - - path: github.com/osmosis-labs/fee-abstraction/v4 + - branch: `release/v4.0.x` + - path: `github.com/osmosis-labs/fee-abstraction/v4` ## Acknowledgements -* cosmos-sdk: - * many developers :) -* async-icq - * strangelove ventures -* ideation - * osmosis grants program -* mergify configuration and branching strategy - * ibc-go +- cosmos-sdk: + - many developers :) +- async-icq + - strangelove ventures +- ideation + - osmosis grants program +- mergify configuration and branching strategy + - ibc-go diff --git a/sample_pool.json b/sample_pool.json index 3a63999a..b6d3282c 100644 --- a/sample_pool.json +++ b/sample_pool.json @@ -1,7 +1,7 @@ { - "weights": "1ibc/9117A26BA81E29FA4F78F57DC2BD90CD3D26848101BA880445F119B22A1E254E,1ibc/C053D637CCA2A2BA030E2C5EE1B28A16F71CCB0E45E8BE52766DC1B241B77878", - "initial-deposit": "500000000000ibc/9117A26BA81E29FA4F78F57DC2BD90CD3D26848101BA880445F119B22A1E254E,100000000000ibc/C053D637CCA2A2BA030E2C5EE1B28A16F71CCB0E45E8BE52766DC1B241B77878", - "swap-fee": "0.01", - "exit-fee": "0", - "future-governor": "168h" + "weights": "1ibc/9117A26BA81E29FA4F78F57DC2BD90CD3D26848101BA880445F119B22A1E254E,1ibc/C053D637CCA2A2BA030E2C5EE1B28A16F71CCB0E45E8BE52766DC1B241B77878", + "initial-deposit": "500000000000ibc/9117A26BA81E29FA4F78F57DC2BD90CD3D26848101BA880445F119B22A1E254E,100000000000ibc/C053D637CCA2A2BA030E2C5EE1B28A16F71CCB0E45E8BE52766DC1B241B77878", + "swap-fee": "0.01", + "exit-fee": "0", + "future-governor": "168h" } diff --git a/testnode.sh b/testnode.sh index 03edc9d0..a49de129 100755 --- a/testnode.sh +++ b/testnode.sh @@ -9,7 +9,10 @@ LOGLEVEL="info" TRACE="" # validate dependencies are installed -command -v jq > /dev/null 2>&1 || { echo >&2 "jq not installed. More info: https://stedolan.github.io/jq/download/"; exit 1; } +command -v jq >/dev/null 2>&1 || { + echo >&2 "jq not installed. More info: https://stedolan.github.io/jq/download/" + exit 1 +} # remove existing daemon rm -rf ~/.feeapp* @@ -21,7 +24,7 @@ rm -rf ~/.feeapp* feeappd keys add $KEY --keyring-backend $KEYRING --algo $KEYALGO # Set moniker and chain-id for Evmos (Moniker can be anything, chain-id must be an integer) -feeappd init $MONIKER --chain-id $CHAINID +feeappd init $MONIKER --chain-id $CHAINID # Allocate genesis accounts (cosmos formatted addresses) feeappd genesis add-genesis-account $KEY 100000000000000000000000000stake --keyring-backend $KEYRING @@ -40,5 +43,4 @@ if [[ $1 == "pending" ]]; then fi # Start the node (remove the --pruning=nothing flag if historical queries are not needed) -feeappd start --pruning=nothing --minimum-gas-prices=0.0001stake - +feeappd start --pruning=nothing --minimum-gas-prices=0.0001stake From 004a9311aa7782479d9234c72b9a73582410a4cd Mon Sep 17 00:00:00 2001 From: Tien Nguyen Date: Fri, 31 May 2024 19:27:02 +0700 Subject: [PATCH 2/4] Update module to go 1.22 and simple start chain test (#203) * Update module to go 1.22 and simple start chain test * Update github workflows to go1.22 * Update github workflows dependencies * Update go module toolchain * Remove conflict mergify file * Remove hard code initial amount deposits of osmosis pool * Remove deps folder --- .github/mergify.yml | 44 --------------- .github/workflows/build.yml | 6 +-- .github/workflows/codeql.yml | 12 ++--- .github/workflows/interchaintest.yaml | 54 +++++++++---------- .github/workflows/lint.yml | 8 +-- .github/workflows/push_docker_image.yml | 10 ++-- .github/workflows/push_protobuf_image.yml | 29 +++++----- .github/workflows/tests.yml | 4 +- Dockerfile | 2 +- deps/gaia | 1 - deps/osmosis | 1 - deps/relayer | 1 - deps/stargaze | 1 - go.mod | 2 +- tests/interchaintest/chain_start_test.go | 37 +++++++++++-- .../ibc_transfer_customfee_test.go | 14 ++--- tests/interchaintest/ibc_transfer_test.go | 17 +++--- tests/interchaintest/packet_foward_test.go | 11 ++-- .../interchaintest/query_osmosis_twap_test.go | 9 ++-- tests/interchaintest/setup.go | 25 +++++---- 20 files changed, 133 insertions(+), 155 deletions(-) delete mode 100644 .github/mergify.yml delete mode 160000 deps/gaia delete mode 160000 deps/osmosis delete mode 160000 deps/relayer delete mode 160000 deps/stargaze diff --git a/.github/mergify.yml b/.github/mergify.yml deleted file mode 100644 index e1b21558..00000000 --- a/.github/mergify.yml +++ /dev/null @@ -1,44 +0,0 @@ -queue_rules: - - name: default - conditions: - - '#approved-reviews-by>=1' - - base=main - - label=automerge - -pull_request_rules: - - name: automerge to main with label automerge and branch protection passing - conditions: - - '#approved-reviews-by>=1' - - base=main - - label=automerge - actions: - queue: - name: default - method: squash - commit_message_template: | - {{ title }} (#{{ number }}) - {{ body }} - - name: backport patches to v4.0.x branch - conditions: - - base=main - - label=backport-to-v4.0.x - actions: - backport: - branches: - - release/v4.0.x - - name: backport patches to v6.0.x branch - conditions: - - base=main - - label=backport-to-v6.0.x - actions: - backport: - branches: - - release/v6.0.x - - name: backport patches to v7.0.x branch - conditions: - - base=main - - label=backport-to-v7.0.x - actions: - backport: - branches: - - release/v7.0.x diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e28b06da..eee69f8e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -11,9 +11,9 @@ jobs: runs-on: ubuntu-latest name: build steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Setup go - uses: actions/setup-go@v3 + uses: actions/setup-go@v5 with: - go-version: 1.21 + go-version: 1.22 - run: go build ./... diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index a4baf0df..5512241c 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -1,15 +1,15 @@ -name: 'CodeQL' +name: "CodeQL" on: pull_request: paths: - - '**.go' + - "**.go" push: branches: - main - release/** paths: - - '**.go' + - "**.go" jobs: analyze: @@ -22,15 +22,15 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3 - - uses: actions/setup-go@v3 + uses: actions/checkout@v4 + - uses: actions/setup-go@v5 with: go-version: 1.21 # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL uses: github/codeql-action/init@v2 with: - languages: 'go' + languages: "go" queries: crypto-com/cosmos-sdk-codeql@main,security-and-quality - name: Build diff --git a/.github/workflows/interchaintest.yaml b/.github/workflows/interchaintest.yaml index 299ee62f..95c5c3b4 100644 --- a/.github/workflows/interchaintest.yaml +++ b/.github/workflows/interchaintest.yaml @@ -11,15 +11,15 @@ jobs: runs-on: ubuntu-latest steps: - name: Check out the repo - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Login to DockerHub - uses: docker/login-action@v2 + uses: docker/login-action@v3 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - name: Build and push id: build_push_image - uses: docker/build-push-action@v3 + uses: docker/build-push-action@v5 with: file: Dockerfile context: . @@ -31,13 +31,13 @@ jobs: runs-on: ubuntu-latest needs: build-and-push-image steps: - - name: Set up Go 1.21 - uses: actions/setup-go@v3 + - name: Set up Go 1.22 + uses: actions/setup-go@v5 with: - go-version: 1.21 + go-version: 1.22 - name: checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - run: make ictest-basic env: @@ -47,13 +47,13 @@ jobs: runs-on: ubuntu-latest needs: build-and-push-image steps: - - name: Set up Go 1.21 - uses: actions/setup-go@v3 + - name: Set up Go 1.22 + uses: actions/setup-go@v5 with: - go-version: 1.21 + go-version: 1.22 - name: checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - run: make ictest-ibc env: @@ -63,13 +63,13 @@ jobs: runs-on: ubuntu-latest needs: build-and-push-image steps: - - name: Set up Go 1.21 - uses: actions/setup-go@v3 + - name: Set up Go 1.22 + uses: actions/setup-go@v5 with: - go-version: 1.21 + go-version: 1.22 - name: checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - run: make ictest-ibc-custom env: @@ -79,13 +79,13 @@ jobs: runs-on: ubuntu-latest needs: build-and-push-image steps: - - name: Set up Go 1.21 - uses: actions/setup-go@v3 + - name: Set up Go 1.22 + uses: actions/setup-go@v5 with: - go-version: 1.21 + go-version: 1.22 - name: checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - run: make ictest-packet-forward env: @@ -95,13 +95,13 @@ jobs: runs-on: ubuntu-latest needs: build-and-push-image steps: - - name: Set up Go 1.21 - uses: actions/setup-go@v3 + - name: Set up Go 1.22 + uses: actions/setup-go@v5 with: - go-version: 1.21 + go-version: 1.22 - name: checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - run: make ictest-host-zone-proposal env: @@ -111,13 +111,13 @@ jobs: runs-on: ubuntu-latest needs: build-and-push-image steps: - - name: Set up Go 1.21 - uses: actions/setup-go@v3 + - name: Set up Go 1.22 + uses: actions/setup-go@v5 with: - go-version: 1.21 + go-version: 1.22 - name: checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - run: make ictest-query-osmosis-twap env: diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index d9397082..0893d8fa 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -13,12 +13,12 @@ jobs: name: lint runs-on: ubuntu-latest steps: - - uses: actions/setup-go@v3 + - uses: actions/setup-go@v5 with: - go-version: 1.21 - - uses: actions/checkout@v3 + go-version: 1.22 + - uses: actions/checkout@v4 - name: golangci-lint - uses: golangci/golangci-lint-action@v3 + uses: golangci/golangci-lint-action@v5 with: version: latest args: --timeout 15m diff --git a/.github/workflows/push_docker_image.yml b/.github/workflows/push_docker_image.yml index 2b96e885..6919b4db 100644 --- a/.github/workflows/push_docker_image.yml +++ b/.github/workflows/push_docker_image.yml @@ -19,17 +19,17 @@ on: types: [published, created, edited] push: tags: - - 'v[0-9]+.[0-9]+.[0-9]+' # ignore rc + - "v[0-9]+.[0-9]+.[0-9]+" # ignore rc jobs: feeapp-images: runs-on: ubuntu-latest steps: - name: Check out the repo - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Set up QEMU - uses: docker/setup-qemu-action@v2 + uses: docker/setup-qemu-action@v3 - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 + uses: docker/setup-buildx-action@v3 - name: Login to DockerHub uses: docker/login-action@v3 @@ -49,7 +49,7 @@ jobs: echo "PATCH_VERSION=$PATCH_VERSION" >> $GITHUB_ENV - name: Build and push id: build_push_image - uses: docker/build-push-action@v3 + uses: docker/build-push-action@v5 with: file: Dockerfile context: . diff --git a/.github/workflows/push_protobuf_image.yml b/.github/workflows/push_protobuf_image.yml index 649c7256..64f51863 100644 --- a/.github/workflows/push_protobuf_image.yml +++ b/.github/workflows/push_protobuf_image.yml @@ -4,7 +4,7 @@ # # osmolabs/fa-proto-gen:commit-hash # is pushed # osmolabs/fa-proto-gen:latest # is updated -# +# # All the images above have support for linux/amd64 and linux/arm64. name: Push Protogen Images @@ -17,29 +17,24 @@ jobs: feeapp-images: runs-on: ubuntu-latest steps: - - - name: Check out the repo - uses: actions/checkout@v3 - - - name: Set up QEMU - uses: docker/setup-qemu-action@v2 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 - - - name: Login to DockerHub - uses: docker/login-action@v2 + - name: Check out the repo + uses: actions/checkout@v4 + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Login to DockerHub + uses: docker/login-action@v3 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - - - name: Build and push + - name: Build and push id: build_push_image - uses: docker/build-push-action@v3 + uses: docker/build-push-action@v5 with: file: proto/Dockerfile context: . push: true platforms: linux/amd64,linux/arm64 tags: | - osmolabs/fa-proto-gen:${{ github.sha }} \ No newline at end of file + osmolabs/fa-proto-gen:${{ github.sha }} diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index e943401d..bc73553e 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -12,9 +12,9 @@ jobs: name: test steps: - name: Install Go - uses: actions/setup-go@v3 + uses: actions/setup-go@v5 with: - go-version: 1.21 + go-version: 1.22 - name: Checkout code uses: actions/checkout@v3 - name: Test diff --git a/Dockerfile b/Dockerfile index 726344f3..7cbd5c42 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ # syntax=docker/dockerfile:1 -ARG GO_VERSION="1.21" +ARG GO_VERSION="1.22" # -------------------------------------------------------- # Builder # -------------------------------------------------------- diff --git a/deps/gaia b/deps/gaia deleted file mode 160000 index 19e63c1b..00000000 --- a/deps/gaia +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 19e63c1b20c3cae935d346ba527cd279f1c03423 diff --git a/deps/osmosis b/deps/osmosis deleted file mode 160000 index dba4b88d..00000000 --- a/deps/osmosis +++ /dev/null @@ -1 +0,0 @@ -Subproject commit dba4b88d538f060629cb92177748b2af6b053b32 diff --git a/deps/relayer b/deps/relayer deleted file mode 160000 index a63cd79b..00000000 --- a/deps/relayer +++ /dev/null @@ -1 +0,0 @@ -Subproject commit a63cd79b779d603fa89228e1b06fb99fcfb96119 diff --git a/deps/stargaze b/deps/stargaze deleted file mode 160000 index 66f83085..00000000 --- a/deps/stargaze +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 66f83085e48c7568d6818a5a0dfc94af7e82678f diff --git a/go.mod b/go.mod index 1ce52305..3911411c 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/osmosis-labs/fee-abstraction/v8 -go 1.21 +go 1.22.3 require ( cosmossdk.io/client/v2 v2.0.0-beta.1 diff --git a/tests/interchaintest/chain_start_test.go b/tests/interchaintest/chain_start_test.go index 5891c2af..5651b075 100644 --- a/tests/interchaintest/chain_start_test.go +++ b/tests/interchaintest/chain_start_test.go @@ -2,11 +2,12 @@ package interchaintest import ( "context" - "fmt" "testing" + "github.com/strangelove-ventures/interchaintest/v8" "github.com/strangelove-ventures/interchaintest/v8/chain/cosmos" "github.com/stretchr/testify/require" + "go.uber.org/zap/zaptest" ) // TestStartFeeabs is a basic test to assert that spinning up a Feeabs network with 1 validator works properly. @@ -15,11 +16,37 @@ func TestStartFeeabs(t *testing.T) { t.Skip() } - // Set up chains, users and channels + numVals := 1 + numFullNodes := 1 + + cf := interchaintest.NewBuiltinChainFactory(zaptest.NewLogger(t), []*interchaintest.ChainSpec{ + { + Name: "feeabs", + ChainConfig: feeabsConfig, + NumValidators: &numVals, + NumFullNodes: &numFullNodes, + }, + }) + + chains, err := cf.Chains(t.Name()) + require.NoError(t, err) + + feeabs := chains[0].(*cosmos.CosmosChain) + ic := interchaintest.NewInterchain().AddChain(feeabs) ctx := context.Background() - chains, _, _ := SetupChain(t, ctx) - feeabs, _, _ := chains[0].(*cosmos.CosmosChain), chains[1].(*cosmos.CosmosChain), chains[2].(*cosmos.CosmosChain) + client, network := interchaintest.DockerSetup(t) + + require.NoError(t, ic.Build(ctx, nil, interchaintest.InterchainBuildOptions{ + TestName: t.Name(), + Client: client, + NetworkID: network, + SkipPathCreation: true, + })) + t.Cleanup(func() { + _ = ic.Close() + }) + a, err := feeabs.AuthQueryModuleAccounts(ctx) require.NoError(t, err) - fmt.Println("module accounts", a) + t.Log("module accounts", a) } diff --git a/tests/interchaintest/ibc_transfer_customfee_test.go b/tests/interchaintest/ibc_transfer_customfee_test.go index 2bf4eed4..b0923791 100644 --- a/tests/interchaintest/ibc_transfer_customfee_test.go +++ b/tests/interchaintest/ibc_transfer_customfee_test.go @@ -8,7 +8,6 @@ import ( "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" - sdktypes "github.com/cosmos/cosmos-sdk/types" transfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types" "github.com/strangelove-ventures/interchaintest/v8/chain/cosmos" "github.com/strangelove-ventures/interchaintest/v8/ibc" @@ -43,7 +42,7 @@ func TestFeeabsGaiaIBCTransferWithIBCFee(t *testing.T) { require.NoError(t, err) _ = crossChainRegistryContractID // // Instatiate - owner := sdktypes.MustBech32ifyAddressBytes(osmosis.Config().Bech32Prefix, osmosisUser.Address()) + owner := sdk.MustBech32ifyAddressBytes(osmosis.Config().Bech32Prefix, osmosisUser.Address()) initMsg := fmt.Sprintf("{\"owner\":\"%s\"}", owner) registryContractAddress, err := osmosis.InstantiateContract(ctx, osmosisUser.KeyName(), crossChainRegistryContractID, initMsg, true) require.NoError(t, err) @@ -75,20 +74,21 @@ func TestFeeabsGaiaIBCTransferWithIBCFee(t *testing.T) { // Create pool Osmosis(uatom)/Osmosis(stake) on Osmosis denomTrace := transfertypes.ParseDenomTrace(transfertypes.GetPrefixedDenom(channOsmosisGaia.PortID, channOsmosisGaia.ChannelID, gaia.Config().Denom)) uatomOnOsmosis := denomTrace.IBCDenom() - osmosisUserBalance, err := osmosis.GetBalance(ctx, sdktypes.MustBech32ifyAddressBytes(osmosis.Config().Bech32Prefix, osmosisUser.Address()), uatomOnOsmosis) + osmosisUserBalance, err := osmosis.GetBalance(ctx, sdk.MustBech32ifyAddressBytes(osmosis.Config().Bech32Prefix, osmosisUser.Address()), uatomOnOsmosis) require.NoError(t, err) require.Equal(t, amountToSend, osmosisUserBalance) denomTrace = transfertypes.ParseDenomTrace(transfertypes.GetPrefixedDenom(channOsmosisFeeabs.PortID, channOsmosisFeeabs.ChannelID, feeabs.Config().Denom)) stakeOnOsmosis := denomTrace.IBCDenom() - osmosisUserBalance, err = osmosis.GetBalance(ctx, sdktypes.MustBech32ifyAddressBytes(osmosis.Config().Bech32Prefix, osmosisUser.Address()), stakeOnOsmosis) + osmosisUserBalance, err = osmosis.GetBalance(ctx, sdk.MustBech32ifyAddressBytes(osmosis.Config().Bech32Prefix, osmosisUser.Address()), stakeOnOsmosis) require.NoError(t, err) require.Equal(t, amountToSend, osmosisUserBalance) // Create pool Osmosis(stake)/uosmo on Osmosis, with 1:1 ratio + initAmount := amountToSend.Uint64() / 2 poolID, err := feeabsCli.CreatePool(osmosis, ctx, osmosisUser.KeyName(), cosmos.OsmosisPoolParams{ Weights: fmt.Sprintf("5%s,5%s", stakeOnOsmosis, osmosis.Config().Denom), - InitialDeposit: fmt.Sprintf("95000000%s,95000000%s", stakeOnOsmosis, osmosis.Config().Denom), + InitialDeposit: fmt.Sprintf("%d%s,%d%s", initAmount, stakeOnOsmosis, initAmount, osmosis.Config().Denom), SwapFee: "0.01", ExitFee: "0", FutureGovernor: "", @@ -147,8 +147,8 @@ func TestFeeabsGaiaIBCTransferWithIBCFee(t *testing.T) { // Get our Bech32 encoded user addresses feeabsUser, gaiaUser := users[0], users[1] - feeabsUserAddr := sdktypes.MustBech32ifyAddressBytes(feeabs.Config().Bech32Prefix, feeabsUser.Address()) - gaiaUserAddr := sdktypes.MustBech32ifyAddressBytes(gaia.Config().Bech32Prefix, gaiaUser.Address()) + feeabsUserAddr := sdk.MustBech32ifyAddressBytes(feeabs.Config().Bech32Prefix, feeabsUser.Address()) + gaiaUserAddr := sdk.MustBech32ifyAddressBytes(gaia.Config().Bech32Prefix, gaiaUser.Address()) // Compose an IBC transfer and send from Gaia -> Feeabs osmoTokenDenom := transfertypes.GetPrefixedDenom(channFeeabsOsmosis.PortID, channFeeabsOsmosis.ChannelID, osmosis.Config().Denom) diff --git a/tests/interchaintest/ibc_transfer_test.go b/tests/interchaintest/ibc_transfer_test.go index c4b46f6a..05840d4e 100644 --- a/tests/interchaintest/ibc_transfer_test.go +++ b/tests/interchaintest/ibc_transfer_test.go @@ -6,7 +6,7 @@ import ( "testing" "cosmossdk.io/math" - sdktypes "github.com/cosmos/cosmos-sdk/types" + sdk "github.com/cosmos/cosmos-sdk/types" transfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types" "github.com/strangelove-ventures/interchaintest/v8" "github.com/strangelove-ventures/interchaintest/v8/chain/cosmos" @@ -113,8 +113,8 @@ func TestFeeabsGaiaIBCTransfer(t *testing.T) { // Get our Bech32 encoded user addresses feeabsUser, gaiaUser := users[0], users[1] - feeabsUserAddr := sdktypes.MustBech32ifyAddressBytes(feeabs.Config().Bech32Prefix, feeabsUser.Address()) - gaiaUserAddr := sdktypes.MustBech32ifyAddressBytes(gaia.Config().Bech32Prefix, gaiaUser.Address()) + feeabsUserAddr := sdk.MustBech32ifyAddressBytes(feeabs.Config().Bech32Prefix, feeabsUser.Address()) + gaiaUserAddr := sdk.MustBech32ifyAddressBytes(gaia.Config().Bech32Prefix, gaiaUser.Address()) // Get original account balances feeabsOrigBal, err := feeabs.GetBalance(ctx, feeabsUserAddr, feeabs.Config().Denom) @@ -126,11 +126,10 @@ func TestFeeabsGaiaIBCTransfer(t *testing.T) { require.Equal(t, genesisWalletAmount, gaiaOrigBal) // Compose an IBC transfer and send from feeabs -> Gaia - transferAmount := math.NewInt(1_000) transfer := ibc.WalletAmount{ Address: gaiaUserAddr, Denom: feeabs.Config().Denom, - Amount: transferAmount, + Amount: amountToSend, } channel, err := ibc.GetTransferChannel(ctx, r, eRep, feeabs.Config().ChainID, gaia.Config().ChainID) @@ -155,17 +154,17 @@ func TestFeeabsGaiaIBCTransfer(t *testing.T) { require.NoError(t, err) // The feeabs account should have the original balance minus the transfer amount and the fee - require.GreaterOrEqual(t, feeabsOrigBal.Sub(transferAmount).Int64(), feeabsUpdateBal.Int64()) + require.GreaterOrEqual(t, feeabsOrigBal.Sub(amountToSend).Int64(), feeabsUpdateBal.Int64()) gaiaUpdateBal, err := gaia.GetBalance(ctx, gaiaUserAddr, feeabsIBCDenom) require.NoError(t, err) - require.Equal(t, transferAmount, gaiaUpdateBal) + require.Equal(t, amountToSend, gaiaUpdateBal) // Compose an IBC transfer and send from Gaia -> Feeabs transfer = ibc.WalletAmount{ Address: feeabsUserAddr, Denom: feeabsIBCDenom, - Amount: transferAmount, + Amount: amountToSend, } transferTx, err = gaia.SendIBCTransfer(ctx, channel.Counterparty.ChannelID, gaiaUserAddr, transfer, ibc.TransferOptions{}) @@ -181,7 +180,7 @@ func TestFeeabsGaiaIBCTransfer(t *testing.T) { // Assert that the funds are now back on feeabs and not on Gaia feeabsBalAfterGettingBackToken, err := feeabs.GetBalance(ctx, feeabsUserAddr, feeabs.Config().Denom) require.NoError(t, err) - require.Equal(t, feeabsUpdateBal.Add(transferAmount).Int64(), feeabsBalAfterGettingBackToken.Int64()) + require.Equal(t, feeabsUpdateBal.Add(amountToSend).Int64(), feeabsBalAfterGettingBackToken.Int64()) gaiaUpdateBal, err = gaia.GetBalance(ctx, gaiaUserAddr, feeabsIBCDenom) require.NoError(t, err) diff --git a/tests/interchaintest/packet_foward_test.go b/tests/interchaintest/packet_foward_test.go index be1aeec1..3afabd1b 100644 --- a/tests/interchaintest/packet_foward_test.go +++ b/tests/interchaintest/packet_foward_test.go @@ -5,7 +5,7 @@ import ( "fmt" "testing" - sdktypes "github.com/cosmos/cosmos-sdk/types" + sdk "github.com/cosmos/cosmos-sdk/types" transfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types" "github.com/strangelove-ventures/interchaintest/v8/chain/cosmos" "github.com/strangelove-ventures/interchaintest/v8/testutil" @@ -33,7 +33,7 @@ func TestPacketForwardMiddleware(t *testing.T) { require.NoError(t, err) _ = crossChainRegistryContractID // // Instatiate - owner := sdktypes.MustBech32ifyAddressBytes(osmosis.Config().Bech32Prefix, osmosisUser.Address()) + owner := sdk.MustBech32ifyAddressBytes(osmosis.Config().Bech32Prefix, osmosisUser.Address()) initMsg := fmt.Sprintf("{\"owner\":\"%s\"}", owner) registryContractAddress, err := osmosis.InstantiateContract(ctx, osmosisUser.KeyName(), crossChainRegistryContractID, initMsg, true) require.NoError(t, err) @@ -65,19 +65,20 @@ func TestPacketForwardMiddleware(t *testing.T) { // Create pool Osmosis(uatom)/Osmosis(stake) on Osmosis denomTrace := transfertypes.ParseDenomTrace(transfertypes.GetPrefixedDenom(channOsmosisGaia.PortID, channOsmosisGaia.ChannelID, gaia.Config().Denom)) uatomOnOsmosis := denomTrace.IBCDenom() - osmosisUserBalance, err := osmosis.GetBalance(ctx, sdktypes.MustBech32ifyAddressBytes(osmosis.Config().Bech32Prefix, osmosisUser.Address()), uatomOnOsmosis) + osmosisUserBalance, err := osmosis.GetBalance(ctx, sdk.MustBech32ifyAddressBytes(osmosis.Config().Bech32Prefix, osmosisUser.Address()), uatomOnOsmosis) require.NoError(t, err) require.Equal(t, amountToSend, osmosisUserBalance) denomTrace = transfertypes.ParseDenomTrace(transfertypes.GetPrefixedDenom(channOsmosisFeeabs.PortID, channOsmosisFeeabs.ChannelID, feeabs.Config().Denom)) stakeOnOsmosis := denomTrace.IBCDenom() - osmosisUserBalance, err = osmosis.GetBalance(ctx, sdktypes.MustBech32ifyAddressBytes(osmosis.Config().Bech32Prefix, osmosisUser.Address()), stakeOnOsmosis) + osmosisUserBalance, err = osmosis.GetBalance(ctx, sdk.MustBech32ifyAddressBytes(osmosis.Config().Bech32Prefix, osmosisUser.Address()), stakeOnOsmosis) require.NoError(t, err) require.Equal(t, amountToSend, osmosisUserBalance) + initAmount := amountToSend.Uint64() / 2 poolID, err := feeabsCli.CreatePool(osmosis, ctx, osmosisUser.KeyName(), cosmos.OsmosisPoolParams{ Weights: fmt.Sprintf("5%s,5%s", stakeOnOsmosis, uatomOnOsmosis), - InitialDeposit: fmt.Sprintf("95000000%s,950000000%s", stakeOnOsmosis, uatomOnOsmosis), + InitialDeposit: fmt.Sprintf("%d%s,%d%s", initAmount, stakeOnOsmosis, initAmount, uatomOnOsmosis), SwapFee: "0.01", ExitFee: "0", FutureGovernor: "", diff --git a/tests/interchaintest/query_osmosis_twap_test.go b/tests/interchaintest/query_osmosis_twap_test.go index 28661db9..0b062bcd 100644 --- a/tests/interchaintest/query_osmosis_twap_test.go +++ b/tests/interchaintest/query_osmosis_twap_test.go @@ -6,7 +6,7 @@ import ( "strconv" "testing" - sdktypes "github.com/cosmos/cosmos-sdk/types" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" transfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types" "github.com/strangelove-ventures/interchaintest/v8/chain/cosmos" @@ -37,7 +37,7 @@ func TestQueryOsmosisTwap(t *testing.T) { require.NoError(t, err) _ = crossChainRegistryContractID // // Instatiate - owner := sdktypes.MustBech32ifyAddressBytes(osmosis.Config().Bech32Prefix, osmosisUser.Address()) + owner := sdk.MustBech32ifyAddressBytes(osmosis.Config().Bech32Prefix, osmosisUser.Address()) initMsg := fmt.Sprintf("{\"owner\":\"%s\"}", owner) registryContractAddress, err := osmosis.InstantiateContract(ctx, osmosisUser.KeyName(), crossChainRegistryContractID, initMsg, true) require.NoError(t, err) @@ -68,13 +68,14 @@ func TestQueryOsmosisTwap(t *testing.T) { // Create pool Osmosis(stake)/uosmo on Osmosis stakeOnOsmosis := GetStakeOnOsmosis(channOsmosisFeeabs, feeabs.Config().Denom) - osmosisUserBalance, err := osmosis.GetBalance(ctx, sdktypes.MustBech32ifyAddressBytes(osmosis.Config().Bech32Prefix, osmosisUser.Address()), stakeOnOsmosis) + osmosisUserBalance, err := osmosis.GetBalance(ctx, sdk.MustBech32ifyAddressBytes(osmosis.Config().Bech32Prefix, osmosisUser.Address()), stakeOnOsmosis) require.NoError(t, err) require.Equal(t, amountToSend, osmosisUserBalance) + initAmount := amountToSend.Uint64() / 2 poolID, err := feeabsCli.CreatePool(osmosis, ctx, osmosisUser.KeyName(), cosmos.OsmosisPoolParams{ Weights: fmt.Sprintf("5%s,5%s", stakeOnOsmosis, osmosis.Config().Denom), - InitialDeposit: fmt.Sprintf("95000000%s,950000000%s", stakeOnOsmosis, osmosis.Config().Denom), + InitialDeposit: fmt.Sprintf("%d%s,%d%s", initAmount, stakeOnOsmosis, initAmount, osmosis.Config().Denom), SwapFee: "0.01", ExitFee: "0", FutureGovernor: "", diff --git a/tests/interchaintest/setup.go b/tests/interchaintest/setup.go index 16c1214d..b6dabf39 100644 --- a/tests/interchaintest/setup.go +++ b/tests/interchaintest/setup.go @@ -9,7 +9,7 @@ import ( "testing" "cosmossdk.io/math" - sdktypes "github.com/cosmos/cosmos-sdk/types" + sdk "github.com/cosmos/cosmos-sdk/types" moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil" "github.com/icza/dyno" "github.com/strangelove-ventures/interchaintest/v8" @@ -44,16 +44,17 @@ const ( votingPeriod = "10s" maxDepositPeriod = "10s" queryEpochTime = "10s" -) -var ( - FFeeabsMainRepo = "osmolabs/fee-abstraction" + // Chain and relayer version info + FeeabsMainRepo = "osmolabs/fee-abstraction" FeeabsICTestRepo = "osmolabs/fee-abstraction-ictest" IBCRelayerImage = "ghcr.io/cosmos/relayer" IBCRelayerVersion = "latest" GaiaImageVersion = "v14.1.0" OsmosisImageVersion = "v22.0.1" +) +var ( repo, version = GetDockerImageInfo() feeabsImage = ibc.DockerImage{ @@ -135,7 +136,6 @@ func modifyGenesisWhitelistTwapQueryOsmosis() func(ibc.ChainConfig, []byte) ([]b if err := dyno.Append(g, whitelist, "app_state", "interchainquery", "params", "allow_queries"); err != nil { return nil, fmt.Errorf("failed to set whitelist in genesis json: %w", err) } - fmt.Println("Genesis file updated", g) out, err := json.Marshal(g) if err != nil { return nil, fmt.Errorf("failed to marshal genesis bytes to json: %w", err) @@ -144,7 +144,11 @@ func modifyGenesisWhitelistTwapQueryOsmosis() func(ibc.ChainConfig, []byte) ([]b } } -func modifyGenesisShortProposals(votingPeriod string, maxDepositPeriod string, queryEpochTime string) func(ibc.ChainConfig, []byte) ([]byte, error) { +func modifyGenesisShortProposals( + votingPeriod string, + maxDepositPeriod string, + queryEpochTime string, +) func(ibc.ChainConfig, []byte) ([]byte, error) { return func(chainConfig ibc.ChainConfig, genbz []byte) ([]byte, error) { g := make(map[string]interface{}) if err := json.Unmarshal(genbz, &g); err != nil { @@ -165,7 +169,6 @@ func modifyGenesisShortProposals(votingPeriod string, maxDepositPeriod string, q if err := dyno.Set(g, queryEpochTime, "app_state", "feeabs", "epochs", 1, "duration"); err != nil { return nil, fmt.Errorf("failed to set query epoch time in genesis json: %w", err) } - fmt.Println("Genesis file updated", g) out, err := json.Marshal(g) if err != nil { return nil, fmt.Errorf("failed to marshal genesis bytes to json: %w", err) @@ -463,7 +466,7 @@ func SetupChain(t *testing.T, ctx context.Context) ([]ibc.Chain, []ibc.Wallet, [ // Send Gaia uatom to Osmosis gaiaHeight, err := gaia.Height(ctx) require.NoError(t, err) - dstAddress := sdktypes.MustBech32ifyAddressBytes(osmosis.Config().Bech32Prefix, osmosisUser.Address()) + dstAddress := sdk.MustBech32ifyAddressBytes(osmosis.Config().Bech32Prefix, osmosisUser.Address()) transfer := ibc.WalletAmount{ Address: dstAddress, Denom: gaia.Config().Denom, @@ -482,7 +485,7 @@ func SetupChain(t *testing.T, ctx context.Context) ([]ibc.Chain, []ibc.Wallet, [ // Send Feeabs stake to Osmosis feeabsHeight, err := feeabs.Height(ctx) require.NoError(t, err) - dstAddress = sdktypes.MustBech32ifyAddressBytes(osmosis.Config().Bech32Prefix, osmosisUser.Address()) + dstAddress = sdk.MustBech32ifyAddressBytes(osmosis.Config().Bech32Prefix, osmosisUser.Address()) transfer = ibc.WalletAmount{ Address: dstAddress, Denom: feeabs.Config().Denom, @@ -501,7 +504,7 @@ func SetupChain(t *testing.T, ctx context.Context) ([]ibc.Chain, []ibc.Wallet, [ // Send Gaia uatom to Feeabs gaiaHeight, err = gaia.Height(ctx) require.NoError(t, err) - dstAddress = sdktypes.MustBech32ifyAddressBytes(feeabs.Config().Bech32Prefix, feeabsUser.Address()) + dstAddress = sdk.MustBech32ifyAddressBytes(feeabs.Config().Bech32Prefix, feeabsUser.Address()) transfer = ibc.WalletAmount{ Address: dstAddress, Denom: gaia.Config().Denom, @@ -558,7 +561,7 @@ func SetupOsmosisContracts(t *testing.T, // Instantiate contracts // 1. Crosschain Registry Contract - owner := sdktypes.MustBech32ifyAddressBytes(osmosis.Config().Bech32Prefix, user.Address()) + owner := sdk.MustBech32ifyAddressBytes(osmosis.Config().Bech32Prefix, user.Address()) initMsg := fmt.Sprintf("{\"owner\":\"%s\"}", owner) registryContractAddr, err := osmosis.InstantiateContract(ctx, user.KeyName(), registryCodeId, initMsg, true) From 4d9adcacd602e0ac7cdc55f216d64a99dbf1728b Mon Sep 17 00:00:00 2001 From: Tien Nguyen Date: Fri, 31 May 2024 21:00:34 +0700 Subject: [PATCH 3/4] Optimize host zone proposal test faster (#204) * Update module to go 1.22 and simple start chain test * Update github workflows to go1.22 * Update github workflows dependencies * Update go module toolchain * Remove conflict mergify file * Remove hard code initial amount deposits of osmosis pool * Remove deps folder * Optimize host zone proposal test faster * Add test parallel --- tests/interchaintest/chain_start_test.go | 2 + .../interchaintest/host_zone_proposal_test.go | 45 +++++++++++++++---- .../ibc_transfer_customfee_test.go | 2 +- tests/interchaintest/packet_foward_test.go | 3 ++ .../interchaintest/query_osmosis_twap_test.go | 20 ++++++--- tests/interchaintest/setup.go | 1 + 6 files changed, 59 insertions(+), 14 deletions(-) diff --git a/tests/interchaintest/chain_start_test.go b/tests/interchaintest/chain_start_test.go index 5651b075..7bee2ae2 100644 --- a/tests/interchaintest/chain_start_test.go +++ b/tests/interchaintest/chain_start_test.go @@ -16,6 +16,8 @@ func TestStartFeeabs(t *testing.T) { t.Skip() } + t.Parallel() + numVals := 1 numFullNodes := 1 diff --git a/tests/interchaintest/host_zone_proposal_test.go b/tests/interchaintest/host_zone_proposal_test.go index 84520325..1b3b7cda 100644 --- a/tests/interchaintest/host_zone_proposal_test.go +++ b/tests/interchaintest/host_zone_proposal_test.go @@ -4,8 +4,10 @@ import ( "context" "testing" + "github.com/strangelove-ventures/interchaintest/v8" "github.com/strangelove-ventures/interchaintest/v8/chain/cosmos" "github.com/stretchr/testify/require" + "go.uber.org/zap/zaptest" feeabsCli "github.com/osmosis-labs/fee-abstraction/v8/tests/interchaintest/feeabs" ) @@ -14,18 +16,45 @@ func TestHostZoneProposal(t *testing.T) { if testing.Short() { t.Skip("skipping in short mode") } - ctx := context.Background() - chains, users, channels := SetupChain(t, ctx) - feeabs, _, osmosis := chains[0].(*cosmos.CosmosChain), chains[1].(*cosmos.CosmosChain), chains[2].(*cosmos.CosmosChain) - channFeeabsOsmosis, _, channFeeabsOsmosisICQ := channels[0], channels[1], channels[6] + t.Parallel() + + numVals := 1 + numFullNodes := 1 - feeabsUser, _, _ := users[0], users[1], users[2] - osmoOnFeeabs := GetOsmoOnFeeabs(channFeeabsOsmosis, osmosis.Config().Denom) + cf := interchaintest.NewBuiltinChainFactory(zaptest.NewLogger(t), []*interchaintest.ChainSpec{ + { + Name: "feeabs", + ChainConfig: feeabsConfig, + NumValidators: &numVals, + NumFullNodes: &numFullNodes, + }, + }) - ParamChangeProposal(t, ctx, feeabs, feeabsUser, &channFeeabsOsmosis, &channFeeabsOsmosisICQ, osmoOnFeeabs) + chains, err := cf.Chains(t.Name()) + require.NoError(t, err) + + ctx := context.Background() + feeabs := chains[0].(*cosmos.CosmosChain) + ic := interchaintest.NewInterchain().AddChain(feeabs) + client, network := interchaintest.DockerSetup(t) + + require.NoError(t, ic.Build(ctx, nil, interchaintest.InterchainBuildOptions{ + TestName: t.Name(), + Client: client, + NetworkID: network, + SkipPathCreation: true, + })) + t.Cleanup(func() { + _ = ic.Close() + }) + + users := interchaintest.GetAndFundTestUsers(t, ctx, t.Name(), genesisWalletAmount, feeabs) + feeabsUser := users[0] + + ParamChangeProposal(t, ctx, feeabs, feeabsUser, "channel-0", "channel-1", fakeIBCDenom) AddHostZoneProposal(t, ctx, feeabs, feeabsUser) - _, err := feeabsCli.QueryHostZoneConfigWithDenom(feeabs, ctx, osmoOnFeeabs) + _, err = feeabsCli.QueryHostZoneConfigWithDenom(feeabs, ctx, fakeIBCDenom) require.NoError(t, err) } diff --git a/tests/interchaintest/ibc_transfer_customfee_test.go b/tests/interchaintest/ibc_transfer_customfee_test.go index b0923791..41804116 100644 --- a/tests/interchaintest/ibc_transfer_customfee_test.go +++ b/tests/interchaintest/ibc_transfer_customfee_test.go @@ -131,7 +131,7 @@ func TestFeeabsGaiaIBCTransferWithIBCFee(t *testing.T) { // Setup feeabs module & add host zone via proposals //////////////////////////////////////////////////////////////////////////////////////// - ParamChangeProposal(t, ctx, feeabs, feeabsUser, &channFeeabsOsmosis, &channFeeabsOsmosisICQ, stakeOnOsmosis) + ParamChangeProposal(t, ctx, feeabs, feeabsUser, channFeeabsOsmosis.ChannelID, channFeeabsOsmosisICQ.ChannelID, stakeOnOsmosis) AddHostZoneProposal(t, ctx, feeabs, feeabsUser) _, err = feeabsCli.QueryAllHostZoneConfig(feeabs, ctx) require.NoError(t, err) diff --git a/tests/interchaintest/packet_foward_test.go b/tests/interchaintest/packet_foward_test.go index 3afabd1b..886ff09a 100644 --- a/tests/interchaintest/packet_foward_test.go +++ b/tests/interchaintest/packet_foward_test.go @@ -18,6 +18,9 @@ func TestPacketForwardMiddleware(t *testing.T) { if testing.Short() { t.Skip("skipping in short mode") } + + t.Parallel() + // Set up chains, users and channels ctx := context.Background() chains, users, channels := SetupChain(t, ctx) diff --git a/tests/interchaintest/query_osmosis_twap_test.go b/tests/interchaintest/query_osmosis_twap_test.go index 0b062bcd..08f777c2 100644 --- a/tests/interchaintest/query_osmosis_twap_test.go +++ b/tests/interchaintest/query_osmosis_twap_test.go @@ -22,6 +22,9 @@ func TestQueryOsmosisTwap(t *testing.T) { if testing.Short() { t.Skip("skipping in short mode") } + + t.Parallel() + // Set up chains, users and channels ctx := context.Background() chains, users, channels := SetupChain(t, ctx) @@ -98,7 +101,7 @@ func TestQueryOsmosisTwap(t *testing.T) { err = osmosis.QueryContract(ctx, registryContractAddress, queryMsg, &res) require.NoError(t, err) - ParamChangeProposal(t, ctx, feeabs, feeabsUser, &channFeeabsOsmosis, &channFeeabsOsmosisICQ, stakeOnOsmosis) + ParamChangeProposal(t, ctx, feeabs, feeabsUser, channFeeabsOsmosis.ChannelID, channFeeabsOsmosisICQ.ChannelID, stakeOnOsmosis) AddHostZoneProposal(t, ctx, feeabs, feeabsUser) // ensure that the host zone is added @@ -120,7 +123,14 @@ func TestQueryOsmosisTwap(t *testing.T) { require.NoError(t, err) } -func ParamChangeProposal(t *testing.T, ctx context.Context, feeabs *cosmos.CosmosChain, feeabsUser ibc.Wallet, channFeeabsOsmosis, channFeeabsOsmosisFeeabs *ibc.ChannelOutput, stakeOnOsmosis string) { +func ParamChangeProposal( + t *testing.T, + ctx context.Context, + feeabs *cosmos.CosmosChain, + feeabsUser ibc.Wallet, + channFeeabsOsmosis, channFeeabsOsmosisFeeabs string, + stakeOnOsmosis string, +) { t.Helper() govAddr, err := feeabs.AuthQueryModuleAddress(ctx, "gov") require.NoError(t, err) @@ -128,8 +138,8 @@ func ParamChangeProposal(t *testing.T, ctx context.Context, feeabs *cosmos.Cosmo updateParamMsg := feeabstypes.MsgUpdateParams{ Params: feeabstypes.Params{ OsmosisQueryTwapPath: "/osmosis.twap.v1beta1.Query/ArithmeticTwapToNow", - IbcTransferChannel: channFeeabsOsmosis.ChannelID, - IbcQueryIcqChannel: channFeeabsOsmosisFeeabs.ChannelID, + IbcTransferChannel: channFeeabsOsmosis, + IbcQueryIcqChannel: channFeeabsOsmosisFeeabs, NativeIbcedInOsmosis: stakeOnOsmosis, OsmosisCrosschainSwapAddress: "osmo17p9rzwnnfxcjp32un9ug7yhhzgtkhvl9jfksztgw5uh69wac2pgs5yczr8", ChainName: feeabs.Config().ChainID, @@ -170,7 +180,7 @@ func AddHostZoneProposal(t *testing.T, ctx context.Context, feeabs *cosmos.Cosmo addHostZoneMsg := feeabstypes.MsgAddHostZone{ HostChainConfig: &feeabstypes.HostChainFeeAbsConfig{ - IbcDenom: "ibc/0471F1C4E7AFD3F07702BEF6DC365268D64570F7C1FDC98EA6098DD6DE59817B", + IbcDenom: fakeIBCDenom, OsmosisPoolTokenDenomIn: "uosmo", PoolId: 1, Status: 0, diff --git a/tests/interchaintest/setup.go b/tests/interchaintest/setup.go index b6dabf39..7acf6f11 100644 --- a/tests/interchaintest/setup.go +++ b/tests/interchaintest/setup.go @@ -86,6 +86,7 @@ var ( pathOsmosisGaia = "osmosis-gaia" genesisWalletAmount = math.NewInt(100_000_000_000) amountToSend = math.NewInt(1_000_000_000) + fakeIBCDenom = "ibc/0471F1C4E7AFD3F07702BEF6DC365268D64570F7C1FDC98EA6098DD6DE59817B" ) // feeabsEncoding registers the feeabs specific module codecs so that the associated types and msgs From e06bbc3bb9d9e551fba368db6fd3b2a9774d1c7e Mon Sep 17 00:00:00 2001 From: Tuan Tran Date: Sun, 9 Jun 2024 20:14:06 +0700 Subject: [PATCH 4/4] add retract (#205) --- go.mod | 2 ++ 1 file changed, 2 insertions(+) diff --git a/go.mod b/go.mod index 3911411c..1adef8b7 100644 --- a/go.mod +++ b/go.mod @@ -354,3 +354,5 @@ replace ( github.com/syndtr/goleveldb => github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 ) + +retract v8.0.0