# Changelog - XDPoS V2 Compatibility & Checkpoint Sync

## [v133] - 2025-05-02

### Added
- Debug logging for `repairSnapshot` checkpoint header inspection
- Logs: `validatorsLen`, `validatorLen`, `penaltiesLen`, `extraLen`

### Discovered
- **CRITICAL**: V2 checkpoint headers store validators in `Extra` field (529 bytes), NOT in `Validators` array (0 bytes)
- Both nodes (168, 113) stuck at block 56,830,293 with "validators not legit"

## [v132] - 2025-05-02

### Added
- `repairSnapshot` checkpoint header fallback when state unavailable
- Attempts to read validators from `checkpointHeader.Validators`

### Status
- NOT WORKING - `Validators` array is empty for V2 blocks

## [v131] - 2025-05-02

### Fixed
- Checkpoint hash for 56,700,000: corrected to `0xb2f51bf5...` (was `0x90c4b9b8...`)
- State root: `0x702f5e59...`

### Added
- Checkpoint at 56,700,000 for smooth V2 sync testing

## [v130] - 2025-05-01/02

### Fixed
- V2 genesis config missing (Issue #379) - patched in `core/genesis.go`
- Dockerfile ENTRYPOINT JSON syntax
- Ubuntu 24.04 base image for glibc compatibility
- V2 deferred snapshot initialization during checkpoint sync

### Added
- TrustedSyncCheckpoints infrastructure
- Checkpoint sync without state support
- `--syncfromblock` flag support

## Pre-v130 (P1-P5c)

### Added
- P1: Checkpoint persistence, V2 switch special-case
- P2: Skip checkpoint block in body download
- P3: Align resultCache offset
- P4: Patch TrustedSyncCheckpoints in SetupGenesisBlockWithOverride
- P5: Use empty state when parent trie missing
- P5b: Auto-detect checkpoint sync without state
- P5c: Fix checkpoint sync for checkpoint blocks without state

---

## Docker Image Versions

| Version | Commit | Status | Notes |
|---------|--------|--------|-------|
| v130 | `da68078` | ❌ Broken | Wrong checkpoint hash, no V2 config |
| v130-fix | `12e60b9` | ❌ Broken | V2 init fix only, no checkpoints |
| v130-cp56700 | `03b6935` | ❌ Broken | GLIBC error, wrong hash |
| v131 | `e457df5` | ❌ Broken | Correct hash but V2 snapshot issue |
| v132 | `6388a2e` | ❌ Broken | Header fallback but validators empty |
| v133 | `7fb53d8` | 🔴 Stuck | Debug logging, identified Extra field issue |

---

## Node Deployment History

### Node 168 (95.217.56.168)
- v130: Stuck at genesis sync
- v130-fix: Stuck at V2 gap header
- v131: Synced to 56M, stuck at 56,830,293
- v132: Same
- v133: Same, with debug logs

### Node 113 (167.235.13.113)
- v130: Stuck at genesis sync
- v130-fix: Synced to 56M, stuck at 56,830,293
- v131-v133: Same as 168

---

## Key Configuration

```
Chain: Apothem (ID 51)
Consensus: XDPoS
V2 Switch Block: 56,828,700
V2 Gap: 450
V2 Epoch: 900
First V2 Checkpoint: 56,829,600
Stuck Block: 56,830,293
Checkpoint Sync From: 56,700,000
```

---

## Remaining Tasks

1. Parse V2 `Extra` field to extract validator addresses
2. Build v134 with Extra field parsing
3. Verify sync passes 56,830,293
4. Ensure stats page visibility
5. Deploy to full fleet
6. Merge PR #501 to `xdc-network`

---

*Generated for PR #501 - feat/trusted-checkpoint-sync*
