INNER CODE UNIT · Rust
is_empty
risc0/risc0-ethereum · crates/aggregation/src/lib.rs:290
pub fn is_empty(&self) -> bool {
self.0.is_empty()
}
/// A compact encoding for the [MerkleMountainRange] used in encoding the journal designed to
/// be efficient for use in the EVM, and designed to ensure it is possible to construct the
/// journal encoding of a finalized [MerkleMountainRange] given only the finalized root.
pub fn encode(&self) -> Vec<u8> {
// bitmap encodes the max-depth values present in the MerkleMountainRange. Note that when
// finalized, the bitmap is guaranteed to be equal to 1 << 255.
let mut bitmap = U256::ZERO;
let mut peaks = Vec::<Digest>::with_capacity(self.0.len());
// Iterate over the peaks from greatest to least max-depth.
for peak in self.0.iter() {
bitmap.set_bit(peak.max_depth as usize, true);
peaks.push(peak.digest);
}
[