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

chore(gas_price_service): use port for GasPriceSettings instead of concrete type #2245

Closed

Conversation

rymnc
Copy link
Member

@rymnc rymnc commented Sep 24, 2024

Note

This is PR 4/n in cleaning up the gas price service.
Please review #2230 before getting to this one ;)

Linked Issues/PRs

Description

Used the existing port for GasPriceSettingsProvider and made the algorithm updater generic over it. the algorithm_updater can be moved to the fuel-core-gas-price-service crate after this.

Checklist

  • Breaking changes are clearly marked as such in the PR description and changelog
  • New behavior is reflected in tests
  • The specification matches the implemented behavior (link update PR if changes are needed)

Before requesting review

  • 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]

@rymnc rymnc added the no changelog Skip the CI check of the changelog modification label Sep 24, 2024
@rymnc rymnc self-assigned this Sep 24, 2024
@rymnc rymnc marked this pull request as ready for review September 24, 2024 10:14
Copy link
Member

@MitchTurner MitchTurner left a comment

Choose a reason for hiding this comment

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

At risk of being obvious: this makes sense since it's all getting merged into the GasPriceService. It would be an overuse of the port to leave it on some external system, i.e. InitializationTask.

rymnc added a commit that referenced this pull request Sep 25, 2024
…ce-service (#2246)

> [!NOTE]
> This is PR 5/n in cleaning up the gas price service.
> Please review #2245 before
getting to this one ;)

## Linked Issues/PRs
<!-- List of related issues/PRs -->
- #2245

## Description
<!-- List of detailed changes -->
- Moves the `algorithm_updater` into `fuel-core-gas-price-service` now
that it has no dependencies on fuel-core and relies on the ports we have
created in previous PRs.

## Checklist
- [x] Breaking changes are clearly marked as such in the PR description
and changelog
- [x] New behavior is reflected in tests
- [x] [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: Mitchell Turner <james.mitchell.turner@gmail.com>
Co-authored-by: Green Baneling <XgreenX9999@gmail.com>
@rymnc
Copy link
Member Author

rymnc commented Sep 25, 2024

already merged into master

@rymnc rymnc closed this Sep 25, 2024
@rymnc rymnc deleted the chore/gas-price-service-ports-p4 branch September 25, 2024 15:09
rymnc added a commit that referenced this pull request Oct 2, 2024
…eUpdater type into GasPriceService (#2256)

> [!WARNING]
> 🚧🚧 This is PR 6/n in refactoring the gas price service. Now that the
`algorithm_updater` is a part of `fuel-core-gas-price-service` we have
squashed it into the `GasPriceService` using the `UninitializedTask`
struct. We don't implement `RunnableService` *or* `RunnableTask` for the
`UninitializedTask` struct, merely use it as a wrapper to generate the
`GasPriceServiceV0` 🚧🚧


## Linked Issues/PRs
<!-- List of related issues/PRs -->
- #2246
- #2245
- #2230
- #2226
- #2224
- #2192

## Description
<!-- List of detailed changes -->
- created common module containing storage adapter, l2 block source and
some updater metadata stuff (linked to storage)
- created v0 module containing impl of GasPriceAlgorithm for
AlgorithmV0, and V0metadata stuff
- created v1 module containing impl of GasPriceAlgorithm for AlgorithmV1
& da block costs source (V1Metadata didn’t exist before so i didn’t
create it)
- fuel-gas-price-updater will be nuked, an
UninitializedGasPriceServiceV(x) for each version that takes in all the
args needed

```mermaid
graph TD                                                                                                                                                                                                  
     A["lib.rs (entry point)"]                                                                                                                                                                               
     B[common]                                                                                                                                                                                             
     B1[utils]                                                                                                                                                                                             
     B2[storage]                                                                                                                                                                                           
     B3[l2_block_source]                                                                                                                                                                                   
     C[ports]                                                                                                                                                                                              
     D[v0]                                                                                                                                                                                                 
     E[v1]                                                                                                                                                                                                 
     F[v0/algorithm]                                                                                                                                                                                       
     G[v1/algorithm]                                                                                                                                                                                       
     H[v0/service]                                                                                                                                                                                         
     I[v1/da_source]                                                                                                                                                                                       
     J[v0/metadata]                                                                                                                                                                                        
     K[v1/service]                                                                                                                                                                                         
     L[v0/uninitialized]                                                                                                                                                                                   
                                                                                                                                                                                                           
     A --> B                                                                                                                                                                                               
     B --> B1                                                                                                                                                                                              
     B --> B2                                                                                                                                                                                              
     B --> B3                                                                                                                                                                                              
     B --> C                                                                                                                                                                                               
     C --> D                                                                                                                                                                                               
     C --> E                                                                                                                                                                                               
     D --> F                                                                                                                                                                                               
     D --> H                                                                                                                                                                                               
     D --> J                                                                                                                                                                                               
     D --> L                                                                                                                                                                                               
     E --> G                                                                                                                                                                                               
     E --> I                                                                                                                                                                                               
     E --> K                                                                                                                                                                                               
     F --> H                                                                                                                                                                                               
     G --> I                                                                                                                                                                                               
     H --> J                                                                                                                                                                                               
     J --> L                                                                                                                                                                                               
     L --> M[SharedV0Algorithm]                                                                                                                                                                            
     L --> N[GasPriceServiceV0]                                                                                                                                                                            
                                                                                                                                                                                                           
     subgraph Common                                                                                                                                                                                       
         B                                                                                                                                                                                                 
         B1                                                                                                                                                                                                
         B2                                                                                                                                                                                                
         B3                                                                                                                                                                                                
     end                                                                                                                                                                                                   
                                                                                                                                                                                                           
     subgraph Ports                                                                                                                                                                                        
         C                                                                                                                                                                                                 
     end                                                                                                                                                                                                   
                                                                                                                                                                                                           
     subgraph V0                                                                                                                                                                                           
         D                                                                                                                                                                                                 
         F                                                                                                                                                                                                 
         H                                                                                                                                                                                                 
         J                                                                                                                                                                                                 
         L                                                                                                                                                                                                 
     end                                                                                                                                                                                                   
                                                                                                                                                                                                           
     subgraph V1                                                                                                                                                                                           
         E                                                                                                                                                                                                 
         G                                                                                                                                                                                                 
         I                                                                                                                                                                                                 
         K                                                                                                                                                                                                 
     end                                                                                                                                                                                               
```

## Checklist
- [x] Breaking changes are clearly marked as such in the PR description
and changelog
- [x] New behavior is reflected in tests
- [x] [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?

---------
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
no changelog Skip the CI check of the changelog modification
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants