sp1-lib 6.1.0

SP1 zkVM library functions
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use sp1_primitives::consts::LOG_PAGE_SIZE;

use crate::syscall_mprotect;

/// Verifies the next proof in the proof input stream given a verification key digest and public
/// values digest. If the proof is invalid, the function will panic.
///
/// Enable this function by adding the `verify` feature to both the `sp1-lib` AND `sp1-zkvm` crates.
pub fn mprotect(addr: *const u8, len: usize, prot: u8) {
    let start = addr as usize;
    let end = start + len;

    (start..end).step_by(1 << LOG_PAGE_SIZE).for_each(|addr| unsafe {
        syscall_mprotect(addr as *const u8, prot);
    });
}