-
Notifications
You must be signed in to change notification settings - Fork 3
feat(state): per-component fingerprint dump for cross-node drift diagnosis #790
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -350,6 +350,31 @@ fn render_json(r: &PreflightReport) -> String { | |||||
| } | ||||||
|
|
||||||
| /// `sentrix state preflight [--json]` — read-only activation readiness report. | ||||||
| /// Dump per-component state fingerprints for the chain.db at SENTRIX_DATA_DIR. | ||||||
| /// Run against each node's data dir (node STOPPED) and diff the output to find | ||||||
| /// WHICH state component diverges across nodes at the same height. Added | ||||||
| /// 2026-06-04 to chase the post-#782 determinism drift. | ||||||
| pub fn cmd_state_fingerprint() -> anyhow::Result<()> { | ||||||
| let storage = Storage::open(&get_db_path())?; | ||||||
| let bc = storage | ||||||
| .load_blockchain()? | ||||||
| .ok_or_else(|| anyhow::anyhow!("Chain not initialized."))?; | ||||||
|
|
||||||
| let c = sentrix::core::block_executor::state_components(&bc); | ||||||
| let hx = |b: &[u8; 32]| b.iter().map(|x| format!("{x:02x}")).collect::<String>(); | ||||||
|
|
||||||
| println!("height {}", bc.height()); | ||||||
| println!("account_count {}", c.account_count); | ||||||
| println!("total_minted {}", c.total_minted); | ||||||
| println!("total_burned {}", c.total_burned); | ||||||
| println!("accounts_fp {}", hx(&c.accounts_fp)); | ||||||
| println!("contract_code_fp {}", hx(&c.contract_code_fp)); | ||||||
| println!("contract_stor_fp {}", hx(&c.contract_storage_fp)); | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use the documented output key name for storage fingerprint. Line 372 prints Suggested patch- println!("contract_stor_fp {}", hx(&c.contract_storage_fp));
+ println!("contract_storage_fp {}", hx(&c.contract_storage_fp));📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||
| println!("src20_fp {}", hx(&c.src20_fp)); | ||||||
| println!("nft_fp {}", hx(&c.nft_fp)); | ||||||
| Ok(()) | ||||||
| } | ||||||
|
|
||||||
| pub fn cmd_state_preflight(json: bool) -> anyhow::Result<()> { | ||||||
| let storage = Storage::open(&get_db_path())?; | ||||||
| let bc = storage | ||||||
|
|
||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix the stale docstring on this command.
Line 352 still describes
state preflight, but this function is the fingerprint command. This is misleading in generated docs and code navigation.Suggested patch
📝 Committable suggestion
🤖 Prompt for AI Agents