Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Fuel APIs for Store #7298

Merged
merged 1 commit into from
Oct 23, 2023
Merged

New Fuel APIs for Store #7298

merged 1 commit into from
Oct 23, 2023

Commits on Oct 23, 2023

  1. Switch to simpler fuel APIs

    In an effort to simplify the many fuel related APIs, simplify the
    interface here to a single counter with get and set methods.
    Additionally the async yield is reduced to an interval of the total fuel
    instead of injecting fuel, so it's easy to still reason about how much
    fuel is left even with yielding turned on.
    
    Internally this works by keeping two counters - one the VM uses to
    increment towards 0 for fuel, the other to track how much is in
    "reserve". Then when we're out of gas, we pull from the reserve to
    refuel and continue. We use the reserve in two cases: one for overflow
    of the fuel (which is an i64 and the API expresses fuel as u64) and the
    other for async yieling, which then the yield interval acts as a cap to
    how much we can refuel with.
    
    This also means that `get_fuel` can return the full range of `u64`
    before this change it could only return up to `i64::MAX`. This is
    important because this PR is removing the functionality to track fuel
    consumption, and this makes the API less error prone for embedders to
    track consumption themselves.
    
    Careful to note that the VM counter that is stored as `i64` can be
    positive if an instruction "costs" multiple units of fuel when the fuel
    ran out.
    
    prtest:full
    
    Signed-off-by: Tyler Rockwood <rockwood@redpanda.com>
    rockwotj committed Oct 23, 2023
    Configuration menu
    Copy the full SHA
    eac17cd View commit details
    Browse the repository at this point in the history