|
|
@@ -53,6 +53,11 @@ pub enum BlockRelation {
|
|
|
pub trait ForkGraph {
|
|
|
/// Returns the BlockRelation of A to B
|
|
|
fn relationship(&self, a: Slot, b: Slot) -> BlockRelation;
|
|
|
+
|
|
|
+ /// Returns the epoch of the given slot
|
|
|
+ fn slot_epoch(&self, _slot: Slot) -> Option<Epoch> {
|
|
|
+ Some(0)
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/// Provides information about current working slot, and its ancestors
|
|
|
@@ -749,14 +754,29 @@ impl<FG: ForkGraph> LoadedPrograms<FG> {
|
|
|
let environments = self.get_environments_for_epoch(working_slot.current_epoch());
|
|
|
let mut missing = Vec::new();
|
|
|
let mut unloaded = Vec::new();
|
|
|
+ let current_slot = working_slot.current_slot();
|
|
|
let found = keys
|
|
|
.filter_map(|(key, (match_criteria, count))| {
|
|
|
if let Some(second_level) = self.entries.get(&key) {
|
|
|
for entry in second_level.iter().rev() {
|
|
|
- let current_slot = working_slot.current_slot();
|
|
|
+ let is_ancestor = if let Some(fork_graph) = &self.fork_graph {
|
|
|
+ fork_graph
|
|
|
+ .read()
|
|
|
+ .map(|fork_graph_r| {
|
|
|
+ matches!(
|
|
|
+ fork_graph_r
|
|
|
+ .relationship(entry.deployment_slot, current_slot),
|
|
|
+ BlockRelation::Ancestor
|
|
|
+ )
|
|
|
+ })
|
|
|
+ .unwrap_or(false)
|
|
|
+ } else {
|
|
|
+ working_slot.is_ancestor(entry.deployment_slot)
|
|
|
+ };
|
|
|
+
|
|
|
if entry.deployment_slot <= self.latest_root_slot
|
|
|
|| entry.deployment_slot == current_slot
|
|
|
- || working_slot.is_ancestor(entry.deployment_slot)
|
|
|
+ || is_ancestor
|
|
|
{
|
|
|
if current_slot >= entry.effective_slot {
|
|
|
if !Self::is_entry_usable(entry, current_slot, &match_criteria) {
|
|
|
@@ -808,7 +828,7 @@ impl<FG: ForkGraph> LoadedPrograms<FG> {
|
|
|
ExtractedPrograms {
|
|
|
loaded: LoadedProgramsForTxBatch {
|
|
|
entries: found,
|
|
|
- slot: working_slot.current_slot(),
|
|
|
+ slot: current_slot,
|
|
|
environments: environments.clone(),
|
|
|
},
|
|
|
missing,
|
|
|
@@ -1478,52 +1498,19 @@ mod tests {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- struct TestWorkingSlot {
|
|
|
- slot: Slot,
|
|
|
- fork: Vec<Slot>,
|
|
|
- slot_pos: usize,
|
|
|
- }
|
|
|
-
|
|
|
- impl TestWorkingSlot {
|
|
|
- fn new(slot: Slot, fork: &[Slot]) -> Self {
|
|
|
- let mut fork = fork.to_vec();
|
|
|
- fork.sort();
|
|
|
- let slot_pos = fork
|
|
|
- .iter()
|
|
|
- .position(|current| *current == slot)
|
|
|
- .expect("The fork didn't have the slot in it");
|
|
|
- TestWorkingSlot {
|
|
|
- slot,
|
|
|
- fork,
|
|
|
- slot_pos,
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- fn update_slot(&mut self, slot: Slot) {
|
|
|
- self.slot = slot;
|
|
|
- self.slot_pos = self
|
|
|
- .fork
|
|
|
- .iter()
|
|
|
- .position(|current| *current == slot)
|
|
|
- .expect("The fork didn't have the slot in it");
|
|
|
- }
|
|
|
- }
|
|
|
+ struct TestWorkingSlot(pub Slot);
|
|
|
|
|
|
impl WorkingSlot for TestWorkingSlot {
|
|
|
fn current_slot(&self) -> Slot {
|
|
|
- self.slot
|
|
|
+ self.0
|
|
|
}
|
|
|
|
|
|
fn current_epoch(&self) -> Epoch {
|
|
|
0
|
|
|
}
|
|
|
|
|
|
- fn is_ancestor(&self, other: Slot) -> bool {
|
|
|
- self.fork
|
|
|
- .iter()
|
|
|
- .position(|current| *current == other)
|
|
|
- .map(|other_pos| other_pos < self.slot_pos)
|
|
|
- .unwrap_or(false)
|
|
|
+ fn is_ancestor(&self, _other: Slot) -> bool {
|
|
|
+ false
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -1561,7 +1548,7 @@ mod tests {
|
|
|
|
|
|
let mut fork_graph = TestForkGraphSpecific::default();
|
|
|
fork_graph.insert_fork(&[0, 10, 20, 22]);
|
|
|
- fork_graph.insert_fork(&[0, 5, 11, 15, 16, 19, 21, 23]);
|
|
|
+ fork_graph.insert_fork(&[0, 5, 11, 15, 16, 18, 19, 21, 23]);
|
|
|
fork_graph.insert_fork(&[0, 5, 11, 25, 27]);
|
|
|
|
|
|
let fork_graph = Arc::new(RwLock::new(fork_graph));
|
|
|
@@ -1618,13 +1605,12 @@ mod tests {
|
|
|
// 23
|
|
|
|
|
|
// Testing fork 0 - 10 - 12 - 22 with current slot at 22
|
|
|
- let working_slot = TestWorkingSlot::new(22, &[0, 10, 20, 22]);
|
|
|
let ExtractedPrograms {
|
|
|
loaded: found,
|
|
|
missing,
|
|
|
unloaded,
|
|
|
} = cache.extract(
|
|
|
- &working_slot,
|
|
|
+ &TestWorkingSlot(22),
|
|
|
vec![
|
|
|
(program1, (LoadedProgramMatchCriteria::NoCriteria, 1)),
|
|
|
(program2, (LoadedProgramMatchCriteria::NoCriteria, 2)),
|
|
|
@@ -1641,14 +1627,13 @@ mod tests {
|
|
|
assert!(missing.contains(&(program3, 3)));
|
|
|
assert!(unloaded.is_empty());
|
|
|
|
|
|
- // Testing fork 0 - 5 - 11 - 15 - 16 with current slot at 16
|
|
|
- let mut working_slot = TestWorkingSlot::new(15, &[0, 5, 11, 15, 16, 18, 19, 23]);
|
|
|
+ // Testing fork 0 - 5 - 11 - 15 - 16 with current slot at 15
|
|
|
let ExtractedPrograms {
|
|
|
loaded: found,
|
|
|
missing,
|
|
|
unloaded,
|
|
|
} = cache.extract(
|
|
|
- &working_slot,
|
|
|
+ &TestWorkingSlot(15),
|
|
|
vec![
|
|
|
(program1, (LoadedProgramMatchCriteria::NoCriteria, 1)),
|
|
|
(program2, (LoadedProgramMatchCriteria::NoCriteria, 1)),
|
|
|
@@ -1671,13 +1656,12 @@ mod tests {
|
|
|
assert!(unloaded.is_empty());
|
|
|
|
|
|
// Testing the same fork above, but current slot is now 18 (equal to effective slot of program4).
|
|
|
- working_slot.update_slot(18);
|
|
|
let ExtractedPrograms {
|
|
|
loaded: found,
|
|
|
missing,
|
|
|
unloaded,
|
|
|
} = cache.extract(
|
|
|
- &working_slot,
|
|
|
+ &TestWorkingSlot(18),
|
|
|
vec![
|
|
|
(program1, (LoadedProgramMatchCriteria::NoCriteria, 1)),
|
|
|
(program2, (LoadedProgramMatchCriteria::NoCriteria, 1)),
|
|
|
@@ -1697,13 +1681,12 @@ mod tests {
|
|
|
assert!(unloaded.is_empty());
|
|
|
|
|
|
// Testing the same fork above, but current slot is now 23 (future slot than effective slot of program4).
|
|
|
- working_slot.update_slot(23);
|
|
|
let ExtractedPrograms {
|
|
|
loaded: found,
|
|
|
missing,
|
|
|
unloaded,
|
|
|
} = cache.extract(
|
|
|
- &working_slot,
|
|
|
+ &TestWorkingSlot(23),
|
|
|
vec![
|
|
|
(program1, (LoadedProgramMatchCriteria::NoCriteria, 1)),
|
|
|
(program2, (LoadedProgramMatchCriteria::NoCriteria, 1)),
|
|
|
@@ -1723,13 +1706,12 @@ mod tests {
|
|
|
assert!(unloaded.is_empty());
|
|
|
|
|
|
// Testing fork 0 - 5 - 11 - 15 - 16 with current slot at 11
|
|
|
- let working_slot = TestWorkingSlot::new(11, &[0, 5, 11, 15, 16]);
|
|
|
let ExtractedPrograms {
|
|
|
loaded: found,
|
|
|
missing,
|
|
|
unloaded,
|
|
|
} = cache.extract(
|
|
|
- &working_slot,
|
|
|
+ &TestWorkingSlot(11),
|
|
|
vec![
|
|
|
(program1, (LoadedProgramMatchCriteria::NoCriteria, 1)),
|
|
|
(program2, (LoadedProgramMatchCriteria::NoCriteria, 1)),
|
|
|
@@ -1762,13 +1744,12 @@ mod tests {
|
|
|
assert!(!cache.replenish(program4, test_program).0);
|
|
|
|
|
|
// Testing fork 0 - 5 - 11 - 15 - 16 - 19 - 21 - 23 with current slot at 19
|
|
|
- let working_slot = TestWorkingSlot::new(19, &[0, 5, 11, 15, 16, 18, 19, 21, 23]);
|
|
|
let ExtractedPrograms {
|
|
|
loaded: found,
|
|
|
missing,
|
|
|
unloaded,
|
|
|
} = cache.extract(
|
|
|
- &working_slot,
|
|
|
+ &TestWorkingSlot(19),
|
|
|
vec![
|
|
|
(program1, (LoadedProgramMatchCriteria::NoCriteria, 1)),
|
|
|
(program2, (LoadedProgramMatchCriteria::NoCriteria, 1)),
|
|
|
@@ -1788,13 +1769,12 @@ mod tests {
|
|
|
|
|
|
// Testing fork 0 - 5 - 11 - 15 - 16 - 19 - 21 - 23 with current slot at 21
|
|
|
// This would cause program4 deployed at slot 19 to be expired.
|
|
|
- let working_slot = TestWorkingSlot::new(21, &[0, 5, 11, 15, 16, 18, 19, 21, 23]);
|
|
|
let ExtractedPrograms {
|
|
|
loaded: found,
|
|
|
missing,
|
|
|
unloaded,
|
|
|
} = cache.extract(
|
|
|
- &working_slot,
|
|
|
+ &TestWorkingSlot(21),
|
|
|
vec![
|
|
|
(program1, (LoadedProgramMatchCriteria::NoCriteria, 1)),
|
|
|
(program2, (LoadedProgramMatchCriteria::NoCriteria, 1)),
|
|
|
@@ -1833,14 +1813,13 @@ mod tests {
|
|
|
// |
|
|
|
// 23
|
|
|
|
|
|
- // Testing fork 11 - 15 - 16- 19 - 22 with root at 5 and current slot at 22
|
|
|
- let working_slot = TestWorkingSlot::new(22, &[5, 11, 15, 16, 19, 22, 23]);
|
|
|
+ // Testing fork 11 - 15 - 16- 19 - 22 with root at 5 and current slot at 21
|
|
|
let ExtractedPrograms {
|
|
|
loaded: found,
|
|
|
missing,
|
|
|
unloaded,
|
|
|
} = cache.extract(
|
|
|
- &working_slot,
|
|
|
+ &TestWorkingSlot(21),
|
|
|
vec![
|
|
|
(program1, (LoadedProgramMatchCriteria::NoCriteria, 1)),
|
|
|
(program2, (LoadedProgramMatchCriteria::NoCriteria, 1)),
|
|
|
@@ -1851,21 +1830,20 @@ mod tests {
|
|
|
);
|
|
|
|
|
|
// Since the fork was pruned, we should not find the entry deployed at slot 20.
|
|
|
- assert!(match_slot(&found, &program1, 0, 22));
|
|
|
- assert!(match_slot(&found, &program2, 11, 22));
|
|
|
- assert!(match_slot(&found, &program4, 15, 22));
|
|
|
+ assert!(match_slot(&found, &program1, 0, 21));
|
|
|
+ assert!(match_slot(&found, &program2, 11, 21));
|
|
|
+ assert!(match_slot(&found, &program4, 15, 21));
|
|
|
|
|
|
assert!(missing.contains(&(program3, 1)));
|
|
|
assert!(unloaded.is_empty());
|
|
|
|
|
|
// Testing fork 0 - 5 - 11 - 25 - 27 with current slot at 27
|
|
|
- let working_slot = TestWorkingSlot::new(27, &[11, 25, 27]);
|
|
|
let ExtractedPrograms {
|
|
|
loaded: found,
|
|
|
missing: _,
|
|
|
unloaded,
|
|
|
} = cache.extract(
|
|
|
- &working_slot,
|
|
|
+ &TestWorkingSlot(27),
|
|
|
vec![
|
|
|
(program1, (LoadedProgramMatchCriteria::NoCriteria, 1)),
|
|
|
(program2, (LoadedProgramMatchCriteria::NoCriteria, 1)),
|
|
|
@@ -1899,13 +1877,12 @@ mod tests {
|
|
|
// 23
|
|
|
|
|
|
// Testing fork 16, 19, 23, with root at 15, current slot at 23
|
|
|
- let working_slot = TestWorkingSlot::new(23, &[16, 19, 23]);
|
|
|
let ExtractedPrograms {
|
|
|
loaded: found,
|
|
|
missing,
|
|
|
unloaded,
|
|
|
} = cache.extract(
|
|
|
- &working_slot,
|
|
|
+ &TestWorkingSlot(23),
|
|
|
vec![
|
|
|
(program1, (LoadedProgramMatchCriteria::NoCriteria, 1)),
|
|
|
(program2, (LoadedProgramMatchCriteria::NoCriteria, 1)),
|
|
|
@@ -1945,7 +1922,7 @@ mod tests {
|
|
|
|
|
|
let mut fork_graph = TestForkGraphSpecific::default();
|
|
|
fork_graph.insert_fork(&[0, 10, 20, 22]);
|
|
|
- fork_graph.insert_fork(&[0, 5, 11, 15, 16, 19, 21, 23]);
|
|
|
+ fork_graph.insert_fork(&[0, 5, 11, 12, 15, 16, 18, 19, 21, 23]);
|
|
|
fork_graph.insert_fork(&[0, 5, 11, 25, 27]);
|
|
|
|
|
|
let fork_graph = Arc::new(RwLock::new(fork_graph));
|
|
|
@@ -1963,13 +1940,12 @@ mod tests {
|
|
|
assert!(!cache.replenish(program3, new_test_loaded_program(25, 26)).0);
|
|
|
|
|
|
// Testing fork 0 - 5 - 11 - 15 - 16 - 19 - 21 - 23 with current slot at 19
|
|
|
- let working_slot = TestWorkingSlot::new(12, &[0, 5, 11, 12, 15, 16, 18, 19, 21, 23]);
|
|
|
let ExtractedPrograms {
|
|
|
loaded: found,
|
|
|
missing,
|
|
|
unloaded,
|
|
|
} = cache.extract(
|
|
|
- &working_slot,
|
|
|
+ &TestWorkingSlot(12),
|
|
|
vec![
|
|
|
(program1, (LoadedProgramMatchCriteria::NoCriteria, 1)),
|
|
|
(program2, (LoadedProgramMatchCriteria::NoCriteria, 1)),
|
|
|
@@ -1990,7 +1966,7 @@ mod tests {
|
|
|
missing,
|
|
|
unloaded,
|
|
|
} = cache.extract(
|
|
|
- &working_slot,
|
|
|
+ &TestWorkingSlot(12),
|
|
|
vec![
|
|
|
(
|
|
|
program1,
|
|
|
@@ -2068,13 +2044,12 @@ mod tests {
|
|
|
);
|
|
|
|
|
|
// Testing fork 0 - 5 - 11 - 15 - 16 - 19 - 21 - 23 with current slot at 19
|
|
|
- let working_slot = TestWorkingSlot::new(19, &[0, 5, 11, 12, 15, 16, 18, 19, 21, 23]);
|
|
|
let ExtractedPrograms {
|
|
|
loaded: found,
|
|
|
missing,
|
|
|
unloaded,
|
|
|
} = cache.extract(
|
|
|
- &working_slot,
|
|
|
+ &TestWorkingSlot(19),
|
|
|
vec![
|
|
|
(program1, (LoadedProgramMatchCriteria::NoCriteria, 1)),
|
|
|
(program2, (LoadedProgramMatchCriteria::NoCriteria, 1)),
|
|
|
@@ -2090,13 +2065,12 @@ mod tests {
|
|
|
assert!(unloaded.is_empty());
|
|
|
|
|
|
// Testing fork 0 - 5 - 11 - 25 - 27 with current slot at 27
|
|
|
- let working_slot = TestWorkingSlot::new(27, &[0, 5, 11, 25, 27]);
|
|
|
let ExtractedPrograms {
|
|
|
loaded: found,
|
|
|
missing,
|
|
|
unloaded,
|
|
|
} = cache.extract(
|
|
|
- &working_slot,
|
|
|
+ &TestWorkingSlot(27),
|
|
|
vec![
|
|
|
(program1, (LoadedProgramMatchCriteria::NoCriteria, 1)),
|
|
|
(program2, (LoadedProgramMatchCriteria::NoCriteria, 1)),
|
|
|
@@ -2112,13 +2086,12 @@ mod tests {
|
|
|
assert!(missing.is_empty());
|
|
|
|
|
|
// Testing fork 0 - 10 - 20 - 22 with current slot at 22
|
|
|
- let working_slot = TestWorkingSlot::new(22, &[0, 10, 20, 22]);
|
|
|
let ExtractedPrograms {
|
|
|
loaded: found,
|
|
|
missing,
|
|
|
unloaded,
|
|
|
} = cache.extract(
|
|
|
- &working_slot,
|
|
|
+ &TestWorkingSlot(22),
|
|
|
vec![
|
|
|
(program1, (LoadedProgramMatchCriteria::NoCriteria, 1)),
|
|
|
(program2, (LoadedProgramMatchCriteria::NoCriteria, 1)),
|
|
|
@@ -2154,7 +2127,7 @@ mod tests {
|
|
|
|
|
|
let mut fork_graph = TestForkGraphSpecific::default();
|
|
|
fork_graph.insert_fork(&[0, 10, 20, 22]);
|
|
|
- fork_graph.insert_fork(&[0, 5, 11, 15, 16, 19, 21, 23]);
|
|
|
+ fork_graph.insert_fork(&[0, 5, 11, 12, 15, 16, 18, 19, 21, 23]);
|
|
|
fork_graph.insert_fork(&[0, 5, 11, 25, 27]);
|
|
|
let fork_graph = Arc::new(RwLock::new(fork_graph));
|
|
|
cache.set_fork_graph(fork_graph);
|
|
|
@@ -2183,13 +2156,12 @@ mod tests {
|
|
|
assert!(!cache.replenish(program1, test_program).0);
|
|
|
|
|
|
// Testing fork 0 - 5 - 11 - 15 - 16 - 19 - 21 - 23 with current slot at 19
|
|
|
- let working_slot = TestWorkingSlot::new(12, &[0, 5, 11, 12, 15, 16, 18, 19, 21, 23]);
|
|
|
let ExtractedPrograms {
|
|
|
loaded: found,
|
|
|
missing,
|
|
|
unloaded,
|
|
|
} = cache.extract(
|
|
|
- &working_slot,
|
|
|
+ &TestWorkingSlot(12),
|
|
|
vec![
|
|
|
(program1, (LoadedProgramMatchCriteria::NoCriteria, 1)),
|
|
|
(program2, (LoadedProgramMatchCriteria::NoCriteria, 1)),
|
|
|
@@ -2207,13 +2179,12 @@ mod tests {
|
|
|
|
|
|
// Testing fork 0 - 5 - 11 - 12 - 15 - 16 - 19 - 21 - 23 with current slot at 15
|
|
|
// This would cause program4 deployed at slot 15 to be expired.
|
|
|
- let working_slot = TestWorkingSlot::new(15, &[0, 5, 11, 15, 16, 18, 19, 21, 23]);
|
|
|
let ExtractedPrograms {
|
|
|
loaded: found,
|
|
|
missing,
|
|
|
unloaded,
|
|
|
} = cache.extract(
|
|
|
- &working_slot,
|
|
|
+ &TestWorkingSlot(15),
|
|
|
vec![
|
|
|
(program1, (LoadedProgramMatchCriteria::NoCriteria, 1)),
|
|
|
(program2, (LoadedProgramMatchCriteria::NoCriteria, 1)),
|
|
|
@@ -2280,13 +2251,12 @@ mod tests {
|
|
|
|
|
|
cache.prune(10, 0);
|
|
|
|
|
|
- let working_slot = TestWorkingSlot::new(20, &[0, 10, 20]);
|
|
|
let ExtractedPrograms {
|
|
|
loaded: found,
|
|
|
missing: _,
|
|
|
unloaded,
|
|
|
} = cache.extract(
|
|
|
- &working_slot,
|
|
|
+ &TestWorkingSlot(20),
|
|
|
vec![(program1, (LoadedProgramMatchCriteria::NoCriteria, 1))].into_iter(),
|
|
|
);
|
|
|
assert!(unloaded.is_empty());
|
|
|
@@ -2318,7 +2288,7 @@ mod tests {
|
|
|
// deployed at slot 0.
|
|
|
let mut fork_graph = TestForkGraphSpecific::default();
|
|
|
fork_graph.insert_fork(&[0, 10, 20]);
|
|
|
- fork_graph.insert_fork(&[0, 5]);
|
|
|
+ fork_graph.insert_fork(&[0, 5, 6]);
|
|
|
let fork_graph = Arc::new(RwLock::new(fork_graph));
|
|
|
cache.set_fork_graph(fork_graph);
|
|
|
|
|
|
@@ -2329,13 +2299,12 @@ mod tests {
|
|
|
let program2 = Pubkey::new_unique();
|
|
|
assert!(!cache.replenish(program2, new_test_loaded_program(10, 11)).0);
|
|
|
|
|
|
- let working_slot = TestWorkingSlot::new(20, &[0, 10, 20]);
|
|
|
let ExtractedPrograms {
|
|
|
loaded: found,
|
|
|
missing: _,
|
|
|
unloaded: _,
|
|
|
} = cache.extract(
|
|
|
- &working_slot,
|
|
|
+ &TestWorkingSlot(20),
|
|
|
vec![
|
|
|
(program1, (LoadedProgramMatchCriteria::NoCriteria, 1)),
|
|
|
(program2, (LoadedProgramMatchCriteria::NoCriteria, 1)),
|
|
|
@@ -2346,13 +2315,12 @@ mod tests {
|
|
|
assert!(match_slot(&found, &program1, 0, 20));
|
|
|
assert!(match_slot(&found, &program2, 10, 20));
|
|
|
|
|
|
- let working_slot = TestWorkingSlot::new(6, &[0, 5, 6]);
|
|
|
let ExtractedPrograms {
|
|
|
loaded: found,
|
|
|
missing,
|
|
|
unloaded: _,
|
|
|
} = cache.extract(
|
|
|
- &working_slot,
|
|
|
+ &TestWorkingSlot(6),
|
|
|
vec![
|
|
|
(program1, (LoadedProgramMatchCriteria::NoCriteria, 1)),
|
|
|
(program2, (LoadedProgramMatchCriteria::NoCriteria, 1)),
|
|
|
@@ -2367,13 +2335,12 @@ mod tests {
|
|
|
// On fork chaining from slot 5, the entry deployed at slot 0 will become visible.
|
|
|
cache.prune_by_deployment_slot(5);
|
|
|
|
|
|
- let working_slot = TestWorkingSlot::new(20, &[0, 10, 20]);
|
|
|
let ExtractedPrograms {
|
|
|
loaded: found,
|
|
|
missing: _,
|
|
|
unloaded: _,
|
|
|
} = cache.extract(
|
|
|
- &working_slot,
|
|
|
+ &TestWorkingSlot(20),
|
|
|
vec![
|
|
|
(program1, (LoadedProgramMatchCriteria::NoCriteria, 1)),
|
|
|
(program2, (LoadedProgramMatchCriteria::NoCriteria, 1)),
|
|
|
@@ -2384,13 +2351,12 @@ mod tests {
|
|
|
assert!(match_slot(&found, &program1, 0, 20));
|
|
|
assert!(match_slot(&found, &program2, 10, 20));
|
|
|
|
|
|
- let working_slot = TestWorkingSlot::new(6, &[0, 5, 6]);
|
|
|
let ExtractedPrograms {
|
|
|
loaded: found,
|
|
|
missing,
|
|
|
unloaded: _,
|
|
|
} = cache.extract(
|
|
|
- &working_slot,
|
|
|
+ &TestWorkingSlot(6),
|
|
|
vec![
|
|
|
(program1, (LoadedProgramMatchCriteria::NoCriteria, 1)),
|
|
|
(program2, (LoadedProgramMatchCriteria::NoCriteria, 1)),
|
|
|
@@ -2405,13 +2371,12 @@ mod tests {
|
|
|
// As there is no other entry for program2, extract() will return it as missing.
|
|
|
cache.prune_by_deployment_slot(10);
|
|
|
|
|
|
- let working_slot = TestWorkingSlot::new(20, &[0, 10, 20]);
|
|
|
let ExtractedPrograms {
|
|
|
loaded: found,
|
|
|
missing: _,
|
|
|
unloaded: _,
|
|
|
} = cache.extract(
|
|
|
- &working_slot,
|
|
|
+ &TestWorkingSlot(20),
|
|
|
vec![
|
|
|
(program1, (LoadedProgramMatchCriteria::NoCriteria, 1)),
|
|
|
(program2, (LoadedProgramMatchCriteria::NoCriteria, 1)),
|