Skip to content

Commit

Permalink
test: refactor interchaintest and add test for using ibc token as fee (
Browse files Browse the repository at this point in the history
  • Loading branch information
tuantran1702 authored May 28, 2024
1 parent 0f6c619 commit 16adadb
Show file tree
Hide file tree
Showing 135 changed files with 33,091 additions and 437 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/interchaintest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,24 @@ jobs:
env:
BRANCH_CI: 'latest'


test-ibc-ibcfee:
runs-on: ubuntu-latest
needs: build-and-push-image
steps:
- name: Set up Go 1.21
uses: actions/setup-go@v3
with:
go-version: 1.21

- name: checkout code
uses: actions/checkout@v3

- run: make ictest-ibc-custom
env:
BRANCH_CI: 'latest'


test-packet-forward:
runs-on: ubuntu-latest
needs: build-and-push-image
Expand Down
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ ictest-basic:

# Executes IBC tests via interchaintest
ictest-ibc:
cd tests/interchaintest && go test -timeout=25m -race -v -run TestFeeabsGaiaIBCTransfer .
cd tests/interchaintest && go test -timeout=25m -race -v -run '^TestFeeabsGaiaIBCTransfer$$' .

# Executes IBC tests via interchaintest
ictest-packet-forward:
Expand All @@ -133,6 +133,9 @@ ictest-feeabs:
ictest-query-osmosis-twap:
cd tests/interchaintest && go test -timeout=25m -race -v -run TestQueryOsmosisTwap .

ictest-ibc-custom:
cd tests/interchaintest && go test -timeout=25m -race -v -run TestFeeabsGaiaIBCTransferWithIBCFee .

# ictest-feeabs-ibc-transfer:
# cd tests/interchaintest && go test -timeout=25m -race -v -run TestIBCTransferWithFeeAbs .

Expand Down
2 changes: 2 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -332,4 +332,6 @@ replace (
// latest grpc doesn't work with our modified proto compiler, so we need to enforce
// the following version across all dependencies.
google.golang.org/grpc => google.golang.org/grpc v1.54.0


)
1 change: 1 addition & 0 deletions tests/interchaintest/feeabs/proposal.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ func ParamChangeProposal(c *cosmos.CosmosChain, ctx context.Context, keyName str
"param-change",
proposalPath,
"--gas", "auto",
"--gas-adjustment", "1.5",
}

txHash, err := tn.ExecTx(ctx, keyName, command...)
Expand Down
20 changes: 20 additions & 0 deletions tests/interchaintest/feeabs/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ package feeabs
import (
"context"
"encoding/json"
"fmt"
"time"

"github.com/strangelove-ventures/interchaintest/v7/chain/cosmos"

Expand Down Expand Up @@ -39,6 +41,7 @@ func QueryAllHostZoneConfig(c *cosmos.CosmosChain, ctx context.Context) (*AllQue
if err != nil {
return &AllQueryHostChainConfigResponse{}, err
}
fmt.Println(hostZoneConfig)

return &hostZoneConfig, nil
}
Expand Down Expand Up @@ -73,3 +76,20 @@ func QueryOsmosisArithmeticTwap(c *cosmos.CosmosChain, ctx context.Context, ibcD
}
return &response, nil
}

func QueryOsmosisArithmeticTwapOsmosis(c *cosmos.CosmosChain, ctx context.Context, poolID, ibcDenom string) (*feeabstypes.QueryOsmosisArithmeticTwapResponse, error) {
node := getFullNode(c)
currentEpoch := time.Now().Unix()

cmd := []string{"twap", "arithmetic", poolID, ibcDenom, fmt.Sprintf("%d", currentEpoch-20), fmt.Sprintf("%d", currentEpoch-10)}
stdout, _, err := node.ExecQuery(ctx, cmd...)
if err != nil {
return &feeabstypes.QueryOsmosisArithmeticTwapResponse{}, err
}

var response feeabstypes.QueryOsmosisArithmeticTwapResponse
if err = json.Unmarshal(stdout, &response); err != nil {
return &feeabstypes.QueryOsmosisArithmeticTwapResponse{}, err
}
return &response, nil
}
233 changes: 0 additions & 233 deletions tests/interchaintest/feeabs_test.go

This file was deleted.

Loading

0 comments on commit 16adadb

Please sign in to comment.