From 6e612fae800d21e759258087d71a9567b2d2df67 Mon Sep 17 00:00:00 2001 From: zale144 Date: Thu, 4 Apr 2024 04:53:46 +0200 Subject: [PATCH] Turn back the disabled tests --- .github/workflows/e2e_test.yml | 44 ++++++++++++++++++++----- tests/eibc_fulfillment_test.go | 14 ++++---- tests/frozen_test.go | 13 ++++---- tests/ibc_grace_period_test.go | 9 ++--- tests/ibc_pfm_test.go | 9 ++--- tests/ibc_pfm_with_grace_period_test.go | 9 ++--- tests/ibc_timeout_test.go | 30 ++++++++--------- tests/ibc_transfer_test.go | 9 ++--- tests/rollapp_genesis_event_test.go | 9 ++--- tests/setup.go | 35 ++++++++++---------- 10 files changed, 107 insertions(+), 74 deletions(-) diff --git a/.github/workflows/e2e_test.yml b/.github/workflows/e2e_test.yml index bf92b119..e505b598 100644 --- a/.github/workflows/e2e_test.yml +++ b/.github/workflows/e2e_test.yml @@ -25,16 +25,16 @@ jobs: strategy: matrix: tests: - # - "e2e-test-ibc-success-evm" + - "e2e-test-ibc-success-evm" - "e2e-test-ibc-timeout-evm" - # - "e2e-test-ibc-grace-period-evm" - # - "e2e-test-eibc-fulfillment-evm" - # - "e2e-test-transfer-multi-hop-evm" - # - "e2e-test-pfm-with-grace-period-evm" - # - "e2e-test-batch-finalization-evm" - # - "e2e-test-rollapp-freeze-evm" - # - "e2e-test-other-rollapp-not-affected-evm" - # - "e2e-test-rollapp-genesis-event-evm" + - "e2e-test-ibc-grace-period-evm" + - "e2e-test-eibc-fulfillment-evm" + - "e2e-test-transfer-multi-hop-evm" + - "e2e-test-pfm-with-grace-period-evm" + - "e2e-test-batch-finalization-evm" + - "e2e-test-rollapp-freeze-evm" + - "e2e-test-other-rollapp-not-affected-evm" + - "e2e-test-rollapp-genesis-event-evm" fail-fast: false runs-on: ubuntu-latest steps: @@ -49,3 +49,29 @@ jobs: - name: Rollapp-EVM E2E Tests run: | make ${{ matrix.tests }} + rollapp-wasm: + strategy: + matrix: + tests: + - "e2e-test-ibc-success-wasm" + - "e2e-test-ibc-timeout-wasm" + - "e2e-test-ibc-grace-period-wasm" + - "e2e-test-eibc-fulfillment-wasm" + - "e2e-test-transfer-multi-hop-wasm" + - "e2e-test-pfm-with-grace-period-wasm" + - "e2e-test-batch-finalization-wasm" + - "e2e-test-rollapp-freeze-wasm" + - "e2e-test-other-rollapp-not-affected-wasm" + fail-fast: false + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + repository: dymensionxyz/e2e-tests + - name: Set up Go 1.21 + uses: actions/setup-go@v4 + with: + go-version: "1.21.4" + + - name: Rollapp-Wasm E2E Tests + run: make ${{ matrix.tests }} diff --git a/tests/eibc_fulfillment_test.go b/tests/eibc_fulfillment_test.go index 798b9983..0fcf9651 100644 --- a/tests/eibc_fulfillment_test.go +++ b/tests/eibc_fulfillment_test.go @@ -8,19 +8,19 @@ import ( "cosmossdk.io/math" transfertypes "github.com/cosmos/ibc-go/v6/modules/apps/transfer/types" + "github.com/stretchr/testify/require" + "go.uber.org/zap/zaptest" + test "github.com/decentrio/rollup-e2e-testing" "github.com/decentrio/rollup-e2e-testing/blockdb" "github.com/decentrio/rollup-e2e-testing/cosmos" "github.com/decentrio/rollup-e2e-testing/cosmos/hub/dym_hub" "github.com/decentrio/rollup-e2e-testing/cosmos/rollapp/dym_rollapp" - "github.com/decentrio/rollup-e2e-testing/ibc" - dymensiontesting "github.com/decentrio/rollup-e2e-testing/dymension" + "github.com/decentrio/rollup-e2e-testing/ibc" "github.com/decentrio/rollup-e2e-testing/relayer" "github.com/decentrio/rollup-e2e-testing/testreporter" "github.com/decentrio/rollup-e2e-testing/testutil" - "github.com/stretchr/testify/require" - "go.uber.org/zap/zaptest" ) // This test case verifies the system's behavior when an eIBC packet sent from the rollapp to the hub @@ -173,7 +173,7 @@ func TestEIBCFulfillment_EVM(t *testing.T) { err = testutil.WaitForBlocks(ctx, 5, dymension) require.NoError(t, err) - triggerGenesisEvent(t, dymension, rollapp1.GetChainID(), channel.ChannelID, dymensionUser) + triggerHubGenesisEvent(t, dymension, rollapp1.Config().ChainID, channel.ChannelID, dymensionUser.KeyName()) transferData := ibc.WalletData{ Address: marketMakerAddr, @@ -417,10 +417,10 @@ func TestEIBCFulfillment_Wasm(t *testing.T) { err = r.StartRelayer(ctx, eRep, ibcPath) require.NoError(t, err) - err = testutil.WaitForBlocks(ctx, 5, dymension) + err = testutil.WaitForBlocks(ctx, 3, dymension) require.NoError(t, err) - triggerGenesisEvent(t, dymension, rollapp1.GetChainID(), channel.ChannelID, dymensionUser) + triggerHubGenesisEvent(t, dymension, rollapp1.Config().ChainID, channel.ChannelID, dymensionUser.KeyName()) transferData := ibc.WalletData{ Address: marketMakerAddr, diff --git a/tests/frozen_test.go b/tests/frozen_test.go index 0fa6ce0d..9a63c481 100644 --- a/tests/frozen_test.go +++ b/tests/frozen_test.go @@ -9,6 +9,9 @@ import ( "cosmossdk.io/math" transfertypes "github.com/cosmos/ibc-go/v6/modules/apps/transfer/types" + "github.com/stretchr/testify/require" + "go.uber.org/zap/zaptest" + test "github.com/decentrio/rollup-e2e-testing" "github.com/decentrio/rollup-e2e-testing/cosmos" "github.com/decentrio/rollup-e2e-testing/cosmos/hub/dym_hub" @@ -17,8 +20,6 @@ import ( "github.com/decentrio/rollup-e2e-testing/relayer" "github.com/decentrio/rollup-e2e-testing/testreporter" "github.com/decentrio/rollup-e2e-testing/testutil" - "github.com/stretchr/testify/require" - "go.uber.org/zap/zaptest" ) const anotherIbcPath = "dymension-demo2" @@ -184,7 +185,7 @@ func TestRollAppFreeze_EVM(t *testing.T) { require.NoError(t, err) require.Equal(t, len(dymChannel), 1) - triggerGenesisEvent(t, dymension, rollapp1.GetChainID(), dymChannel[0].ChannelID, dymensionUser) + triggerHubGenesisEvent(t, dymension, rollapp1.Config().ChainID, dymChannel[0].ChannelID, dymensionUser.KeyName()) oldLatestIndex, err := dymension.GetNode().QueryLatestStateIndex(ctx, rollapp1.Config().ChainID) require.NoError(t, err) @@ -426,7 +427,7 @@ func TestRollAppFreeze_Wasm(t *testing.T) { err = testutil.WaitForBlocks(ctx, 3, dymension, rollapp1) require.NoError(t, err) - triggerGenesisEvent(t, dymension, rollapp1.GetChainID(), dymChannel[0].ChannelID, dymensionUser) + triggerHubGenesisEvent(t, dymension, rollapp1.Config().ChainID, dymChannel[0].ChannelID, dymensionUser.KeyName()) oldLatestIndex, err := dymension.GetNode().QueryLatestStateIndex(ctx, rollapp1.Config().ChainID) require.NoError(t, err) @@ -743,7 +744,7 @@ func TestOtherRollappNotAffected_EVM(t *testing.T) { channsRollApp2Dym := channsRollApp2[0] require.NotEmpty(t, channsRollApp2Dym.ChannelID) - triggerGenesisEvent(t, dymension, rollapp1.GetChainID(), channDymRollApp1.ChannelID, dymensionUser) + triggerHubGenesisEvent(t, dymension, rollapp1.Config().ChainID, channDymRollApp1.ChannelID, dymensionUser.KeyName()) oldLatestIndex, err := dymension.GetNode().QueryLatestStateIndex(ctx, rollapp1.Config().ChainID) require.NoError(t, err) @@ -1150,7 +1151,7 @@ func TestOtherRollappNotAffected_Wasm(t *testing.T) { channsRollApp2Dym := channsRollApp2[0] require.NotEmpty(t, channsRollApp2Dym.ChannelID) - triggerGenesisEvent(t, dymension, rollapp1.GetChainID(), channDymRollApp1.ChannelID, dymensionUser) + triggerHubGenesisEvent(t, dymension, rollapp1.Config().ChainID, channDymRollApp1.ChannelID, dymensionUser.KeyName()) oldLatestIndex, err := dymension.GetNode().QueryLatestStateIndex(ctx, rollapp1.Config().ChainID) require.NoError(t, err) diff --git a/tests/ibc_grace_period_test.go b/tests/ibc_grace_period_test.go index 03ade9b5..1fa8df33 100644 --- a/tests/ibc_grace_period_test.go +++ b/tests/ibc_grace_period_test.go @@ -7,6 +7,9 @@ import ( "cosmossdk.io/math" transfertypes "github.com/cosmos/ibc-go/v6/modules/apps/transfer/types" + "github.com/stretchr/testify/require" + "go.uber.org/zap/zaptest" + test "github.com/decentrio/rollup-e2e-testing" "github.com/decentrio/rollup-e2e-testing/cosmos" "github.com/decentrio/rollup-e2e-testing/cosmos/hub/dym_hub" @@ -15,8 +18,6 @@ import ( "github.com/decentrio/rollup-e2e-testing/relayer" "github.com/decentrio/rollup-e2e-testing/testreporter" "github.com/decentrio/rollup-e2e-testing/testutil" - "github.com/stretchr/testify/require" - "go.uber.org/zap/zaptest" ) // TestIBCGracePeriodCompliance ensures that the grace period for transaction finalization is correctly enforced on hub and rollapp. @@ -169,7 +170,7 @@ func TestIBCGracePeriodCompliance_EVM(t *testing.T) { err = testutil.WaitForBlocks(ctx, 3, rollapp1) require.NoError(t, err) - triggerGenesisEvent(t, dymension, rollapp1.GetChainID(), channel.ChannelID, dymensionUser) + triggerHubGenesisEvent(t, dymension, rollapp1.Config().ChainID, channel.ChannelID, dymensionUser.KeyName()) // Compose an IBC transfer and send from Hub -> rollapp _, err = dymension.SendIBCTransfer(ctx, channel.ChannelID, dymensionUserAddr, transferData, ibc.TransferOptions{}) @@ -382,7 +383,7 @@ func TestIBCGracePeriodCompliance_Wasm(t *testing.T) { err = testutil.WaitForBlocks(ctx, 3, dymension, rollapp1) require.NoError(t, err) - triggerGenesisEvent(t, dymension, rollapp1.GetChainID(), channel.ChannelID, dymensionUser) + triggerHubGenesisEvent(t, dymension, rollapp1.Config().ChainID, channel.ChannelID, dymensionUser.KeyName()) // Compose an IBC transfer and send from Hub -> rollapp _, err = dymension.SendIBCTransfer(ctx, channel.ChannelID, dymensionUserAddr, transferData, ibc.TransferOptions{}) diff --git a/tests/ibc_pfm_test.go b/tests/ibc_pfm_test.go index 44ee8b8d..31a11bb9 100644 --- a/tests/ibc_pfm_test.go +++ b/tests/ibc_pfm_test.go @@ -9,6 +9,9 @@ import ( "cosmossdk.io/math" transfertypes "github.com/cosmos/ibc-go/v6/modules/apps/transfer/types" + "github.com/stretchr/testify/require" + "go.uber.org/zap/zaptest" + test "github.com/decentrio/rollup-e2e-testing" "github.com/decentrio/rollup-e2e-testing/cosmos" "github.com/decentrio/rollup-e2e-testing/cosmos/hub/dym_hub" @@ -17,8 +20,6 @@ import ( "github.com/decentrio/rollup-e2e-testing/relayer" "github.com/decentrio/rollup-e2e-testing/testreporter" "github.com/decentrio/rollup-e2e-testing/testutil" - "github.com/stretchr/testify/require" - "go.uber.org/zap/zaptest" ) func TestIBCTransferMultiHop_EVM(t *testing.T) { @@ -212,7 +213,7 @@ func TestIBCTransferMultiHop_EVM(t *testing.T) { require.NoError(t, err) require.Equal(t, walletAmount, gaiaOrigBal) - triggerGenesisEvent(t, dymension, rollapp1.GetChainID(), channDymRollApp.ChannelID, dymensionUser) + triggerHubGenesisEvent(t, dymension, rollapp1.Config().ChainID, channDymRollApp.ChannelID, dymensionUser.KeyName()) t.Run("multihop rollapp->dym->gaia", func(t *testing.T) { firstHopDenom := transfertypes.GetPrefixedDenom(channDymRollApp.PortID, channDymRollApp.ChannelID, rollapp1.Config().Denom) @@ -451,7 +452,7 @@ func TestIBCTransferMultiHop_Wasm(t *testing.T) { require.NoError(t, err) require.Equal(t, walletAmount, gaiaOrigBal) - triggerGenesisEvent(t, dymension, rollapp1.GetChainID(), channDymRollApp.ChannelID, dymensionUser) + triggerHubGenesisEvent(t, dymension, rollapp1.Config().ChainID, channDymRollApp.ChannelID, dymensionUser.KeyName()) t.Run("multihop rollapp->dym->gaia", func(t *testing.T) { firstHopDenom := transfertypes.GetPrefixedDenom(channDymRollApp.PortID, channDymRollApp.ChannelID, rollapp1.Config().Denom) diff --git a/tests/ibc_pfm_with_grace_period_test.go b/tests/ibc_pfm_with_grace_period_test.go index 3e3865be..b2b59f88 100644 --- a/tests/ibc_pfm_with_grace_period_test.go +++ b/tests/ibc_pfm_with_grace_period_test.go @@ -9,6 +9,9 @@ import ( "cosmossdk.io/math" transfertypes "github.com/cosmos/ibc-go/v6/modules/apps/transfer/types" + "github.com/stretchr/testify/require" + "go.uber.org/zap/zaptest" + test "github.com/decentrio/rollup-e2e-testing" "github.com/decentrio/rollup-e2e-testing/cosmos" "github.com/decentrio/rollup-e2e-testing/cosmos/hub/dym_hub" @@ -17,8 +20,6 @@ import ( "github.com/decentrio/rollup-e2e-testing/relayer" "github.com/decentrio/rollup-e2e-testing/testreporter" "github.com/decentrio/rollup-e2e-testing/testutil" - "github.com/stretchr/testify/require" - "go.uber.org/zap/zaptest" ) func TestIBCPFMWithGracePeriod_EVM(t *testing.T) { @@ -236,7 +237,7 @@ func TestIBCPFMWithGracePeriod_EVM(t *testing.T) { require.NoError(t, err) require.Equal(t, walletAmount, gaiaOrigBal) - triggerGenesisEvent(t, dymension, rollapp1.GetChainID(), channDymRollApp.ChannelID, dymensionUser) + triggerHubGenesisEvent(t, dymension, rollapp1.Config().ChainID, channDymRollApp.ChannelID, dymensionUser.KeyName()) t.Run("multihop rollapp->dym->gaia, funds received on gaia after grace period", func(t *testing.T) { firstHopDenom := transfertypes.GetPrefixedDenom(channDymRollApp.PortID, channDymRollApp.ChannelID, rollapp1.Config().Denom) @@ -516,7 +517,7 @@ func TestIBCPFMWithGracePeriod_Wasm(t *testing.T) { require.NoError(t, err) require.Equal(t, walletAmount, gaiaOrigBal) - triggerGenesisEvent(t, dymension, rollapp1.GetChainID(), channDymRollApp.ChannelID, dymensionUser) + triggerHubGenesisEvent(t, dymension, rollapp1.Config().ChainID, channDymRollApp.ChannelID, dymensionUser.KeyName()) t.Run("multihop rollapp->dym->gaia, funds received on gaia after grace period", func(t *testing.T) { firstHopDenom := transfertypes.GetPrefixedDenom(channDymRollApp.PortID, channDymRollApp.ChannelID, rollapp1.Config().Denom) diff --git a/tests/ibc_timeout_test.go b/tests/ibc_timeout_test.go index f3e92adb..060defbc 100644 --- a/tests/ibc_timeout_test.go +++ b/tests/ibc_timeout_test.go @@ -7,17 +7,19 @@ import ( "cosmossdk.io/math" transfertypes "github.com/cosmos/ibc-go/v6/modules/apps/transfer/types" + test "github.com/decentrio/rollup-e2e-testing" "github.com/decentrio/rollup-e2e-testing/cosmos" "github.com/decentrio/rollup-e2e-testing/cosmos/hub/dym_hub" "github.com/decentrio/rollup-e2e-testing/cosmos/rollapp/dym_rollapp" "github.com/decentrio/rollup-e2e-testing/ibc" + "github.com/stretchr/testify/require" + "go.uber.org/zap/zaptest" + "github.com/decentrio/rollup-e2e-testing/relayer" "github.com/decentrio/rollup-e2e-testing/testreporter" "github.com/decentrio/rollup-e2e-testing/testutil" - "github.com/stretchr/testify/require" - "go.uber.org/zap/zaptest" ) // This test case verifies the system's behavior when an IBC packet sent from the rollapp to the hub times out. @@ -158,13 +160,7 @@ func TestIBCTransferTimeout_EVM(t *testing.T) { channel, err := ibc.GetTransferChannel(ctx, r, eRep, dymension.Config().ChainID, rollapp1.Config().ChainID) require.NoError(t, err) - err = r.StartRelayer(ctx, eRep, ibcPath) - require.NoError(t, err) - // Wait a few blocks for relayer to start - err = testutil.WaitForBlocks(ctx, 3, dymension, rollapp1) - require.NoError(t, err) - - triggerGenesisEvent(t, dymension, rollapp1.GetChainID(), channel.ChannelID, dymensionUser) + triggerHubGenesisEvent(t, dymension, rollapp1.Config().ChainID, channel.ChannelID, dymensionUser.KeyName()) transferData := ibc.WalletData{ Address: dymensionUserAddr, @@ -184,6 +180,9 @@ func TestIBCTransferTimeout_EVM(t *testing.T) { // Assert balance was updated on the rollapp testutil.AssertBalance(t, ctx, rollapp1, rollappUserAddr, rollapp1.Config().Denom, walletAmount.Sub(transferData.Amount)) + err = r.StartRelayer(ctx, eRep, ibcPath) + require.NoError(t, err) + err = testutil.WaitForBlocks(ctx, 5, dymension) require.NoError(t, err) @@ -380,12 +379,7 @@ func TestIBCTransferTimeout_Wasm(t *testing.T) { channel, err := ibc.GetTransferChannel(ctx, r, eRep, dymension.Config().ChainID, rollapp1.Config().ChainID) require.NoError(t, err) - err = r.StartRelayer(ctx, eRep, ibcPath) - require.NoError(t, err) - err = testutil.WaitForBlocks(ctx, 3, dymension) - require.NoError(t, err) - - triggerGenesisEvent(t, dymension, rollapp1.GetChainID(), channel.ChannelID, dymensionUser) + triggerHubGenesisEvent(t, dymension, rollapp1.GetChainID(), channel.ChannelID, dymensionUser.KeyName()) transferData := ibc.WalletData{ Address: dymensionUserAddr, @@ -405,6 +399,12 @@ func TestIBCTransferTimeout_Wasm(t *testing.T) { // Assert balance was updated on the rollapp testutil.AssertBalance(t, ctx, rollapp1, rollappUserAddr, rollapp1.Config().Denom, walletAmount.Sub(transferData.Amount)) + err = r.StartRelayer(ctx, eRep, ibcPath) + require.NoError(t, err) + + err = testutil.WaitForBlocks(ctx, 5, dymension) + require.NoError(t, err) + // Stop relayer after relaying err = r.StopRelayer(ctx, eRep) require.NoError(t, err, "an error occurred while stopping the relayer") diff --git a/tests/ibc_transfer_test.go b/tests/ibc_transfer_test.go index bd77aee2..ce7aceed 100644 --- a/tests/ibc_transfer_test.go +++ b/tests/ibc_transfer_test.go @@ -7,6 +7,9 @@ import ( "cosmossdk.io/math" transfertypes "github.com/cosmos/ibc-go/v6/modules/apps/transfer/types" + "github.com/stretchr/testify/require" + "go.uber.org/zap/zaptest" + test "github.com/decentrio/rollup-e2e-testing" "github.com/decentrio/rollup-e2e-testing/cosmos/hub/dym_hub" "github.com/decentrio/rollup-e2e-testing/cosmos/rollapp/dym_rollapp" @@ -14,8 +17,6 @@ import ( "github.com/decentrio/rollup-e2e-testing/relayer" "github.com/decentrio/rollup-e2e-testing/testreporter" "github.com/decentrio/rollup-e2e-testing/testutil" - "github.com/stretchr/testify/require" - "go.uber.org/zap/zaptest" ) const ibcPath = "dymension-demo" @@ -152,7 +153,7 @@ func TestIBCTransferSuccess_EVM(t *testing.T) { }, ) - triggerGenesisEvent(t, dymension, rollapp1.GetChainID(), channel.ChannelID, dymensionUser) + triggerHubGenesisEvent(t, dymension, rollapp1.Config().ChainID, channel.ChannelID, dymensionUser.KeyName()) // Compose an IBC transfer and send from dymension -> rollapp transferAmount := math.NewInt(1_000_000) @@ -336,7 +337,7 @@ func TestIBCTransferSuccess_Wasm(t *testing.T) { }, ) - triggerGenesisEvent(t, dymension, rollapp1.GetChainID(), channel.ChannelID, dymensionUser) + triggerHubGenesisEvent(t, dymension, rollapp1.Config().ChainID, channel.ChannelID, dymensionUser.KeyName()) // Compose an IBC transfer and send from dymension -> rollapp transferAmount := math.NewInt(1_000_000) diff --git a/tests/rollapp_genesis_event_test.go b/tests/rollapp_genesis_event_test.go index dc0a2d04..31709603 100644 --- a/tests/rollapp_genesis_event_test.go +++ b/tests/rollapp_genesis_event_test.go @@ -7,6 +7,9 @@ import ( "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/stretchr/testify/require" + "go.uber.org/zap/zaptest" + test "github.com/decentrio/rollup-e2e-testing" "github.com/decentrio/rollup-e2e-testing/cosmos" "github.com/decentrio/rollup-e2e-testing/cosmos/hub/dym_hub" @@ -15,8 +18,6 @@ import ( "github.com/decentrio/rollup-e2e-testing/relayer" "github.com/decentrio/rollup-e2e-testing/testreporter" "github.com/decentrio/rollup-e2e-testing/testutil" - "github.com/stretchr/testify/require" - "go.uber.org/zap/zaptest" ) // TestRollappGenesisEvent_EVM ensure that genesis event triggered in both rollapp evm and dymension hub @@ -128,7 +129,7 @@ func TestRollappGenesisEvent_EVM(t *testing.T) { dymensionUserAddr := dymensionUser.FormattedAddress() rollappUserAddr := rollappUser.FormattedAddress() - registerGenesisEventTriggerer(t, dymension, dymensionUser, "rollapp", "DeployerWhitelist") + registerGenesisEventTriggerer(t, dymension.CosmosChain, dymensionUser.KeyName(), dymensionUserAddr, "rollapp", "DeployerWhitelist") channel, err := ibc.GetTransferChannel(ctx, r, eRep, dymension.Config().ChainID, rollapp1.Config().ChainID) require.NoError(t, err) @@ -153,7 +154,7 @@ func TestRollappGenesisEvent_EVM(t *testing.T) { testutil.AssertBalance(t, ctx, dymension, validatorAddr, genesisCoin.Denom, genesisCoin.Amount) - registerGenesisEventTriggerer(t, dymension, dymensionUser, "hubgenesis", "GenesisTriggererWhitelist") + registerGenesisEventTriggerer(t, rollapp1.CosmosChain, rollappUser.KeyName(), rollappUserAddr, "hubgenesis", "GenesisTriggererWhitelist") hubgenesisMAcc, err := rollapp1.Validators[0].QueryModuleAccount(ctx, "hubgenesis") require.NoError(t, err) diff --git a/tests/setup.go b/tests/setup.go index 33c49419..185725a6 100644 --- a/tests/setup.go +++ b/tests/setup.go @@ -10,11 +10,12 @@ import ( simappparams "github.com/cosmos/cosmos-sdk/simapp/params" "github.com/cosmos/cosmos-sdk/x/params/client/utils" + "github.com/icza/dyno" + "github.com/stretchr/testify/require" + "github.com/decentrio/rollup-e2e-testing/cosmos" "github.com/decentrio/rollup-e2e-testing/cosmos/hub/dym_hub" "github.com/decentrio/rollup-e2e-testing/ibc" - "github.com/icza/dyno" - "github.com/stretchr/testify/require" hubgenesis "github.com/dymensionxyz/dymension-rdk/x/hub-genesis/types" eibc "github.com/dymensionxyz/dymension/v3/x/eibc/types" @@ -393,38 +394,38 @@ func modifyDymensionGenesis(genesisKV []cosmos.GenesisKV) func(ibc.ChainConfig, } } -func registerGenesisEventTriggerer(t *testing.T, dymension *dym_hub.DymHub, user ibc.Wallet, module, param string) { +func triggerHubGenesisEvent(t *testing.T, dymension *dym_hub.DymHub, rollappID, channelID, userKey string) { ctx := context.Background() keyDir := dymension.GetRollApps()[0].GetSequencerKeyDir() sequencerAddr, err := dymension.AccountKeyBech32WithKeyDir(ctx, "sequencer", keyDir) require.NoError(t, err) - deployerWhitelistParams := json.RawMessage(fmt.Sprintf(`[{"address":"%s"}]`, sequencerAddr)) - propTx, err := dymension.ParamChangeProposal(ctx, user.KeyName(), &utils.ParamChangeProposalJSON{ + registerGenesisEventTriggerer(t, dymension.CosmosChain, userKey, sequencerAddr, "rollapp", "DeployerWhitelist") + err = dymension.GetNode().TriggerGenesisEvent(ctx, "sequencer", rollappID, channelID, keyDir) + require.NoError(t, err) +} + +func registerGenesisEventTriggerer(t *testing.T, targetChain *cosmos.CosmosChain, userKey, address, module, param string) { + ctx := context.Background() + deployerWhitelistParams := json.RawMessage(fmt.Sprintf(`[{"address":"%s"}]`, address)) + propTx, err := targetChain.ParamChangeProposal(ctx, userKey, &utils.ParamChangeProposalJSON{ Title: "Add new deployer to whitelist", Description: "Add current user addr to the deployer whitelist", Changes: utils.ParamChangesJSON{ utils.NewParamChangeJSON(module, param, deployerWhitelistParams), }, - Deposit: "500000000000" + dymension.Config().Denom, // greater than min deposit + Deposit: "500000000000" + targetChain.Config().Denom, // greater than min deposit }) require.NoError(t, err) - err = dymension.VoteOnProposalAllValidators(ctx, propTx.ProposalID, cosmos.ProposalVoteYes) + err = targetChain.VoteOnProposalAllValidators(ctx, propTx.ProposalID, cosmos.ProposalVoteYes) require.NoError(t, err, "failed to submit votes") - height, err := dymension.Height(ctx) + height, err := targetChain.Height(ctx) require.NoError(t, err, "error fetching height") - _, err = cosmos.PollForProposalStatus(ctx, dymension.CosmosChain, height, height+20, propTx.ProposalID, cosmos.ProposalStatusPassed) + _, err = cosmos.PollForProposalStatus(ctx, targetChain, height, height+30, propTx.ProposalID, cosmos.ProposalStatusPassed) require.NoError(t, err, "proposal status did not change to passed") - new_params, err := dymension.QueryParam(ctx, "rollapp", "DeployerWhitelist") + new_params, err := targetChain.QueryParam(ctx, module, param) require.NoError(t, err) require.Equal(t, new_params.Value, string(deployerWhitelistParams)) } - -func triggerGenesisEvent(t *testing.T, dymension *dym_hub.DymHub, rollappID, channelID string, user ibc.Wallet) { - registerGenesisEventTriggerer(t, dymension, user, "rollapp", "DeployerWhitelist") - keyDir := dymension.GetRollApps()[0].GetSequencerKeyDir() - err := dymension.GetNode().TriggerGenesisEvent(context.Background(), "sequencer", rollappID, channelID, keyDir) - require.NoError(t, err) -}