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/go.mod b/go.mod index 1ce52305..060fbf2d 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 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..efeb2bab 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,13 +74,13 @@ 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) @@ -147,8 +146,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..e881a230 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,13 +65,13 @@ 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) diff --git a/tests/interchaintest/query_osmosis_twap_test.go b/tests/interchaintest/query_osmosis_twap_test.go index 28661db9..7516dea1 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,7 +68,7 @@ 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) diff --git a/tests/interchaintest/setup.go b/tests/interchaintest/setup.go index 16c1214d..04083dfc 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{ @@ -84,7 +85,7 @@ var ( pathFeeabsOsmosis = "feeabs-osmosis" pathOsmosisGaia = "osmosis-gaia" genesisWalletAmount = math.NewInt(100_000_000_000) - amountToSend = math.NewInt(1_000_000_000) + amountToSend = math.NewInt(1_000_000) ) // feeabsEncoding registers the feeabs specific module codecs so that the associated types and msgs @@ -144,7 +145,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 { @@ -463,7 +468,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 +487,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 +506,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 +563,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)