# CON-006: Neutral PoS/VDF Fields

> **Authoritative requirement:** [CON-006](../NORMATIVE.md#CON-006)
> **Verification:** [VERIFICATION.md](../VERIFICATION.md)
> **Tracking:** [TRACKING.yaml](../TRACKING.yaml)
> **Spec reference:** [SPEC.md](../../../../resources/SPEC.md) — Section 4.3

---

## Summary

The `ConsensusConstants` struct from `chia-consensus` contains many fields related to Chia's proof-of-space (PoS), verifiable delay function (VDF), and plot filter mechanisms that are irrelevant to DIG L2. However, because `chia-consensus` validation functions accept `&ConsensusConstants` as a parameter, DIG must provide valid values for ALL fields — including the PoS/VDF fields it does not use. These fields are set to "neutral" values: valid defaults that satisfy any internal consistency checks in `chia-consensus` without affecting CLVM execution or condition validation.

DIG L2 uses a different consensus mechanism than Chia L1. It does not use proof-of-space, does not run VDFs, and does not have plot filters. However, the `chia-consensus` library was designed for Chia's full consensus and its `ConsensusConstants` type reflects that. Rather than forking `chia-consensus` to remove unused fields (which would create a maintenance burden), DIG populates these fields with neutral values that make the struct well-formed.

The term "neutral" means that the values do not trigger errors, do not affect the CLVM execution path, and do not alter condition validation outcomes. For numeric fields, this typically means setting them to their default or minimum values. For slot/epoch parameters, it means using Chia L1's standard values so that any internal assertions in `chia-consensus` pass. The key insight is that these fields only matter for PoS block validation, which DIG never performs — CLVM execution and condition validation only read the fields exposed by `NetworkConstants` (genesis_challenge, cost limits, AGG_SIG data, fork heights).

---

## Specification

### PoS/VDF Fields with Neutral Values

```rust
const DIG_BASE_CONSTANTS: ConsensusConstants = ConsensusConstants {
    // === Fields DIG actually uses ===
    genesis_challenge: Bytes32::new([0u8; 32]),  // Set per-network (CON-003)
    max_block_cost_clvm: 11_000_000_000,
    cost_per_byte: 12_000,
    max_coin_amount: u64::MAX,
    hard_fork_height: 0,                          // CON-004
    hard_fork2_height: 0,                         // CON-004
    agg_sig_me_additional_data: Bytes32::new([0u8; 32]),  // CON-005
    // ... other AGG_SIG fields

    // === Neutral PoS fields ===
    slot_blocks_target: 32,           // Chia default
    min_blocks_per_challenge_block: 16, // Chia default
    max_sub_slot_blocks: 128,         // Chia default
    sub_slot_time_target: 600,        // Chia default (10 minutes)
    number_zero_bits_plot_filter: 9,  // Chia default
    min_plot_size: 32,                // k=32 minimum
    max_plot_size: 59,                // k=59 maximum
    sub_epoch_blocks: 384,            // Chia default
    epoch_blocks: 4608,               // Chia default

    // === Neutral VDF fields ===
    num_sps_sub_slot: 64,             // Chia default
    sub_slot_iters_starting: 2u64.pow(27), // Chia default
    significant_bits: 8,              // Chia default
    discriminant_size_bits: 1024,     // Chia default

    // === Neutral weight/difficulty fields ===
    difficulty_constant_factor: 2u128.pow(67), // Chia default
    difficulty_starting: 7,           // Chia default
    max_future_time2: 2 * 60,        // Chia default (2 minutes)
    pool_sub_slot_iters: 37_600_000_000, // Chia default

    // === Neutral network fields ===
    network_type: 0,                  // Mainnet
    mempool_block_buffer: 10,         // Chia default
};
```

### Why Chia Defaults

Using Chia's default values (rather than zeros or arbitrary numbers) ensures:

1. **Internal consistency:** `chia-consensus` may have assertions like `assert!(epoch_blocks > sub_epoch_blocks)`. Chia defaults satisfy all such invariants.

2. **Future safety:** If `chia-consensus` is updated to read these fields in new code paths, Chia-compatible values are less likely to cause unexpected behavior than zeros.

3. **Documentation clarity:** Developers reading the constants see familiar Chia values and understand that DIG is using "standard" parameters for unused fields.

### Fields That DIG Does NOT Use But Must Set

| Category | Fields | Why Set |
|----------|--------|---------|
| Plot filter | `number_zero_bits_plot_filter`, `min_plot_size`, `max_plot_size` | ConsensusConstants completeness |
| Sub-slot timing | `slot_blocks_target`, `sub_slot_time_target`, `max_sub_slot_blocks` | Internal consistency assertions |
| VDF | `num_sps_sub_slot`, `sub_slot_iters_starting`, `discriminant_size_bits` | Struct completeness |
| Difficulty | `difficulty_constant_factor`, `difficulty_starting` | Struct completeness |
| Epoch | `sub_epoch_blocks`, `epoch_blocks` | Internal ratio assertions |

### What DIG DOES Use

| Category | Fields | Why Used |
|----------|--------|---------|
| CLVM cost | `max_block_cost_clvm`, `cost_per_byte` | Cost enforcement (VAL-007) |
| Network identity | `genesis_challenge` | Domain separation |
| Signature data | `agg_sig_*_additional_data` | BLS verification (VAL-012) |
| Fork activation | `hard_fork_height`, `hard_fork2_height` | Feature gating (CON-004) |
| Coin limits | `max_coin_amount` | Conservation check |

### Verification That Neutral Fields Don't Affect Validation

```rust
#[test]
fn neutral_fields_irrelevant_to_clvm() {
    // Create two constant sets: one with Chia defaults, one with
    // different neutral values for PoS fields.
    let constants_a = DIG_MAINNET;
    let mut constants_b_inner = *DIG_MAINNET.consensus();
    constants_b_inner.slot_blocks_target = 64;  // Changed
    constants_b_inner.min_plot_size = 18;        // Changed
    let constants_b = NetworkConstants::new(constants_b_inner);

    // Same bundle, same context, different PoS constants.
    // Validation results should be identical.
    let result_a = validate_spend_bundle(&bundle, &ctx_a, &config, None);
    let result_b = validate_spend_bundle(&bundle, &ctx_b, &config, None);

    assert_eq!(result_a, result_b);
}
```

---

## Acceptance Criteria

- [ ] All PoS, VDF, plot filter, and weight proof fields in `ConsensusConstants` are set to valid neutral values.
- [ ] The neutral values are Chia L1 defaults (not zeros or arbitrary numbers).
- [ ] `ConsensusConstants` with neutral PoS/VDF fields passes any internal consistency checks in `chia-consensus`.
- [ ] CLVM execution and condition validation produce identical results regardless of PoS/VDF field values.
- [ ] The neutral fields are clearly commented as "not used by DIG" in the source.

---

## Implementation Notes

- **Primary file:** `dig-constants/src/constants.rs` (DIG_BASE_CONSTANTS definition).
- **Source of defaults:** The Chia default values can be found in `chia-consensus`'s default `ConsensusConstants` or in Chia's `config.yaml` initial values. Use the same values to maximize compatibility.
- **No struct update syntax:** If `ConsensusConstants` does not provide a `Default` impl, all fields must be explicitly set. This is tedious but ensures no field is accidentally left uninitialized.
- **Documentation:** Each PoS/VDF field should have a comment explaining that it is set for struct completeness and is not used by DIG L2 consensus.
- **Upgrade consideration:** When upgrading the `chia-consensus` dependency, new fields may be added to `ConsensusConstants`. These must be set to appropriate neutral values. This is a known maintenance cost of wrapping rather than forking.
- **No runtime impact:** The neutral fields are never read during CLVM execution, condition validation, or BLS signature verification. They exist only to satisfy the struct definition.

---

## Verification

### Test Plan

| Test | Type | Description | Expected Result |
|------|------|-------------|-----------------|
| Struct completeness | Build test | DIG_MAINNET compiles with all fields set | No missing field errors |
| Internal consistency | Unit test | Pass DIG_MAINNET.consensus() to chia-consensus functions | No assertion failures |
| PoS fields don't affect CLVM | Unit test | Change PoS values, re-validate same bundle | Same result |
| VDF fields don't affect conditions | Unit test | Change VDF values, re-validate same bundle | Same result |
| Comments present | Code review | Each neutral field has explanatory comment | All documented |
| Values match Chia defaults | Unit test | Compare with known Chia L1 defaults | Match |

---

## Source Citations

- **SPEC.md Section 4.3**: "Proof-of-space, VDF, plot filter fields set to valid neutral values. Required because ConsensusConstants is passed to chia-consensus functions. DIG doesn't use PoS."
- **Chia L1 source — config.yaml:** Default values for all ConsensusConstants fields.
- **chia-consensus source:** ConsensusConstants struct definition with all fields.

---

## References

- [CON-001](CON-001.md) — Separate dig-constants crate (where constants are defined)
- [CON-002](CON-002.md) — NetworkConstants type (wraps ConsensusConstants, hides neutral fields)
- [CON-003](CON-003.md) — DIG_MAINNET and DIG_TESTNET (instances containing neutral fields)
- [CON-004](CON-004.md) — Fork heights at zero (a field DIG does use)
