plonky2/evm/src/cpu/kernel/global_metadata.rs
Daniel Lubarov f951345556
Update evm/src/cpu/kernel/global_metadata.rs
Co-authored-by: Jacqueline Nabaglo <jakub@mirprotocol.org>
2022-08-02 09:09:48 -07:00

24 lines
845 B
Rust

/// These metadata fields contain global VM state, stored in the `Segment::Metadata` segment of the
/// kernel's context (which is zero).
#[derive(Copy, Clone, Eq, PartialEq, Hash, Ord, PartialOrd, Debug)]
pub(crate) enum GlobalMetadata {
/// The largest context ID that has been used so far in this execution. Tracking this allows us
/// give each new context a unique ID, so that its memory will be zero-initialized.
LargestContext = 0,
}
impl GlobalMetadata {
pub(crate) const COUNT: usize = 1;
pub(crate) fn all() -> [Self; Self::COUNT] {
[Self::LargestContext]
}
/// The variable name that gets passed into kernel assembly code.
pub(crate) fn var_name(&self) -> &'static str {
match self {
GlobalMetadata::LargestContext => "GLOBAL_METADATA_LARGEST_CONTEXT",
}
}
}