v0.3.5-pre.002-fix.001

This commit is contained in:
2026-08-31 10:44:51 +02:00
parent 0dd722ffca
commit ca018095bf
6 changed files with 103 additions and 24 deletions

View File

@@ -1,12 +1,10 @@
// file: crates/ksp-interface-lib/unit_tests/slot_lifecycle.rs
// version: 1
// version: 2
#[test]
fn slot_lifecycle_stages_are_distinct_copy_and_complete_for_the_admitted_family() {
fn assert_copy<T: Copy>() {}
assert_copy::<crate::SlotLifecycleStage>();
let stages = [
crate::SlotLifecycleStage::Processed,
crate::SlotLifecycleStage::FirstShredReceived,
@@ -16,7 +14,6 @@ fn slot_lifecycle_stages_are_distinct_copy_and_complete_for_the_admitted_family(
crate::SlotLifecycleStage::OptimisticallyConfirmed,
crate::SlotLifecycleStage::Rooted,
];
for (index, stage) in stages.iter().enumerate() {
for other in stages.iter().skip(index + 1) {
assert_ne!(stage, other);
@@ -27,11 +24,8 @@ fn slot_lifecycle_stages_are_distinct_copy_and_complete_for_the_admitted_family(
#[test]
fn slot_lifecycle_event_preserves_full_u64_slot_and_stage() {
fn assert_copy<T: Copy>() {}
assert_copy::<crate::SlotLifecycleEvent>();
let event = crate::SlotLifecycleEvent::new(u64::MAX, crate::SlotLifecycleStage::Rooted);
assert_eq!(event.slot(), u64::MAX);
assert_eq!(event.stage(), crate::SlotLifecycleStage::Rooted);
let copied = event;
@@ -42,7 +36,6 @@ fn slot_lifecycle_event_preserves_full_u64_slot_and_stage() {
fn slot_lifecycle_debug_is_bounded_and_contains_only_shared_fields() {
let event = crate::SlotLifecycleEvent::new(42, crate::SlotLifecycleStage::OptimisticallyConfirmed);
let debug = std::format!("{event:?}");
assert!(debug.len() <= 128);
assert!(debug.contains("slot: 42"));
assert!(debug.contains("OptimisticallyConfirmed"));