-
Notifications
You must be signed in to change notification settings - Fork 301
feat: Return fee estimate that make sense #1573
Comments
Hey, I can pick this up |
I am thinking of this logic to fetch the L1 gas price per block
wdyt? |
Where will you be fetching the gas price from? Will you be doing some http request? |
Yes over an http request. |
Won't it delay the block production by the time of the http request? |
Hmm, fair point. So a worker updates some const every X seconds and the start of a new block, an inherent fetches the latest storage value and inserts it into the runtime? |
That is what I would say. The gas price is updated every eth block, no? We are listening to them anyway for messages, no? |
On eth, the gas price isn't a part of the block header afaik. It's just a metric based on the supply and demand. |
Decentralizing this will be a terrible experience... |
Why? The author node can set the l1_gas_price based however it likes, other nodes can reject it if they feel its incorrect (similar to the timestamp inherent) |
Resolved with #1601 |
Feature Request
Describe the Feature Request
Right now all our fee estimation methods return mocked/false values. We should fix that.
Describe Preferred Solution
simulate_transaction
#329 is still not fixed, but it can be now
replace
get_block
-like RPCsRight now the code contains in multiple places:
Instead, get the price from the block header
gas_prices
field, it containseth_l1_gas_price
andstrk_l1_gas_price
, which are the values we are looking for.Estimate fee
Right now we are totally wrong on our fee estimation. We return
(exec_info.actual_fee.0, *l1_gas_usage)
incrates/pallets/starknet/src/simulations.rs
as values foroveral_fee
andgas_consumed
. That is not how the protocol is supposed to work: https://docs.starknet.io/documentation/architecture_and_concepts/Network_Architecture/fee-mechanism/We should follow this specifications, for this we can take inspiration of the pathfinder implementation here: https://github.com/eqlabs/pathfinder/blob/main/crates/executor/src/estimate.rs#L12
The text was updated successfully, but these errors were encountered: