Skip to content
Open
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
869 changes: 302 additions & 567 deletions Cargo.lock

Large diffs are not rendered by default.

20 changes: 10 additions & 10 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,16 @@ sha2 = "0.10"
async-trait = "0.1"

# Fedimint dependencies (core)
fedimint-api-client = "0.8.0"
fedimint-client = "0.8.0"
fedimint-core = "0.8.0"
fedimint-wallet-client = "0.8.0"
fedimint-mint-client = "0.8.0"
fedimint-ln-client = "0.8.0"
fedimint-ln-common = "0.8.0"
fedimint-rocksdb = "0.8.0"
fedimint-bip39 = "0.8.0"
fedimint-derive-secret = "0.8.0"
fedimint-api-client = "0.9.0"
fedimint-client = "0.9.0"
fedimint-core = "0.9.0"
fedimint-wallet-client = "0.9.0"
fedimint-mint-client = "0.9.0"
fedimint-ln-client = "0.9.0"
fedimint-ln-common = "0.9.0"
fedimint-rocksdb = "0.9.0"
fedimint-bip39 = "0.9.0"
fedimint-derive-secret = "0.9.0"

# API dependencies (only used by binary)
axum = { version = "0.7.1", features = ["json", "ws"], optional = true }
Expand Down
232 changes: 232 additions & 0 deletions V0.9.0_MIGRATION_PLAN.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,232 @@
# Fedimint v0.9.0 Migration Plan for fmcd

## Executive Summary
This document outlines the migration plan for fmcd to fully leverage Fedimint v0.9.0 features. The codebase has already been updated to use v0.9.0 dependencies and implements gateway auto-selection, but several important features remain to be implemented.

## Current Implementation Status

### ✅ Completed
- **Dependencies**: All Fedimint crates updated to v0.9.0
- **Gateway Auto-Selection**: Implemented in commit 1066e18
- Invoice creation and payment support optional `gateway_id`
- Auto-selects best available gateway when not specified
- **LNURL Support**: Full implementation with Lightning Address support
- **Core Architecture**: Restructured as dual library/binary crate
- **Crypto Provider Initialization**: Implemented in `src/bin/main.rs:109`
- Required for v0.9.0 TLS connections
- Calls `fedimint_core::rustls::install_crypto_provider().await`

### ❌ Not Yet Implemented
- Client RPC interface
- Enhanced gateway monitoring
- Event log trimming
- Config backup/recovery features
- Network performance optimizations

## Priority Implementation Tasks

### 🔴 Priority 1: Critical Breaking Changes (Immediate)

#### 1.1 Crypto Provider Initialization ✅ COMPLETED
**Status**: ✅ IMPLEMENTED (2025-11-09)
**Urgency**: CRITICAL - Application won't work without this

**Implementation**:
```rust
// In src/bin/main.rs:109
fedimint_core::rustls::install_crypto_provider().await;
```

**Files modified**:
- ✅ `/home/okj/minmoto/fmcd/src/bin/main.rs` (line 109)
- ✅ `/home/okj/minmoto/fmcd/flake.nix` (updated to Rust 1.91.0+ for v0.9.0 compatibility)

**Testing**:
- [ ] Verify TLS connections work in production
- [ ] Test federation joins with v0.9.0
- [ ] Test gateway communications

**Notes**:
- Function is async, requires `.await`
- Must be called before any TLS operations
- Nix flake updated to use latest stable Rust (required for fedimint v0.9.0 if-let-guard feature)

---

### 🟡 Priority 2: Major Features (This Week)

#### 2.1 Client RPC Interface
**Status**: NOT IMPLEMENTED
**Complexity**: High
**Time Estimate**: 2-3 days

**Implementation Steps**:
1. Create new module: `src/api/rpc/mod.rs`
2. Implement JSON-RPC 2.0 server using existing core methods
3. Add RPC-specific types and error handling
4. Expose endpoints:
- Federation management (join, leave, list)
- Lightning operations (invoice, pay, list)
- Mint operations (issue, spend, balance)
- On-chain operations (deposit, withdraw)

**Files to create**:
- `/home/okj/minmoto/fmcd/src/api/rpc/mod.rs`
- `/home/okj/minmoto/fmcd/src/api/rpc/handlers.rs`
- `/home/okj/minmoto/fmcd/src/api/rpc/types.rs`

**Dependencies to add**:
```toml
jsonrpsee = { version = "0.20", features = ["server", "macros"] }
```
---

### 🟢 Priority 3: Enhancements (Next Sprint)

#### 3.1 Trimable Event Log
**Status**: NOT IMPLEMENTED
**Complexity**: Medium
**Time Estimate**: 1 day

**Implementation Steps**:
1. Add configuration for max log size/age
2. Implement log rotation mechanism
3. Add trim operation to EventBus
4. Schedule periodic trim tasks

**Files to modify**:
- `/home/okj/minmoto/fmcd/src/events/mod.rs`
- `/home/okj/minmoto/fmcd/src/config.rs`

#### 3.2 Config Backup and Recovery
**Status**: NOT IMPLEMENTED
**Complexity**: Medium
**Time Estimate**: 1-2 days

**Implementation Steps**:
1. Add backup endpoint to admin API
2. Implement config export/import functions
3. Add encryption for sensitive data
4. Support dynamic config switching

**Files to modify**:
- `/home/okj/minmoto/fmcd/src/api/rest/admin/mod.rs`
- `/home/okj/minmoto/fmcd/src/config.rs`

#### 3.3 Network Performance Optimizations
**Status**: NOT IMPLEMENTED
**Complexity**: Low-Medium
**Time Estimate**: 1 day

**Implementation Steps**:
1. Implement connection pooling for WebSocket
2. Add Iroh connection reuse
3. Add configuration for DHT disable
4. Monitor and log connection types

**Files to modify**:
- `/home/okj/minmoto/fmcd/src/core/multimint.rs`
- Network client initialization code

---

## Implementation Schedule

### Week 1 (Immediate)
- [x] Day 1: Crypto provider initialization (1 hour) ✅ COMPLETED 2025-11-09
- [ ] Day 1-3: Client RPC interface implementation

### Week 2
- [ ] Day 1-2: Event log trimming
- [ ] Day 3-4: Config backup/recovery
- [ ] Day 5: Network optimizations

### Week 3
- [ ] Testing and bug fixes
- [ ] Documentation updates
- [ ] Performance benchmarking

## Testing Strategy

### Unit Tests
- Test crypto provider initialization
- Test RPC endpoint handlers
- Test gateway selection with new metrics
- Test event log trimming logic

### Integration Tests
- Test full RPC workflow
- Test gateway failover scenarios
- Test config backup/restore
- Test connection reuse

### Performance Tests
- Benchmark RPC vs REST API
- Measure connection reuse benefits
- Test event log performance with trimming

## Migration Risks and Mitigations

### Risk 1: Crypto Provider Breaking Change ✅ MITIGATED
**Impact**: HIGH - Application won't start
**Mitigation**: ✅ Implemented on 2025-11-09, requires production testing

### Risk 2: RPC Interface Compatibility
**Impact**: MEDIUM - External integrations may break
**Mitigation**: Maintain REST API, document RPC differences

### Risk 3: Gateway Selection Changes
**Impact**: LOW - Already implemented
**Mitigation**: Monitor gateway selection behavior

## Success Criteria

1. **Functional**:
- All v0.9.0 critical features implemented
- No regression in existing functionality
- All tests passing

2. **Performance**:
- Connection establishment 20% faster
- Gateway selection < 100ms
- Event processing maintains < 10ms latency

3. **Reliability**:
- Zero downtime during migration
- Graceful handling of gateway failures
- Successful config backup/restore

## Documentation Updates Required

1. Update README with v0.9.0 features
2. Document RPC API endpoints
3. Add gateway configuration guide
4. Update deployment documentation

## Next Steps

1. ~~**Immediate Action**: Implement crypto provider initialization~~ ✅ COMPLETED
2. **This Week**: Start RPC interface development
3. **Testing**: Production testing of crypto provider initialization
4. **Testing**: Set up v0.9.0 test environment
5. **Communication**: Update team on migration progress

---

## Appendix: v0.9.0 Feature Reference

### Complete v0.9.0 Feature List (from changelog)
- ✅ Gateway auto-selection
- ✅ Reduced default gateway fees
- ❌ Client RPC interface
- ❌ Config backup download
- ❌ Trimable event log
- ❌ Online e-cash validation
- ❌ WebSocket connection reuse
- ❌ Iroh connection optimizations
- ❌ DHT disable option

### Breaking Changes Checklist
- [x] Crypto provider initialization ✅ COMPLETED 2025-11-09
- [x] Gateway selection API changes (backward compatible)
- [x] Fee structure updates (handled by federation)
Loading
Loading