Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
cd67b37
init
cocoyoon May 14, 2025
a151013
chore: refactor
cocoyoon May 15, 2025
d0169d1
generics
cocoyoon May 16, 2025
801e2a1
generics
cocoyoon May 18, 2025
faddab8
chore: refactor
cocoyoon May 19, 2025
251a4ce
chore: refactor
cocoyoon May 20, 2025
927d7bf
chore: refactor rpc client
cocoyoon May 21, 2025
20b41f9
chore: refactor
cocoyoon May 21, 2025
e83ef19
chore: refactor async task
cocoyoon May 22, 2025
0012335
introduce SecureBlock trait
cocoyoon May 22, 2025
090ba37
generic for enc dec key
cocoyoon May 22, 2025
163097b
chore: refactor to generic dkg
cocoyoon May 24, 2025
c16c345
chore: refactor
cocoyoon May 25, 2025
0a43562
chore: refactor
cocoyoon May 25, 2025
5438419
chore: edit comment
cocoyoon May 25, 2025
999d392
add auth service
cocoyoon Jun 2, 2025
2aa0ef2
add session worker
cocoyoon Jun 12, 2025
8551a2a
refactor error types
cocoyoon Jun 13, 2025
d456d30
refactor
cocoyoon Jun 13, 2025
1156ff3
feat: SessionWorker
cocoyoon Jun 20, 2025
b920ddf
Manage SessionWorker state
cocoyoon Jun 23, 2025
c205e1a
error handling
cocoyoon Jun 24, 2025
dbbb9e4
add 'is_dev' and 'node_name' for node config
cocoyoon Jun 27, 2025
2d404aa
edit log
cocoyoon Jun 27, 2025
ae1bf1d
Add new event & refactor creating SignedCommitment
cocoyoon Jun 27, 2025
448a2bc
add session_id for is_leader method
cocoyoon Jun 27, 2025
ea9b359
edit readme
cocoyoon Jun 27, 2025
372cad4
edit skde dependency
cocoyoon Jun 27, 2025
5151756
Add timeout for collecting keys
cocoyoon Jul 2, 2025
df717a7
Delete .DS_Store
cocoyoon Jul 2, 2025
2bd3ca9
chore: update dependencies and build configuration
cocoyoon Aug 4, 2025
21f2d85
feat(cli): add TOML configuration system
cocoyoon Aug 4, 2025
ee33794
refactor(cli): restructure command arguments for flexibility
cocoyoon Aug 4, 2025
e54777f
refactor\!: restructure node architecture with operator pattern
cocoyoon Aug 4, 2025
f5a7862
feat: add key generator and operator components
cocoyoon Aug 4, 2025
f4c13be
refactor(primitives): update core types and traits
cocoyoon Aug 4, 2025
d925570
refactor(rpc): update RPC handlers for new architecture
cocoyoon Aug 4, 2025
0231ada
refactor\!: remove legacy auth system and verifier
cocoyoon Aug 4, 2025
b89cf29
docs: add CLAUDE.md project documentation
cocoyoon Aug 4, 2025
590f3a5
refactor(config): replace auth service URL with separate blockchain R…
cocoyoon Aug 5, 2025
3948c21
refactor(operator): enhance blockchain service with improved event ha…
cocoyoon Aug 5, 2025
0609706
refactor(committee)\!: restructure worker architecture with specializ…
cocoyoon Aug 6, 2025
c5bdc3e
feat(events)\!: implement dual-channel event system with DkgEvent enum
cocoyoon Aug 6, 2025
3ce55a9
refactor(service): update task workers for new event architecture
cocoyoon Aug 6, 2025
f9877bf
refactor(rpc): update handlers for new worker architecture
cocoyoon Aug 6, 2025
2308335
refactor(primitives): update type system for enhanced architecture
cocoyoon Aug 6, 2025
f34b285
docs(claude): enhance development documentation with comprehensive gu…
cocoyoon Aug 6, 2025
a64c7d2
docs(readme): transform into comprehensive project overview with visu…
cocoyoon Aug 6, 2025
0de4ed7
docs: enhance development documentation with workspace details
cocoyoon Aug 27, 2025
2fe5072
chore: update dependencies and rust toolchain
cocoyoon Aug 27, 2025
d11050d
refactor!: remove operator blockchain integration module
cocoyoon Aug 27, 2025
f69af00
refactor(primitives): update core type system and consensus
cocoyoon Aug 27, 2025
6c39cda
refactor(service): restructure task workers with enhanced event handling
cocoyoon Aug 27, 2025
d1e62f3
refactor(rpc): update handlers for enhanced key management system
cocoyoon Aug 27, 2025
0cd92e5
feat(skde): enhance key generator integration with improved error han…
cocoyoon Aug 27, 2025
a506f91
feat(validation): add new validation module and development issues do…
cocoyoon Aug 27, 2025
4b80cb9
docs: remove ISSUES.md file
cocoyoon Nov 28, 2025
92d169f
chore: update Cargo.lock dependencies
cocoyoon Nov 28, 2025
2bebd13
fix(error): add InvalidDecKey error type for UTF-8 conversion failures
cocoyoon Nov 28, 2025
dd2e758
fix(keygen): improve verify_dec_key with logging and UTF-8 validation
cocoyoon Nov 28, 2025
b1dea32
refactor(primitives): rename ActiveOperatorList to ActiveCommitteeList
cocoyoon Nov 28, 2025
ea4daa8
fix(rpc): improve decryption key verification in sync_dec_key handler
cocoyoon Nov 28, 2025
f12b102
refactor(rpc): update RPC handlers to use ActiveCommitteeList
cocoyoon Nov 28, 2025
4c7e7c1
refactor(service): update service to use ActiveCommitteeList
cocoyoon Nov 28, 2025
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
8 changes: 7 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
# Ignore all under /data
/data/**

/tmp/**

# Unignore directories that lead to the file
!data/
!data/authority/
Expand All @@ -11,4 +13,8 @@
/scripts/key-generator

/scripts/execute/env.sh
/scripts/rpc-call/env.sh
/scripts/rpc-call/env.sh

.DS_Store

.env
129 changes: 129 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
# CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

## Build and Test Commands

- **Build**: `cargo build --release`
- **Debug Build**: `cargo build` (creates binary at `target/debug/dkg`)
- **Test**: `cargo test -- --test-threads=1` (single-threaded required for DKG tests)
- **Format**: `cargo fmt` (uses custom formatting rules in `rustfmt.toml`)
- **Lint**: `cargo clippy`
- **Kill hanging processes**: `pkill -f key-generator` (if tests don't exit properly)

### Running Individual Tests

Use specific test file names or test functions:
```bash
cargo test integration::run_single_node_for_each_role -- --test-threads=1
```

## Architecture Overview

This is a Distributed Key Generator for the Radius Block Building Solution. The system implements aggregated encryption/decryption with timed key generation.

### Workspace Structure

- **cli/**: Command-line interface and configuration management
- **node/**: Core node implementation
- **primitives/**: Node configuration, auth, and key services
- **service/**: Main service logic with task workers (committee, solver)
- **primitives/**: Core types, traits, and consensus mechanisms
- **rpc/**: RPC handlers for cluster and external communication
- **utils/**: Shared utilities

### Key Components

#### Node Roles
- **Authority**: Constructs trusted setup parameters
- **Committee**: Generates encryption keys and acts as leader
- **Solver**: Computes decryption keys
- **Verifier**: Monitors network for Byzantine behavior

#### Configuration Priority
Configuration values follow this priority order:
1. CLI arguments (highest priority)
2. TOML config file values (`--config` or `config.toml`)
3. DEFAULT constants (fallback)

### Running Nodes

1. **Create trusted setup**:
```bash
./target/release/dkg trusted-setup skde --skde.generator 4 --skde.time 1258291 --skde.max-sequencer 2
```

2. **Run Authority node**:
```bash
./target/release/dkg node --dkg.role authority --dkg.trusted-address 0x5FbDB2315678afecb367f032d93F642f64180aa3
```

3. **Run Committee node**:
```bash
./target/release/dkg node --dkg.role committee --dkg.trusted-address 0x5FbDB2315678afecb367f032d93F642f64180aa3 --internal.port 7100 --external.port 7200 --cluster.port 7300
```

4. **Run Solver node**:
```bash
./target/release/dkg node --dkg.role solver --dkg.trusted-address 0x5FbDB2315678afecb367f032d93F642f64180aa3 --internal.port 8100 --external.port 8200 --cluster.port 8300
```

### Development Scripts

The `scripts/execute/` directory contains automation scripts:
- **00_cleanup_nodes.sh**: Clean up processes and data directories
- **01_run_all_nodes.sh**: Start all nodes in correct sequence
- **02_run_authority.sh** through **05_run_solver.sh**: Individual node startup
- **06_register_nodes.sh**: Register nodes with each other

### Key Implementation Details

- **SKDE Integration**: Uses Shared Key Derivation Extension for cryptographic operations
- **RPC Architecture**: Three-tier RPC system (external, internal, cluster)
- **Task Workers**: Asynchronous task processing for committee and solver operations
- **Consensus**: Custom consensus mechanism with commitment and payload types
- **Database**: RocksDB for persistent storage (stored in `./tmp/{role}/db/`)
- **Binary Output**: `cargo build --release` produces `./target/release/dkg` executable

### Development Notes

- **Rust Toolchain**: Uses nightly-2024-10-24 (see `rust-toolchain`)
- **Tests**: Require single-threaded execution due to shared resources
- **Configuration**: Loading uses `as_ref()` and `clone()` to avoid move issues
- **RPC Endpoints**: All have configurable URLs with sensible defaults
- **Storage**: Node data stored under `./tmp/{role}/db/` using RocksDB
- **Private Keys**: Test private keys defined in `tests/utils.rs:38-49`
- **Formatting**: Uses custom rustfmt.toml with StdExternalCrate grouping and crate-level import granularity
- **Dependencies**: External dependencies include radius-sdk, skde (from GitHub), and standard async/crypto libraries

### Event System Architecture

The system uses a dual-channel event system with two main event types:
- **SessionEvent**: Committee session management (genesis, timeouts, key submissions)
- **SolverEvent**: Solver-specific events (decryption key submissions)
- **DkgEvent**: Wrapper enum combining both event types

### Configuration System

Configuration follows a three-tier priority system:
1. CLI arguments (highest priority)
2. TOML config file values (`--config` or `config.toml`)
3. DEFAULT constants (fallback)

Key configuration files are generated per role in `tmp/{role}/config.toml`

### Testing Infrastructure

- **Test Utilities**: Comprehensive test helpers in `tests/utils.rs`
- **Integration Tests**: Located in `tests/integration/` directory
- **Port Allocation**: Tests use predictable port ranges (7100+ internal, 7200+ external, 7300+ cluster)
- **Process Management**: Automatic cleanup and process spawning for multi-node tests
- **Process Cleanup**: Use `pkill -f key-generator` if tests hang or don't exit properly

### Workspace Structure Details

The project uses a Cargo workspace with the following key crates:
- **src/**: Main binary crate producing the `dkg` executable
- **node/operator/**: Blockchain operator integration for Radius network
- **node/key_generator/skde/**: SKDE-specific key generation implementation
- **External Dependencies**: Uses radius-sdk from local path, SKDE from GitHub commit, and ethers for blockchain interaction
Loading