diff --git a/CHANGELOG.md b/CHANGELOG.md index bb59f510abd..3eedcea8a52 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - [#1980](https://github.com/FuelLabs/fuel-core/pull/1980): Add `Transaction` to relayer 's event filter #### Breaking +- [#2012](https://github.com/FuelLabs/fuel-core/pull/2012): Bumped the `fuel-vm` to `0.55.0` release. More about the change [here](https://github.com/FuelLabs/fuel-vm/releases/tag/v0.55.0). - [#2001](https://github.com/FuelLabs/fuel-core/pull/2001): Prevent GraphQL query body to be huge and cause OOM. The default body size is `1MB`. The limit can be changed by the `graphql-request-body-bytes-limit` CLI argument. - [#1991](https://github.com/FuelLabs/fuel-core/pull/1991): Prepare the database to use different types than `Database` for atomic view. - [#1989](https://github.com/FuelLabs/fuel-core/pull/1989): Extract `HistoricalView` trait from the `AtomicView`. diff --git a/Cargo.lock b/Cargo.lock index 6abdd41073e..6cf4193e7ab 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2773,9 +2773,9 @@ dependencies = [ [[package]] name = "fuel-asm" -version = "0.54.1" +version = "0.55.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7239ac2ecda5c5cf0bbfb407e7ab59142593cd4625da2d3d7100e7ace8d3e49c" +checksum = "491f1777538b0e1d479609d0d75bca5242c7fd3394f2ddd4ea55b8c96bcc8387" dependencies = [ "bitflags 2.6.0", "fuel-types", @@ -3387,9 +3387,9 @@ dependencies = [ [[package]] name = "fuel-crypto" -version = "0.54.1" +version = "0.55.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55716f388824a64be7a18bd5f2b06549717dbd9fdad8af02546e889c78b07327" +checksum = "f74f03ba9b27f375a0482b1afe20d5b8cfd032fedba683a584cdbd6d10147439" dependencies = [ "coins-bip32", "coins-bip39", @@ -3408,9 +3408,9 @@ dependencies = [ [[package]] name = "fuel-derive" -version = "0.54.1" +version = "0.55.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8324301ea89931f544f63cd5907e414bfd1bfb3013f5b99afa9dda00504b194" +checksum = "89ad30ad1a11e5a811ae67b6b0cb6785ce21bcd5ef0afd442fd963d5be95d09d" dependencies = [ "proc-macro2", "quote", @@ -3427,9 +3427,9 @@ dependencies = [ [[package]] name = "fuel-merkle" -version = "0.54.1" +version = "0.55.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18f0b623f77576fcfa60a624c56ebf310bf7433da6d8fa6407dfb7e95ebeb8c3" +checksum = "5433c41ffbf531eed1380148cd68e37f9dd7e25966a9c59518f6b09e346e80e2" dependencies = [ "derive_more", "digest 0.10.7", @@ -3442,15 +3442,15 @@ dependencies = [ [[package]] name = "fuel-storage" -version = "0.54.1" +version = "0.55.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8be80f1cf059ac87c63fa21b5fa3036472bdb4757c3ba5bae16f0256651e37a1" +checksum = "ce3fc3cd96fe312442cdf35966b96d66becd02582b505f856f74953f57adf020" [[package]] name = "fuel-tx" -version = "0.54.1" +version = "0.55.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6142c7fd2bf2b1686dee63eb06a06fbb41e453ecb74a4a0c9031156669086f5" +checksum = "e00cc42ae3121b1881a6ae8306696d1bea73adca424216d9f676ee91d3927c74" dependencies = [ "bitflags 2.6.0", "derivative", @@ -3471,9 +3471,9 @@ dependencies = [ [[package]] name = "fuel-types" -version = "0.54.1" +version = "0.55.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38056e7a2b4def574a02e5c9859ffc084e17e565525b5e4a93af6249137d9ca0" +checksum = "ae98e143dec4e6cb114a92435e314f1d4815e17e8fded24332fb285319d60167" dependencies = [ "fuel-derive", "hex", @@ -3483,9 +3483,9 @@ dependencies = [ [[package]] name = "fuel-vm" -version = "0.54.1" +version = "0.55.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f050af48f6028f2edcc5469e9522ce12b5be6d0761c3cfe7175dea9784e9596" +checksum = "641a2ee5a3398633fa243fba3343cbe2225ae335a09141f6b94041720cfc3520" dependencies = [ "anyhow", "async-trait", diff --git a/Cargo.toml b/Cargo.toml index 2aa764290eb..ad33c966879 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -85,7 +85,7 @@ fuel-core-xtask = { version = "0.0.0", path = "./xtask" } fuel-gas-price-algorithm = { version = "0.30.0", path = "crates/fuel-gas-price-algorithm" } # Fuel dependencies -fuel-vm-private = { version = "0.54.1", package = "fuel-vm", default-features = false } +fuel-vm-private = { version = "0.55.0", package = "fuel-vm", default-features = false } # Common dependencies anyhow = "1.0" diff --git a/bin/fuel-core/chainspec/local-testnet/state_transition_bytecode.wasm b/bin/fuel-core/chainspec/local-testnet/state_transition_bytecode.wasm index 9a097580b17..9907ada7564 100755 Binary files a/bin/fuel-core/chainspec/local-testnet/state_transition_bytecode.wasm and b/bin/fuel-core/chainspec/local-testnet/state_transition_bytecode.wasm differ diff --git a/crates/fuel-core/src/database/storage.rs b/crates/fuel-core/src/database/storage.rs index 1bce54d0070..d00e292963f 100644 --- a/crates/fuel-core/src/database/storage.rs +++ b/crates/fuel-core/src/database/storage.rs @@ -23,7 +23,7 @@ where StructuredStorage: StorageInspect, for<'a> StorageTransaction<&'a Storage>: StorageMutate, { - fn insert( + fn replace( &mut self, key: &M::Key, value: &M::Value, @@ -33,18 +33,18 @@ where ConflictPolicy::Overwrite, Default::default(), ); - let prev = transaction.storage_as_mut::().insert(key, value)?; + let prev = transaction.storage_as_mut::().replace(key, value)?; self.commit_changes(transaction.into_changes())?; Ok(prev) } - fn remove(&mut self, key: &M::Key) -> Result, Self::Error> { + fn take(&mut self, key: &M::Key) -> Result, Self::Error> { let mut transaction = StorageTransaction::transaction( self.as_ref(), ConflictPolicy::Overwrite, Default::default(), ); - let prev = transaction.storage_as_mut::().remove(key)?; + let prev = transaction.storage_as_mut::().take(key)?; self.commit_changes(transaction.into_changes())?; Ok(prev) } @@ -57,18 +57,18 @@ where for<'a> StorageTransaction<&'a Storage>: StorageWrite, Self: Modifiable, { - fn write(&mut self, key: &M::Key, buf: &[u8]) -> Result { + fn write_bytes(&mut self, key: &M::Key, buf: &[u8]) -> Result { let mut transaction = StorageTransaction::transaction( self.as_ref(), ConflictPolicy::Overwrite, Default::default(), ); - let prev = <_ as StorageWrite>::write(&mut transaction, key, buf)?; + let prev = <_ as StorageWrite>::write_bytes(&mut transaction, key, buf)?; self.commit_changes(transaction.into_changes())?; Ok(prev) } - fn replace( + fn replace_bytes( &mut self, key: &M::Key, buf: &[u8], @@ -78,18 +78,18 @@ where ConflictPolicy::Overwrite, Default::default(), ); - let prev = <_ as StorageWrite>::replace(&mut transaction, key, buf)?; + let prev = <_ as StorageWrite>::replace_bytes(&mut transaction, key, buf)?; self.commit_changes(transaction.into_changes())?; Ok(prev) } - fn take(&mut self, key: &M::Key) -> Result>, Self::Error> { + fn take_bytes(&mut self, key: &M::Key) -> Result>, Self::Error> { let mut transaction = StorageTransaction::transaction( self.as_ref(), ConflictPolicy::Overwrite, Default::default(), ); - let prev = <_ as StorageWrite>::take(&mut transaction, key)?; + let prev = <_ as StorageWrite>::take_bytes(&mut transaction, key)?; self.commit_changes(transaction.into_changes())?; Ok(prev) } diff --git a/crates/fuel-core/src/graphql_api/ports.rs b/crates/fuel-core/src/graphql_api/ports.rs index d02cbef5729..4f535ff0d3e 100644 --- a/crates/fuel-core/src/graphql_api/ports.rs +++ b/crates/fuel-core/src/graphql_api/ports.rs @@ -312,7 +312,7 @@ pub mod worker { block_height: BlockHeight, tx_idx: u16, tx_id: &Bytes32, - ) -> StorageResult>; + ) -> StorageResult<()>; fn update_tx_status( &mut self, diff --git a/crates/fuel-core/src/graphql_api/storage.rs b/crates/fuel-core/src/graphql_api/storage.rs index 50f5adb6162..90f54f7f9f2 100644 --- a/crates/fuel-core/src/graphql_api/storage.rs +++ b/crates/fuel-core/src/graphql_api/storage.rs @@ -129,7 +129,7 @@ where block_height: BlockHeight, tx_idx: u16, tx_id: &Bytes32, - ) -> StorageResult> { + ) -> StorageResult<()> { self.storage::().insert( &OwnedTransactionIndexKey::new(owner, block_height, tx_idx), tx_id, @@ -141,7 +141,7 @@ where id: &Bytes32, status: TransactionStatus, ) -> StorageResult> { - self.storage::().insert(id, &status) + self.storage::().replace(id, &status) } fn increase_tx_count(&mut self, new_txs_count: u64) -> StorageResult { diff --git a/crates/fuel-core/src/service/genesis/importer/on_chain.rs b/crates/fuel-core/src/service/genesis/importer/on_chain.rs index fa3ad50e926..6f1395b43ee 100644 --- a/crates/fuel-core/src/service/genesis/importer/on_chain.rs +++ b/crates/fuel-core/src/service/genesis/importer/on_chain.rs @@ -220,7 +220,7 @@ fn init_coin( if transaction .storage::() - .insert(&utxo_id, &compressed_coin)? + .replace(&utxo_id, &compressed_coin)? .is_some() { return Err(anyhow!("Coin should not exist")); @@ -244,7 +244,7 @@ fn init_contract_latest_utxo( if transaction .storage::() - .insert(&contract_id, &entry.value)? + .replace(&contract_id, &entry.value)? .is_some() { return Err(anyhow!("Contract utxo should not exist")); @@ -263,7 +263,7 @@ fn init_contract_raw_code( // insert contract code if transaction .storage::() - .insert(&contract_id, contract)? + .replace(&contract_id, contract)? .is_some() { return Err(anyhow!("Contract code should not exist")); @@ -287,7 +287,7 @@ fn init_da_message( if transaction .storage::() - .insert(message.id(), &message)? + .replace(message.id(), &message)? .is_some() { return Err(anyhow!("Message should not exist")); diff --git a/crates/fuel-core/src/state/historical_rocksdb.rs b/crates/fuel-core/src/state/historical_rocksdb.rs index 494b55e6607..3ac2d3c598c 100644 --- a/crates/fuel-core/src/state/historical_rocksdb.rs +++ b/crates/fuel-core/src/state/historical_rocksdb.rs @@ -197,7 +197,7 @@ where let old_changes = storage_transaction .storage_as_mut::>() - .insert(&height_u64, &reverse_changes)?; + .replace(&height_u64, &reverse_changes)?; if let Some(old_changes) = old_changes { tracing::warn!( @@ -269,7 +269,7 @@ where let last_changes = storage_transaction .storage_as_mut::>() - .remove(&latest_height)? + .take(&latest_height)? .ok_or(not_found!(ModificationsHistory))?; remove_historical_modifications( @@ -312,7 +312,7 @@ where let old_changes = storage_transaction .storage_as_mut::>() - .remove(&old_height)?; + .take(&old_height)?; if let Some(old_changes) = old_changes { remove_historical_modifications( diff --git a/crates/services/executor/src/executor.rs b/crates/services/executor/src/executor.rs index d890b1720f7..4993ecbd30c 100644 --- a/crates/services/executor/src/executor.rs +++ b/crates/services/executor/src/executor.rs @@ -1251,7 +1251,7 @@ where if storage_tx .storage::() - .insert(&coinbase_id, &())? + .replace(&coinbase_id, &())? .is_some() { return Err(ExecutorError::TransactionIdCollision(coinbase_id)) @@ -1637,7 +1637,7 @@ where // prune utxo from db let coin = db .storage::() - .remove(utxo_id) + .take(utxo_id) .map_err(Into::into) .transpose() .unwrap_or_else(|| { @@ -1666,7 +1666,7 @@ where // and cleanup message contents let message = db .storage::() - .remove(nonce)? + .take(nonce)? .ok_or(ExecutorError::MessageDoesNotExist(*nonce))?; execution_data .events @@ -1981,7 +1981,7 @@ where } .into(); - if db.storage::().insert(&utxo_id, &coin)?.is_some() { + if db.storage::().replace(&utxo_id, &coin)?.is_some() { return Err(ExecutorError::OutputAlreadyExists) } execution_data diff --git a/crates/services/importer/src/ports.rs b/crates/services/importer/src/ports.rs index ee1952b335c..a98f88739f0 100644 --- a/crates/services/importer/src/ports.rs +++ b/crates/services/importer/src/ports.rs @@ -139,18 +139,18 @@ where let height = block.entity.header().height(); let mut found = storage .storage_as_mut::() - .insert(height, &block.entity.compress(chain_id))? + .replace(height, &block.entity.compress(chain_id))? .is_some(); found |= storage .storage_as_mut::() - .insert(height, &block.consensus)? + .replace(height, &block.consensus)? .is_some(); // TODO: Use `batch_insert` from https://github.com/FuelLabs/fuel-core/pull/1576 for tx in block.entity.transactions() { found |= storage .storage_as_mut::() - .insert(&tx.id(chain_id), tx)? + .replace(&tx.id(chain_id), tx)? .is_some(); } storage.commit()?; diff --git a/crates/storage/src/blueprint/merklized.rs b/crates/storage/src/blueprint/merklized.rs index 81cd86d1842..df456169f0b 100644 --- a/crates/storage/src/blueprint/merklized.rs +++ b/crates/storage/src/blueprint/merklized.rs @@ -174,12 +174,12 @@ where let key_encoder = KeyCodec::encode(key); let key_bytes = key_encoder.as_bytes(); let encoded_value = ValueCodec::encode_as_value(value); - let prev = storage - .replace(key_bytes.as_ref(), column, encoded_value)? - .map(|value| { - ValueCodec::decode_from_value(value).map_err(StorageError::Codec) - }) - .transpose()?; + let prev = + KeyValueMutate::replace(storage, key_bytes.as_ref(), column, encoded_value)? + .map(|value| { + ValueCodec::decode_from_value(value).map_err(StorageError::Codec) + }) + .transpose()?; if prev.is_some() { Self::remove(storage, key_bytes.as_ref(), column)?; @@ -198,8 +198,7 @@ where let key_encoder = KeyCodec::encode(key); let key_bytes = key_encoder.as_bytes(); Self::remove(storage, key_bytes.as_ref(), column)?; - let prev = storage - .take(key_bytes.as_ref(), column)? + let prev = KeyValueMutate::take(storage, key_bytes.as_ref(), column)? .map(|value| { ValueCodec::decode_from_value(value).map_err(StorageError::Codec) }) diff --git a/crates/storage/src/blueprint/sparse.rs b/crates/storage/src/blueprint/sparse.rs index 0e77cf4a8cc..cffd2a1ccdd 100644 --- a/crates/storage/src/blueprint/sparse.rs +++ b/crates/storage/src/blueprint/sparse.rs @@ -212,12 +212,12 @@ where let key_encoder = KeyCodec::encode(key); let key_bytes = key_encoder.as_bytes(); let value = ValueCodec::encode_as_value(value); - let prev = storage - .replace(key_bytes.as_ref(), column, value.clone())? - .map(|value| { - ValueCodec::decode_from_value(value).map_err(StorageError::Codec) - }) - .transpose()?; + let prev = + KeyValueMutate::replace(storage, key_bytes.as_ref(), column, value.clone())? + .map(|value| { + ValueCodec::decode_from_value(value).map_err(StorageError::Codec) + }) + .transpose()?; Self::insert_into_tree(storage, key, key_bytes.as_ref(), value.as_ref())?; Ok(prev) @@ -230,8 +230,7 @@ where ) -> StorageResult> { let key_encoder = KeyCodec::encode(key); let key_bytes = key_encoder.as_bytes(); - let prev = storage - .take(key_bytes.as_ref(), column)? + let prev = KeyValueMutate::take(storage, key_bytes.as_ref(), column)? .map(|value| { ValueCodec::decode_from_value(value).map_err(StorageError::Codec) }) @@ -641,7 +640,7 @@ macro_rules! root_storage_tests { // Then let result = storage_transaction .storage_as_mut::<$table>() - .insert(&given_key, &state_value) + .replace(&given_key, &state_value) .unwrap(); assert!(result.is_some()); diff --git a/crates/storage/src/structured_storage.rs b/crates/storage/src/structured_storage.rs index 8f0c83290d7..93d1b741496 100644 --- a/crates/storage/src/structured_storage.rs +++ b/crates/storage/src/structured_storage.rs @@ -235,7 +235,11 @@ where M: TableWithBlueprint, M::Blueprint: BlueprintMutate>, { - fn insert( + fn insert(&mut self, key: &M::Key, value: &M::Value) -> Result<(), Self::Error> { + ::Blueprint::put(self, key, M::column(), value) + } + + fn replace( &mut self, key: &M::Key, value: &M::Value, @@ -243,7 +247,11 @@ where ::Blueprint::replace(self, key, M::column(), value) } - fn remove(&mut self, key: &M::Key) -> Result, Self::Error> { + fn remove(&mut self, key: &M::Key) -> Result<(), Self::Error> { + ::Blueprint::delete(self, key, M::column()) + } + + fn take(&mut self, key: &M::Key) -> Result, Self::Error> { ::Blueprint::take(self, key, M::column()) } } @@ -348,12 +356,12 @@ where // without deserialization into `OwnedValue`. M::OwnedValue: Into>, { - fn write(&mut self, key: &M::Key, buf: &[u8]) -> Result { + fn write_bytes(&mut self, key: &M::Key, buf: &[u8]) -> Result { ::Blueprint::put(self, key, M::column(), buf) .map(|_| buf.len()) } - fn replace( + fn replace_bytes( &mut self, key: &M::Key, buf: &[u8], @@ -366,7 +374,7 @@ where Ok(result) } - fn take(&mut self, key: &M::Key) -> Result>, Self::Error> { + fn take_bytes(&mut self, key: &M::Key) -> Result>, Self::Error> { let take = ::Blueprint::take(self, key, M::column())? .map(|value| value.into()); Ok(take) diff --git a/crates/storage/src/structured_storage/state.rs b/crates/storage/src/structured_storage/state.rs index ca48a6e4eea..755e880311e 100644 --- a/crates/storage/src/structured_storage/state.rs +++ b/crates/storage/src/structured_storage/state.rs @@ -139,8 +139,12 @@ mod structured_storage_tests { .root(&contract_id) .expect("Unable to retrieve Merkle root"); for key in keys.iter() { - <_ as StorageWrite>::write(&mut structure, key, &value) - .expect("Unable to write storage"); + <_ as StorageWrite>::write_bytes( + &mut structure, + key, + &value, + ) + .expect("Unable to write storage"); let new_merkle_root = structure .storage::() .root(&contract_id) @@ -196,8 +200,12 @@ mod structured_storage_tests { .root(&contract_id) .expect("Unable to retrieve Merkle root"); for key in keys.iter() { - <_ as StorageWrite>::replace(&mut structure, key, &value) - .expect("Unable to write storage"); + <_ as StorageWrite>::replace_bytes( + &mut structure, + key, + &value, + ) + .expect("Unable to write storage"); let new_merkle_root = structure .storage::() .root(&contract_id) @@ -251,8 +259,12 @@ mod structured_storage_tests { .root(&contract_id) .expect("Unable to retrieve Merkle root"); for key in keys.iter() { - <_ as StorageWrite>::replace(&mut structure, key, &value) - .expect("Unable to write storage"); + <_ as StorageWrite>::replace_bytes( + &mut structure, + key, + &value, + ) + .expect("Unable to write storage"); let new_merkle_root = structure .storage::() @@ -267,10 +279,14 @@ mod structured_storage_tests { let key = ContractsStateKey::from((&contract_id, &state_key)); let merkle_root_replace = { - <_ as StorageWrite>::write(&mut structure, &key, &value) - .expect("Unable to write storage"); - - <_ as StorageWrite>::take(&mut structure, &key) + <_ as StorageWrite>::write_bytes( + &mut structure, + &key, + &value, + ) + .expect("Unable to write storage"); + + <_ as StorageWrite>::take_bytes(&mut structure, &key) .expect("Unable to take value from storage"); structure @@ -281,8 +297,12 @@ mod structured_storage_tests { // Then let merkle_root_remove = { - <_ as StorageWrite>::write(&mut structure, &key, &value) - .expect("Unable to write storage"); + <_ as StorageWrite>::write_bytes( + &mut structure, + &key, + &value, + ) + .expect("Unable to write storage"); structure .storage::() diff --git a/crates/storage/src/test_helpers.rs b/crates/storage/src/test_helpers.rs index f6fb5d019e7..5967b5c7920 100644 --- a/crates/storage/src/test_helpers.rs +++ b/crates/storage/src/test_helpers.rs @@ -111,7 +111,7 @@ where M: Mappable + 'static, Storage: MockStorageMethods, { - fn insert( + fn replace( &mut self, key: &M::Key, value: &M::Value, @@ -119,7 +119,7 @@ where MockStorageMethods::insert::(&mut self.storage, key, value) } - fn remove(&mut self, key: &M::Key) -> StorageResult> { + fn take(&mut self, key: &M::Key) -> StorageResult> { MockStorageMethods::remove::(&mut self.storage, key) } } diff --git a/crates/storage/src/vm_storage.rs b/crates/storage/src/vm_storage.rs index 2eeea092fa0..666b565743c 100644 --- a/crates/storage/src/vm_storage.rs +++ b/crates/storage/src/vm_storage.rs @@ -144,17 +144,25 @@ impl StorageMutate for VmStorage where D: StorageMutate, { - fn insert( + fn insert(&mut self, key: &M::Key, value: &M::Value) -> Result<(), Self::Error> { + StorageMutate::::insert(&mut self.database, key, value) + } + + fn replace( &mut self, key: &M::Key, value: &M::Value, ) -> Result, Self::Error> { - StorageMutate::::insert(&mut self.database, key, value) + StorageMutate::::replace(&mut self.database, key, value) } - fn remove(&mut self, key: &M::Key) -> Result, Self::Error> { + fn remove(&mut self, key: &M::Key) -> Result<(), Self::Error> { StorageMutate::::remove(&mut self.database, key) } + + fn take(&mut self, key: &M::Key) -> Result, Self::Error> { + StorageMutate::::take(&mut self.database, key) + } } impl StorageSize for VmStorage @@ -186,20 +194,20 @@ impl StorageWrite for VmStorage where D: StorageWrite, { - fn write(&mut self, key: &M::Key, buf: &[u8]) -> Result { - StorageWrite::::write(&mut self.database, key, buf) + fn write_bytes(&mut self, key: &M::Key, buf: &[u8]) -> Result { + StorageWrite::::write_bytes(&mut self.database, key, buf) } - fn replace( + fn replace_bytes( &mut self, key: &M::Key, buf: &[u8], ) -> Result<(usize, Option>), Self::Error> { - StorageWrite::::replace(&mut self.database, key, buf) + StorageWrite::::replace_bytes(&mut self.database, key, buf) } - fn take(&mut self, key: &M::Key) -> Result>, Self::Error> { - StorageWrite::::take(&mut self.database, key) + fn take_bytes(&mut self, key: &M::Key) -> Result>, Self::Error> { + StorageWrite::::take_bytes(&mut self.database, key) } } @@ -283,7 +291,7 @@ where ) -> Result, Self::DataError> { self.database .storage_as_mut::() - .insert(&version, consensus_parameters) + .replace(&version, consensus_parameters) } fn set_state_transition_bytecode( @@ -293,7 +301,7 @@ where ) -> Result, Self::DataError> { self.database .storage_as_mut::() - .insert(&version, hash) + .replace(&version, hash) } fn deploy_contract_with_id( @@ -355,7 +363,7 @@ where let option = self .database .storage::() - .insert(&(contract_id, &key_bytes).into(), value)?; + .replace(&(contract_id, &key_bytes).into(), value)?; if option.is_none() { found_unset = found_unset @@ -386,7 +394,7 @@ where let option = self .database .storage::() - .remove(&(contract_id, &key_bytes).into())?; + .take(&(contract_id, &key_bytes).into())?; found_unset |= option.is_none();