Skip to main content

dig_clvm/consensus/
config.rs

1//! Validation configuration and cost constants.
2
3use clvmr::cost::Cost;
4
5/// Maximum CLVM cost per spend (matches Chia L1).
6pub const L1_MAX_COST_PER_SPEND: Cost = 11_000_000_000;
7
8/// Maximum CLVM cost per block (DIG L2: 50x L1 per-spend).
9pub const L2_MAX_COST_PER_BLOCK: Cost = 550_000_000_000;
10
11/// L2-specific validation parameters.
12pub struct ValidationConfig {
13    /// Maximum CLVM cost per individual spend.
14    pub max_cost_per_spend: Cost,
15    /// Maximum total CLVM cost per block.
16    pub max_cost_per_block: Cost,
17    /// Execution flags from chia-consensus (MEMPOOL_MODE, DONT_VALIDATE_SIGNATURE, etc.).
18    pub flags: u32,
19}
20
21impl Default for ValidationConfig {
22    fn default() -> Self {
23        Self {
24            max_cost_per_spend: L1_MAX_COST_PER_SPEND,
25            max_cost_per_block: L2_MAX_COST_PER_BLOCK,
26            flags: 0,
27        }
28    }
29}