Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion checkpoint/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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-<height>.tar.gz` containing `root.sdb`, `nums.sdb`, and `index.sqlite`
2. Create `checkpoint-<height>.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

Expand Down
6 changes: 3 additions & 3 deletions checkpoint/src/integrity.rs
Original file line number Diff line number Diff line change
@@ -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(),
}
}
12 changes: 10 additions & 2 deletions checkpoint/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -295,7 +295,8 @@ pub fn checkpoint() -> super::Checkpoint {{
block_hash: "{}".to_string(),
digest: "{}".to_string(),
}}
}}"#,
}}
"#,
height,
block_hash,
hex::encode(digest),
Expand Down Expand Up @@ -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);
Expand Down
6 changes: 5 additions & 1 deletion client/src/store/chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,11 @@ impl Chain {
cache_size: Option<usize>,
) -> anyhow::Result<Self> {
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)?;
Expand Down
Loading