Skip to content

Commit

Permalink
Debug
Browse files Browse the repository at this point in the history
  • Loading branch information
Jayashsatolia403 committed Aug 25, 2023
1 parent 64d6066 commit bf7b380
Showing 1 changed file with 37 additions and 36 deletions.
73 changes: 37 additions & 36 deletions tests/tokenomics_tests/blobber_challenge_reward_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,51 +92,53 @@ 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,
"data": 1,
"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,
"data": 1,
"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)
})
Expand All @@ -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
Expand All @@ -178,54 +179,54 @@ 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,
"data": 1,
"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,
"data": 1,
"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)
})

Check failure on line 229 in tests/tokenomics_tests/blobber_challenge_reward_test.go

View workflow job for this annotation

GitHub Actions / lint

unnecessary trailing newline (whitespace)
}

func stakeTokensToBlobbersAndValidators(t *test.SystemTest, blobbers, validators []string, configPath string, tokens []float64, numDelegates int) {
Expand Down

0 comments on commit bf7b380

Please sign in to comment.