refactor: consolidate blockchain explorer into single app and update backup ignore patterns
- Remove standalone explorer-web app (README, HTML, package files) - Add /web endpoint to blockchain-explorer for web interface access - Update .gitignore to exclude application backup archives (*.tar.gz, *.zip) - Add backup documentation files to .gitignore (BACKUP_INDEX.md, README.md) - Consolidate explorer functionality into main blockchain-explorer application
This commit is contained in:
342
docs/10_plan/06_cli/CLI_MULTICHAIN_ANALYSIS.md
Normal file
342
docs/10_plan/06_cli/CLI_MULTICHAIN_ANALYSIS.md
Normal file
@@ -0,0 +1,342 @@
|
||||
# CLI Multi-Chain Support Analysis
|
||||
|
||||
## 🎯 **MULTI-CHAIN SUPPORT ANALYSIS - March 6, 2026**
|
||||
|
||||
**Status**: 🔍 **IDENTIFYING COMMANDS NEEDING MULTI-CHAIN ENHANCEMENTS**
|
||||
|
||||
---
|
||||
|
||||
## 📊 **Analysis Summary**
|
||||
|
||||
### **Commands Requiring Multi-Chain Fixes**
|
||||
|
||||
Based on analysis of the blockchain command group implementation, several commands need multi-chain enhancements similar to the `blockchain balance` fix.
|
||||
|
||||
---
|
||||
|
||||
## 🔧 **Blockchain Commands Analysis**
|
||||
|
||||
### **✅ Commands WITH Multi-Chain Support (Already Fixed)**
|
||||
1. **`blockchain balance`** ✅ **ENHANCED** - Now supports `--chain-id` and `--all-chains`
|
||||
2. **`blockchain genesis`** ✅ **HAS CHAIN SUPPORT** - Requires `--chain-id` parameter
|
||||
3. **`blockchain transactions`** ✅ **HAS CHAIN SUPPORT** - Requires `--chain-id` parameter
|
||||
4. **`blockchain head`** ✅ **HAS CHAIN SUPPORT** - Requires `--chain-id` parameter
|
||||
5. **`blockchain send`** ✅ **HAS CHAIN SUPPORT** - Requires `--chain-id` parameter
|
||||
|
||||
### **❌ Commands MISSING Multi-Chain Support (Need Fixes)**
|
||||
1. **`blockchain blocks`** ❌ **NEEDS FIX** - No chain selection, hardcoded to default node
|
||||
2. **`blockchain block`** ❌ **NEEDS FIX** - No chain selection, queries default node
|
||||
3. **`blockchain transaction`** ❌ **NEEDS FIX** - No chain selection, queries default node
|
||||
4. **`blockchain status`** ❌ **NEEDS FIX** - Limited to node selection, no chain context
|
||||
5. **`blockchain sync_status`** ❌ **NEEDS FIX** - No chain context
|
||||
6. **`blockchain peers`** ❌ **NEEDS FIX** - No chain context
|
||||
7. **`blockchain info`** ❌ **NEEDS FIX** - No chain context
|
||||
8. **`blockchain supply`** ❌ **NEEDS FIX** - No chain context
|
||||
9. **`blockchain validators`** ❌ **NEEDS FIX** - No chain context
|
||||
|
||||
---
|
||||
|
||||
## 📋 **Detailed Command Analysis**
|
||||
|
||||
### **Commands Needing Immediate Multi-Chain Fixes**
|
||||
|
||||
#### **1. `blockchain blocks`**
|
||||
**Current Implementation**:
|
||||
```python
|
||||
@blockchain.command()
|
||||
@click.option("--limit", type=int, default=10, help="Number of blocks to show")
|
||||
@click.option("--from-height", type=int, help="Start from this block height")
|
||||
def blocks(ctx, limit: int, from_height: Optional[int]):
|
||||
```
|
||||
|
||||
**Issues**:
|
||||
- ❌ No `--chain-id` option
|
||||
- ❌ No `--all-chains` option
|
||||
- ❌ Hardcoded to default blockchain RPC URL
|
||||
- ❌ Cannot query blocks from specific chains
|
||||
|
||||
**Required Fix**:
|
||||
```python
|
||||
@blockchain.command()
|
||||
@click.option("--limit", type=int, default=10, help="Number of blocks to show")
|
||||
@click.option("--from-height", type=int, help="Start from this block height")
|
||||
@click.option('--chain-id', help='Specific chain ID to query (default: ait-devnet)')
|
||||
@click.option('--all-chains', is_flag=True, help='Query blocks across all available chains')
|
||||
def blocks(ctx, limit: int, from_height: Optional[int], chain_id: str, all_chains: bool):
|
||||
```
|
||||
|
||||
#### **2. `blockchain block`**
|
||||
**Current Implementation**:
|
||||
```python
|
||||
@blockchain.command()
|
||||
@click.argument("block_hash")
|
||||
def block(ctx, block_hash: str):
|
||||
```
|
||||
|
||||
**Issues**:
|
||||
- ❌ No `--chain-id` option
|
||||
- ❌ No `--all-chains` option
|
||||
- ❌ Cannot specify which chain to search for block
|
||||
|
||||
**Required Fix**:
|
||||
```python
|
||||
@blockchain.command()
|
||||
@click.argument("block_hash")
|
||||
@click.option('--chain-id', help='Specific chain ID to query (default: ait-devnet)')
|
||||
@click.option('--all-chains', is_flag=True, help='Search block across all available chains')
|
||||
def block(ctx, block_hash: str, chain_id: str, all_chains: bool):
|
||||
```
|
||||
|
||||
#### **3. `blockchain transaction`**
|
||||
**Current Implementation**:
|
||||
```python
|
||||
@blockchain.command()
|
||||
@click.argument("tx_hash")
|
||||
def transaction(ctx, tx_hash: str):
|
||||
```
|
||||
|
||||
**Issues**:
|
||||
- ❌ No `--chain-id` option
|
||||
- ❌ No `--all-chains` option
|
||||
- ❌ Cannot specify which chain to search for transaction
|
||||
|
||||
**Required Fix**:
|
||||
```python
|
||||
@blockchain.command()
|
||||
@click.argument("tx_hash")
|
||||
@click.option('--chain-id', help='Specific chain ID to query (default: ait-devnet)')
|
||||
@click.option('--all-chains', is_flag=True, help='Search transaction across all available chains')
|
||||
def transaction(ctx, tx_hash: str, chain_id: str, all_chains: bool):
|
||||
```
|
||||
|
||||
#### **4. `blockchain status`**
|
||||
**Current Implementation**:
|
||||
```python
|
||||
@blockchain.command()
|
||||
@click.option("--node", type=int, default=1, help="Node number (1, 2, or 3)")
|
||||
def status(ctx, node: int):
|
||||
```
|
||||
|
||||
**Issues**:
|
||||
- ❌ No `--chain-id` option
|
||||
- ❌ Limited to node selection only
|
||||
- ❌ No chain-specific status information
|
||||
|
||||
**Required Fix**:
|
||||
```python
|
||||
@blockchain.command()
|
||||
@click.option("--node", type=int, default=1, help="Node number (1, 2, or 3)")
|
||||
@click.option('--chain-id', help='Specific chain ID to query (default: ait-devnet)')
|
||||
@click.option('--all-chains', is_flag=True, help='Get status across all available chains')
|
||||
def status(ctx, node: int, chain_id: str, all_chains: bool):
|
||||
```
|
||||
|
||||
#### **5. `blockchain sync_status`**
|
||||
**Current Implementation**:
|
||||
```python
|
||||
@blockchain.command()
|
||||
def sync_status(ctx):
|
||||
```
|
||||
|
||||
**Issues**:
|
||||
- ❌ No `--chain-id` option
|
||||
- ❌ No chain-specific sync information
|
||||
|
||||
**Required Fix**:
|
||||
```python
|
||||
@blockchain.command()
|
||||
@click.option('--chain-id', help='Specific chain ID to query (default: ait-devnet)')
|
||||
@click.option('--all-chains', is_flag=True, help='Get sync status across all available chains')
|
||||
def sync_status(ctx, chain_id: str, all_chains: bool):
|
||||
```
|
||||
|
||||
#### **6. `blockchain peers`**
|
||||
**Current Implementation**:
|
||||
```python
|
||||
@blockchain.command()
|
||||
def peers(ctx):
|
||||
```
|
||||
|
||||
**Issues**:
|
||||
- ❌ No `--chain-id` option
|
||||
- ❌ No chain-specific peer information
|
||||
|
||||
**Required Fix**:
|
||||
```python
|
||||
@blockchain.command()
|
||||
@click.option('--chain-id', help='Specific chain ID to query (default: ait-devnet)')
|
||||
@click.option('--all-chains', is_flag=True, help='Get peers across all available chains')
|
||||
def peers(ctx, chain_id: str, all_chains: bool):
|
||||
```
|
||||
|
||||
#### **7. `blockchain info`**
|
||||
**Current Implementation**:
|
||||
```python
|
||||
@blockchain.command()
|
||||
def info(ctx):
|
||||
```
|
||||
|
||||
**Issues**:
|
||||
- ❌ No `--chain-id` option
|
||||
- ❌ No chain-specific information
|
||||
|
||||
**Required Fix**:
|
||||
```python
|
||||
@blockchain.command()
|
||||
@click.option('--chain-id', help='Specific chain ID to query (default: ait-devnet)')
|
||||
@click.option('--all-chains', is_flag=True, help='Get info across all available chains')
|
||||
def info(ctx, chain_id: str, all_chains: bool):
|
||||
```
|
||||
|
||||
#### **8. `blockchain supply`**
|
||||
**Current Implementation**:
|
||||
```python
|
||||
@blockchain.command()
|
||||
def supply(ctx):
|
||||
```
|
||||
|
||||
**Issues**:
|
||||
- ❌ No `--chain-id` option
|
||||
- ❌ No chain-specific token supply
|
||||
|
||||
**Required Fix**:
|
||||
```python
|
||||
@blockchain.command()
|
||||
@click.option('--chain-id', help='Specific chain ID to query (default: ait-devnet)')
|
||||
@click.option('--all-chains', is_flag=True, help='Get supply across all available chains')
|
||||
def supply(ctx, chain_id: str, all_chains: bool):
|
||||
```
|
||||
|
||||
#### **9. `blockchain validators`**
|
||||
**Current Implementation**:
|
||||
```python
|
||||
@blockchain.command()
|
||||
def validators(ctx):
|
||||
```
|
||||
|
||||
**Issues**:
|
||||
- ❌ No `--chain-id` option
|
||||
- ❌ No chain-specific validator information
|
||||
|
||||
**Required Fix**:
|
||||
```python
|
||||
@blockchain.command()
|
||||
@click.option('--chain-id', help='Specific chain ID to query (default: ait-devnet)')
|
||||
@click.option('--all-chains', is_flag=True, help='Get validators across all available chains')
|
||||
def validators(ctx, chain_id: str, all_chains: bool):
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 📈 **Priority Classification**
|
||||
|
||||
### **🔴 HIGH PRIORITY (Critical Multi-Chain Commands)**
|
||||
1. **`blockchain blocks`** - Essential for block exploration
|
||||
2. **`blockchain block`** - Essential for specific block queries
|
||||
3. **`blockchain transaction`** - Essential for transaction tracking
|
||||
|
||||
### **🟡 MEDIUM PRIORITY (Important Multi-Chain Commands)**
|
||||
4. **`blockchain status`** - Important for node monitoring
|
||||
5. **`blockchain sync_status`** - Important for sync monitoring
|
||||
6. **`blockchain info`** - Important for chain information
|
||||
|
||||
### **🟢 LOW PRIORITY (Nice-to-Have Multi-Chain Commands)**
|
||||
7. **`blockchain peers`** - Useful for network monitoring
|
||||
8. **`blockchain supply`** - Useful for token economics
|
||||
9. **`blockchain validators`** - Useful for validator monitoring
|
||||
|
||||
---
|
||||
|
||||
## 🎯 **Implementation Strategy**
|
||||
|
||||
### **Phase 1: Critical Commands (Week 1)**
|
||||
- Fix `blockchain blocks`, `blockchain block`, `blockchain transaction`
|
||||
- Implement standard multi-chain pattern
|
||||
- Add comprehensive testing
|
||||
|
||||
### **Phase 2: Important Commands (Week 2)**
|
||||
- Fix `blockchain status`, `blockchain sync_status`, `blockchain info`
|
||||
- Maintain backward compatibility
|
||||
- Add error handling
|
||||
|
||||
### **Phase 3: Utility Commands (Week 3)**
|
||||
- Fix `blockchain peers`, `blockchain supply`, `blockchain validators`
|
||||
- Complete multi-chain coverage
|
||||
- Final testing and documentation
|
||||
|
||||
---
|
||||
|
||||
## 🧪 **Testing Requirements**
|
||||
|
||||
### **Standard Multi-Chain Test Pattern**
|
||||
Each enhanced command should have tests for:
|
||||
1. **Help Options** - Verify `--chain-id` and `--all-chains` options
|
||||
2. **Single Chain Query** - Test specific chain selection
|
||||
3. **All Chains Query** - Test comprehensive multi-chain query
|
||||
4. **Default Chain** - Test default behavior (ait-devnet)
|
||||
5. **Error Handling** - Test network errors and missing chains
|
||||
|
||||
### **Test File Naming Convention**
|
||||
`cli/tests/test_blockchain_<command>_multichain.py`
|
||||
|
||||
---
|
||||
|
||||
## 📋 **CLI Checklist Updates Required**
|
||||
|
||||
### **Commands to Mark as Enhanced**
|
||||
```markdown
|
||||
# High Priority
|
||||
- [ ] `blockchain blocks` — List recent blocks (❌ **NEEDS MULTI-CHAIN FIX**)
|
||||
- [ ] `blockchain block` — Get details of specific block (❌ **NEEDS MULTI-CHAIN FIX**)
|
||||
- [ ] `blockchain transaction` — Get transaction details (❌ **NEEDS MULTI-CHAIN FIX**)
|
||||
|
||||
# Medium Priority
|
||||
- [ ] `blockchain status` — Get blockchain node status (❌ **NEEDS MULTI-CHAIN FIX**)
|
||||
- [ ] `blockchain sync_status` — Get blockchain synchronization status (❌ **NEEDS MULTI-CHAIN FIX**)
|
||||
- [ ] `blockchain info` — Get blockchain information (❌ **NEEDS MULTI-CHAIN FIX**)
|
||||
|
||||
# Low Priority
|
||||
- [ ] `blockchain peers` — List connected peers (❌ **NEEDS MULTI-CHAIN FIX**)
|
||||
- [ ] `blockchain supply` — Get token supply information (❌ **NEEDS MULTI-CHAIN FIX**)
|
||||
- [ ] `blockchain validators` — List blockchain validators (❌ **NEEDS MULTI-CHAIN FIX**)
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🚀 **Benefits of Multi-Chain Enhancement**
|
||||
|
||||
### **User Experience**
|
||||
- **Consistent Interface**: All blockchain commands follow same multi-chain pattern
|
||||
- **Flexible Queries**: Users can choose specific chains or all chains
|
||||
- **Better Discovery**: Multi-chain block and transaction exploration
|
||||
- **Comprehensive Monitoring**: Chain-specific status and sync information
|
||||
|
||||
### **Technical Benefits**
|
||||
- **Scalable Architecture**: Easy to add new chains
|
||||
- **Consistent API**: Uniform multi-chain interface
|
||||
- **Error Resilience**: Robust error handling across chains
|
||||
- **Performance**: Parallel queries for multi-chain operations
|
||||
|
||||
---
|
||||
|
||||
## 🎉 **Summary**
|
||||
|
||||
### **Commands Requiring Multi-Chain Fixes: 9**
|
||||
- **High Priority**: 3 commands (blocks, block, transaction)
|
||||
- **Medium Priority**: 3 commands (status, sync_status, info)
|
||||
- **Low Priority**: 3 commands (peers, supply, validators)
|
||||
|
||||
### **Commands Already Multi-Chain Ready: 5**
|
||||
- **Enhanced**: 1 command (balance) ✅
|
||||
- **Has Chain Support**: 4 commands (genesis, transactions, head, send) ✅
|
||||
|
||||
### **Total Blockchain Commands: 14**
|
||||
- **Multi-Chain Ready**: 5 (36%)
|
||||
- **Need Enhancement**: 9 (64%)
|
||||
|
||||
**The blockchain command group needs significant multi-chain enhancements to provide consistent and comprehensive multi-chain support across all operations.**
|
||||
|
||||
*Analysis Completed: March 6, 2026*
|
||||
*Commands Needing Fixes: 9*
|
||||
*Priority: High → Medium → Low*
|
||||
*Implementation: 3 Phases*
|
||||
Reference in New Issue
Block a user