forked from lavanet/lava
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PRT - fix e2e race condition and invalid behavior (lavanet#1085)
* fix init_e2e race condition and invalid behavior * better stability * adding more info to debug * test adjustment * fix e2e * fix * fix e2e adding another block wait because of begin block event order * adding delay because github action is so slow. * fix a bug related to qos excellence report. * fix optimizer race condition on unitests * upgrade lavajs to v0.32.4 * increase protocol patch version to 32.5 * using rlock instead * fix division of zero * fix lint * fixed race in init_e2e * changed sync score to one instead of 0 in excellence due to 0 being ideal value and 1 being 0 contribution
- Loading branch information
1 parent
88bc936
commit abc96ed
Showing
10 changed files
with
150 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,30 @@ | ||
{ | ||
"proposal": { | ||
"title": "Add temporary to-delete plan proposal", | ||
"description": "A proposal of a temporary to-delete plan", | ||
"plans": [ | ||
{ | ||
"index": "to_delete_plan", | ||
"description": "This plan has no restrictions", | ||
"type": "rpc", | ||
"price": { | ||
"denom": "ulava", | ||
"amount": "100000" | ||
}, | ||
"annual_discount_percentage": 20, | ||
"allow_overuse": true, | ||
"overuse_rate": 2, | ||
"plan_policy": { | ||
"chain_policies": [ | ||
{ | ||
"chain_id": "LAV1", | ||
"apis": [ | ||
] | ||
}, | ||
{ | ||
"chain_id": "ETH1", | ||
"apis": [ | ||
"eth_blockNumber", | ||
"eth_accounts" | ||
] | ||
} | ||
], | ||
"geolocation_profile": "AU", | ||
"total_cu_limit": 1000000, | ||
"epoch_cu_limit": 100000, | ||
"max_providers_to_pair": 3, | ||
"selected_providers_mode": "MIXED", | ||
"selected_providers": [ | ||
"lava@1wvn4slrf2r7cm92fnqdhvl3x470944uev92squ" | ||
] | ||
} | ||
} | ||
] | ||
"title": "to_delete_plan", | ||
"description": "to_delete_plan", | ||
"plans": [ | ||
{ | ||
"index": "to_delete_plan", | ||
"description": "to_delete_plan", | ||
"type": "rpc", | ||
"price": { | ||
"denom": "ulava", | ||
"amount": "10000" | ||
}, | ||
"annual_discount_percentage": 20, | ||
"allow_overuse": false, | ||
"overuse_rate": 0, | ||
"plan_policy": { | ||
"chain_policies": [], | ||
"geolocation_profile": "GL", | ||
"total_cu_limit": 100000, | ||
"epoch_cu_limit": 50, | ||
"max_providers_to_pair": 5, | ||
"selected_providers_mode": "ALLOWED", | ||
"selected_providers": [] | ||
} | ||
} | ||
] | ||
}, | ||
"deposit": "10000000ulava" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package types | ||
|
||
import ( | ||
"testing" | ||
|
||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
func TestQosReport(t *testing.T) { | ||
qos1 := &QualityOfServiceReport{ | ||
Latency: sdk.MustNewDecFromStr("1.5"), | ||
Availability: sdk.MustNewDecFromStr("1"), | ||
Sync: sdk.MustNewDecFromStr("0.1"), | ||
} | ||
qos2 := &QualityOfServiceReport{ | ||
Latency: sdk.MustNewDecFromStr("0.2"), | ||
Availability: sdk.MustNewDecFromStr("1"), | ||
Sync: sdk.MustNewDecFromStr("0.1"), | ||
} | ||
qos3 := &QualityOfServiceReport{ | ||
Latency: sdk.MustNewDecFromStr("0.1"), | ||
Availability: sdk.MustNewDecFromStr("1"), | ||
Sync: sdk.MustNewDecFromStr("0.5"), | ||
} | ||
qos4 := &QualityOfServiceReport{ | ||
Latency: sdk.MustNewDecFromStr("0.1"), | ||
Availability: sdk.MustNewDecFromStr("0.5"), | ||
Sync: sdk.MustNewDecFromStr("0.5"), | ||
} | ||
|
||
qos1Res, errQos1 := qos1.ComputeQoSExcellence() | ||
qos2Res, errQos2 := qos2.ComputeQoSExcellence() | ||
qos3Res, errQos3 := qos3.ComputeQoSExcellence() | ||
qos4Res, errQos4 := qos4.ComputeQoSExcellence() | ||
require.NoError(t, errQos1) | ||
require.NoError(t, errQos2) | ||
require.NoError(t, errQos3) | ||
require.NoError(t, errQos4) | ||
require.True(t, qos1Res.LT(qos2Res)) | ||
require.True(t, qos1Res.LT(qos3Res)) | ||
require.True(t, qos1Res.LT(qos4Res)) | ||
|
||
require.True(t, qos2Res.GT(qos3Res)) | ||
require.True(t, qos2Res.GT(qos4Res)) | ||
|
||
require.True(t, qos4Res.LT(qos3Res)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters