Skip to content

Commit

Permalink
Revert blanket impl for SetMetadataStorage
Browse files Browse the repository at this point in the history
  • Loading branch information
MitchTurner committed Dec 9, 2024
1 parent 497d1f0 commit f26b024
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
3 changes: 2 additions & 1 deletion crates/fuel-core/src/service/sub_services.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ use fuel_core_poa::{
};
use fuel_core_storage::{
self,
structured_storage::StructuredStorage,
transactional::AtomicView,
};
#[cfg(feature = "relayer")]
Expand Down Expand Up @@ -189,7 +190,7 @@ pub fn init_sub_services(
settings,
block_stream,
database.gas_price().clone(),
metadata,
StructuredStorage::new(metadata),
database.on_chain().clone(),
)?;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ use fuel_core_storage::{
Encode,
},
kv_store::KeyValueInspect,
structured_storage::StructuredStorage,
transactional::{
Modifiable,
StorageTransaction,
Expand Down Expand Up @@ -59,15 +60,17 @@ mod metadata_tests;

pub mod storage;

impl<Storage> SetMetadataStorage for Storage
impl<Storage> SetMetadataStorage for StructuredStorage<Storage>
where
Storage: Send + Sync,
Storage: StorageMutate<GasPriceMetadata, Error = StorageError>,
Storage: KeyValueInspect<Column = GasPriceColumn> + Modifiable,
{
fn set_metadata(&mut self, metadata: &UpdaterMetadata) -> GasPriceResult<()> {
let block_height = metadata.l2_block_height();
self.storage_as_mut::<GasPriceMetadata>()
let mut tx = self.write_transaction();
tx.storage_as_mut::<GasPriceMetadata>()
.insert(&block_height, metadata)
.and_then(|_| tx.commit())
.map_err(|err| GasPriceError::CouldNotSetMetadata {
block_height,
source_error: err.into(),
Expand Down

0 comments on commit f26b024

Please sign in to comment.