0xPolygonMiden / miden-vm

STARK-based virtual machine
MIT License
632 stars 161 forks source link

Kernel ROM table and chiplets bus are broken #1545

Open plafer opened 1 month ago

plafer commented 1 month ago

The chiplet virtual table doesn't sum to 1 (due to the kernel ROM part) when there is more than 1 kernel procedure exported.

Failing test:

#[test]
fn simple_syscall_2() {
    let kernel_source = "
        export.foo
            add
        end
        export.bar
            mul
        end
    ";

    let program_source = "
        begin
            syscall.foo
            syscall.bar
        end";

    // TODO: update and use macro?
    let mut test = Test::new(&format!("test{}", line!()), program_source, false);
    test.stack_inputs = StackInputs::try_from_ints([3, 2, 1]).unwrap();
    test.kernel_source = Some(
        test.source_manager
            .load(&format!("kernel{}", line!()), kernel_source.to_string()),
    );
    test.expect_stack(&[9]);

    test.prove_and_verify(vec![3, 2, 1], false);
}

The chiplets bus is also broken (some miden-base tests trigger a bug we don't catch in our tests).

bobbinth commented 3 weeks ago

Not the same issue but maybe related: the check for block stack table was disabled in https://github.com/0xPolygonMiden/miden-vm/pull/1553#issue-2621890460 because it also seems to have an issue.

bobbinth commented 3 weeks ago

Do we still need to address TODO here to close this issue?