1#![no_std]
2
3#[macro_use]
4extern crate alloc;
5
6#[cfg(feature = "std")]
7extern crate std;
8
9#[macro_export]
15macro_rules! assert_matches {
16 ($left:expr, $(|)? $( $pattern:pat_param )|+ $( if $guard: expr )? $(,)?) => {
17 match $left {
18 $( $pattern )|+ $( if $guard )? => {}
19 ref left_val => {
20 panic!(r#"
21assertion failed: `(left matches right)`
22 left: `{:?}`,
23 right: `{}`"#, left_val, stringify!($($pattern)|+ $(if $guard)?));
24 }
25 }
26 };
27
28 ($left:expr, $(|)? $( $pattern:pat_param )|+ $( if $guard: expr )?, $msg:literal $(,)?) => {
29 match $left {
30 $( $pattern )|+ $( if $guard )? => {}
31 ref left_val => {
32 panic!(concat!(r#"
33assertion failed: `(left matches right)`
34 left: `{:?}`,
35 right: `{}`
36"#, $msg), left_val, stringify!($($pattern)|+ $(if $guard)?));
37 }
38 }
39 };
40
41 ($left:expr, $(|)? $( $pattern:pat_param )|+ $( if $guard: expr )?, $msg:literal, $($arg:tt)+) => {
42 match $left {
43 $( $pattern )|+ $( if $guard )? => {}
44 ref left_val => {
45 panic!(concat!(r#"
46assertion failed: `(left matches right)`
47 left: `{:?}`,
48 right: `{}`
49"#, $msg), left_val, stringify!($($pattern)|+ $(if $guard)?), $($arg)+);
50 }
51 }
52 }
53}
54
55pub use miden_crypto::{EMPTY_WORD, Felt, ONE, WORD_SIZE, Word, ZERO, word::LexicographicWord};
59
60pub mod advice;
61pub mod chiplets;
62pub mod events;
63pub mod mast;
64pub mod operations;
65pub mod precompile;
66pub mod program;
67pub mod proof;
68pub mod utils;
69
70pub mod field {
71 pub use miden_crypto::field::*;
72
73 pub type QuadFelt = BinomialExtensionField<super::Felt, 2>;
74}
75
76pub mod serde {
77 pub use miden_crypto::utils::{
78 BudgetedReader, ByteReader, ByteWriter, Deserializable, DeserializationError, Serializable,
79 SliceReader,
80 };
81}
82
83pub mod crypto {
84 pub mod merkle {
85 pub use miden_crypto::merkle::{
86 EmptySubtreeRoots, InnerNodeInfo, MerkleError, MerklePath, MerkleTree, NodeIndex,
87 PartialMerkleTree,
88 mmr::{Mmr, MmrPeaks},
89 smt::{LeafIndex, SMT_DEPTH, SimpleSmt, Smt, SmtProof, SmtProofError},
90 store::{MerkleStore, StoreNode},
91 };
92 }
93
94 pub mod hash {
95 pub use miden_crypto::hash::{
96 blake::{Blake3_256, Blake3Digest},
97 keccak::Keccak256,
98 poseidon2::Poseidon2,
99 rpo::Rpo256,
100 rpx::Rpx256,
101 sha2::{Sha256, Sha512},
102 };
103 }
104
105 pub mod random {
106 pub use miden_crypto::rand::{RpoRandomCoin, RpxRandomCoin};
107 }
108
109 pub mod dsa {
110 pub use miden_crypto::dsa::{ecdsa_k256_keccak, eddsa_25519_sha512, falcon512_poseidon2};
111 }
112}
113
114pub mod prettier {
115 pub use miden_formatting::{prettier::*, pretty_via_display, pretty_via_to_string};
116
117 pub fn pretty_print_csv<'a, T>(items: impl IntoIterator<Item = &'a T>) -> Document
119 where
120 T: PrettyPrint + 'a,
121 {
122 let mut doc = Document::Empty;
123 for (i, item) in items.into_iter().enumerate() {
124 if i > 0 {
125 doc += const_text(", ");
126 }
127 doc += item.render();
128 }
129 doc
130 }
131}
132
133pub const FMP_INIT_VALUE: Felt = Felt::new(2_u64.pow(31));
139
140pub const FMP_ADDR: Felt = Felt::new(u32::MAX as u64 - 1_u64);