Skip to content

Commit

Permalink
test: adjusted keeper_suite_funding_bundles_test.go in bundles module
Browse files Browse the repository at this point in the history
  • Loading branch information
troykessler committed Oct 27, 2023
1 parent 6417020 commit 9d41146
Showing 1 changed file with 97 additions and 64 deletions.
161 changes: 97 additions & 64 deletions x/bundles/keeper/keeper_suite_funding_bundles_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand All @@ -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{
Expand All @@ -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,
Expand Down Expand Up @@ -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{
Expand All @@ -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,
Expand Down Expand Up @@ -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{
Expand All @@ -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,
Expand Down Expand Up @@ -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{
Expand All @@ -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,
Expand Down Expand Up @@ -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{
Expand All @@ -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,
Expand Down Expand Up @@ -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{
Expand All @@ -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,
Expand Down Expand Up @@ -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{
Expand All @@ -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,
Expand Down Expand Up @@ -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{
Expand All @@ -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
Expand All @@ -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,
Expand Down

0 comments on commit 9d41146

Please sign in to comment.