From fd41d7dad65de91a8fa9a4a21244b93703928377 Mon Sep 17 00:00:00 2001 From: Buffrr Date: Fri, 24 Jul 2026 12:49:24 +0200 Subject: [PATCH] chore(checkpoint): update to match changes to db --- checkpoint/README.md | 2 +- checkpoint/src/integrity.rs | 6 +++--- checkpoint/src/lib.rs | 12 ++++++++++-- client/src/store/chain.rs | 6 +++++- 4 files changed, 19 insertions(+), 7 deletions(-) diff --git a/checkpoint/README.md b/checkpoint/README.md index 6e30fb9..d332d85 100644 --- a/checkpoint/README.md +++ b/checkpoint/README.md @@ -12,7 +12,7 @@ cargo run -p spaces_checkpoint --bin checkpoint-builder -- --data-dir /path/to/s This will: 1. Read the current tip (block hash + height) from `root.sdb` -2. Create `checkpoint-.tar.gz` containing `root.sdb`, `nums.sdb`, and `index.sqlite` +2. Create `checkpoint-.tar.gz` containing `root.sdb`, `nums_v2.sdb`, and `index.sqlite` 3. Update `checkpoint/src/integrity.rs` with the SHA-256 digest 4. If `--upload` is specified, upload the archive and `latest.json` to S3 diff --git a/checkpoint/src/integrity.rs b/checkpoint/src/integrity.rs index 4492ea4..0e471e8 100644 --- a/checkpoint/src/integrity.rs +++ b/checkpoint/src/integrity.rs @@ -1,8 +1,8 @@ // AUTO GENERATED by checkpoint-builder. Do not edit manually. pub fn checkpoint() -> super::Checkpoint { super::Checkpoint { - height: 945180, - block_hash: "000000000000000000012b40cac64a5fb5417cff15dc01461f99a76fc9643568".to_string(), - digest: "e98c1999a3b98b517b174b3add778fb55f0fe63e0795e9f85952edc00a919f58".to_string(), + height: 959292, + block_hash: "000000000000000000007f21e4b603aa3efa431bc561dda34c71b1eb217764ec".to_string(), + digest: "8202dedd377c0ff5cf91b0fcddf1f9a8f4c10c5913e2d6d5231e3c0c685858c2".to_string(), } } diff --git a/checkpoint/src/lib.rs b/checkpoint/src/lib.rs index 725c982..b247936 100644 --- a/checkpoint/src/lib.rs +++ b/checkpoint/src/lib.rs @@ -9,7 +9,7 @@ use std::path::Path; pub const CHECKPOINT_BASE_URL: &str = "https://checkpoints.spacesprotocol.org"; /// The three spaced database files included in a checkpoint. -pub const CHECKPOINT_FILES: &[&str] = &["root.sdb", "nums.sdb", "index.sqlite"]; +pub const CHECKPOINT_FILES: &[&str] = &["root.sdb", "nums_v2.sdb", "index.sqlite"]; #[derive(Debug, Clone, serde::Serialize, serde::Deserialize)] pub struct Checkpoint { @@ -295,7 +295,8 @@ pub fn checkpoint() -> super::Checkpoint {{ block_hash: "{}".to_string(), digest: "{}".to_string(), }} -}}"#, +}} +"#, height, block_hash, hex::encode(digest), @@ -332,7 +333,14 @@ mod tests { use std::sync::Arc; use std::sync::atomic::{AtomicU64, Ordering}; + // Network integration test: downloads the checkpoint named in + // `integrity::checkpoint()` from the live server. Ignored by default — + // it requires that specific archive to already be uploaded (freshly + // generated checkpoints aren't, until published), makes a multi-MB + // production request, and would otherwise couple CI to server state. + // Run manually after upload: `cargo test -p spaces_checkpoint -- --ignored`. #[test] + #[ignore = "requires the current checkpoint to be uploaded to the server"] fn download_reports_progress() { let cp = integrity::checkpoint(); let url = cp.url(CHECKPOINT_BASE_URL); diff --git a/client/src/store/chain.rs b/client/src/store/chain.rs index 791cf22..fd2235a 100644 --- a/client/src/store/chain.rs +++ b/client/src/store/chain.rs @@ -194,7 +194,11 @@ impl Chain { cache_size: Option, ) -> anyhow::Result { let proto_db_path = dir.join("root.sdb"); - let nums_db_path = dir.join("nums.sdb"); + // Versioned filename: the numout storage format changed (spent flag + + // split identity/rebind slots), so the old `nums.sdb` is incompatible. + // Bumping the name makes upgrading nodes miss the file and rebuild the + // nums tree from `nums_genesis` (root.sdb / spaces state is untouched). + let nums_db_path = dir.join("nums_v2.sdb"); let initial_num_sync = !nums_db_path.exists(); let sp_store = SpStore::open(proto_db_path, index_hashes, cache_size)?;