Skip to content

Commit

Permalink
Gas Price Algorithm (#1948)
Browse files Browse the repository at this point in the history
Closes: #1957

Part of #1624

Add the gas price algorithm with some tools for analyzing its behavior.

The algorithm is made up of two portions:
- `AlgorithmUpdaterV1`
- `AlgorithmV1`

The updater holds the state of the historical data and can generate new
algorithms as its data is updated. The algorithm just takes the
`block_bytes` and can calculate the price from that data.

I've included a lot of docs on the actual code, so see that for more
details. LMK if something is missing :)

## Checklist
- [ ] Breaking changes are clearly marked as such in the PR description
and changelog
- [x] New behavior is reflected in tests
- [ ] [The specification](https://github.com/FuelLabs/fuel-specs/)
matches the implemented behavior (link update PR if changes are needed)

### Before requesting review
- [x] I have reviewed the code myself
- [ ] I have created follow-up issues caused by this PR and linked them
here

### After merging, notify other teams

[Add or remove entries as needed]

- [ ] [Rust SDK](https://github.com/FuelLabs/fuels-rs/)
- [ ] [Sway compiler](https://github.com/FuelLabs/sway/)
- [ ] [Platform
documentation](https://github.com/FuelLabs/devrel-requests/issues/new?assignees=&labels=new+request&projects=&template=NEW-REQUEST.yml&title=%5BRequest%5D%3A+)
(for out-of-organization contributors, the person merging the PR will do
this)
- [ ] Someone else?

---------

Co-authored-by: human <jamesturner@Zenobia.hsd1.wa.comcast.net>
  • Loading branch information
MitchTurner and human committed Jun 19, 2024
1 parent 12cb17f commit 4d6167d
Show file tree
Hide file tree
Showing 17 changed files with 2,765 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

### Added
- [#1889](https://github.com/FuelLabs/fuel-core/pull/1889): Add new `FuelGasPriceProvider` that receives the gas price algorithm from a `GasPriceService`
- [#1948](https://github.com/FuelLabs/fuel-core/pull/1948): Add new `AlgorithmV1` and `AlgorithmUpdaterV1' for the gas price. Include tools for analysis

### Changed
- [#1942](https://github.com/FuelLabs/fuel-core/pull/1942): Sequential relayer's commits.
Expand Down
7 changes: 7 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ members = [
"crates/client",
"crates/database",
"crates/fuel-core",
"crates/fuel-gas-price-algorithm",
"crates/keygen",
"crates/metrics",
"crates/services",
Expand Down Expand Up @@ -81,6 +82,7 @@ fuel-core-tests = { version = "0.0.0", path = "./tests" }
fuel-core-upgradable-executor = { version = "0.30.0", path = "./crates/services/upgradable-executor" }
fuel-core-wasm-executor = { version = "0.30.0", path = "./crates/services/upgradable-executor/wasm-executor", default-features = false }
fuel-core-xtask = { version = "0.0.0", path = "./xtask" }
fuel-gas-price-algorithm = { version = "0.30.0", path = "crates/fuel-gas-price-algorithm" }

# Fuel dependencies
fuel-vm-private = { version = "0.54.1", package = "fuel-vm", default-features = false }
Expand Down
Binary file not shown.
17 changes: 17 additions & 0 deletions crates/fuel-gas-price-algorithm/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[package]
name = "fuel-gas-price-algorithm"
authors = { workspace = true }
categories = { workspace = true }
edition = { workspace = true }
homepage = { workspace = true }
keywords = { workspace = true }
license = { workspace = true }
repository = { workspace = true }
version = { workspace = true }

[lib]
name = "fuel_gas_price_algorithm"
path = "src/lib.rs"

[dependencies]
thiserror = { workspace = true }
Loading

0 comments on commit 4d6167d

Please sign in to comment.