Skip to content

Commit a803471

Browse files
committed
indexer-selection: remove versions_behind
1 parent 1d6db83 commit a803471

File tree

2 files changed

+0
-22
lines changed

2 files changed

+0
-22
lines changed

indexer-selection/src/lib.rs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@ pub struct Candidate<I, D> {
2222
/// seconds behind chain head
2323
pub seconds_behind: u32,
2424
pub slashable_grt: u64,
25-
/// subgraph versions behind latest deployment
26-
pub versions_behind: u8,
2725
pub zero_allocation: bool,
2826
}
2927

@@ -58,7 +56,6 @@ where
5856
score_latency(self.perf.latency_ms),
5957
score_seconds_behind(self.seconds_behind),
6058
score_slashable_grt(self.slashable_grt),
61-
score_subgraph_versions_behind(self.versions_behind),
6259
score_zero_allocation(self.zero_allocation),
6360
]
6461
.into_iter()
@@ -109,15 +106,13 @@ where
109106
.recip() as u16;
110107
let seconds_behind = candidates.iter().map(|c| c.seconds_behind).max().unwrap();
111108
let slashable_grt = candidates.iter().map(|c| c.slashable_grt).min().unwrap();
112-
let versions_behind = candidates.iter().map(|c| c.versions_behind).max().unwrap();
113109
let zero_allocation = candidates.iter().all(|c| c.zero_allocation);
114110

115111
[
116112
score_success_rate(success_rate),
117113
score_latency(latency),
118114
score_seconds_behind(seconds_behind),
119115
score_slashable_grt(slashable_grt),
120-
score_subgraph_versions_behind(versions_behind),
121116
score_zero_allocation(zero_allocation),
122117
]
123118
.into_iter()
@@ -128,11 +123,6 @@ where
128123
// When picking curves to use consider the following reference:
129124
// https://en.wikipedia.org/wiki/Logistic_function
130125

131-
/// Avoid serving deployments behind latest version, unless newer versions have poor indexer support.
132-
fn score_subgraph_versions_behind(versions_behind: u8) -> Normalized {
133-
Normalized::new(0.25_f64.powi(versions_behind as i32)).unwrap()
134-
}
135-
136126
/// https://www.desmos.com/calculator/gzmp7rbiai
137127
fn score_seconds_behind(seconds_behind: u32) -> Normalized {
138128
let b: f64 = 1e-6;

indexer-selection/src/test.rs

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ prop_compose! {
4747
fee,
4848
seconds_behind: seconds_behind as u32,
4949
slashable_grt: slashable_grt as u64,
50-
versions_behind,
5150
zero_allocation,
5251
}
5352
}
@@ -97,7 +96,6 @@ fn sensitivity_seconds_behind() {
9796
fee: Normalized::ZERO,
9897
seconds_behind: 86400,
9998
slashable_grt: 1_000_000,
100-
versions_behind: 0,
10199
zero_allocation: false,
102100
},
103101
Candidate {
@@ -110,7 +108,6 @@ fn sensitivity_seconds_behind() {
110108
fee: Normalized::ONE,
111109
seconds_behind: 120,
112110
slashable_grt: 100_000,
113-
versions_behind: 0,
114111
zero_allocation: false,
115112
},
116113
];
@@ -141,7 +138,6 @@ fn sensitivity_seconds_behind_vs_latency() {
141138
fee: Normalized::ZERO,
142139
seconds_behind: 35_000_000,
143140
slashable_grt: 1_600_000,
144-
versions_behind: 0,
145141
zero_allocation: false,
146142
},
147143
Candidate {
@@ -154,7 +150,6 @@ fn sensitivity_seconds_behind_vs_latency() {
154150
fee: Normalized::ZERO,
155151
seconds_behind: 120,
156152
slashable_grt: 100_000,
157-
versions_behind: 0,
158153
zero_allocation: true,
159154
},
160155
];
@@ -185,7 +180,6 @@ fn multi_selection_preference() {
185180
fee: Normalized::ZERO,
186181
seconds_behind: 0,
187182
slashable_grt: 9445169,
188-
versions_behind: 0,
189183
zero_allocation: false,
190184
},
191185
Candidate {
@@ -198,7 +192,6 @@ fn multi_selection_preference() {
198192
fee: Normalized::ZERO,
199193
seconds_behind: 0,
200194
slashable_grt: 1330801,
201-
versions_behind: 0,
202195
zero_allocation: false,
203196
},
204197
Candidate {
@@ -211,7 +204,6 @@ fn multi_selection_preference() {
211204
fee: Normalized::ZERO,
212205
seconds_behind: 0,
213206
slashable_grt: 2675210,
214-
versions_behind: 0,
215207
zero_allocation: false,
216208
},
217209
];
@@ -244,7 +236,6 @@ fn low_volume_response() {
244236
fee: Normalized::ZERO,
245237
seconds_behind: 0,
246238
slashable_grt: 100000,
247-
versions_behind: 0,
248239
zero_allocation: false,
249240
},
250241
Candidate {
@@ -257,7 +248,6 @@ fn low_volume_response() {
257248
fee: Normalized::ZERO,
258249
seconds_behind: 0,
259250
slashable_grt: 100000,
260-
versions_behind: 0,
261251
zero_allocation: false,
262252
},
263253
Candidate {
@@ -270,7 +260,6 @@ fn low_volume_response() {
270260
fee: Normalized::ZERO,
271261
seconds_behind: 0,
272262
slashable_grt: 100000,
273-
versions_behind: 0,
274263
zero_allocation: true,
275264
},
276265
];
@@ -300,7 +289,6 @@ fn perf_decay() {
300289
fee: Normalized::ZERO,
301290
seconds_behind: 0,
302291
slashable_grt: 1_000_000,
303-
versions_behind: 0,
304292
zero_allocation: false,
305293
};
306294

0 commit comments

Comments
 (0)