risc0 icon indicating copy to clipboard operation
risc0 copied to clipboard

Improve error message for MethodId verification failures

Open flaub opened this issue 3 years ago • 1 comments

A clear error message should be presented when MethodId verification fails. Especially in the case where the generated MethodId is smaller than the number of cycles (we run off the end of the table). A helpful error message directing the user to use the code_limit parameter of embed_methods_with_options function would be good.

flaub avatar Aug 30 '22 00:08 flaub

Specifically, to work around this, modify this file: https://github.com/risc0/risc0-rust-starter/blob/main/methods/build.rs to call https://docs.rs/risc0-build/0.11.1/risc0_build/fn.embed_methods_with_options.html and set code_limit to something larger (16 being the max):

    // The default code_limit is 12. Increase to 16.
    let options_map = HashMap::from([("methods-guest", risc0_build::GuestOptions{ code_limit: 16, features: vec![] })]);
    risc0_build::embed_methods_with_options(options_map);

Basically, the code limit determines the maximum time a program can execute. We would set it to the max value automatically, but larger values increase build time dramatically.

jbruestle avatar Sep 13 '22 18:09 jbruestle