Skip to content

Commit

Permalink
Change enforceMaxPrice default valure to true
Browse files Browse the repository at this point in the history
  • Loading branch information
leszko committed Aug 12, 2024
1 parent 0eb89d8 commit f21f855
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion cmd/livepeer/starter/starter.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ func DefaultLivepeerConfig() LivepeerConfig {
defaultMaxTotalEV := "20000000000000"
defaultDepositMultiplier := 1
defaultMaxPricePerUnit := "0"
defaultEnforceMaxPrice := false
defaultEnforceMaxPrice := true
defaultPixelsPerUnit := "1"
defaultPriceFeedAddr := "0x639Fe6ab55C921f74e7fac1ee960C0B6293ba612" // ETH / USD price feed address on Arbitrum Mainnet
defaultAutoAdjustPrice := true
Expand Down
10 changes: 9 additions & 1 deletion server/selection_algorithm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ func TestFilter(t *testing.T) {
{
name: "Some Orchestrators pass the filter",
orchMinPerfScore: 0.7,
enforceMaxPrice: false,
orchPerfScores: map[string]float64{
"0x0000000000000000000000000000000000000001": 0.6,
"0x0000000000000000000000000000000000000002": 0.8,
Expand All @@ -45,6 +46,7 @@ func TestFilter(t *testing.T) {
name: "No orchestrator Scores defined",
orchMinPerfScore: 0.7,
orchPerfScores: nil,
enforceMaxPrice: false,
orchestrators: []string{
"0x0000000000000000000000000000000000000001",
"0x0000000000000000000000000000000000000002",
Expand All @@ -57,6 +59,7 @@ func TestFilter(t *testing.T) {
{
name: "No min score defined",
orchMinPerfScore: 0,
enforceMaxPrice: false,
orchPerfScores: map[string]float64{
"0x0000000000000000000000000000000000000001": 0.6,
"0x0000000000000000000000000000000000000002": 0.8,
Expand All @@ -73,6 +76,7 @@ func TestFilter(t *testing.T) {
{
name: "No Orchestrators pass the filter",
orchMinPerfScore: 0.99,
enforceMaxPrice: false,
orchPerfScores: map[string]float64{
"0x0000000000000000000000000000000000000001": 0.6,
"0x0000000000000000000000000000000000000002": 0.8,
Expand All @@ -95,6 +99,7 @@ func TestFilter(t *testing.T) {
name: "All prices below max price",
orchMinPerfScore: 0.7,
maxPrice: 2000,
enforceMaxPrice: false,
prices: map[string]float64{
"0x0000000000000000000000000000000000000001": 500,
"0x0000000000000000000000000000000000000002": 1500,
Expand All @@ -119,6 +124,7 @@ func TestFilter(t *testing.T) {
name: "All prices above max price",
orchMinPerfScore: 0.7,
maxPrice: 100,
enforceMaxPrice: false,
prices: map[string]float64{
"0x0000000000000000000000000000000000000001": 500,
"0x0000000000000000000000000000000000000002": 1500,
Expand All @@ -143,7 +149,7 @@ func TestFilter(t *testing.T) {
name: "All prices above max price and enforceMaxPrice enabled",
orchMinPerfScore: 0.7,
maxPrice: 100,
enforceMaxPrice: true,
enforceMaxPrice: false,
prices: map[string]float64{
"0x0000000000000000000000000000000000000001": 500,
"0x0000000000000000000000000000000000000002": 1500,
Expand All @@ -165,6 +171,7 @@ func TestFilter(t *testing.T) {
name: "Mix of prices relative to max price",
orchMinPerfScore: 0.7,
maxPrice: 750,
enforceMaxPrice: false,
prices: map[string]float64{
"0x0000000000000000000000000000000000000001": 500,
"0x0000000000000000000000000000000000000002": 1500,
Expand All @@ -189,6 +196,7 @@ func TestFilter(t *testing.T) {
name: "Exact match with max price",
orchMinPerfScore: 0.7,
maxPrice: 1000,
enforceMaxPrice: false,
prices: map[string]float64{
"0x0000000000000000000000000000000000000001": 500,
"0x0000000000000000000000000000000000000002": 1000, // exactly max
Expand Down

0 comments on commit f21f855

Please sign in to comment.