Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
3f87ce3
feat(storage): add CrdtType to entity metadata
xilosada Feb 1, 2026
68fef57
fix(storage): unify CrdtType definitions and fix backward compatibility
xilosada Feb 1, 2026
7acdd9f
fix(storage): include crdt_type in hash_metadata_for_payload
xilosada Feb 1, 2026
889600d
fix(storage): implement proper Borsh backward compatibility for Metad…
xilosada Feb 1, 2026
bff9846
feat(tests): add comprehensive CRDT test app and enhanced workflows w…
xilosada Feb 2, 2026
a00e06c
chore: format entities.rs
xilosada Feb 2, 2026
1e5c36b
fix: crdt storage and events (#1804)
cursor[bot] Feb 2, 2026
e38ccfb
feat(storage): Add CrdtType to entity metadata for CRDT merge dispatch
xilosada Feb 3, 2026
910fa41
feat(merodb): add CrdtType support for entity metadata deserialization
xilosada Feb 3, 2026
150b57b
feat(storage): add field_name to metadata for schema inference
xilosada Feb 3, 2026
dc7a534
feat(kv-store,merodb): improve visualization with icons, colors, and …
xilosada Feb 3, 2026
4c97f21
refactor(merodb): add field_name-based matching for tree building
xilosada Feb 3, 2026
b06584f
fix(merodb-gui): show field names instead of truncated IDs in tree view
xilosada Feb 3, 2026
82d25dd
feat(storage): store correct CRDT type in collection metadata
xilosada Feb 3, 2026
007eeaa
fix(merodb): treat Counter as Map type for proper tree building
xilosada Feb 3, 2026
5fb27cb
fix(merodb-gui): show values for Vector and Set entries in tree labels
xilosada Feb 4, 2026
1af25be
fix(merodb-gui): show Counter value instead of executor ID
xilosada Feb 4, 2026
7cc9ecd
fix(merodb-gui): show correct children count in sidebar
xilosada Feb 4, 2026
95b8c29
fix(merodb-gui): hide empty hash/timestamp sections in sidebar
xilosada Feb 4, 2026
f9839d3
fix(merodb-gui): show Vector/Set values in folder view
xilosada Feb 4, 2026
d427488
revert(kv-store): restore original kv-store app
xilosada Feb 4, 2026
3d6732e
feat(apps): add state-visualization-test app for merodb testing
xilosada Feb 4, 2026
dbf792e
fix(merodb): remove debug eprintln from schema inference
xilosada Feb 4, 2026
73cd91c
test(storage): add unit tests for field_name in Metadata and Element
xilosada Feb 4, 2026
3f6735a
test(storage): add backward compatibility tests for Metadata deserial…
xilosada Feb 4, 2026
a540a8e
docs(storage): add schema inference documentation
xilosada Feb 4, 2026
ce967ad
fix(merodb): validate context_id slice length before conversion
xilosada Feb 4, 2026
12f3b8b
fix(merodb): align CrdtType::Custom variant with canonical definition
xilosada Feb 4, 2026
c2adff5
fix(merodb): remove Copy trait from CrdtType enum
xilosada Feb 4, 2026
01e3e1a
fix(sdk): simplify Default generation for LwwRegister fields
xilosada Feb 4, 2026
392b728
fix(apps): add Default derive to Status and UserId32
xilosada Feb 4, 2026
e1f5984
fix(sdk): only generate Default impl when struct has collection fields
xilosada Feb 4, 2026
4f6f5c1
fix(merodb,sdk): fix CrdtType::Custom pattern and quote! syntax
xilosada Feb 4, 2026
5447d52
fix(storage): add missing crdt_type and field_name to test Metadata i…
xilosada Feb 4, 2026
4bf97a3
fix(storage): add missing Metadata fields and fix UpdatedAt comparison
xilosada Feb 4, 2026
7ec9721
fix(workflow): restore remote Docker image for CI
xilosada Feb 5, 2026
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
12 changes: 12 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ members = [
"./apps/private_data",
"./apps/blobs",
"./apps/collaborative-editor",
"./apps/comprehensive-crdt-test",
"./apps/abi_conformance",
"./apps/state-schema-conformance",
"./apps/xcall-example",
Expand Down
24 changes: 24 additions & 0 deletions apps/comprehensive-crdt-test/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
[package]
name = "comprehensive-crdt-test"
version.workspace = true
authors.workspace = true
edition.workspace = true
repository.workspace = true
license.workspace = true
publish = false

[lib]
crate-type = ["cdylib"]

[dependencies]
thiserror.workspace = true
calimero-sdk.workspace = true
calimero-storage.workspace = true
hex.workspace = true

[build-dependencies]
calimero-wasm-abi.workspace = true
serde_json.workspace = true

[package.metadata.workspaces]
independent = true
64 changes: 64 additions & 0 deletions apps/comprehensive-crdt-test/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# Comprehensive CRDT Test Application

This application tests **ALL** CRDT types, UserStorage, FrozenStorage, and root-level concurrent modifications.

## Features Tested

### CRDT Types
- ✅ **Counter** - Grow-only counter with concurrent increments
- ✅ **UnorderedMap** - Field-level merge semantics
- ✅ **Vector** - Element-wise merge
- ✅ **UnorderedSet** - Union merge semantics
- ✅ **RGA (ReplicatedGrowableArray)** - Text CRDT for collaborative editing
- ✅ **LwwRegister** - Last-write-wins register

### Storage Types
- ✅ **UserStorage (Simple)** - User-owned simple values
- ✅ **UserStorage (Nested)** - User-owned nested data structures
- ✅ **FrozenStorage** - Content-addressable immutable storage

### Root-Level Merging
- ✅ **Concurrent Root Modifications** - Tests that root merge works when different nodes modify different root fields concurrently

## Purpose

This app is designed to:
1. Test all CRDT types in a single application
2. Verify root-level concurrent modifications trigger proper merging
3. Test UserStorage and FrozenStorage alongside CRDT types
4. Serve as a comprehensive integration test for the sync protocol

## Usage

Build the app:
```bash
./build.sh
```

Run the workflow:
```bash
merobox bootstrap run workflows/comprehensive-crdt-test.yml
```

## Workflow Tests

The `comprehensive-crdt-test.yml` workflow tests:
1. Root Counter - concurrent increments merge correctly
2. Root Map - field-level merge when different nodes modify different keys
3. Root Vector - element-wise merge
4. Root Set - union merge
5. Root RGA - text CRDT merge
6. Root Register - LWW semantics
7. UserStorage Simple - user-owned data sync
8. UserStorage Nested - nested user data with CRDTs
9. FrozenStorage - content-addressable storage
10. Root-Level Concurrent Modifications - different nodes modifying different root fields simultaneously

## Architecture

The app state (`ComprehensiveCrdtApp`) contains all CRDT types and storage types as root-level fields. This design allows testing root-level concurrent modifications where:
- Node 1 modifies `root_counter`
- Node 2 modifies `root_map`
- Node 1 modifies `root_set`

All concurrently, triggering `merge_root_state` to merge all fields correctly.
38 changes: 38 additions & 0 deletions apps/comprehensive-crdt-test/build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
use std::fs;
use std::path::Path;

use calimero_wasm_abi::emitter::emit_manifest;

fn main() {
println!("cargo:rerun-if-changed=src/lib.rs");

// Parse the source code
let src_path = Path::new("src/lib.rs");
let src_content = fs::read_to_string(src_path).expect("Failed to read src/lib.rs");

// Generate ABI manifest using the emitter
let manifest = emit_manifest(&src_content).expect("Failed to emit ABI manifest");

// Serialize the manifest to JSON
let json = serde_json::to_string_pretty(&manifest).expect("Failed to serialize manifest");

// Write the ABI JSON to the res directory
let res_dir = Path::new("res");
if !res_dir.exists() {
fs::create_dir_all(res_dir).expect("Failed to create res directory");
}

let abi_path = res_dir.join("abi.json");
fs::write(&abi_path, json).expect("Failed to write ABI JSON");

// Extract and write the state schema
if let Ok(mut state_schema) = manifest.extract_state_schema() {
state_schema.schema_version = "wasm-abi/1".to_owned();

let state_schema_json =
serde_json::to_string_pretty(&state_schema).expect("Failed to serialize state schema");
let state_schema_path = res_dir.join("state-schema.json");
fs::write(&state_schema_path, state_schema_json)
.expect("Failed to write state schema JSON");
}
}
19 changes: 19 additions & 0 deletions apps/comprehensive-crdt-test/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash
set -e

# Add wasm32 target if not already present
rustup target add wasm32-unknown-unknown || true

# Build the app
cargo build -p comprehensive-crdt-test --target wasm32-unknown-unknown --release

# Copy WASM file to res directory
mkdir -p res
cp target/wasm32-unknown-unknown/release/comprehensive_crdt_test.wasm res/comprehensive_crdt_test.wasm

# Optimize WASM if wasm-opt is available
if command -v wasm-opt &> /dev/null; then
wasm-opt -O2 res/comprehensive_crdt_test.wasm -o res/comprehensive_crdt_test.wasm || true
fi

echo "Build complete: res/comprehensive_crdt_test.wasm"
Loading
Loading