Skip to content

Commit

Permalink
chore: reorganize data_model crates (#5199)
Browse files Browse the repository at this point in the history
* chore: reorganize `data_model` crates
* chore: remove call to `set_getrandom` and make `dbg` a macro in smart contracts
* perf: directly provide payload to wasm triggers and smart contracts

---------

Signed-off-by: Marin Veršić <marin.versic101@gmail.com>
  • Loading branch information
mversic authored Nov 6, 2024
1 parent eee9449 commit 5677cf1
Show file tree
Hide file tree
Showing 70 changed files with 454 additions and 579 deletions.
12 changes: 11 additions & 1 deletion Cargo.lock

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

11 changes: 6 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ iroha_macro_utils = { version = "=2.0.0-rc.1.0", path = "crates/iroha_macro_util
iroha_telemetry = { version = "=2.0.0-rc.1.0", path = "crates/iroha_telemetry" }
iroha_p2p = { version = "=2.0.0-rc.1.0", path = "crates/iroha_p2p" }
iroha_primitives = { version = "=2.0.0-rc.1.0", path = "crates/iroha_primitives", default-features = false }
iroha_data_model = { version = "=2.0.0-rc.1.0", path = "crates/iroha_data_model", default-features = false }
iroha_config = { version = "=2.0.0-rc.1.0", path = "crates/iroha_config" }
iroha_config_base = { version = "=2.0.0-rc.1.0", path = "crates/iroha_config_base" }
iroha_schema_gen = { version = "=2.0.0-rc.1.0", path = "crates/iroha_schema_gen" }
Expand All @@ -42,11 +41,11 @@ iroha_wasm_builder = { version = "=2.0.0-rc.1.0", path = "crates/iroha_wasm_buil

iroha_smart_contract = { version = "=2.0.0-rc.1.0", path = "crates/iroha_smart_contract" }
iroha_smart_contract_utils = { version = "=2.0.0-rc.1.0", path = "crates/iroha_smart_contract_utils" }

iroha_executor = { version = "=2.0.0-rc.1.0", path = "crates/iroha_executor" }
iroha_executor_data_model = { version = "=2.0.0-rc.1.0", path = "crates/iroha_executor_data_model" }

iroha_multisig_data_model = { version = "=2.0.0-rc.1.0", path = "crates/iroha_multisig_data_model" }
iroha_data_model = { version = "=2.0.0-rc.1.0", path = "crates/iroha_data_model", default-features = false }
iroha_multisig_data_model = { version = "=2.0.0-rc.1.0", path = "data_model/libs/iroha_multisig_data_model" }
iroha_executor_data_model = { version = "=2.0.0-rc.1.0", path = "crates/iroha_executor_data_model" }

iroha_test_network = { version = "=2.0.0-rc.1.0", path = "crates/iroha_test_network" }
iroha_test_samples = { version = "=2.0.0-rc.1.0", path = "crates/iroha_test_samples" }
Expand Down Expand Up @@ -199,7 +198,9 @@ clippy.wildcard_dependencies = "deny"
[workspace]
resolver = "2"
members = [
"crates/*"
"crates/*",
"data_model/libs/*",
"data_model/samples/*"
]

[profile.deploy]
Expand Down
7 changes: 5 additions & 2 deletions crates/iroha/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,13 @@ tls-rustls-webpki-roots = [
iroha_config = { workspace = true }
iroha_config_base = { workspace = true }
iroha_crypto = { workspace = true }
iroha_data_model = { workspace = true, features = ["http"] }
iroha_primitives = { workspace = true }
iroha_logger = { workspace = true }
iroha_telemetry = { workspace = true }
iroha_torii_const = { workspace = true }
iroha_version = { workspace = true }

iroha_data_model = { workspace = true, features = ["http"] }
iroha_multisig_data_model = { workspace = true }

attohttpc = { version = "0.28.0", default-features = false }
Expand Down Expand Up @@ -84,8 +85,10 @@ nonzero_ext = { workspace = true }
iroha_genesis = { workspace = true }
iroha_test_samples = { workspace = true }
iroha_test_network = { workspace = true }

mint_rose_trigger_data_model = { path = "../../data_model/samples/mint_rose_trigger_data_model" }
executor_custom_data_model = { path = "../../data_model/samples/executor_custom_data_model" }
iroha_executor_data_model = { workspace = true }
executor_custom_data_model = { version = "=2.0.0-rc.1.0", path = "../../wasm/samples/executor_custom_data_model" }

tokio = { workspace = true, features = ["rt-multi-thread"] }
reqwest = { version = "0.12.7", features = ["json"] }
Expand Down
2 changes: 1 addition & 1 deletion crates/iroha/src/secrecy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ impl SecretString {
}
}

const REDACTED: &'static str = "[REDACTED]";
const REDACTED: &str = "[REDACTED]";

impl Serialize for SecretString {
fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
Expand Down
2 changes: 1 addition & 1 deletion crates/iroha/tests/events/data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ async fn wasm_execution_should_produce_events() -> Result<()> {
{wasm_template}
;; Function which starts the smartcontract execution
(func (export "{main_fn_name}") (param)
(func (export "{main_fn_name}") (param i32)
{isi_calls}))
"#,
main_fn_name = "_iroha_smart_contract_main",
Expand Down
4 changes: 2 additions & 2 deletions crates/iroha/tests/triggers/by_call_trigger.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use std::{sync::mpsc, thread, time::Duration};

use executor_custom_data_model::mint_rose_args::MintRoseArgs;
use eyre::{eyre, Result, WrapErr};
use iroha::{
crypto::KeyPair,
Expand All @@ -13,6 +12,7 @@ use iroha::{
use iroha_executor_data_model::permission::trigger::CanRegisterTrigger;
use iroha_test_network::*;
use iroha_test_samples::{load_sample_wasm, ALICE_ID};
use mint_rose_trigger_data_model::MintRoseArgs;

use crate::triggers::get_asset_value;

Expand Down Expand Up @@ -621,7 +621,7 @@ fn call_execute_trigger_with_args() -> Result<()> {
let trigger = Trigger::new(
trigger_id.clone(),
Action::new(
load_sample_wasm("mint_rose_trigger_args"),
load_sample_wasm("mint_rose_trigger"),
Repeats::Indefinitely,
account_id.clone(),
ExecuteTriggerEventFilter::new()
Expand Down
2 changes: 1 addition & 1 deletion crates/iroha_config/tests/fixtures.rs
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ fn self_is_presented_in_trusted_peers() {
.value()
.clone()
.into_non_empty_vec()
.contains(&config.common.peer.id()));
.contains(config.common.peer.id()));
}

#[test]
Expand Down
4 changes: 2 additions & 2 deletions crates/iroha_core/src/smartcontracts/isi/world.rs
Original file line number Diff line number Diff line change
Expand Up @@ -513,8 +513,8 @@ pub mod query {
Ok(state_ro
.world()
.peers()
.cloned()
.filter(move |peer| filter.applies(peer)))
.filter(move |peer| filter.applies(peer))
.cloned())
}
}

Expand Down
Loading

0 comments on commit 5677cf1

Please sign in to comment.