Stream: git-wasmtime

Topic: wasmtime / PR #5013 Adjust fuel consumption to be empty w...


view this post on Zulip Wasmtime GitHub notifications bot (Oct 04 2022 at 23:06):

itsrainy requested alexcrichton for a review on PR #5013.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 04 2022 at 23:06):

itsrainy opened PR #5013 from rainy/minor-fuel-changes to main:

I ran into this when attempting to use set_fuel in a fuzz target (https://github.com/bytecodealliance/wasm-tools/pull/769). set_fuel calls consume_fuel(0) in order to get the current amount of fuel in a Store. However, consume_fuel(0) will return an out of fuel error if there is 0 fuel remaining, which is the case with a new Store.

Switching the < to a <= also has the effect of making this work:

...
let mut store = Store::new(&engine, ());
store.add_fuel(1).unwrap();
store.consume_fuel(1).unwrap();

previously this would have returned an "out of fuel" error, which doesn't seem correct, though maybe there's some nuance I'm missing?

view this post on Zulip Wasmtime GitHub notifications bot (Oct 04 2022 at 23:34):

itsrainy updated PR #5013 from rainy/minor-fuel-changes to main.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 05 2022 at 14:39):

alexcrichton submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 05 2022 at 14:44):

alexcrichton merged PR #5013.


Last updated: Dec 23 2024 at 12:05 UTC