diff --git a/tests/interchaintest/chain_start_test.go b/tests/interchaintest/chain_start_test.go index 634d4f45..2c970a9b 100644 --- a/tests/interchaintest/chain_start_test.go +++ b/tests/interchaintest/chain_start_test.go @@ -3,10 +3,11 @@ package interchaintest import ( "context" "fmt" + "testing" + sdktypes "github.com/cosmos/cosmos-sdk/types" "github.com/strangelove-ventures/interchaintest/v7/ibc" "github.com/strangelove-ventures/interchaintest/v7/testutil" - "testing" "github.com/strangelove-ventures/interchaintest/v7" "github.com/strangelove-ventures/interchaintest/v7/chain/cosmos" diff --git a/tests/interchaintest/feeabs/events.go b/tests/interchaintest/feeabs/events.go index 4686a440..2ab41bba 100644 --- a/tests/interchaintest/feeabs/events.go +++ b/tests/interchaintest/feeabs/events.go @@ -2,6 +2,7 @@ package feeabs import ( "encoding/base64" + abcitypes "github.com/cometbft/cometbft/abci/types" ) diff --git a/tests/interchaintest/feeabs/osmosis.go b/tests/interchaintest/feeabs/osmosis.go index acf85c9c..26d0be18 100644 --- a/tests/interchaintest/feeabs/osmosis.go +++ b/tests/interchaintest/feeabs/osmosis.go @@ -4,9 +4,10 @@ import ( "context" "encoding/json" "fmt" - "github.com/strangelove-ventures/interchaintest/v7/chain/cosmos" "path/filepath" "strconv" + + "github.com/strangelove-ventures/interchaintest/v7/chain/cosmos" ) func CreatePool(c *cosmos.CosmosChain, ctx context.Context, keyName string, params cosmos.OsmosisPoolParams) (string, error) { diff --git a/tests/interchaintest/feeabs/proposal.go b/tests/interchaintest/feeabs/proposal.go index 51e885df..86ba9989 100644 --- a/tests/interchaintest/feeabs/proposal.go +++ b/tests/interchaintest/feeabs/proposal.go @@ -5,6 +5,11 @@ import ( "crypto/sha256" "encoding/json" "fmt" + "os" + "path/filepath" + "strconv" + "time" + "github.com/avast/retry-go/v4" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/types" @@ -13,10 +18,6 @@ import ( "github.com/strangelove-ventures/interchaintest/v7/chain/cosmos" "github.com/strangelove-ventures/interchaintest/v7/ibc" "github.com/strangelove-ventures/interchaintest/v7/testutil" - "os" - "path/filepath" - "strconv" - "time" ) func getFullNode(c *cosmos.CosmosChain) *cosmos.ChainNode { diff --git a/tests/interchaintest/feeabs/query.go b/tests/interchaintest/feeabs/query.go index 5137159d..b48e4730 100644 --- a/tests/interchaintest/feeabs/query.go +++ b/tests/interchaintest/feeabs/query.go @@ -3,6 +3,7 @@ package feeabs import ( "context" "encoding/json" + "github.com/strangelove-ventures/interchaintest/v7/chain/cosmos" ) diff --git a/tests/interchaintest/feeabs/types.go b/tests/interchaintest/feeabs/types.go index 87d5b040..a21328ae 100644 --- a/tests/interchaintest/feeabs/types.go +++ b/tests/interchaintest/feeabs/types.go @@ -1,6 +1,8 @@ package feeabs -import "github.com/cosmos/cosmos-sdk/types" +import ( + sdk "github.com/cosmos/cosmos-sdk/types" +) type HostChainFeeAbsConfigResponse struct { HostChainConfig HostChainFeeAbsConfig `json:"host_chain_config"` @@ -21,6 +23,6 @@ type AddHostZoneProposalType struct { } type QueryFeeabsModuleBalacesResponse struct { - Balances types.Coins + Balances sdk.Coins Address string } diff --git a/tests/interchaintest/host_zone_proposal_test.go b/tests/interchaintest/host_zone_proposal_test.go index d751ba48..ba9853da 100644 --- a/tests/interchaintest/host_zone_proposal_test.go +++ b/tests/interchaintest/host_zone_proposal_test.go @@ -3,9 +3,9 @@ package interchaintest import ( "context" "fmt" - feeabsCli "github.com/notional-labs/fee-abstraction/tests/interchaintest/feeabs" "testing" + feeabsCli "github.com/notional-labs/fee-abstraction/tests/interchaintest/feeabs" "github.com/strangelove-ventures/interchaintest/v7/chain/cosmos" "github.com/stretchr/testify/require" ) @@ -28,7 +28,9 @@ func TestHostZoneProposal(t *testing.T) { err = feeabs.VoteOnProposalAllValidators(ctx, "1", cosmos.ProposalVoteYes) require.NoError(t, err, "failed to submit votes") - height, _ := feeabs.Height(ctx) + height, err := feeabs.Height(ctx) + require.NoError(t, err) + _, err = cosmos.PollForProposalStatus(ctx, feeabs, height, height+10, "1", cosmos.ProposalStatusPassed) require.NoError(t, err, "proposal status did not change to passed in expected number of blocks") @@ -48,7 +50,9 @@ func TestHostZoneProposal(t *testing.T) { err = feeabs.VoteOnProposalAllValidators(ctx, "2", cosmos.ProposalVoteYes) require.NoError(t, err, "failed to submit votes") - height, _ = feeabs.Height(ctx) + height, err = feeabs.Height(ctx) + require.NoError(t, err) + _, err = cosmos.PollForProposalStatus(ctx, feeabs, height, height+10, "2", cosmos.ProposalStatusPassed) require.NoError(t, err, "proposal status did not change to passed in expected number of blocks") @@ -68,16 +72,13 @@ func TestHostZoneProposal(t *testing.T) { err = feeabs.VoteOnProposalAllValidators(ctx, "3", cosmos.ProposalVoteYes) require.NoError(t, err, "failed to submit votes") - height, _ = feeabs.Height(ctx) + height, err = feeabs.Height(ctx) + require.NoError(t, err) + response, err := cosmos.PollForProposalStatus(ctx, feeabs, height, height+10, "3", cosmos.ProposalStatusPassed) require.NoError(t, err, "proposal status did not change to passed in expected number of blocks") fmt.Printf("response: %s\n", response) - config, err = feeabsCli.QueryHostZoneConfigWithDenom(feeabs, ctx, "ibc/C4CFF46FD6DE35CA4CF4CE031E643C8FDC9BA4B99AE598E9B0ED98FE3A2319F9") - require.Equal(t, config, &feeabsCli.HostChainFeeAbsConfigResponse{HostChainConfig: feeabsCli.HostChainFeeAbsConfig{ - IbcDenom: "", - OsmosisPoolTokenDenomIn: "", - PoolId: "", - Frozen: false, - }}) + _, err = feeabsCli.QueryHostZoneConfigWithDenom(feeabs, ctx, "ibc/C4CFF46FD6DE35CA4CF4CE031E643C8FDC9BA4B99AE598E9B0ED98FE3A2319F9") + require.Error(t, err) // not found } diff --git a/tests/interchaintest/ibc_transfer_test.go b/tests/interchaintest/ibc_transfer_test.go index 8f2fe8c2..4307e95c 100644 --- a/tests/interchaintest/ibc_transfer_test.go +++ b/tests/interchaintest/ibc_transfer_test.go @@ -7,7 +7,6 @@ import ( "cosmossdk.io/math" sdktypes "github.com/cosmos/cosmos-sdk/types" - transfertypes "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types" "github.com/strangelove-ventures/interchaintest/v7" "github.com/strangelove-ventures/interchaintest/v7/chain/cosmos" diff --git a/tests/interchaintest/packet_foward_test.go b/tests/interchaintest/packet_foward_test.go index 22751613..f15dfee1 100644 --- a/tests/interchaintest/packet_foward_test.go +++ b/tests/interchaintest/packet_foward_test.go @@ -2,16 +2,16 @@ package interchaintest import ( "context" - "cosmossdk.io/math" "fmt" - sdktypes "github.com/cosmos/cosmos-sdk/types" - paramsutils "github.com/cosmos/cosmos-sdk/x/params/client/utils" - feeabsCli "github.com/notional-labs/fee-abstraction/tests/interchaintest/feeabs" "os" "path" "testing" + "cosmossdk.io/math" + sdktypes "github.com/cosmos/cosmos-sdk/types" + paramsutils "github.com/cosmos/cosmos-sdk/x/params/client/utils" transfertypes "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types" + feeabsCli "github.com/notional-labs/fee-abstraction/tests/interchaintest/feeabs" "github.com/strangelove-ventures/interchaintest/v7/chain/cosmos" "github.com/strangelove-ventures/interchaintest/v7/ibc" "github.com/strangelove-ventures/interchaintest/v7/testutil" @@ -143,6 +143,7 @@ func TestPacketForwardMiddleware(t *testing.T) { // send ibc token to feeabs module account gaiaHeight, err := gaia.Height(ctx) require.NoError(t, err) + feeabsModule, err := feeabsCli.QueryModuleAccountBalances(feeabs, ctx) require.NoError(t, err) dstAddress := feeabsModule.Address @@ -176,7 +177,9 @@ func TestPacketForwardMiddleware(t *testing.T) { err = feeabs.VoteOnProposalAllValidators(ctx, paramTx.ProposalID, cosmos.ProposalVoteYes) require.NoError(t, err, "failed to submit votes") - height, _ := feeabs.Height(ctx) + height, err := feeabs.Height(ctx) + require.NoError(t, err) + _, err = cosmos.PollForProposalStatus(ctx, feeabs, height, height+10, paramTx.ProposalID, cosmos.ProposalStatusPassed) require.NoError(t, err, "proposal status did not change to passed in expected number of blocks") @@ -186,7 +189,9 @@ func TestPacketForwardMiddleware(t *testing.T) { err = feeabs.VoteOnProposalAllValidators(ctx, "2", cosmos.ProposalVoteYes) require.NoError(t, err, "failed to submit votes") - height, _ = feeabs.Height(ctx) + height, err = feeabs.Height(ctx) + require.NoError(t, err) + _, err = cosmos.PollForProposalStatus(ctx, feeabs, height, height+10, "2", cosmos.ProposalStatusPassed) require.NoError(t, err, "proposal status did not change to passed in expected number of blocks") diff --git a/tests/interchaintest/setup.go b/tests/interchaintest/setup.go index a0c6a88c..5c772c35 100644 --- a/tests/interchaintest/setup.go +++ b/tests/interchaintest/setup.go @@ -1,19 +1,16 @@ package interchaintest import ( - "cosmossdk.io/math" "encoding/json" "fmt" "os" "strings" + "cosmossdk.io/math" "github.com/cosmos/cosmos-sdk/types/module/testutil" "github.com/icza/dyno" - "github.com/strangelove-ventures/interchaintest/v7/chain/cosmos/wasm" - feeabstype "github.com/osmosis-labs/fee-abstraction/v7/x/feeabs/types" - - // "github.com/strangelove-ventures/interchaintest/v7/chain/cosmos/wasm" + "github.com/strangelove-ventures/interchaintest/v7/chain/cosmos/wasm" "github.com/strangelove-ventures/interchaintest/v7/ibc" ) diff --git a/x/feeabs/keeper/grpc_query.go b/x/feeabs/keeper/grpc_query.go index bfb39f78..47760517 100644 --- a/x/feeabs/keeper/grpc_query.go +++ b/x/feeabs/keeper/grpc_query.go @@ -23,7 +23,7 @@ func NewQuerier(k Keeper) Querier { return Querier{Keeper: k} } -// OsmosisSpotPrice return spot price of pair Osmo/nativeToken +// OsmosisArithmeticTwap return spot price of pair Osmo/nativeToken func (q Querier) OsmosisArithmeticTwap(goCtx context.Context, req *types.QueryOsmosisArithmeticTwapRequest) (*types.QueryOsmosisArithmeticTwapResponse, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "empty request")