Skip to main content

dig_clvm/consensus/
context.rs

1//! Validation context — L2 chain state passed into validation.
2
3use std::collections::{HashMap, HashSet};
4
5use chia_protocol::Bytes32;
6use chia_sdk_coinset::CoinRecord;
7use dig_constants::NetworkConstants;
8
9/// L2 chain state for validation.
10///
11/// `coin_records` should contain only the coins being spent in this bundle,
12/// not the full UTXO set. The caller loads these from their database and
13/// passes them in. dig-clvm never touches storage directly.
14pub struct ValidationContext {
15    /// Current L2 block height.
16    pub height: u32,
17    /// Current block timestamp (seconds since epoch).
18    pub timestamp: u64,
19    /// DIG network constants (from dig-constants crate).
20    pub constants: NetworkConstants,
21    /// Coins being spent in this bundle (coin_id -> CoinRecord).
22    /// Only the coins relevant to this validation — NOT the full UTXO set.
23    pub coin_records: HashMap<Bytes32, CoinRecord>,
24    /// Coins created by earlier bundles in the same block (ephemeral).
25    pub ephemeral_coins: HashSet<Bytes32>,
26}