Skip to content

Commit 16adadb

Browse files
authored
test: refactor interchaintest and add test for using ibc token as fee (#193)
1 parent 0f6c619 commit 16adadb

File tree

135 files changed

+33091
-437
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

135 files changed

+33091
-437
lines changed

.github/workflows/interchaintest.yaml

+18
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,24 @@ jobs:
5959
env:
6060
BRANCH_CI: 'latest'
6161

62+
63+
test-ibc-ibcfee:
64+
runs-on: ubuntu-latest
65+
needs: build-and-push-image
66+
steps:
67+
- name: Set up Go 1.21
68+
uses: actions/setup-go@v3
69+
with:
70+
go-version: 1.21
71+
72+
- name: checkout code
73+
uses: actions/checkout@v3
74+
75+
- run: make ictest-ibc-custom
76+
env:
77+
BRANCH_CI: 'latest'
78+
79+
6280
test-packet-forward:
6381
runs-on: ubuntu-latest
6482
needs: build-and-push-image

Makefile

+4-1
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ ictest-basic:
118118

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

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

136+
ictest-ibc-custom:
137+
cd tests/interchaintest && go test -timeout=25m -race -v -run TestFeeabsGaiaIBCTransferWithIBCFee .
138+
136139
# ictest-feeabs-ibc-transfer:
137140
# cd tests/interchaintest && go test -timeout=25m -race -v -run TestIBCTransferWithFeeAbs .
138141

go.mod

+2
Original file line numberDiff line numberDiff line change
@@ -332,4 +332,6 @@ replace (
332332
// latest grpc doesn't work with our modified proto compiler, so we need to enforce
333333
// the following version across all dependencies.
334334
google.golang.org/grpc => google.golang.org/grpc v1.54.0
335+
336+
335337
)

tests/interchaintest/feeabs/proposal.go

+1
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,7 @@ func ParamChangeProposal(c *cosmos.CosmosChain, ctx context.Context, keyName str
195195
"param-change",
196196
proposalPath,
197197
"--gas", "auto",
198+
"--gas-adjustment", "1.5",
198199
}
199200

200201
txHash, err := tn.ExecTx(ctx, keyName, command...)

tests/interchaintest/feeabs/query.go

+20
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ package feeabs
33
import (
44
"context"
55
"encoding/json"
6+
"fmt"
7+
"time"
68

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

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

4346
return &hostZoneConfig, nil
4447
}
@@ -73,3 +76,20 @@ func QueryOsmosisArithmeticTwap(c *cosmos.CosmosChain, ctx context.Context, ibcD
7376
}
7477
return &response, nil
7578
}
79+
80+
func QueryOsmosisArithmeticTwapOsmosis(c *cosmos.CosmosChain, ctx context.Context, poolID, ibcDenom string) (*feeabstypes.QueryOsmosisArithmeticTwapResponse, error) {
81+
node := getFullNode(c)
82+
currentEpoch := time.Now().Unix()
83+
84+
cmd := []string{"twap", "arithmetic", poolID, ibcDenom, fmt.Sprintf("%d", currentEpoch-20), fmt.Sprintf("%d", currentEpoch-10)}
85+
stdout, _, err := node.ExecQuery(ctx, cmd...)
86+
if err != nil {
87+
return &feeabstypes.QueryOsmosisArithmeticTwapResponse{}, err
88+
}
89+
90+
var response feeabstypes.QueryOsmosisArithmeticTwapResponse
91+
if err = json.Unmarshal(stdout, &response); err != nil {
92+
return &feeabstypes.QueryOsmosisArithmeticTwapResponse{}, err
93+
}
94+
return &response, nil
95+
}

tests/interchaintest/feeabs_test.go

-233
This file was deleted.

0 commit comments

Comments
 (0)