-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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(storage): use the cached block height from the database at the time of creation of the view #2639
Merged
AurelienFT
merged 5 commits into
release/v0.40.4
from
fix/graphql-storage-read-for-height
Jan 28, 2025
Merged
chore(storage): use the cached block height from the database at the time of creation of the view #2639
AurelienFT
merged 5 commits into
release/v0.40.4
from
fix/graphql-storage-read-for-height
Jan 28, 2025
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…time of creation of the view Co-authored-by: Green Baneling <[email protected]>
AurelienFT
approved these changes
Jan 28, 2025
This reverts commit 526eca6.
AurelienFT
approved these changes
Jan 28, 2025
AurelienFT
added a commit
that referenced
this pull request
Jan 28, 2025
## Version 0.40.4 ### Changed - [2639](#2639): Refactor fetching `latest_height` from `OnChainIterableKeyValueView` to instead use height at the time of its creation. ### Fixed - [2638](#2638): Optimize the `cumulative_percent_change` function used in estimation of gas price, convert multiple async functions to sync.
9 tasks
rymnc
added a commit
that referenced
this pull request
Feb 11, 2025
…ime of creation of the view (#2646) ## Linked Issues/PRs <!-- List of related issues/PRs --> - same as #2639, but for master ## Description <!-- List of detailed changes --> The most important changes include adding metadata support to the `GenericDatabase`, modifying type definitions to include height metadata, and updating various methods to use the new database structure. ### Database Structure Improvements: * [`crates/fuel-core/src/database.rs`](diffhunk://#diff-c95a3d57a39feac7c8c2f3b193a24eec39e794413adc741df36450f9a4539898R28): Added metadata support to the `GenericDatabase` and updated type definitions to include height metadata. This includes changes to methods such as `new`, `in_memory`, and `latest_view`. [[1]](diffhunk://#diff-c95a3d57a39feac7c8c2f3b193a24eec39e794413adc741df36450f9a4539898R28) [[2]](diffhunk://#diff-c95a3d57a39feac7c8c2f3b193a24eec39e794413adc741df36450f9a4539898R64-L73) [[3]](diffhunk://#diff-c95a3d57a39feac7c8c2f3b193a24eec39e794413adc741df36450f9a4539898R83-R89) [[4]](diffhunk://#diff-c95a3d57a39feac7c8c2f3b193a24eec39e794413adc741df36450f9a4539898L129-R138) [[5]](diffhunk://#diff-c95a3d57a39feac7c8c2f3b193a24eec39e794413adc741df36450f9a4539898L144-R152) [[6]](diffhunk://#diff-c95a3d57a39feac7c8c2f3b193a24eec39e794413adc741df36450f9a4539898L179-R190) [[7]](diffhunk://#diff-c95a3d57a39feac7c8c2f3b193a24eec39e794413adc741df36450f9a4539898L190-R209) [[8]](diffhunk://#diff-c95a3d57a39feac7c8c2f3b193a24eec39e794413adc741df36450f9a4539898L238-R259) [[9]](diffhunk://#diff-c95a3d57a39feac7c8c2f3b193a24eec39e794413adc741df36450f9a4539898L257-R274) [[10]](diffhunk://#diff-c95a3d57a39feac7c8c2f3b193a24eec39e794413adc741df36450f9a4539898L270-R290) [[11]](diffhunk://#diff-c95a3d57a39feac7c8c2f3b193a24eec39e794413adc741df36450f9a4539898R346-R369) [[12]](diffhunk://#diff-c95a3d57a39feac7c8c2f3b193a24eec39e794413adc741df36450f9a4539898L344-R378) [[13]](diffhunk://#diff-c95a3d57a39feac7c8c2f3b193a24eec39e794413adc741df36450f9a4539898L354-R396) * [`crates/fuel-core/src/state.rs`](diffhunk://#diff-386ccf4eb5acb74a927c8c9849dfcc59aa78bcf800d9fd89f4e1a6e30f7199f0R33-R51): Updated type definitions for `IterableKeyValueView` and `KeyValueView` to include height metadata. Modified the `TransactableStorage` trait to use the new types. [[1]](diffhunk://#diff-386ccf4eb5acb74a927c8c9849dfcc59aa78bcf800d9fd89f4e1a6e30f7199f0R33-R51) [[2]](diffhunk://#diff-386ccf4eb5acb74a927c8c9849dfcc59aa78bcf800d9fd89f4e1a6e30f7199f0L64-R68) [[3]](diffhunk://#diff-386ccf4eb5acb74a927c8c9849dfcc59aa78bcf800d9fd89f4e1a6e30f7199f0L82-L89) ### Code Refactoring: * [`crates/fuel-core/src/state/generic_database.rs`](diffhunk://#diff-304688e42224bb543ff683ccd9bc78e6432eea2e2868da28fc91ca441e38ea17L31-R60): Refactored the `GenericDatabase` struct to include metadata and updated various trait implementations to support the new structure. [[1]](diffhunk://#diff-304688e42224bb543ff683ccd9bc78e6432eea2e2868da28fc91ca441e38ea17L31-R60) [[2]](diffhunk://#diff-304688e42224bb543ff683ccd9bc78e6432eea2e2868da28fc91ca441e38ea17L67-R76) [[3]](diffhunk://#diff-304688e42224bb543ff683ccd9bc78e6432eea2e2868da28fc91ca441e38ea17L77-R86) [[4]](diffhunk://#diff-304688e42224bb543ff683ccd9bc78e6432eea2e2868da28fc91ca441e38ea17L96-R106) [[5]](diffhunk://#diff-304688e42224bb543ff683ccd9bc78e6432eea2e2868da28fc91ca441e38ea17L106-R116) [[6]](diffhunk://#diff-304688e42224bb543ff683ccd9bc78e6432eea2e2868da28fc91ca441e38ea17L139-R149) [[7]](diffhunk://#diff-304688e42224bb543ff683ccd9bc78e6432eea2e2868da28fc91ca441e38ea17L165-R202) ### Performance Improvements: * [`crates/fuel-core/src/database.rs`](diffhunk://#diff-c95a3d57a39feac7c8c2f3b193a24eec39e794413adc741df36450f9a4539898L144-R152): Improved the `latest_height` method to use metadata for fetching the latest height, enhancing performance. ### Test Updates: * [`crates/fuel-core/src/service/genesis/importer/import_task.rs`](diffhunk://#diff-954b9280f787dd90eda70a58c77f53b3543e8286462d498dcda45536ca7a175fL581-R587): Updated tests to use the new `KeyValueView` and `IterableKeyValueView` types with height metadata. ## Checklist - [ ] Breaking changes are clearly marked as such in the PR description and changelog - [ ] 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 - [ ] 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: Green Baneling <[email protected]> Co-authored-by: Andrea Cerone <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Linked Issues/PRs
Description
This pull request includes several changes to the
crates/fuel-core/src/database.rs
and related files to enhance the handling of metadata within theGenericDatabase
structure. The most important changes include the addition of metadata support, the modification of type definitions to incorporate height types, and updates to various database methods to utilize this new structure.Enhancements to metadata handling:
crates/fuel-core/src/database.rs
: Introduced metadata support in theGenericDatabase
structure and updated related type definitions and methods to incorporate metadata and height types. [1] [2] [3] [4] [5] [6]Updates to type definitions:
crates/fuel-core/src/state.rs
: Modified type definitions forIterableKeyValueView
andKeyValueView
to include height types, and updated theTransactableStorage
trait to reflect these changes. [1] [2] [3]Changes to database methods:
crates/fuel-core/src/database.rs
: Updated methods such aslatest_view
,view_at_height
, andin_memory
to utilize the new metadata structure, ensuring consistent handling of metadata across different database operations. [1] [2] [3]Refactoring and cleanup:
crates/fuel-core/src/database.rs
: Refactored imports and removed redundant code to improve readability and maintainability. [1] [2] [3]Updates to related files:
crates/fuel-core/src/database/storage.rs
: Updated implementations ofStorageMutate
,StorageWrite
, andStorageBatchMutate
to support the new metadata structure. [1] [2] [3]crates/fuel-core/src/state/generic_database.rs
: Added metadata handling methods and updated trait implementations to support metadata. [1] [2] [3] [4] [5] [6] [7]These changes collectively enhance the database's functionality by introducing metadata support and improving the handling of height types, leading to a more robust and flexible database structure.
Checklist
Before requesting review
After merging, notify other teams
[Add or remove entries as needed]