Add example of execution limits using fuel consumption#2869
Conversation
|
Ah it looks like CI is failing when it's running the examples, as it expects that all examples pass successfully. Could the example be updated to not return a failure code? (e.g. catch the error) Also I think our CI verifies that all examples are available in both C and Rust, so I think that at least a stub program will be needed for a C example? |
|
Ah, that could be it. Thanks for the pointer, adding a C stub now. EDIT: This may take a bit, figuring out how to build and run the C examples on a mac now. |
|
Added a C example. I'm not particularly confident in the error handling and cleanup code there. I think I handle the error codes from I'm not sure about the semantics of the |
|
That all looks great to me, thanks! |
…nce#2869) * Add example of execution limits using fuel consumption * run rustfmt * Use a more naive WAT implementation * Catch error and return cleanly * Add a C example to demonstrate fuel consumption * Add error handling for add_fuel
This is a quick example of using the "fuel consumption" logic introduced in #2611.
It computes larger and larger Fibonacci numbers (using the expensive recursive algorithm) until the computation requires more than 10k fuel.