#![no_std]
#[macro_use]
extern crate alloc;
#[cfg(feature = "std")]
extern crate std;
#[macro_export]
macro_rules! assert_matches {
($left:expr, $(|)? $( $pattern:pat_param )|+ $( if $guard: expr )? $(,)?) => {
match $left {
$( $pattern )|+ $( if $guard )? => {}
ref left_val => {
panic!(r#"
assertion failed: `(left matches right)`
left: `{:?}`,
right: `{}`"#, left_val, stringify!($($pattern)|+ $(if $guard)?));
}
}
};
($left:expr, $(|)? $( $pattern:pat_param )|+ $( if $guard: expr )?, $msg:literal $(,)?) => {
match $left {
$( $pattern )|+ $( if $guard )? => {}
ref left_val => {
panic!(concat!(r#"
assertion failed: `(left matches right)`
left: `{:?}`,
right: `{}`
"#, $msg), left_val, stringify!($($pattern)|+ $(if $guard)?));
}
}
};
($left:expr, $(|)? $( $pattern:pat_param )|+ $( if $guard: expr )?, $msg:literal, $($arg:tt)+) => {
match $left {
$( $pattern )|+ $( if $guard )? => {}
ref left_val => {
panic!(concat!(r#"
assertion failed: `(left matches right)`
left: `{:?}`,
right: `{}`
"#, $msg), left_val, stringify!($($pattern)|+ $(if $guard)?), $($arg)+);
}
}
}
}
pub use miden_crypto::{EMPTY_WORD, Felt, LexicographicWord, ONE, WORD_SIZE, Word, ZERO};
pub mod advice;
pub mod chiplets;
pub mod events;
pub mod mast;
pub mod operations;
pub mod precompile;
pub mod program;
pub mod proof;
pub mod utils;
pub mod field {
pub use miden_crypto::field::*;
pub type QuadFelt = BinomialExtensionField<super::Felt, 2>;
}
pub mod serde {
pub use miden_crypto::utils::{
BudgetedReader, ByteReader, ByteWriter, Deserializable, DeserializationError, Serializable,
SliceReader,
};
}
pub mod crypto {
pub mod merkle {
pub use miden_crypto::merkle::{
EmptySubtreeRoots, InnerNodeInfo, MerkleError, MerklePath, MerkleTree, NodeIndex,
PartialMerkleTree,
mmr::{Mmr, MmrPeaks},
smt::{LeafIndex, SMT_DEPTH, SimpleSmt, Smt, SmtProof, SmtProofError},
store::{MerkleStore, StoreNode},
};
}
pub mod hash {
pub use miden_crypto::hash::{
blake::{Blake3_256, Blake3Digest},
keccak::Keccak256,
poseidon2::Poseidon2,
rpo::Rpo256,
rpx::Rpx256,
sha2::{Sha256, Sha512},
};
}
pub mod random {
pub use miden_crypto::rand::RandomCoin;
}
pub mod dsa {
pub use miden_crypto::dsa::{ecdsa_k256_keccak, eddsa_25519_sha512, falcon512_poseidon2};
}
}
pub mod prettier {
pub use miden_formatting::{prettier::*, pretty_via_display, pretty_via_to_string};
pub fn pretty_print_csv<'a, T>(items: impl IntoIterator<Item = &'a T>) -> Document
where
T: PrettyPrint + 'a,
{
let mut doc = Document::Empty;
for (i, item) in items.into_iter().enumerate() {
if i > 0 {
doc += const_text(", ");
}
doc += item.render();
}
doc
}
}
pub const FMP_INIT_VALUE: Felt = Felt::new(2_u64.pow(31));
pub const FMP_ADDR: Felt = Felt::new(u32::MAX as u64 - 1_u64);