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

Set Latest Recorded Height on startup #2603

Merged
merged 22 commits into from
Jan 22, 2025
Merged
Show file tree
Hide file tree
Changes from 20 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
83bf21a
Use Url apis to build the full url path
MitchTurner Jan 18, 2025
b9977d4
Remove unused import
MitchTurner Jan 18, 2025
e8d72c8
Update CHANGELOG
MitchTurner Jan 18, 2025
968fd69
Make comment more inclusive
MitchTurner Jan 18, 2025
b331fe2
Add test to show the latest recorded height is set on init
MitchTurner Jan 20, 2025
b3da4da
Update CHANGELOG
MitchTurner Jan 20, 2025
cdfec32
Apply fix to shared sequencer service
MitchTurner Jan 20, 2025
b3540ce
Avoid creating extra storage tx
MitchTurner Jan 20, 2025
2f021af
Add missed commit
MitchTurner Jan 20, 2025
c57b645
Add missing api endpoints
MitchTurner Jan 20, 2025
575c28f
Appease Clippy-sama
MitchTurner Jan 20, 2025
6be00a7
Merge branch 'fix-url-scheme' into set-latest-recorded-height-on-startup
MitchTurner Jan 20, 2025
449bd41
Merge branch 'master' into set-latest-recorded-height-on-startup
MitchTurner Jan 21, 2025
25bca69
Merge branch 'master' into set-latest-recorded-height-on-startup
MitchTurner Jan 21, 2025
dc13c4e
Fix failing test
MitchTurner Jan 21, 2025
76f5b43
Include `--starting-recorded-height` in `cli` flags
MitchTurner Jan 21, 2025
6a44c23
Remove unused imports
MitchTurner Jan 21, 2025
fd0b38e
Remove unused imports
MitchTurner Jan 21, 2025
21edb4f
Merge branch 'master' into set-latest-recorded-height-on-startup
MitchTurner Jan 21, 2025
ab55e3f
Rename cli arg
MitchTurner Jan 22, 2025
3316f76
Merge branch 'master' into set-latest-recorded-height-on-startup
MitchTurner Jan 22, 2025
e18acd0
Merge branch 'master' into set-latest-recorded-height-on-startup
MitchTurner Jan 22, 2025
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: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
### Added
- [2551](https://github.com/FuelLabs/fuel-core/pull/2551): Enhanced the DA compressed block header to include block id.

### Changed
- [2603](https://github.com/FuelLabs/fuel-core/pull/2603): Sets the latest recorded height on initialization, not just when DA costs are received

### Fixed
- [2609](https://github.com/FuelLabs/fuel-core/pull/2609): Check response before trying to deserialize, return error instead
- [2599](https://github.com/FuelLabs/fuel-core/pull/2599): Use the proper `url` apis to construct full url path in `BlockCommitterHttpApi` client
Expand Down
7 changes: 7 additions & 0 deletions bin/fuel-core/src/cli/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,11 @@ pub struct Command {
#[arg(long = "da-poll-interval", env)]
pub da_poll_interval: Option<humantime::Duration>,

/// The L2 height the Gas Price Service will assume is already recorded on DA
/// i.e. If you want the Gas Price Service to look for the costs of block 1000, set to 999
#[arg(long = "da-starting-recorded-height", env)]
da_starting_recorded_height: Option<u32>,

/// The signing key used when producing blocks.
/// Setting via the `CONSENSUS_KEY_SECRET` ENV var is preferred.
#[arg(long = "consensus-key", env = "CONSENSUS_KEY_SECRET")]
Expand Down Expand Up @@ -377,6 +382,7 @@ impl Command {
da_gas_price_d_component,
da_committer_url,
da_poll_interval,
da_starting_recorded_height: starting_recorded_height,
consensus_key,
#[cfg(feature = "aws-kms")]
consensus_aws_kms,
Expand Down Expand Up @@ -698,6 +704,7 @@ impl Command {
time_until_synced: time_until_synced.into(),
memory_pool_size,
da_gas_price_factor: NonZeroU64::new(100).expect("100 is not zero"),
starting_recorded_height,
min_da_gas_price,
max_da_gas_price,
max_da_gas_price_change_percent: gas_price_change_percent,
Expand Down
3 changes: 3 additions & 0 deletions crates/fuel-core/src/service/adapters/gas_price_adapters.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@ impl From<Config> for V1AlgorithmConfig {
block_activity_threshold: value.block_activity_threshold,
da_poll_interval: value.da_poll_interval,
gas_price_factor: value.da_gas_price_factor,
starting_recorded_height: value
.starting_recorded_height
.map(BlockHeight::from),
}
}
}
Expand Down
2 changes: 2 additions & 0 deletions crates/fuel-core/src/service/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ pub struct Config {
/// The size of the memory pool in number of `MemoryInstance`s.
pub memory_pool_size: usize,
pub da_gas_price_factor: NonZeroU64,
pub starting_recorded_height: Option<u32>,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can work directly with BlockHeight

pub min_da_gas_price: u64,
pub max_da_gas_price: u64,
pub max_da_gas_price_change_percent: u16,
Expand Down Expand Up @@ -208,6 +209,7 @@ impl Config {
time_until_synced: Duration::ZERO,
memory_pool_size: 4,
da_gas_price_factor: NonZeroU64::new(100).expect("100 is not zero"),
starting_recorded_height: None,
min_da_gas_price: 0,
max_da_gas_price: 1,
max_da_gas_price_change_percent: 0,
Expand Down
2 changes: 2 additions & 0 deletions crates/services/gas_price_service/src/v1/metadata.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use crate::v0::metadata::V0Metadata;
use fuel_core_types::fuel_types::BlockHeight;
use fuel_gas_price_algorithm::v1::{
AlgorithmUpdaterV1,
L2ActivityTracker,
Expand Down Expand Up @@ -80,6 +81,7 @@ pub struct V1AlgorithmConfig {
pub block_activity_threshold: u8,
/// The interval at which the `DaSourceService` polls for new data
pub da_poll_interval: Option<Duration>,
pub starting_recorded_height: Option<BlockHeight>,
}

pub fn updater_from_config(
Expand Down
Loading
Loading