INNER CODE UNIT · Rust
is_initial
risc0/risc0-ethereum · crates/aggregation/src/lib.rs:96
pub fn is_initial(&self) -> bool {
self.mmr.is_empty()
}
/// Encodes the [GuestState] for committing to the journal. Uses a specialized codec.
/// See [MerkleMountainRange::encode].
pub fn encode(&self) -> Vec<u8> {
[self.self_image_id.as_bytes(), &self.mmr.encode()].concat()
}
/// Decodes the [GuestState] for the journal. Uses a specialized codec.
/// See [MerkleMountainRange::encode].
pub fn decode(bytes: impl AsRef<[u8]>) -> Result<Self, DecodingError> {
// Read the first 32 bytes as the self_image_id.
let (chunk, bytes) = bytes
.as_ref()
.split_at_checked(U256::BYTES)
.ok_or(DecodingError::UnexpectedEnd)?;