Skip to main content

miden_core/
lib.rs

1#![no_std]
2
3#[macro_use]
4extern crate alloc;
5
6#[cfg(any(test, feature = "std"))]
7extern crate std;
8
9// EXPORTS
10// ================================================================================================
11
12pub use miden_crypto::{EMPTY_WORD, Felt, ONE, Word, ZERO};
13
14/// The number of field elements in a Miden word.
15pub const WORD_SIZE: usize = Word::NUM_ELEMENTS;
16
17pub mod advice;
18pub mod chiplets;
19pub mod deferred;
20pub mod events;
21pub mod mast;
22pub mod operations;
23pub mod program;
24pub mod proof;
25pub mod utils;
26
27pub mod field {
28    pub use miden_crypto::field::*;
29
30    pub type QuadFelt = BinomialExtensionField<super::Felt, 2>;
31}
32
33pub mod serde {
34    #[cfg(feature = "std")]
35    pub use miden_serde_utils::read_file_bounded;
36    pub use miden_serde_utils::{
37        BudgetedReader, ByteReader, ByteWriter, Deserializable, DeserializationError, Serializable,
38        SliceReader, read_bounded_len, validate_bounded_len,
39    };
40}
41
42pub mod crypto {
43    pub mod merkle {
44        pub use miden_crypto::merkle::{
45            EmptySubtreeRoots, InnerNodeInfo, MerkleError, MerklePath, MerkleTree, NodeIndex,
46            PartialMerkleTree,
47            mmr::{Mmr, MmrPeaks},
48            smt::{
49                LeafIndex, PartialSmt, SMT_DEPTH, SimpleSmt, Smt, SmtProof, SmtProofError,
50                SmtWitness,
51            },
52            store::{MerkleStore, StoreNode},
53        };
54    }
55
56    pub mod hash {
57        pub use miden_crypto::hash::{
58            blake::{Blake3_256, Blake3Digest},
59            eidos::Eidos,
60            keccak::Keccak256,
61            sha2::Sha256,
62        };
63    }
64
65    pub mod dsa {
66        pub use miden_crypto::dsa::{ecdsa_k256_keccak, falcon512_eidos};
67    }
68}
69
70pub mod prettier {
71    pub use miden_formatting::{prettier::*, pretty_via_display, pretty_via_to_string};
72}
73
74// CONSTANTS
75// ================================================================================================
76
77/// The initial value for the frame pointer, corresponding to the start address for procedure
78/// locals.
79pub const FMP_INIT_VALUE: Felt = Felt::new_unchecked(2_u64.pow(31));
80
81/// The address where the frame pointer is stored in memory.
82pub const FMP_ADDR: Felt = Felt::new_unchecked(u32::MAX as u64 - 1_u64);