From bf7b3806f5297a4569015bcc73ea1c271d4f0edc Mon Sep 17 00:00:00 2001 From: Jayash Satolia Date: Sat, 26 Aug 2023 01:25:04 +0530 Subject: [PATCH] Debug --- .../blobber_challenge_reward_test.go | 73 ++++++++++--------- 1 file changed, 37 insertions(+), 36 deletions(-) diff --git a/tests/tokenomics_tests/blobber_challenge_reward_test.go b/tests/tokenomics_tests/blobber_challenge_reward_test.go index e5f52ab6d3..0475a99d1c 100644 --- a/tests/tokenomics_tests/blobber_challenge_reward_test.go +++ b/tests/tokenomics_tests/blobber_challenge_reward_test.go @@ -92,18 +92,17 @@ func TestBlobberChallengeRewards(testSetup *testing.T) { t.Log("Blobber List: ", blobberListString) t.Log("Validator List: ", validatorListString) - t.RunSequentiallyWithTimeout("Client Uploads 10% of Allocation and 1 delegate each (equal stake)", 100*time.Minute, func(t *test.SystemTest) { + t.RunSequentiallyWithTimeout("Client Uploads 10% of Allocation and 2 delegate each (equal stake)", 100*time.Minute, func(t *test.SystemTest) { t.Cleanup(func() { - tearDownRewardsTests(t, blobberListString, validatorListString, configPath, 1) + tearDownRewardsTests(t, blobberListString, validatorListString, configPath, 2) }) stakeTokensToBlobbersAndValidators(t, blobberListString, validatorListString, configPath, []float64{ - 1, 1, 1, 1, - }, 1) + 1, 1, 1, 1, 1, 1, 1, 1, + }, 2) // Creating Allocation - _ = utils.SetupWalletWithCustomTokens(t, configPath, 9.0) - + utils.SetupWalletWithCustomTokens(t, configPath, 9.0) allocationId := utils.SetupAllocationAndReadLock(t, configPath, map[string]interface{}{ "size": 1 * GB, "tokens": 99, @@ -111,21 +110,22 @@ func TestBlobberChallengeRewards(testSetup *testing.T) { "parity": 1, }) - assertChallengeRewardsForOneDelegateEach(t, allocationId, blobberListString, validatorListString, 0.1*GB, 1, 0) + assertChallengeRewardsForTwoDelegatesEach(t, allocationId, blobberListString, validatorListString, 0.1*GB, []int64{ + 1, 1, 1, 1, 1, 1, 1, 1, + }) }) - t.RunSequentiallyWithTimeout("Client Uploads 20% of Allocation and delete 10% immediately and 1 delegate each (equal stake)", 100*time.Minute, func(t *test.SystemTest) { + t.RunSequentiallyWithTimeout("Client Uploads 10% of Allocation and 2 delegate each (unequal stake)", 100*time.Minute, func(t *test.SystemTest) { t.Cleanup(func() { - tearDownRewardsTests(t, blobberListString, validatorListString, configPath, 1) + tearDownRewardsTests(t, blobberListString, validatorListString, configPath, 2) }) stakeTokensToBlobbersAndValidators(t, blobberListString, validatorListString, configPath, []float64{ - 1, 1, 1, 1, - }, 1) + 1, 1, 2, 2, 1, 1, 2, 2, + }, 2) // Creating Allocation - _ = utils.SetupWalletWithCustomTokens(t, configPath, 9.0) - + utils.SetupWalletWithCustomTokens(t, configPath, 9.0) allocationId := utils.SetupAllocationAndReadLock(t, configPath, map[string]interface{}{ "size": 1 * GB, "tokens": 99, @@ -133,10 +133,12 @@ func TestBlobberChallengeRewards(testSetup *testing.T) { "parity": 1, }) - assertChallengeRewardsForOneDelegateEach(t, allocationId, blobberListString, validatorListString, 0.1*GB, 2, 1) + assertChallengeRewardsForTwoDelegatesEach(t, allocationId, blobberListString, validatorListString, 0.1*GB, []int64{ + 1, 1, 2, 2, 1, 1, 2, 2, + }) }) - t.RunSequentiallyWithTimeout("Client Uploads 30% of Allocation and 1 delegate each (equal stake)", 100*time.Minute, func(t *test.SystemTest) { + t.RunSequentiallyWithTimeout("Client Uploads 10% of Allocation and 1 delegate each (equal stake)", 100*time.Minute, func(t *test.SystemTest) { t.Cleanup(func() { tearDownRewardsTests(t, blobberListString, validatorListString, configPath, 1) }) @@ -155,17 +157,16 @@ func TestBlobberChallengeRewards(testSetup *testing.T) { "parity": 1, }) - assertChallengeRewardsForOneDelegateEach(t, allocationId, blobberListString, validatorListString, 0.3*GB, 1, 0) + assertChallengeRewardsForOneDelegateEach(t, allocationId, blobberListString, validatorListString, 0.1*GB, 1, 0) }) - t.RunSequentiallyWithTimeout("Client Uploads 10% of Allocation and 1 delegate each (unequal stake 2:1)", 100*time.Minute, func(t *test.SystemTest) { + t.RunSequentiallyWithTimeout("Client Uploads 20% of Allocation and delete 10% immediately and 1 delegate each (equal stake)", 100*time.Minute, func(t *test.SystemTest) { t.Cleanup(func() { tearDownRewardsTests(t, blobberListString, validatorListString, configPath, 1) }) - // Staking Tokens to all blobbers and validators stakeTokensToBlobbersAndValidators(t, blobberListString, validatorListString, configPath, []float64{ - 1, 2, 1, 2, + 1, 1, 1, 1, }, 1) // Creating Allocation @@ -178,20 +179,21 @@ func TestBlobberChallengeRewards(testSetup *testing.T) { "parity": 1, }) - assertChallengeRewardsForOneDelegateEach(t, allocationId, blobberListString, validatorListString, 0.1*GB, 1, 0) + assertChallengeRewardsForOneDelegateEach(t, allocationId, blobberListString, validatorListString, 0.1*GB, 2, 1) }) - t.RunSequentiallyWithTimeout("Client Uploads 10% of Allocation and 2 delegate each (equal stake)", 100*time.Minute, func(t *test.SystemTest) { + t.RunSequentiallyWithTimeout("Client Uploads 30% of Allocation and 1 delegate each (equal stake)", 100*time.Minute, func(t *test.SystemTest) { t.Cleanup(func() { - tearDownRewardsTests(t, blobberListString, validatorListString, configPath, 2) + tearDownRewardsTests(t, blobberListString, validatorListString, configPath, 1) }) stakeTokensToBlobbersAndValidators(t, blobberListString, validatorListString, configPath, []float64{ - 1, 1, 1, 1, 1, 1, 1, 1, - }, 2) + 1, 1, 1, 1, + }, 1) // Creating Allocation - utils.SetupWalletWithCustomTokens(t, configPath, 9.0) + _ = utils.SetupWalletWithCustomTokens(t, configPath, 9.0) + allocationId := utils.SetupAllocationAndReadLock(t, configPath, map[string]interface{}{ "size": 1 * GB, "tokens": 99, @@ -199,22 +201,22 @@ func TestBlobberChallengeRewards(testSetup *testing.T) { "parity": 1, }) - assertChallengeRewardsForTwoDelegatesEach(t, allocationId, blobberListString, validatorListString, 0.1*GB, []int64{ - 1, 1, 1, 1, 1, 1, 1, 1, - }) + assertChallengeRewardsForOneDelegateEach(t, allocationId, blobberListString, validatorListString, 0.3*GB, 1, 0) }) - t.RunSequentiallyWithTimeout("Client Uploads 10% of Allocation and 2 delegate each (unequal stake)", 100*time.Minute, func(t *test.SystemTest) { + t.RunSequentiallyWithTimeout("Client Uploads 10% of Allocation and 1 delegate each (unequal stake 2:1)", 100*time.Minute, func(t *test.SystemTest) { t.Cleanup(func() { - tearDownRewardsTests(t, blobberListString, validatorListString, configPath, 2) + tearDownRewardsTests(t, blobberListString, validatorListString, configPath, 1) }) + // Staking Tokens to all blobbers and validators stakeTokensToBlobbersAndValidators(t, blobberListString, validatorListString, configPath, []float64{ - 1, 1, 2, 2, 1, 1, 2, 2, - }, 2) + 1, 2, 1, 2, + }, 1) // Creating Allocation - utils.SetupWalletWithCustomTokens(t, configPath, 9.0) + _ = utils.SetupWalletWithCustomTokens(t, configPath, 9.0) + allocationId := utils.SetupAllocationAndReadLock(t, configPath, map[string]interface{}{ "size": 1 * GB, "tokens": 99, @@ -222,10 +224,9 @@ func TestBlobberChallengeRewards(testSetup *testing.T) { "parity": 1, }) - assertChallengeRewardsForTwoDelegatesEach(t, allocationId, blobberListString, validatorListString, 0.1*GB, []int64{ - 1, 1, 2, 2, 1, 1, 2, 2, - }) + assertChallengeRewardsForOneDelegateEach(t, allocationId, blobberListString, validatorListString, 0.1*GB, 1, 0) }) + } func stakeTokensToBlobbersAndValidators(t *test.SystemTest, blobbers, validators []string, configPath string, tokens []float64, numDelegates int) {