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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add new FuelGasPriceProvider
#1889
base: master
Are you sure you want to change the base?
Conversation
We might want to take into account the average number of txs per block. Or we could get a similar result with an "I" value (PID). |
*self.profitablility_totals.totaled_block_height.borrow() | ||
} | ||
|
||
fn update_totals(&self, latest_block_height: BlockHeight) -> Result<()> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to take into account the fact that DA recording has some lag to it. Possibly 12-24 blocks? How does that effect the gas_price
calculation? The current design doesn't take that into account.
let new_gas_price = core::cmp::min( | ||
new_gas_price_candidate, | ||
self.algorithm.maximum_next_gas_price(previous_gas_price), | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is kinda a smell. I'm not sure if this should be in the provider or the algo. I'm getting a feeling like the provider and the algo abstractions could be merged some, especially when we start looking at the estimation trait impl.
Part of: #1624
Introduce a new type to replace
StaticGasPrice
that will actually calculate new gas prices based on historical data. For now we're just faking all the input sources to show that the algorithm can work.This work is largely exploratory since we don't know exactly what the algorithm will land on. This means that the algorithm might need to be moved to a versioned subtype before this work is done. But hopefully we can either land on a good MVP algorithm or unearth more specifications for our algorithm through this work 馃
The current design separates the algorithm from the
FuelBlockProvider
. This helps identify what behavior is independent of the specifc algorithm we end up choosing and helps us determine the minimum set of variables the algorithm requires. It's possible that we will need more or fewer params. Currently the algorithm looks like this:Taking the
total
of bothreward
andcost
could instead be a profitablility ratio, but that robs the control loop of information about the magnitude of the difference in the units ofgas_price
. i.e. being 20% away from the target profitability is much different if it's accrued over 100 blocks or 100,000 blocks. It's still TBD.The actual impllementation of the
FuelGasPriceAlgo
for now is going to take inspiration from a PID control loop, but ideally as simple as possible and as deterministic as possible (we don't want to use floats in places likeBlockFullness
).Architecture Diagram (WIP, I'll try to update as it changes). CLICK IF NOT SHOWING UP PROPERLY IN DARK MODE:
Checklist
Before requesting review
After merging, notify other teams
[Add or remove entries as needed]