1#![no_std]
2
3#[macro_use]
4extern crate alloc;
5
6#[cfg(feature = "std")]
7extern crate std;
8
9#[macro_export]
12macro_rules! assert_matches {
13 ($left:expr, $(|)? $( $pattern:pat_param )|+ $( if $guard: expr )? $(,)?) => {
14 match $left {
15 $( $pattern )|+ $( if $guard )? => {}
16 ref left_val => {
17 panic!(r#"
18assertion failed: `(left matches right)`
19 left: `{:?}`,
20 right: `{}`"#, left_val, stringify!($($pattern)|+ $(if $guard)?));
21 }
22 }
23 };
24
25 ($left:expr, $(|)? $( $pattern:pat_param )|+ $( if $guard: expr )?, $msg:literal $(,)?) => {
26 match $left {
27 $( $pattern )|+ $( if $guard )? => {}
28 ref left_val => {
29 panic!(concat!(r#"
30assertion failed: `(left matches right)`
31 left: `{:?}`,
32 right: `{}`
33"#, $msg), left_val, stringify!($($pattern)|+ $(if $guard)?));
34 }
35 }
36 };
37
38 ($left:expr, $(|)? $( $pattern:pat_param )|+ $( if $guard: expr )?, $msg:literal, $($arg:tt)+) => {
39 match $left {
40 $( $pattern )|+ $( if $guard )? => {}
41 ref left_val => {
42 panic!(concat!(r#"
43assertion failed: `(left matches right)`
44 left: `{:?}`,
45 right: `{}`
46"#, $msg), left_val, stringify!($($pattern)|+ $(if $guard)?), $($arg)+);
47 }
48 }
49 }
50}
51
52pub mod chiplets;
53pub mod errors;
54
55mod program;
56pub use program::{Program, ProgramInfo};
57
58mod kernel;
59pub use kernel::Kernel;
60pub use miden_crypto::{EMPTY_WORD, ONE, WORD_SIZE, Word, ZERO, word::LexicographicWord};
61pub mod crypto {
62 pub mod merkle {
63 pub use miden_crypto::merkle::{
64 EmptySubtreeRoots, InnerNodeInfo, MerkleError, MerklePath, MerkleTree, NodeIndex,
65 PartialMerkleTree,
66 mmr::{Mmr, MmrPeaks},
67 smt::{LeafIndex, SMT_DEPTH, SimpleSmt, Smt, SmtProof, SmtProofError},
68 store::{MerkleStore, StoreNode},
69 };
70 }
71
72 pub mod hash {
73 pub use miden_crypto::hash::{
74 Digest, ElementHasher, Hasher,
75 blake::{Blake3_160, Blake3_192, Blake3_256, Blake3Digest},
76 poseidon2::Poseidon2,
77 rpo::Rpo256,
78 rpx::Rpx256,
79 };
80 }
81
82 pub mod random {
83 pub use miden_crypto::rand::{
84 RandomCoin, RandomCoinError, RpoRandomCoin, RpxRandomCoin, WinterRandomCoin,
85 };
86 }
87
88 pub mod dsa {
89 pub use miden_crypto::dsa::{ecdsa_k256_keccak, eddsa_25519_sha512, falcon512_rpo};
90 }
91}
92
93pub mod mast;
94
95pub use winter_math::{
96 ExtensionOf, FieldElement, StarkField, ToElements,
97 fields::{QuadExtension, f64::BaseElement as Felt},
98 polynom,
99};
100pub type QuadFelt = QuadExtension<Felt>;
101
102pub mod prettier {
103 pub use miden_formatting::{prettier::*, pretty_via_display, pretty_via_to_string};
104
105 pub fn pretty_print_csv<'a, T>(items: impl IntoIterator<Item = &'a T>) -> Document
107 where
108 T: PrettyPrint + 'a,
109 {
110 let mut doc = Document::Empty;
111 for (i, item) in items.into_iter().enumerate() {
112 if i > 0 {
113 doc += const_text(", ");
114 }
115 doc += item.render();
116 }
117 doc
118 }
119}
120
121mod operations;
122pub use operations::{
123 AssemblyOp, DebugOptions, Decorator, DecoratorList, Operation, opcode_constants::*,
124};
125
126pub mod stack;
127pub use stack::{StackInputs, StackOutputs};
128
129mod event_id;
130pub use event_id::{EventId, EventName};
131
132pub mod sys_events;
133
134mod advice;
135pub use advice::map::AdviceMap;
136
137pub mod precompile;
138pub mod utils;
139
140pub use miden_utils_indexing::{
142 DenseIdMap, Idx, IndexVec, IndexedVecError, LookupByIdx, newtype_id,
143};
144
145pub const FMP_INIT_VALUE: Felt = Felt::new(2_u64.pow(31));
151
152pub const FMP_ADDR: Felt = Felt::new(u32::MAX as u64 - 1_u64);