30 lines
1.4 KiB
Rust
30 lines
1.4 KiB
Rust
// file: crates/ksp-interface-lib/tests/slot_lifecycle_public_api.rs
|
|
// version: 2
|
|
|
|
//! Public API canaries for the shared slot lifecycle event contract.
|
|
|
|
#[test]
|
|
fn public_v0_3_5_pre_002_slot_lifecycle_contract_is_available_from_crate_root() {
|
|
let event = ksp_interface_lib::SlotLifecycleEvent::new(u64::MAX, ksp_interface_lib::SlotLifecycleStage::Rooted);
|
|
assert_eq!(event.slot(), u64::MAX);
|
|
assert_eq!(event.stage(), ksp_interface_lib::SlotLifecycleStage::Rooted);
|
|
}
|
|
|
|
#[test]
|
|
fn public_v0_3_5_pre_002_slot_lifecycle_stage_remains_downstream_evolvable() {
|
|
fn stage_label(stage: ksp_interface_lib::SlotLifecycleStage) -> &'static str {
|
|
return match stage {
|
|
ksp_interface_lib::SlotLifecycleStage::Processed => "processed",
|
|
ksp_interface_lib::SlotLifecycleStage::FirstShredReceived => "first_shred_received",
|
|
ksp_interface_lib::SlotLifecycleStage::Completed => "completed",
|
|
ksp_interface_lib::SlotLifecycleStage::CreatedBank => "created_bank",
|
|
ksp_interface_lib::SlotLifecycleStage::Dead => "dead",
|
|
ksp_interface_lib::SlotLifecycleStage::OptimisticallyConfirmed => "optimistically_confirmed",
|
|
ksp_interface_lib::SlotLifecycleStage::Rooted => "rooted",
|
|
_ => "future",
|
|
};
|
|
}
|
|
assert_eq!(stage_label(ksp_interface_lib::SlotLifecycleStage::Processed), "processed");
|
|
assert_eq!(stage_label(ksp_interface_lib::SlotLifecycleStage::Rooted), "rooted");
|
|
}
|