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
3 changes: 2 additions & 1 deletion src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -562,6 +562,8 @@ fn print_status_line(ok: bool) {
fn print_unsigned_warning() {
println!("warning: ⚠ UNSIGNED — hash ok, not cryptographically signed");
}

// ---------------------------------------------------------------------------
// Handlers
// ---------------------------------------------------------------------------

Expand Down Expand Up @@ -1843,7 +1845,6 @@ pub fn handle_check(args: CheckArgs) -> Result<(), TaprootError> {
warning: warnings,
});
}
// Validate has_breaking helper stays consistent
debug_assert_eq!(has_breaking(&diffs), breaking > 0);

Ok(())
Expand Down
8 changes: 2 additions & 6 deletions src/engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,10 @@ use crate::state::{SignedState, TaprootState};
pub struct StateEngine;

impl StateEngine {
/// Canonical JSON — sorted keys, no whitespace tricks.
/// Uses serde_json with BTreeMap already sorted, then re-serializes deterministically.
/// Canonical JSON — sorted keys, no whitespace tricks. The hash is taken over
/// this form, so key order must be stable across struct and map nesting.
pub fn to_canonical_json(state: &TaprootState) -> Result<Vec<u8>, TaprootError> {
// serde_json sorts struct keys by definition order; BTreeMap sorts env_vars.
// For true canonical, we serialize via Value then to_string with sorted keys.
let json = serde_json::to_string(state)?;
// Parse and re-stringify to ensure deterministic key ordering at all levels.
// serde_json's Value uses BTreeMap internally when `preserve_order` is off (default).
let value: serde_json::Value = serde_json::from_str(&json)?;
Ok(serde_json::to_vec(&value)?)
}
Expand Down
1 change: 0 additions & 1 deletion src/keys.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@ impl KeyStore {

fn add_to_index(&self, kp: &Keypair) -> Result<(), TaprootError> {
let mut keys = self.load_index()?;
// deactivate previous active keys if this one is active? keep all active for rotation
keys.push(kp.clone());
self.save_index(&keys)?;
Ok(())
Expand Down
4 changes: 0 additions & 4 deletions src/mount.rs
Original file line number Diff line number Diff line change
Expand Up @@ -706,10 +706,6 @@ impl Filesystem for TaprootFS {
}
}

// ---------------------------------------------------------------------------
// Public mount helper
// ---------------------------------------------------------------------------

// ---------------------------------------------------------------------------
// Drift extraction
// ---------------------------------------------------------------------------
Expand Down
Loading