# TYP-001: Column Family Constants

| Link | Path |
|------|------|
| **Normative** | [NORMATIVE.md](../NORMATIVE.md) |
| **Verification** | [VERIFICATION.md](../VERIFICATION.md) |
| **Tracking** | [TRACKING.yaml](../TRACKING.yaml) |
| **Spec** | [SPEC.md](../../../../resources/SPEC.md) Section 2.1 |

---

## Summary

The crate MUST define six column family name constants used to partition data in RocksDB.

---

## Specification

```rust
/// Column family for serialized L2Block data.
/// Key: block hash (32 bytes). Value: compressed serialized L2Block.
pub const CF_BLOCKS: &str = "blocks";

/// Column family for serialized L2BlockHeader data.
/// Key: block hash (32 bytes). Value: bincode-serialized L2BlockHeader.
pub const CF_HEADERS: &str = "headers";

/// Column family for serialized AttestedBlock data.
/// Key: block hash (32 bytes). Value: serialized AttestedBlock.
pub const CF_ATTESTED: &str = "attested";

/// Column family for the canonical chain index.
/// Key: height (8 bytes big-endian). Value: block hash (32 bytes).
pub const CF_CANONICAL: &str = "canonical";

/// Column family for serialized StoredCheckpoint data.
/// Key: epoch (8 bytes big-endian). Value: serialized StoredCheckpoint.
pub const CF_CHECKPOINTS: &str = "checkpoints";

/// Column family for key-value metadata.
/// Key: UTF-8 string. Value: varies by key.
pub const CF_METADATA: &str = "metadata";
```

All constants MUST be `pub const &str` values. The string values are used as RocksDB column family names and MUST NOT be changed after initial deployment (breaking change).

---

## Acceptance Criteria

- [x] `CF_BLOCKS` equals `"blocks"`
- [x] `CF_HEADERS` equals `"headers"`
- [x] `CF_ATTESTED` equals `"attested"`
- [x] `CF_CANONICAL` equals `"canonical"`
- [x] `CF_CHECKPOINTS` equals `"checkpoints"`
- [x] `CF_METADATA` equals `"metadata"`
- [x] All six constants are distinct values
- [x] Constants are public (`pub`)

---

## Implementation Notes

- Define in `src/constants.rs`.
- These constants are re-exported from the crate root per STR-003.
- Used by `BlockStore::open()` to create/open column families.

---

## Test Plan

| Test Name | Type | Description |
|-----------|------|-------------|
| `test_cf_blocks_value` | unit | Assert `CF_BLOCKS == "blocks"` |
| `test_cf_headers_value` | unit | Assert `CF_HEADERS == "headers"` |
| `test_cf_attested_value` | unit | Assert `CF_ATTESTED == "attested"` |
| `test_cf_canonical_value` | unit | Assert `CF_CANONICAL == "canonical"` |
| `test_cf_checkpoints_value` | unit | Assert `CF_CHECKPOINTS == "checkpoints"` |
| `test_cf_metadata_value` | unit | Assert `CF_METADATA == "metadata"` |
| `test_cf_constants_distinct` | unit | Collect all six into a HashSet, assert size is 6 |

---

## Expected Test Files

- `tests/typ_001_tests.rs`
