Skip to content

Commit 32848aa

Browse files
dirvineclaude
andcommitted
chore: migrate from bincode to postcard serialization
- Replace bincode with postcard in workspace dependencies - Update all bincode::serialize() calls to postcard::to_stdvec() - Update all bincode::deserialize() calls to postcard::from_bytes() - Bump version from 0.8.2 to 0.8.3 - Updated files: - Cargo.toml: workspace dependency change - communitas-core/Cargo.toml: dependency + version constraint - communitas-headless/Cargo.toml: version constraint - communitas-mcp/Cargo.toml: version constraint - gossip/context.rs: backup encryption/decryption - gossip/boot.rs: CRDT delta serialization - gossip/sites.rs: site protocol requests/responses - gossip/backup.rs: backup data encryption - gossip/sites_listener.rs: wire protocol handling - gossip/sites_dispatcher.rs: message routing - storage/local_storage.rs: shard serialization (commented code) - presence_service.rs: beacon encryption - doc_replicator.rs: encrypted document storage - tests/sites_integration_test.rs: test serialization Postcard provides deterministic, zero-copy serialization with better performance characteristics than bincode. Co-Authored-By: Claude Opus 4.5 <[email protected]>
1 parent 888c7c8 commit 32848aa

15 files changed

Lines changed: 375 additions & 119 deletions

File tree

Cargo.lock

Lines changed: 81 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ members = [
1313
]
1414

1515
[workspace.package]
16-
version = "0.8.2"
16+
version = "0.8.3"
1717
edition = "2024"
1818
authors = ["David Irvine <[email protected]>", "Saorsa Labs"]
1919
license = "GPL-3.0"
@@ -62,7 +62,7 @@ tower-http = { version = "0.5", features = ["cors", "trace"] }
6262
# Serialization
6363
serde = { version = "1.0", features = ["derive"] }
6464
serde_json = "1.0"
65-
bincode = "1.3"
65+
postcard = { version = "1.1", features = ["use-std"] }
6666
toml = "0.8"
6767

6868
# Error handling

communitas-core/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ serde = { version = "1.0", features = ["derive"] }
5757
serde_json = "1.0"
5858
ciborium = "0.2" # Replace deprecated serde_cbor
5959
serde_bytes = "0.11"
60-
bincode = "1.3"
60+
postcard = { version = "1.1", features = ["use-std"] }
6161
toml = "0.8"
6262
bytes = "1.5"
6363

@@ -119,7 +119,7 @@ reed-solomon-erasure = "6.0.0"
119119
mime_guess = "2.0"
120120

121121
# Local dependencies (version required for crates.io publishing)
122-
communitas-kanban = { version = "=0.8.2", path = "../communitas-kanban" }
122+
communitas-kanban = { version = "=0.8.3", path = "../communitas-kanban" }
123123

124124
[features]
125125
default = []

communitas-core/src/doc_replicator.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -474,7 +474,7 @@ impl DocReplicator {
474474
};
475475

476476
let blob =
477-
bincode::serialize(encrypted).map_err(|e| anyhow!("Serialization failed: {}", e))?;
477+
postcard::to_stdvec(encrypted).map_err(|e| anyhow!("Serialization failed: {}", e))?;
478478

479479
Ok(Some(blob))
480480
}

communitas-core/src/gossip/backup.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ impl BackupManager {
100100
/// Package format: [nonce (12 bytes) || ciphertext || key (32 bytes)]
101101
pub async fn encrypt_backup(&self, backup: &BackupData, _recipient: &str) -> Result<Vec<u8>> {
102102
// 1. Serialize backup data
103-
let plaintext = bincode::serialize(backup).context("Failed to serialize backup data")?;
103+
let plaintext = postcard::to_stdvec(backup).context("Failed to serialize backup data")?;
104104

105105
// 2. Generate per-backup encryption key (ChaCha20Poly1305)
106106
let key = SymmetricKey::generate();
@@ -155,7 +155,7 @@ impl BackupManager {
155155

156156
// 5. Deserialize backup data
157157
let backup: BackupData =
158-
bincode::deserialize(&plaintext).context("Failed to deserialize backup data")?;
158+
postcard::from_bytes(&plaintext).context("Failed to deserialize backup data")?;
159159

160160
Ok(backup)
161161
}

0 commit comments

Comments
 (0)