From 51e7ade75052469716dcb08c3d723e6006ed9674 Mon Sep 17 00:00:00 2001 From: "rearden-grok[bot]" Date: Tue, 22 Sep 2026 07:20:25 -0700 Subject: [PATCH] store: drop unreachable Paged SH and the BDZ1 codec Mode-10 scripthash heads already refuse in unpack8, so the Paged value and the walks only it used are gone. BDZ1 was a test codec; tx.head is BDZ2 and sealed SH heads are BDZ3. KIND_IDX was unused. --- crates/rbitcoin-query/src/catchup.rs | 4 +- crates/rbitcoin-store/src/bdz.rs | 134 ------------------ crates/rbitcoin-store/src/scripthash.rs | 67 +-------- .../rbitcoin-store/src/scripthash_layout.rs | 43 ++---- crates/rbitcoin-store/src/scripthash_mphf.rs | 9 +- crates/rbitcoin-store/src/tx_head_mphf.rs | 49 +------ crates/rbitcoin-store/src/uring_session.rs | 8 +- 7 files changed, 22 insertions(+), 292 deletions(-) diff --git a/crates/rbitcoin-query/src/catchup.rs b/crates/rbitcoin-query/src/catchup.rs index 6ad045c32..b76014a63 100644 --- a/crates/rbitcoin-query/src/catchup.rs +++ b/crates/rbitcoin-query/src/catchup.rs @@ -202,8 +202,8 @@ impl Query { /// Cold bulk-load durable scripthash tables (tip entry). /// - /// Direct IBD defers SH. Tip: one Class A pass into unsorted per-shard - /// files, then in-place unique-sort + seal. + /// Direct IBD defers SH. Tip: two Class A scans (identity-map keys, then + /// fuse-hit postings) into `scripthash.unsorted`, then pack and seal. /// /// **`RBITCOIN_SH_FORCE_REBUILD=1`:** wipe SH head/runs/SEAL/HWM, then /// full unsorted Class A collect + pack (not a catch-up tail). diff --git a/crates/rbitcoin-store/src/bdz.rs b/crates/rbitcoin-store/src/bdz.rs index 8b73f35b1..decbdf9bf 100644 --- a/crates/rbitcoin-store/src/bdz.rs +++ b/crates/rbitcoin-store/src/bdz.rs @@ -144,14 +144,6 @@ impl BdzMphf { self.modulus } - #[cfg(test)] - pub fn g_bytes(&self) -> usize { - match &self.g { - GStore::Ram(g) => g.len() * 4, - GStore::Fd { n_bytes, .. } => *n_bytes as usize, - } - } - pub fn g_bytes_resident(&self) -> usize { match &self.g { GStore::Ram(g) => g.len() * 4, @@ -385,26 +377,6 @@ impl BdzMphf { Err(StoreError::Corrupt("bdz mphf: graph did not peel")) } - #[cfg(test)] - pub fn write_to(&self, path: &Path) -> Result<(), StoreError> { - const MAGIC: &[u8; 4] = b"BDZ1"; - const HEADER_LEN: u64 = 24; - let GStore::Ram(g) = &self.g else { - return Err(StoreError::Corrupt("bdz mphf: write requires RAM g")); - }; - let mut buf = Vec::with_capacity(HEADER_LEN as usize + g.len() * 4); - buf.extend_from_slice(MAGIC); - buf.extend_from_slice(&VERSION.to_le_bytes()); - buf.extend_from_slice(&self.n.to_le_bytes()); - buf.extend_from_slice(&self.m.to_le_bytes()); - buf.extend_from_slice(&self.seed.to_le_bytes()); - for &x in g.iter() { - buf.extend_from_slice(&x.to_le_bytes()); - } - std::fs::write(path, &buf).map_err(|e| StoreError::io(path, e))?; - Ok(()) - } - pub fn write_packed_to(&self, path: &Path) -> Result<(), StoreError> { let GStore::Ram(g) = &self.g else { return Err(StoreError::Corrupt("bdz mphf: write requires RAM g")); @@ -425,56 +397,6 @@ impl BdzMphf { }) } - #[cfg(test)] - pub fn read_from(path: &Path) -> Result { - const MAGIC: &[u8; 4] = b"BDZ1"; - const HEADER_LEN: u64 = 24; - let file = File::open(path).map_err(|e| StoreError::io(path, e))?; - let mut hdr = [0u8; HEADER_LEN as usize]; - pread_exact(&file, path, 0, &mut hdr)?; - if &hdr[0..4] != MAGIC { - return Err(StoreError::Corrupt("bdz mphf: bad magic")); - } - let ver = u32::from_le_bytes(hdr[4..8].try_into().unwrap()); - if ver != VERSION { - return Err(StoreError::Corrupt("bdz mphf: bad version")); - } - let n = u32::from_le_bytes(hdr[8..12].try_into().unwrap()); - let m = u32::from_le_bytes(hdr[12..16].try_into().unwrap()); - let seed = u64::from_le_bytes(hdr[16..24].try_into().unwrap()); - if n == 0 { - return Ok(Self { - n: 0, - m: 0, - seed: 0, - modulus: 0, - g: GStore::Ram(Box::new([])), - compact: None, - }); - } - let n_words = if n == 1 { 1 } else { m }; - let g_bytes = n_words as u64 * 4; - let meta = file.metadata().map_err(|e| StoreError::io(path, e))?; - if meta.len() < HEADER_LEN + g_bytes { - return Err(StoreError::Corrupt("bdz mphf: g length")); - } - Ok(Self { - n, - m: n_words, - seed, - modulus: n, - g: GStore::Fd { - file, - path: path.to_path_buf(), - off: HEADER_LEN, - n_bytes: g_bytes, - g_bits: G_BITS_WORDS, - page_preads: AtomicU64::new(0), - }, - compact: None, - }) - } - pub fn read_packed_from(path: &Path) -> Result { let file = File::open(path).map_err(|e| StoreError::io(path, e))?; let mut hdr = [0u8; HEADER_LEN2 as usize]; @@ -1399,62 +1321,6 @@ mod tests { assert_eq!(one.index(99).unwrap(), 0); } - #[test] - fn bdz_roundtrip_file() { - let dir = std::env::temp_dir().join(format!( - "rbitcoin-bdz-{}-{}", - std::process::id(), - std::time::SystemTime::now() - .duration_since(std::time::UNIX_EPOCH) - .unwrap() - .as_nanos() - )); - std::fs::create_dir_all(&dir).unwrap(); - let keys: Vec = (0..200u64).map(|i| i * 17 + 3).collect(); - let f = BdzMphf::build(&keys).unwrap(); - let p = dir.join("t.mphf"); - f.write_to(&p).unwrap(); - assert_eq!(&std::fs::read(&p).unwrap()[0..4], b"BDZ1"); - let g = BdzMphf::read_from(&p).unwrap(); - for &k in &keys { - assert_eq!(f.index(k).unwrap(), g.index(k).unwrap()); - } - assert_eq!(g.g_bytes_resident(), 0, "open must not retain the g array"); - assert_eq!(g.g_bytes(), f.g_bytes()); - let miss = g.index(0xDEAD_BEEF_u64).unwrap(); - assert!(miss < keys.len() as u32); - let _ = std::fs::remove_dir_all(&dir); - } - - #[test] - fn bdz_open_matches_ram_index_without_g_heap() { - let dir = std::env::temp_dir().join(format!( - "rbitcoin-bdz-fd-{}-{}", - std::process::id(), - std::time::SystemTime::now() - .duration_since(std::time::UNIX_EPOCH) - .unwrap() - .as_nanos() - )); - std::fs::create_dir_all(&dir).unwrap(); - let keys: Vec = (0..10_000u64) - .map(|i| i.wrapping_mul(0x9E37_79B9_7F4A_7C15).wrapping_add(7)) - .collect(); - let ram = BdzMphf::build(&keys).unwrap(); - assert!(ram.g_bytes_resident() > 0); - let p = dir.join("t.mphf"); - ram.write_to(&p).unwrap(); - let fd = BdzMphf::read_from(&p).unwrap(); - assert_eq!(fd.g_bytes_resident(), 0); - for &k in &keys { - assert_eq!(ram.index(k).unwrap(), fd.index(k).unwrap()); - } - let miss_k = 0xDEAD_BEEF_u64; - assert_eq!(ram.index(miss_k).unwrap(), fd.index(miss_k).unwrap()); - assert!(fd.index(miss_k).unwrap() < keys.len() as u32); - let _ = std::fs::remove_dir_all(&dir); - } - #[test] fn assigned_peel_index_is_rel_minus_one() { let keys = [10u64, 20, 30, 40]; diff --git a/crates/rbitcoin-store/src/scripthash.rs b/crates/rbitcoin-store/src/scripthash.rs index c643b0b29..3b401c635 100644 --- a/crates/rbitcoin-store/src/scripthash.rs +++ b/crates/rbitcoin-store/src/scripthash.rs @@ -1234,20 +1234,17 @@ impl ScriptHashTable { scripthash: &[u8; 32], ) -> Result, StoreError> { if let Some(v) = self.ingest.lock().unwrap().get(scripthash)? { - let v = self.fill_paged_first(scripthash, v, KeyHome::Ingest)?; return Ok(Some((v, KeyHome::Ingest))); } let hk = head_key_from_full(scripthash); for h in self.sealed_ovf.lock().unwrap().iter().rev() { if let Some(v) = h.get(&hk)? { - let v = self.fill_paged_first(scripthash, v, KeyHome::SealedOvf)?; return Ok(Some((v, KeyHome::SealedOvf))); } } if let Some(l1) = self.ovf_l1.lock().unwrap().as_ref() { if l1.fuse.contains(mix_key16(&hk)) { if let Some(v) = l1.head.get(&hk)? { - let v = self.fill_paged_first(scripthash, v, KeyHome::SealedOvf)?; return Ok(Some((v, KeyHome::SealedOvf))); } } @@ -1258,7 +1255,6 @@ impl ScriptHashTable { let g = slot.read().unwrap(); if let Some(h) = g.as_ref() { if let Some(v) = h.get(&hk)? { - let v = self.fill_paged_first(scripthash, v, KeyHome::Main)?; return Ok(Some((v, KeyHome::Main))); } } @@ -1267,25 +1263,6 @@ impl ScriptHashTable { Ok(None) } - fn fill_paged_first( - &self, - key: &[u8; 32], - val: ShHeadValue, - home: KeyHome, - ) -> Result { - match val { - ShHeadValue::Paged { - first_page: 0, - last_page, - } if last_page != 0 => { - let first = - paged_first_from_last(self.body_for(key, home), last_page, &self.page_ios)?; - Ok(ShHeadValue::paged(first, last_page)) - } - other => Ok(other), - } - } - fn has_sorted_main(&self) -> bool { self.sorted_main_on .load(std::sync::atomic::Ordering::Acquire) @@ -1438,13 +1415,6 @@ impl ScriptHashTable { .collect()) } - fn collect_page_chain(&self, body: &TableFile, first_page: u64) -> Result, StoreError> { - if first_page == 0 { - return Ok(Vec::new()); - } - collect_page_chain_linked(body, first_page, &self.page_ios) - } - #[cfg(test)] pub(crate) fn take_page_ios(&self) -> u64 { self.page_ios.swap(0, Ordering::Relaxed) @@ -1469,7 +1439,7 @@ impl ScriptHashTable { let ents = self.read_slab(body, *class, *off)?; Ok(ents.last().copied()) } - ShHeadValue::Paged { last_page, .. } | ShHeadValue::Extent { last_page } => { + ShHeadValue::Extent { last_page } => { let mut page = [0u8; SH_PAGE_SIZE]; body.read_at(*last_page, &mut page)?; sh_page_last_fk(&page) @@ -1917,17 +1887,6 @@ impl ScriptHashTable { } Ok(got) } - ShHeadValue::Paged { - first_page, - last_page, - } => { - let first = if *first_page != 0 { - *first_page - } else { - paged_first_from_last(body, *last_page, &self.page_ios)? - }; - self.collect_page_chain(body, first) - } ShHeadValue::Extent { last_page } => { collect_extent_then_tail(body, *last_page, &self.page_ios) } @@ -2017,14 +1976,6 @@ impl ScriptHashTable { } Ok(new_val) } - ShHeadValue::Paged { - first_page, - last_page, - } => { - let last = - self.append_fks_to_pages(body, alloc, *first_page, *last_page, new_ents)?; - Ok(ShHeadValue::paged(*first_page, last)) - } ShHeadValue::Extent { last_page } => { let first = paged_first_from_last(body, *last_page, &self.page_ios)?; let last = self.append_fks_to_pages(body, alloc, first, *last_page, new_ents)?; @@ -2280,16 +2231,6 @@ impl ScriptHashTable { old: &ShHeadValue, ) -> Result<(), StoreError> { match old { - ShHeadValue::Paged { first_page, .. } => { - let mut off = *first_page; - while off != 0 { - let mut page = [0u8; SH_PAGE_SIZE]; - body.read_at(off, &mut page)?; - let next = sh_page_next(&page)?; - self.free_slab(body, alloc, SH_PAGE_SLAB_CLASS, off)?; - off = next; - } - } ShHeadValue::Extent { last_page } => { let mut off = paged_first_from_last(body, *last_page, &self.page_ios)?; while off != 0 { @@ -3523,7 +3464,7 @@ fn write_alloc_header(body: &TableFile, state: &AllocState) -> Result<(), StoreE /// Read SHAL alloc page. Returns `(state, on_disk_version)`. /// /// **v1** (schema-13 slabs) and **v2** (schema-14 page chains) share the same -/// header field layout. Callers upgrade empty v1 → v2 or refuse durable v1. +/// header field layout. An empty older header is reset; a durable pre-v3 body refuses. fn read_alloc_header(body: &TableFile) -> Result<(AllocState, u16), StoreError> { let mut buf = vec![0u8; SH_ALLOC_HEADER_LEN]; let avail = body @@ -3532,13 +3473,13 @@ fn read_alloc_header(body: &TableFile) -> Result<(AllocState, u16), StoreError> .min(SH_ALLOC_HEADER_LEN as u64) as usize; if avail < 24 { return Err(StoreError::Corrupt( - "scripthash body missing alloc header (expected hybrid SHAL; migrate v3 stores)", + "scripthash body missing alloc header (expected SHAL)", )); } body.read_at(FILE_HEADER_LEN as u64, &mut buf[..avail])?; if buf[0..4] != SH_ALLOC_MAGIC { return Err(StoreError::Corrupt( - "scripthash body not hybrid (no SHAL magic; run migrate)", + "scripthash body not hybrid (no SHAL magic)", )); } let ver = u16::from_le_bytes([buf[4], buf[5]]); diff --git a/crates/rbitcoin-store/src/scripthash_layout.rs b/crates/rbitcoin-store/src/scripthash_layout.rs index e6bf9fa7a..b44ae56b5 100644 --- a/crates/rbitcoin-store/src/scripthash_layout.rs +++ b/crates/rbitcoin-store/src/scripthash_layout.rs @@ -73,11 +73,6 @@ pub enum ShHeadValue { used: u16, off: u64, }, - /// 4 KiB page chain; head stores first and last page file offsets only. - Paged { - first_page: u64, - last_page: u64, - }, /// Schema 19 megakey: pack8 mode 11 last page; that page holds extent_base/n. Extent { last_page: u64, @@ -91,7 +86,7 @@ impl ShHeadValue { ShHeadValue::Inline { used, .. } => u32::from(*used), ShHeadValue::Slab { used, .. } => u32::from(*used), // Count not stored in head; callers that need n walk pages. - ShHeadValue::Paged { .. } | ShHeadValue::Extent { .. } => u32::MAX, + ShHeadValue::Extent { .. } => u32::MAX, } } @@ -100,7 +95,7 @@ impl ShHeadValue { } pub fn is_paged(&self) -> bool { - matches!(self, ShHeadValue::Paged { .. } | ShHeadValue::Extent { .. }) + matches!(self, ShHeadValue::Extent { .. }) } pub fn is_slab(&self) -> bool { @@ -113,13 +108,6 @@ impl ShHeadValue { ShHeadValue::Inline { entries, used: 1 } } - pub fn paged(first_page: u64, last_page: u64) -> Self { - ShHeadValue::Paged { - first_page, - last_page, - } - } - pub fn extent(last_page: u64) -> Self { ShHeadValue::Extent { last_page } } @@ -173,7 +161,6 @@ pub fn pack8(v: &ShHeadValue) -> Result { | ((u64::from(*used) & SH8_USED_MASK) << SH8_USED_SHIFT) | ((u64::from(*class) & SH8_CLASS_MASK) << SH8_CLASS_SHIFT)) } - ShHeadValue::Paged { .. } => Err(StoreError::Corrupt(INDEX_REFUSE_PAGED_SH)), ShHeadValue::Extent { last_page } => { if *last_page > SH8_PAYLOAD62 || *last_page == 0 { return Err(StoreError::Corrupt("sh pack8: last_page overflow")); @@ -184,7 +171,7 @@ pub fn pack8(v: &ShHeadValue) -> Result { } } -/// Inverse of [`pack8`]. Paged `first_page` is 0 (lives on the last page header). +/// Inverse of [`pack8`]. Mode 2 (old Paged megakey) refuses. pub fn pack8_bytes(v: &ShHeadValue) -> Result<[u8; SH_HEAD_VALUE_LEN], StoreError> { Ok(pack8(v)?.to_le_bytes()) } @@ -233,16 +220,11 @@ mod tests { use super::*; #[test] - fn head_value_roundtrip_inline_paged() { + fn head_value_roundtrip_inline_and_mode10_refuses() { let e0 = Fk(3); let inline = ShHeadValue::inline_one(e0); assert_eq!(unpack8(pack8(&inline).unwrap()).unwrap(), inline); - let paged = ShHeadValue::paged(4096, 8192); - match pack8(&paged) { - Err(StoreError::Corrupt(m)) => assert_eq!(m, INDEX_REFUSE_PAGED_SH), - other => panic!("pack8 Paged must refuse, got {other:?}"), - } let mode10 = (2u64 << SH8_MODE_SHIFT) | 8192; match unpack8(mode10) { Err(StoreError::Corrupt(m)) => assert_eq!(m, INDEX_REFUSE_PAGED_SH), @@ -289,11 +271,6 @@ mod tests { let slab = ShHeadValue::slab(2, 9, 4096); let got = unpack8(pack8(&slab).unwrap()).unwrap(); assert_eq!(got, slab); - let paged = ShHeadValue::paged(4096, 8192); - assert!(matches!( - pack8(&paged), - Err(StoreError::Corrupt(m)) if m == INDEX_REFUSE_PAGED_SH - )); assert_eq!(pack8(&ShHeadValue::Empty).unwrap(), 0); assert!(pack8(&ShHeadValue::inline_one(Fk(0))).is_ok()); assert!(unpack8(1u64 << 62 | 1).is_err() || unpack8(1u64 << 62 | 1).is_ok()); @@ -342,12 +319,12 @@ mod tests { used: 0, }; assert!(matches!(pack8(&zero_inline), Err(StoreError::Corrupt(_)))); - let paged = ShHeadValue::paged(4096, 8192); - assert_eq!(paged.used(), u32::MAX); - assert!(paged.is_paged()); - assert!(!paged.is_slab()); - assert!(paged.inline_entries().is_empty()); - assert!(paged.inline_fks().is_empty()); + let extent = ShHeadValue::extent(8192); + assert_eq!(extent.used(), u32::MAX); + assert!(extent.is_paged()); + assert!(!extent.is_slab()); + assert!(extent.inline_entries().is_empty()); + assert!(extent.inline_fks().is_empty()); let slab = ShHeadValue::slab(0, 4, 4096); assert_eq!(slab.used(), 4); assert!(slab.is_slab()); diff --git a/crates/rbitcoin-store/src/scripthash_mphf.rs b/crates/rbitcoin-store/src/scripthash_mphf.rs index e6e634c35..a114f1eef 100644 --- a/crates/rbitcoin-store/src/scripthash_mphf.rs +++ b/crates/rbitcoin-store/src/scripthash_mphf.rs @@ -438,19 +438,12 @@ mod tests { } #[test] - fn sh_mphf_empty_and_paged_last_only() { + fn sh_mphf_empty_and_extent_last_only() { let dir = tmp(); let base = dir.join("00"); let h = MphfHead::write_pack8(&base, &[]).unwrap(); assert!(h.is_empty()); assert!(h.get(&key(1)).unwrap().is_none()); - let paged = ShHeadValue::paged(4096, 8192); - match pack8(&paged) { - Err(StoreError::Corrupt(m)) => { - assert_eq!(m, crate::scripthash_layout::INDEX_REFUSE_PAGED_SH); - } - other => panic!("pack8 Paged must refuse, got {other:?}"), - } let extent = ShHeadValue::extent(8192); let h = MphfHead::write_pack8(&base, &[(key(1), pack8(&extent).unwrap())]).unwrap(); match h.get(&key(1)).unwrap().unwrap() { diff --git a/crates/rbitcoin-store/src/tx_head_mphf.rs b/crates/rbitcoin-store/src/tx_head_mphf.rs index 45bb70f84..59c249904 100644 --- a/crates/rbitcoin-store/src/tx_head_mphf.rs +++ b/crates/rbitcoin-store/src/tx_head_mphf.rs @@ -229,47 +229,6 @@ mod tests { )) } - #[test] - fn shared_g_page_is_one_pread() { - let dir = tmp("share"); - std::fs::create_dir_all(&dir).unwrap(); - let keys: Vec = (0..4_000u64) - .map(|i| i.wrapping_mul(0x9E37_79B9_7F4A_7C15).wrapping_add(3)) - .collect(); - let ram = BdzMphf::build(&keys).unwrap(); - let p = dir.join("t.mphf"); - ram.write_to(&p).unwrap(); - let fd = BdzMphf::read_from(&p).unwrap(); - let page_of = |k: u64| { - fd.vertices(k) - .into_iter() - .map(|v| v / 1024) - .collect::>() - }; - let k0 = keys[0]; - let p0 = page_of(k0); - let k1 = keys - .iter() - .copied() - .find(|&k| k != k0 && page_of(k).iter().any(|p| p0.contains(p))) - .expect("two keys sharing a g page"); - let _ = fd.take_g_page_preads(); - let a = fd.index(k0).unwrap(); - let b = fd.index(k1).unwrap(); - let serial_pages = fd.take_g_page_preads(); - let batch = fd.index_batch(&[k0, k1], &mut IoCtx::none()).unwrap(); - let batch_pages = fd.take_g_page_preads(); - assert_eq!(batch, vec![a, b]); - let mut uniq = page_of(k0); - uniq.extend(page_of(k1)); - uniq.sort_unstable(); - uniq.dedup(); - assert_eq!(batch_pages, uniq.len() as u64); - assert!(batch_pages <= serial_pages); - assert!(batch_pages >= 1); - let _ = std::fs::remove_dir_all(&dir); - } - #[test] fn index_batch_held_session_submits_g_pages() { let dir = tmp("held"); @@ -277,8 +236,8 @@ mod tests { let keys: Vec = (0..200u64).map(|i| i * 17 + 3).collect(); let ram = BdzMphf::build(&keys).unwrap(); let p = dir.join("t.mphf"); - ram.write_to(&p).unwrap(); - let fd = BdzMphf::read_from(&p).unwrap(); + ram.write_packed_to(&p).unwrap(); + let fd = BdzMphf::read_packed_from(&p).unwrap(); let serial = fd.index_batch(&keys[..8], &mut IoCtx::none()).unwrap(); let mut session = UringSession::try_open_kind(SessionKind::Pool, 32).expect("pool"); let _ = session.take_sqe_n(); @@ -303,8 +262,8 @@ mod tests { let keys: Vec = (0..200u64).map(|i| i * 17 + 3).collect(); let ram = BdzMphf::build(&keys).unwrap(); let p = dir.join("t.mphf"); - ram.write_to(&p).unwrap(); - let fd_mphf = BdzMphf::read_from(&p).unwrap(); + ram.write_packed_to(&p).unwrap(); + let fd_mphf = BdzMphf::read_packed_from(&p).unwrap(); let serial = fd_mphf.index_batch(&keys[..8], &mut IoCtx::none()).unwrap(); let leftover_path = dir.join("leftover.bin"); diff --git a/crates/rbitcoin-store/src/uring_session.rs b/crates/rbitcoin-store/src/uring_session.rs index 53d21ce63..390717c67 100644 --- a/crates/rbitcoin-store/src/uring_session.rs +++ b/crates/rbitcoin-store/src/uring_session.rs @@ -1170,8 +1170,6 @@ pub fn with_thread_local( /// Kind byte for [`pack_ud`]. Distinct per machine so a leftover CQE cannot /// complete a different stage's slot (probe slot `5` ≠ ID op `5`). pub const KIND_BULK_PREAD: u8 = 1; -#[allow(dead_code)] -pub const KIND_IDX: u8 = 2; pub const KIND_PROBE: u8 = 3; pub const KIND_BULK_PWRITE: u8 = 4; pub const KIND_SPEND_META_READ: u8 = 5; @@ -1371,7 +1369,6 @@ mod tests { fn pack_ud_kinds_are_unique_and_do_not_alias() { let kinds = [ KIND_BULK_PREAD, - KIND_IDX, KIND_PROBE, KIND_BULK_PWRITE, KIND_SPEND_META_READ, @@ -1387,13 +1384,10 @@ mod tests { for k in kinds { assert!(seen.insert(k), "duplicate kind {k}"); } - // Leftover probe slot 5 must not look like ID op 5 or idx slot 5. + // Leftover probe slot 5 must not look like a bulk-pread slot 5. let probe = pack_ud(KIND_PROBE, 1, 5); let id = pack_ud(KIND_BULK_PREAD, 1, 5); - let idx = pack_ud(KIND_IDX, 1, 5); assert_ne!(probe, id); - assert_ne!(probe, idx); - assert_ne!(id, idx); // Epoch N CQE is a different ud than epoch N+1 (same kind+slot). assert_ne!(pack_ud(KIND_PROBE, 1, 5), pack_ud(KIND_PROBE, 2, 5)); let (k, e, s) = unpack_ud(probe);