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)