# BLK-009: Attestation Storage

## Summary

Store and retrieve `AttestedBlock` values in `CF_ATTESTED`, keyed by block hash. Attestations are serialized with bincode. This provides a dedicated column family for attestation data separate from block and header storage.

## Specification

```rust
impl BlockStore {
    /// Store an attestation for a block.
    pub fn put_attestation(
        &self,
        hash: &Bytes32,
        attested: &AttestedBlock,
    ) -> Result<()> {
        let bytes = bincode::serialize(attested)?;
        self.db.put_cf(&self.cf_attested, hash.as_ref(), &bytes)?;
        Ok(())
    }

    /// Retrieve an attestation by block hash. Returns `Ok(None)` if not found.
    pub fn get_attestation(
        &self,
        hash: &Bytes32,
    ) -> Result<Option<AttestedBlock>> {
        let raw = match self.db.get_cf(&self.cf_attested, hash.as_ref())? {
            Some(bytes) => bytes,
            None => return Ok(None),
        };

        let attested: AttestedBlock = bincode::deserialize(&raw)?;
        Ok(Some(attested))
    }
}
```

## Acceptance Criteria

1. `put_attestation` serializes the `AttestedBlock` via bincode and stores it in `CF_ATTESTED` keyed by the block hash.
2. `get_attestation` reads from `CF_ATTESTED`, deserializes with bincode, and returns the `AttestedBlock`.
3. `get_attestation` returns `Ok(None)` when no attestation exists for the given hash.
4. Overwriting an existing attestation for the same hash replaces the previous value.

## Implementation Notes

- Attestations are not compressed; they are typically small (signatures and metadata).
- No caching layer is specified for attestations; if attestation reads become a hot path, a cache can be added in a future iteration.
- `CF_ATTESTED` is a separate RocksDB column family to allow independent compaction and tuning.

## Test Plan

- **Unit: round-trip** -- Store an attestation with `put_attestation`, retrieve with `get_attestation`, verify equality.
- **Unit: missing hash** -- Call `get_attestation` with an unknown hash, verify `Ok(None)`.
- **Unit: overwrite** -- Store an attestation, store a different attestation for the same hash, verify the latest is returned.
- **Unit: bincode format** -- Read raw bytes from `CF_ATTESTED`, manually deserialize with bincode, verify the result matches.

## Expected Test Files

- `tests/blk_009_tests.rs`
