Skip to main content

miden_core/
lib.rs

1#![no_std]
2
3#[macro_use]
4extern crate alloc;
5
6#[cfg(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    pub use miden_serde_utils::{
35        BudgetedReader, ByteReader, ByteWriter, Deserializable, DeserializationError, Serializable,
36        SliceReader, read_bounded_len, validate_bounded_len,
37    };
38}
39
40pub mod crypto {
41    pub mod merkle {
42        pub use miden_crypto::merkle::{
43            EmptySubtreeRoots, InnerNodeInfo, MerkleError, MerklePath, MerkleTree, NodeIndex,
44            PartialMerkleTree,
45            mmr::{Mmr, MmrPeaks},
46            smt::{LeafIndex, SMT_DEPTH, SimpleSmt, Smt, SmtProof, SmtProofError},
47            store::{MerkleStore, StoreNode},
48        };
49    }
50
51    pub mod hash {
52        pub use miden_crypto::hash::{
53            blake::{Blake3_256, Blake3Digest},
54            keccak::Keccak256,
55            poseidon2::Poseidon2,
56            rpo::Rpo256,
57            rpx::Rpx256,
58            sha2::Sha256,
59        };
60    }
61
62    pub mod random {
63        pub use miden_crypto::rand::RandomCoin;
64    }
65
66    pub mod dsa {
67        pub use miden_crypto::dsa::{ecdsa_k256_keccak, falcon512_poseidon2};
68    }
69}
70
71pub mod prettier {
72    pub use miden_formatting::{prettier::*, pretty_via_display, pretty_via_to_string};
73}
74
75// CONSTANTS
76// ================================================================================================
77
78/// The initial value for the frame pointer, corresponding to the start address for procedure
79/// locals.
80pub const FMP_INIT_VALUE: Felt = Felt::new_unchecked(2_u64.pow(31));
81
82/// The address where the frame pointer is stored in memory.
83pub const FMP_ADDR: Felt = Felt::new_unchecked(u32::MAX as u64 - 1_u64);