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::{LeafIndex, SMT_DEPTH, SimpleSmt, Smt, SmtProof, SmtProofError},
49            store::{MerkleStore, StoreNode},
50        };
51    }
52
53    pub mod hash {
54        pub use miden_crypto::hash::{
55            blake::{Blake3_256, Blake3Digest},
56            keccak::Keccak256,
57            poseidon2::Poseidon2,
58            rpo::Rpo256,
59            rpx::Rpx256,
60            sha2::Sha256,
61        };
62    }
63
64    pub mod random {
65        pub use miden_crypto::rand::RandomCoin;
66    }
67
68    pub mod dsa {
69        pub use miden_crypto::dsa::{ecdsa_k256_keccak, falcon512_poseidon2};
70    }
71}
72
73pub mod prettier {
74    pub use miden_formatting::{prettier::*, pretty_via_display, pretty_via_to_string};
75}
76
77// CONSTANTS
78// ================================================================================================
79
80/// The initial value for the frame pointer, corresponding to the start address for procedure
81/// locals.
82pub const FMP_INIT_VALUE: Felt = Felt::new_unchecked(2_u64.pow(31));
83
84/// The address where the frame pointer is stored in memory.
85pub const FMP_ADDR: Felt = Felt::new_unchecked(u32::MAX as u64 - 1_u64);