Open kariy opened 1 month ago
Hi, I would love to work on this issue. I have experience with Rust and also contributing to Kakarot with Cairo. I will make sure to communicate if I encounter any issues along the way
@augustin-v assigned :). you can take a look at madara's implementation for some reference.
@augustin-v i've added a very simple skeleton code for the gas oracle in #2643. its only supporting fixed gas prices as we already have today.
@kariy Nice, I have made a draft pull request for my progress on the gas oracle implementation in #2558. I would love to get a review to see how I could move forward.
Problem
Right now, Katana hardcoded the gas prices value. These gas prices are then used for computing the fees that transactions has to pay.
Though it works fine when using Katana just for testing/dev environment but for actual production setting we want to properly sample the L1 gas prices. Refer to the doc below for how starknet sample the l1 gas price:
https://docs.starknet.io/architecture-and-concepts/network-architecture/fee-mechanism/#calculation_of_gas_costs
Implementation for the gas oracle component should be able to (1) perform actual sampling on the underlying L1, (2) hardcoded value when katana is not run with an L1 (ie testing env).
On every new block, we'd then need to update the gas price values that have been sampled, in the block env:
https://github.com/dojoengine/dojo/blob/e6bab2d0066c3cf1acfc5ee41a27294b5b23697d/crates/katana/core/src/backend/mod.rs#L101-L117