Skip to main content

disassemble_from_str

Function disassemble_from_str 

Source
pub fn disassemble_from_str<N: Network>(
    name: impl Display,
    program: &str,
    process: &mut Process<N>,
) -> Result<AleoProgram, LeoError>
Expand description

Parse, validate via Process::add_program, and disassemble. Catches the class of malformed-but-parseable bytecode that disassemble panics on (e.g. issue #29399, where a non-finalize function declared a future-typed register input). Pattern matches crates/compiler/src/test_compiler.rs:62-66.

process must already have all of program’s declared imports loaded — snarkVM’s add_program is contextual and rejects a program whose imports aren’t yet in the process. Callers that disassemble multiple related dependencies should reuse the same process across calls in topological dependency order so each program’s imports are present when it’s added.