Skip to content

Allow fuel metering customization via Config::fuel_costs API - #2025

Merged
Robbepop merged 7 commits into
mainfrom
rf-expose-fuel-metering-customization
Aug 9, 2026
Merged

Allow fuel metering customization via Config::fuel_costs API#2025
Robbepop merged 7 commits into
mainfrom
rf-expose-fuel-metering-customization

Conversation

@Robbepop

@Robbepop Robbepop commented Aug 9, 2026

Copy link
Copy Markdown
Member

This allows to customize fuel costs for the following areas:

  • Lazy translation and validation of functions.
    • For example if CompilationMode::Lazy or CompilationMode::LazyTranslation is used.
  • Copying bytes or values in the following Wasm operator executions:
    • memory.{grow,copy,fill,init}
    • table.{grow,copy,fill,init}

New API

image

Where CustomFuelCosts is defined as:

pub struct CustomFuelCosts {
    /// The amount of bytes that can be copied for a single unit of fuel.
    pub bytes_copied_per_fuel: u32,
    /// The amount of fuel required to translate one byte from Wasm bytecode to Wasmi IR.
    pub fuel_per_bytes_translated: u32,
    /// The amount of fuel required to validate one byte of Wasm bytecode.
    pub fuel_per_bytes_validated: u32,
}

@codecov

codecov Bot commented Aug 9, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 62.74510% with 19 lines in your changes missing coverage. Please review.
✅ Project coverage is 76.29%. Comparing base (ef2b908) to head (d3ca681).

Files with missing lines Patch % Lines
crates/core/src/fuel.rs 58.97% 16 Missing ⚠️
crates/wasmi/src/engine/config.rs 25.00% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2025      +/-   ##
==========================================
- Coverage   76.32%   76.29%   -0.04%     
==========================================
  Files         168      168              
  Lines       15496    15531      +35     
==========================================
+ Hits        11828    11849      +21     
- Misses       3668     3682      +14     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Robbepop
Robbepop merged commit c242c15 into main Aug 9, 2026
23 of 24 checks passed
@Robbepop
Robbepop deleted the rf-expose-fuel-metering-customization branch August 9, 2026 17:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant