keep-starknet-strange / shinigami

Bitcoin Script VM in Cairo
https://shinigamibtc.dev
MIT License
64 stars 59 forks source link

test for max stack size #193

Closed mubarak23 closed 2 months ago

mubarak23 commented 3 months ago
vercel[bot] commented 3 months ago

@mubarak23 is attempting to deploy a commit to the keep-starknet-strange Team on Vercel.

A member of the Team first needs to authorize it.

mubarak23 commented 2 months ago

@b-j-roberts This PR is Ready for review

mubarak23 commented 2 months ago

this test function throw the following error

#[test]
fn test_max_stack_size_more() {
    let mut program: ByteArray = "";
    let op_1_string = "OP_1 ";
    let mut index: u64 = 0;
    while index < 1000 {
        program.append(@op_1_string);
        index += 1;
    };

    let mut engine = utils::test_compile_and_run_err(program, Error::SCRIPT_STACK_SIZE_EXCEEDED);

    utils::check_dstack_size(ref engine, 1000);
}

this errors


failures:
   shinigami::opcodes::tests::test_stack::test_max_stack_size_more - Panicked with "Execution of the program did not fail as expected".

which mean putting 1000 item in the stack does not break it @b-j-roberts

b-j-roberts commented 2 months ago

which mean putting 1000 item in the stack does not break it @b-j-roberts

Yes, that is the expected behavior. 1000 items on the stack should work fine. So you can use utils::test_compile_and_run instead of the error one.