1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
//! `dig-compiler`: deterministic transform from on-disk generations to a single
//! self-serving WASM module (paper §5, §8.3, §17.1, §19).
//!
//! ## Documented deviations
//! - **Endianness (deviation #1):** the data-section codec is BIG-ENDIAN (Chia
//! streamable framing via `crate::imp::core::Encode`), not the paper's
//! "little-endian" note (§5.3). Chia compatibility wins.
//! - **Filler (deviation #2):** §8.3 "random filler" is a DETERMINISTIC ChaCha20
//! keystream seeded by `SHA-256(store_id || roothash || b"digstore-filler-v1")`,
//! so compilation is byte-identical (§19.3).
//! - **Obfuscation (§17.1):** optional, WASM-level, deterministic, and
//! behavior-preserving; security never rests on it.
//! - **Template (§19.3):** the guest template is a single PINNED committed input,
//! assembled by `build.rs` from `fixtures/digstore_guest_template.wat`; the
//! build script never invokes `cargo build` for the guest, so the template
//! bytes (and thus the final module) are byte-identical across environments.
//! - **Stats (CONVENTIONS C6):** the canonical [`crate::imp::core::CompilationStats`]
//! is reused for [`crate::imp::core::CompilationResult::stats`]; the compiler's
//! richer detail is a SEPARATE struct [`CompilerStats`] (NOT a second
//! `CompilationStats`). [`Compiler::compile`] returns a [`CompileOutcome`]
//! carrying both.
//!
//! ## Data-section contract (BINDING D1–D5)
//! The byte-exact data-section format is owned by `crate::imp::core::datasection`.
//! The compiler emits the blob via that module and injects it as an ACTIVE data
//! segment at [`DATA_SECTION_MEM_OFFSET`] (= `crate::imp::core::datasection::DIGS_DATA_OFFSET`,
//! 1 MiB), raising the module's memory min pages to fit. The `dig-capsule-guest`
//! crate reads from the same offset. The compiler's old private `SEG_*` format is
//! deleted: core is the single source of truth.
pub use ;
pub use ChunkIndex;
pub use ;
pub use ;
pub use ;
pub use deterministic_filler;
pub use ;
pub use ;
pub use obfuscate;
pub use ;
pub use ;
// Re-export the canonical core result/stats so consumers reference one home (C6).
pub use crate;