Skip to content
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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use min-gas-price as a starting point if start-gas-price is zero #2060

Merged
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

## [Unreleased]

### Bug Fixes
### Fixes
- [2060](https://github.com/FuelLabs/fuel-core/pull/2060): Use `min-gas-price` as a starting point if `start-gas-price` is zero.
- [2059](https://github.com/FuelLabs/fuel-core/pull/2059): Remove unwrap that is breaking backwards compatibility
- [2063](https://github.com/FuelLabs/fuel-core/pull/2063): Don't use historical view during dry run.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ pub fn get_synced_gas_price_updater(
};

let first_metadata = UpdaterMetadata::V0(V0Metadata {
new_exec_price: config.starting_gas_price,
new_exec_price: config.starting_gas_price.max(config.min_gas_price),
min_exec_gas_price: config.min_gas_price,
exec_gas_price_change_percent: config.gas_price_change_percent,
l2_block_height: latest_block_height,
Expand Down
19 changes: 19 additions & 0 deletions tests/tests/gas_price.rs
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,25 @@ async fn estimate_gas_price__is_greater_than_actual_price_at_desired_height() {
assert!(estimated >= real);
}

#[tokio::test]
async fn estimate_gas_price__returns_min_gas_price_if_starting_gas_price_is_zero() {
const MIN_GAS_PRICE: u64 = 1;

// Given
let mut node_config = Config::local_node();
node_config.min_gas_price = MIN_GAS_PRICE;
node_config.starting_gas_price = 0;
let srv = FuelService::new_node(node_config.clone()).await.unwrap();
let client = FuelClient::from(srv.bound_address);

// When
let result = client.estimate_gas_price(10).await.unwrap();

// Then
let actual = result.gas_price.0;
assert_eq!(MIN_GAS_PRICE, actual)
}

#[tokio::test]
async fn latest_gas_price__if_node_restarts_gets_latest_value() {
// given
Expand Down
Loading