Skip to content

Commit

Permalink
feat: test kyve image in interchaintest (#174)
Browse files Browse the repository at this point in the history
  • Loading branch information
shifty11 authored Apr 29, 2024
1 parent 5d89ccb commit c7af4e0
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 5 deletions.
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -182,12 +182,17 @@ proto-setup:
ensure_heighliner:
@which heighliner > /dev/null || (echo "❌ Heighliner not found. Please install it by running 'make heighliner-setup'." && exit 1)
@docker inspect kaon:local > /dev/null || (echo "❌ Kaon image not found. Please build it by running 'make heighliner'." && exit 1)
@docker inspect kyve:local > /dev/null || (echo "❌ Kyve image not found. Please build it by running 'make heighliner'." && exit 1)

heighliner:
@echo "🤖 Building Kaon image..."
@heighliner build --chain kaon --local 1> /dev/null
@echo "✅ Completed build!"

@echo "🤖 Building Kyve image..."
@heighliner build --chain kyve --local 1> /dev/null
@echo "✅ Completed build!"

heighliner-setup:
@echo "🤖 Installing Heighliner..."
@git clone https://github.com/strangelove-ventures/heighliner.git /tmp/heighliner
Expand Down
25 changes: 20 additions & 5 deletions interchaintest/upgrades/v1_5/upgrade_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,15 @@ func TestV1P2Upgrade(t *testing.T) {

var _ = Describe(fmt.Sprintf("%s Upgrade Tests", v1_5.UpgradeName), Ordered, func() {
var kaon *cosmos.CosmosChain
var kyve *cosmos.CosmosChain

var ctx context.Context
var client *client.Client
var network string
var interchain *interchaintest.Interchain

var kaonWallet *cosmos.CosmosWallet
var kyveWallet *cosmos.CosmosWallet

BeforeAll(func() {
numFullNodes := 0
Expand All @@ -51,14 +53,21 @@ var _ = Describe(fmt.Sprintf("%s Upgrade Tests", v1_5.UpgradeName), Ordered, fun
NumValidators: &numValidators,
NumFullNodes: &numFullNodes,
},
{
Name: "kyve",
ChainConfig: mainnetConfig,
NumValidators: &numValidators,
NumFullNodes: &numFullNodes,
},
})

chains, err := factory.Chains(GinkgoT().Name())
Expect(err).To(BeNil())
kaon = chains[0].(*cosmos.CosmosChain)
kaon, kyve = chains[0].(*cosmos.CosmosChain), chains[1].(*cosmos.CosmosChain)

interchain = interchaintest.NewInterchain().
AddChain(kaon)
AddChain(kaon).
AddChain(kyve)

ctx = context.Background()
client, network = interchaintest.DockerSetup(GinkgoT())
Expand All @@ -72,18 +81,24 @@ var _ = Describe(fmt.Sprintf("%s Upgrade Tests", v1_5.UpgradeName), Ordered, fun
Expect(err).To(BeNil())

wallets := interchaintest.GetAndFundTestUsers(
GinkgoT(), ctx, GinkgoT().Name(), math.NewInt(10_000_000_000), kaon,
GinkgoT(), ctx, GinkgoT().Name(), math.NewInt(10_000_000_000), kaon, kyve,
)
kaonWallet = wallets[0].(*cosmos.CosmosWallet)
kaonWallet, kyveWallet = wallets[0].(*cosmos.CosmosWallet), wallets[1].(*cosmos.CosmosWallet)
})

AfterAll(func() {
_ = kaon.StopAllNodes(ctx)
_ = kyve.StopAllNodes(ctx)
_ = interchain.Close()
})

It("", func() {
It("Kaon upgrade test", func() {
PerformUpgrade(ctx, client, kaon, kaonWallet, 10, "kaon")
})

It("Kyve upgrade test", func() {
PerformUpgrade(ctx, client, kyve, kyveWallet, 10, "kyve")
})
})

type Plan struct {
Expand Down
21 changes: 21 additions & 0 deletions interchaintest/upgrades/v1_5/upgrade_utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,27 @@ var testnetConfig = ibc.ChainConfig{
EncodingConfig: nil,
}

var mainnetConfig = ibc.ChainConfig{
Type: "cosmos",
Name: "kyve",
ChainID: "kyve-1",
Images: []ibc.DockerImage{{
Repository: "ghcr.io/strangelove-ventures/heighliner/kyve",
Version: previousVersion,
UidGid: uidGid,
}},
Bin: "kyved",
Bech32Prefix: "kyve",
Denom: "ukyve",
GasPrices: "0.02ukyve",
GasAdjustment: 5,
TrustingPeriod: "112h",
NoHostMount: false,
ModifyGenesis: ModifyGenesis,
ConfigFileOverrides: nil,
EncodingConfig: nil,
}

func ModifyGenesis(config ibc.ChainConfig, genbz []byte) ([]byte, error) {
genesis := make(map[string]interface{})
_ = json.Unmarshal(genbz, &genesis)
Expand Down

0 comments on commit c7af4e0

Please sign in to comment.