INNER CODE UNIT · Rust
new_finalized
risc0/risc0-ethereum · crates/aggregation/src/lib.rs:196
pub fn new_finalized(root: Digest) -> Self {
Self(vec![Peak {
max_depth: u8::MAX,
digest: root,
}])
}
/// Push a new value onto the Merkle mountain range.
pub fn push(&mut self, value: impl Borrow<Digest>) -> Result<(), Error> {
self.push_peak(Peak {
digest: hash_leaf(value.borrow()),
max_depth: 0,
})
}
fn push_peak(&mut self, new_peak: Peak) -> Result<(), Error> {
// If the peak has a max-depth of 255, then the mountain range is finalized and no new
// peaks can be pushed to it. Note that this state can only be achieved by calling