From 9d41146f4dbb3846780ad5a9bc6f13d0f5b7519c Mon Sep 17 00:00:00 2001 From: Troy Kessler Date: Fri, 27 Oct 2023 10:45:40 +0200 Subject: [PATCH] test: adjusted keeper_suite_funding_bundles_test.go in bundles module --- .../keeper_suite_funding_bundles_test.go | 161 +++++++++++------- 1 file changed, 97 insertions(+), 64 deletions(-) diff --git a/x/bundles/keeper/keeper_suite_funding_bundles_test.go b/x/bundles/keeper/keeper_suite_funding_bundles_test.go index 7b39e1b3..ad16c345 100644 --- a/x/bundles/keeper/keeper_suite_funding_bundles_test.go +++ b/x/bundles/keeper/keeper_suite_funding_bundles_test.go @@ -60,6 +60,23 @@ var _ = Describe("funding bundles", Ordered, func() { PoolId: 0, Valaddress: i.VALADDRESS_0_A, }) + + s.RunTxStakersSuccess(&stakertypes.MsgCreateStaker{ + Creator: i.STAKER_1, + Amount: 100 * i.KYVE, + }) + + s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ + Creator: i.STAKER_1, + PoolId: 0, + Valaddress: i.VALADDRESS_1_A, + }) + + s.RunTxBundlesSuccess(&bundletypes.MsgClaimUploaderRole{ + Creator: i.VALADDRESS_0_A, + Staker: i.STAKER_0, + PoolId: 0, + }) }) AfterEach(func() { @@ -74,12 +91,6 @@ var _ = Describe("funding bundles", Ordered, func() { Amount: 100 * i.KYVE, }) - s.RunTxBundlesSuccess(&bundletypes.MsgClaimUploaderRole{ - Creator: i.VALADDRESS_0_A, - Staker: i.STAKER_0, - PoolId: 0, - }) - s.CommitAfterSeconds(60) s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ @@ -96,12 +107,20 @@ var _ = Describe("funding bundles", Ordered, func() { BundleSummary: "test_value", }) + s.RunTxBundlesSuccess(&bundletypes.MsgVoteBundleProposal{ + Creator: i.VALADDRESS_1_A, + Staker: i.STAKER_1, + PoolId: 0, + StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", + Vote: 1, + }) + s.CommitAfterSeconds(60) // ACT s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_0_A, - Staker: i.STAKER_0, + Creator: i.VALADDRESS_1_A, + Staker: i.STAKER_1, PoolId: 0, StorageId: "P9edn0bjEfMU_lecFDIPLvGO2v2ltpFNUMWp5kgPddg", DataSize: 100, @@ -148,12 +167,6 @@ var _ = Describe("funding bundles", Ordered, func() { Amount: 100 * i.KYVE, }) - s.RunTxBundlesSuccess(&bundletypes.MsgClaimUploaderRole{ - Creator: i.VALADDRESS_0_A, - Staker: i.STAKER_0, - PoolId: 0, - }) - s.CommitAfterSeconds(60) s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ @@ -170,12 +183,20 @@ var _ = Describe("funding bundles", Ordered, func() { BundleSummary: "test_value", }) + s.RunTxBundlesSuccess(&bundletypes.MsgVoteBundleProposal{ + Creator: i.VALADDRESS_1_A, + Staker: i.STAKER_1, + PoolId: 0, + StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", + Vote: 1, + }) + s.CommitAfterSeconds(60) // ACT s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_0_A, - Staker: i.STAKER_0, + Creator: i.VALADDRESS_1_A, + Staker: i.STAKER_1, PoolId: 0, StorageId: "P9edn0bjEfMU_lecFDIPLvGO2v2ltpFNUMWp5kgPddg", DataSize: 100, @@ -229,12 +250,6 @@ var _ = Describe("funding bundles", Ordered, func() { Amount: 50 * i.KYVE, }) - s.RunTxBundlesSuccess(&bundletypes.MsgClaimUploaderRole{ - Creator: i.VALADDRESS_0_A, - Staker: i.STAKER_0, - PoolId: 0, - }) - s.CommitAfterSeconds(60) s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ @@ -251,12 +266,20 @@ var _ = Describe("funding bundles", Ordered, func() { BundleSummary: "test_value", }) + s.RunTxBundlesSuccess(&bundletypes.MsgVoteBundleProposal{ + Creator: i.VALADDRESS_1_A, + Staker: i.STAKER_1, + PoolId: 0, + StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", + Vote: 1, + }) + s.CommitAfterSeconds(60) // ACT s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_0_A, - Staker: i.STAKER_0, + Creator: i.VALADDRESS_1_A, + Staker: i.STAKER_1, PoolId: 0, StorageId: "P9edn0bjEfMU_lecFDIPLvGO2v2ltpFNUMWp5kgPddg", DataSize: 100, @@ -310,12 +333,6 @@ var _ = Describe("funding bundles", Ordered, func() { Amount: 100 * i.KYVE, }) - s.RunTxBundlesSuccess(&bundletypes.MsgClaimUploaderRole{ - Creator: i.VALADDRESS_0_A, - Staker: i.STAKER_0, - PoolId: 0, - }) - s.CommitAfterSeconds(60) s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ @@ -332,12 +349,20 @@ var _ = Describe("funding bundles", Ordered, func() { BundleSummary: "test_value", }) + s.RunTxBundlesSuccess(&bundletypes.MsgVoteBundleProposal{ + Creator: i.VALADDRESS_1_A, + Staker: i.STAKER_1, + PoolId: 0, + StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", + Vote: 1, + }) + s.CommitAfterSeconds(60) // ACT s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_0_A, - Staker: i.STAKER_0, + Creator: i.VALADDRESS_1_A, + Staker: i.STAKER_1, PoolId: 0, StorageId: "P9edn0bjEfMU_lecFDIPLvGO2v2ltpFNUMWp5kgPddg", DataSize: 100, @@ -380,12 +405,6 @@ var _ = Describe("funding bundles", Ordered, func() { Amount: 10, }) - s.RunTxBundlesSuccess(&bundletypes.MsgClaimUploaderRole{ - Creator: i.VALADDRESS_0_A, - Staker: i.STAKER_0, - PoolId: 0, - }) - s.CommitAfterSeconds(60) s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ @@ -402,12 +421,20 @@ var _ = Describe("funding bundles", Ordered, func() { BundleSummary: "test_value", }) + s.RunTxBundlesSuccess(&bundletypes.MsgVoteBundleProposal{ + Creator: i.VALADDRESS_1_A, + Staker: i.STAKER_1, + PoolId: 0, + StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", + Vote: 1, + }) + s.CommitAfterSeconds(60) // ACT s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_0_A, - Staker: i.STAKER_0, + Creator: i.VALADDRESS_1_A, + Staker: i.STAKER_1, PoolId: 0, StorageId: "P9edn0bjEfMU_lecFDIPLvGO2v2ltpFNUMWp5kgPddg", DataSize: 100, @@ -449,12 +476,6 @@ var _ = Describe("funding bundles", Ordered, func() { Amount: 10, }) - s.RunTxBundlesSuccess(&bundletypes.MsgClaimUploaderRole{ - Creator: i.VALADDRESS_0_A, - Staker: i.STAKER_0, - PoolId: 0, - }) - s.CommitAfterSeconds(60) s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ @@ -471,12 +492,20 @@ var _ = Describe("funding bundles", Ordered, func() { BundleSummary: "test_value", }) + s.RunTxBundlesSuccess(&bundletypes.MsgVoteBundleProposal{ + Creator: i.VALADDRESS_1_A, + Staker: i.STAKER_1, + PoolId: 0, + StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", + Vote: 1, + }) + s.CommitAfterSeconds(60) // ACT s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_0_A, - Staker: i.STAKER_0, + Creator: i.VALADDRESS_1_A, + Staker: i.STAKER_1, PoolId: 0, StorageId: "P9edn0bjEfMU_lecFDIPLvGO2v2ltpFNUMWp5kgPddg", DataSize: 100, @@ -521,12 +550,6 @@ var _ = Describe("funding bundles", Ordered, func() { Amount: 20, }) - s.RunTxBundlesSuccess(&bundletypes.MsgClaimUploaderRole{ - Creator: i.VALADDRESS_0_A, - Staker: i.STAKER_0, - PoolId: 0, - }) - s.CommitAfterSeconds(60) s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ @@ -543,12 +566,20 @@ var _ = Describe("funding bundles", Ordered, func() { BundleSummary: "test_value", }) + s.RunTxBundlesSuccess(&bundletypes.MsgVoteBundleProposal{ + Creator: i.VALADDRESS_1_A, + Staker: i.STAKER_1, + PoolId: 0, + StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", + Vote: 1, + }) + s.CommitAfterSeconds(60) // ACT s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_0_A, - Staker: i.STAKER_0, + Creator: i.VALADDRESS_1_A, + Staker: i.STAKER_1, PoolId: 0, StorageId: "P9edn0bjEfMU_lecFDIPLvGO2v2ltpFNUMWp5kgPddg", DataSize: 100, @@ -581,12 +612,6 @@ var _ = Describe("funding bundles", Ordered, func() { It("Produce a valid bundle although there are no funders at all", func() { // ARRANGE - s.RunTxBundlesSuccess(&bundletypes.MsgClaimUploaderRole{ - Creator: i.VALADDRESS_0_A, - Staker: i.STAKER_0, - PoolId: 0, - }) - s.CommitAfterSeconds(60) s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ @@ -603,6 +628,14 @@ var _ = Describe("funding bundles", Ordered, func() { BundleSummary: "test_value", }) + s.RunTxBundlesSuccess(&bundletypes.MsgVoteBundleProposal{ + Creator: i.VALADDRESS_1_A, + Staker: i.STAKER_1, + PoolId: 0, + StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", + Vote: 1, + }) + pool, _ := s.App().PoolKeeper.GetPool(s.Ctx(), 0) // assert total pool funds @@ -613,8 +646,8 @@ var _ = Describe("funding bundles", Ordered, func() { // ACT s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_0_A, - Staker: i.STAKER_0, + Creator: i.VALADDRESS_1_A, + Staker: i.STAKER_1, PoolId: 0, StorageId: "P9edn0bjEfMU_lecFDIPLvGO2v2ltpFNUMWp5kgPddg", DataSize: 100,