solana-labs / rbpf

Rust virtual machine and JIT compiler for eBPF programs
Apache License 2.0
272 stars 163 forks source link

BuiltinProgram::new_mock: use max_call_depth=64 #566

Closed alessandrod closed 3 months ago

alessandrod commented 4 months ago

I'm adding code to bpf_loader in the validator that asserts that max_call_depth is the same value as solana_program_runtime::compute_budget::MAX_CALL_DEPTH. This change is needed so that the tests that use BuiltinProgram::new_mock() in the validator don't trigger the assert.

Lichtso commented 3 months ago

We can probably adjust the Config::default() here instead. That way the other tests in this crate also get the more realistic setup.

alessandrod commented 3 months ago

We can probably adjust the Config::default() here instead. That way the other tests in this crate also get the more realistic setup.

The reason I didn't want to do this is that I think it's good to test more than one value. But I'm also ok changing the default to 64 and then testing != 64 explicitly

Lichtso commented 3 months ago

I adjusted tests (test_bpf_to_bpf_depth() and test_err_reg_stack_depth()) to run on the previous and the new value in #574.