Skip to content

Commit

Permalink
refactor: use mv crate (hyperledger-iroha#5018)
Browse files Browse the repository at this point in the history
Signed-off-by: Shanin Roman <[email protected]>
  • Loading branch information
Erigara authored Sep 1, 2024
1 parent be22388 commit 69b0ea6
Show file tree
Hide file tree
Showing 9 changed files with 40 additions and 39 deletions.
26 changes: 14 additions & 12 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ parity-scale-codec = { version = "3.6.12", default-features = false }
json5 = "0.4.1"
toml = "0.8.16"

storage = { git = "https://github.com/Erigara/storage.git", rev = "cf82588d20494a1c1613ea2f4faa1e66bd827b5c" }
mv = { version = "0.1.0" }

[workspace.lints]
rustdoc.private_doc_tests = "deny"
Expand Down
2 changes: 1 addition & 1 deletion core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ iroha_telemetry = { workspace = true }
iroha_primitives = { workspace = true }
iroha_genesis = { workspace = true }
iroha_wasm_codec = { workspace = true }
storage = { workspace = true, features = ["serde"] }
mv = { workspace = true, features = ["serde"] }

async-trait = { workspace = true }
dashmap = { workspace = true }
Expand Down
2 changes: 1 addition & 1 deletion core/src/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ mod valid {
use commit::CommittedBlock;
use indexmap::IndexMap;
use iroha_data_model::{account::AccountId, events::pipeline::PipelineEventBox, ChainId};
use storage::storage::StorageReadOnly;
use mv::storage::StorageReadOnly;

use super::*;
use crate::{state::StateBlock, sumeragi::network_topology::Role};
Expand Down
2 changes: 1 addition & 1 deletion core/src/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ use std::{num::NonZeroUsize, sync::Arc, time::SystemTime};

use eyre::{Result, WrapErr as _};
use iroha_telemetry::metrics::Metrics;
use mv::storage::StorageReadOnly;
use parking_lot::Mutex;
use storage::storage::StorageReadOnly;

use crate::{
kura::Kura,
Expand Down
2 changes: 1 addition & 1 deletion core/src/smartcontracts/isi/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use iroha_data_model::{
prelude::*,
};
use iroha_logger::prelude::*;
use storage::storage::StorageReadOnly;
use mv::storage::StorageReadOnly;

use super::Execute;
use crate::{
Expand Down
25 changes: 12 additions & 13 deletions core/src/smartcontracts/isi/triggers/set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,17 @@ use iroha_data_model::{
query::error::FindError,
transaction::WasmSmartContract,
};
use serde::{
de::{DeserializeSeed, MapAccess, Visitor},
Deserialize, Serialize,
};
use storage::{
use mv::{
cell::{Block as CellBlock, Cell, Transaction as CellTransaction, View as CellView},
storage::{
Block as StorageBlock, Storage, StorageReadOnly, Transaction as StorageTransaction,
View as StorageView,
},
};
use serde::{
de::{DeserializeSeed, MapAccess, Visitor},
Deserialize, Serialize,
};
use thiserror::Error;

use crate::{
Expand Down Expand Up @@ -207,11 +207,10 @@ impl<'de> DeserializeSeed<'de> for WasmSeed<'_, Set> {
ids = Some(map.next_value()?);
}
"contracts" => {
contracts =
Some(map.next_value_seed(storage::serde::StorageSeeded {
kseed: PhantomData,
vseed: self.loader.cast::<WasmSmartContractEntry>(),
})?);
contracts = Some(map.next_value_seed(mv::serde::StorageSeeded {
kseed: PhantomData,
vseed: self.loader.cast::<WasmSmartContractEntry>(),
})?);
}
"matched_ids" => {
matched_ids = Some(map.next_value()?);
Expand Down Expand Up @@ -710,7 +709,7 @@ impl<'block, 'set> SetTransaction<'block, 'set> {
/// # Errors
///
/// Return [`Err`] if failed to preload wasm trigger
fn add_to<F: TriggeringEventFilter + storage::Value>(
fn add_to<F: TriggeringEventFilter + mv::Value>(
&mut self,
engine: &wasmtime::Engine,
trigger: SpecializedTrigger<F>,
Expand Down Expand Up @@ -872,7 +871,7 @@ impl<'block, 'set> SetTransaction<'block, 'set> {
/// Note that this function doesn't remove the trigger from [`Set::ids`].
///
/// Returns `true` if trigger was removed and `false` otherwise.
fn remove_from<F: storage::Value + EventFilter>(
fn remove_from<F: mv::Value + EventFilter>(
contracts: &mut WasmSmartContractMapTransaction<'block, 'set>,
triggers: &mut StorageTransaction<'block, 'set, TriggerId, LoadedAction<F>>,
trigger_id: TriggerId,
Expand Down Expand Up @@ -936,7 +935,7 @@ impl<'block, 'set> SetTransaction<'block, 'set> {
}

/// Remove actions with zero execution count from `triggers`
fn remove_zeros<F: storage::Value + EventFilter>(
fn remove_zeros<F: mv::Value + EventFilter>(
ids: &mut StorageTransaction<'block, 'set, TriggerId, TriggeringEventType>,
contracts: &mut WasmSmartContractMapTransaction<'block, 'set>,
triggers: &mut StorageTransaction<'block, 'set, TriggerId, LoadedAction<F>>,
Expand Down
16 changes: 8 additions & 8 deletions core/src/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,20 @@ use iroha_data_model::{
};
use iroha_logger::prelude::*;
use iroha_primitives::{must_use::MustUse, numeric::Numeric, small::SmallVec};
use mv::{
cell::{Block as CellBlock, Cell, Transaction as CellTransaction, View as CellView},
storage::{
Block as StorageBlock, RangeIter, Storage, StorageReadOnly,
Transaction as StorageTransaction, View as StorageView,
},
};
use nonzero_ext::nonzero;
use parking_lot::Mutex;
use range_bounds::*;
use serde::{
de::{DeserializeSeed, MapAccess, Visitor},
Deserializer, Serialize,
};
use storage::{
cell::{Block as CellBlock, Cell, Transaction as CellTransaction, View as CellView},
storage::{
Block as StorageBlock, RangeIter, Storage, StorageReadOnly,
Transaction as StorageTransaction, View as StorageView,
},
};

use crate::{
block::CommittedBlock,
Expand Down Expand Up @@ -1871,7 +1871,7 @@ mod range_bounds {
}

pub(crate) mod deserialize {
use storage::serde::CellSeeded;
use mv::serde::CellSeeded;

use super::*;

Expand Down
2 changes: 1 addition & 1 deletion core/src/tx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use iroha_data_model::{
};
use iroha_logger::{debug, error};
use iroha_macro::FromVariant;
use storage::storage::StorageReadOnly;
use mv::storage::StorageReadOnly;

use crate::{
smartcontracts::wasm,
Expand Down

0 comments on commit 69b0ea6

Please sign in to comment.