Skip to content

Commit

Permalink
chore: reorganize data_model crates
Browse files Browse the repository at this point in the history
Signed-off-by: Marin Veršić <[email protected]>
  • Loading branch information
mversic committed Oct 29, 2024
1 parent 4b23527 commit 2aa8d18
Show file tree
Hide file tree
Showing 19 changed files with 57 additions and 675 deletions.
10 changes: 10 additions & 0 deletions 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
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
19 changes: 0 additions & 19 deletions crates/iroha_multisig_data_model/Cargo.toml

This file was deleted.

74 changes: 0 additions & 74 deletions crates/iroha_multisig_data_model/src/lib.rs

This file was deleted.

7 changes: 4 additions & 3 deletions wasm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,16 @@ opt-level = "z" # Optimize for size vs speed with "s"/"z"(removes vectorizat
codegen-units = 1 # Further reduces binary size but increases compilation time

[workspace.dependencies]
executor_custom_data_model = { path = "samples/executor_custom_data_model" }

iroha_smart_contract = { version = "=2.0.0-rc.1.0", path = "../crates/iroha_smart_contract", features = ["debug"] }
iroha_trigger = { version = "=2.0.0-rc.1.0", path = "../crates/iroha_trigger", features = ["debug"] }
iroha_executor = { version = "=2.0.0-rc.1.0", path = "../crates/iroha_executor", features = ["debug"] }
iroha_schema = { version = "=2.0.0-rc.1.0", path = "../crates/iroha_schema" }

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_multisig_data_model = { version = "=2.0.0-rc.1.0", path = "../crates/iroha_multisig_data_model" }
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" }

parity-scale-codec = { version = "3.2.1", default-features = false }
anyhow = { version = "1.0.71", default-features = false }
Expand Down
11 changes: 7 additions & 4 deletions wasm/samples/create_nft_for_every_user_trigger/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,28 @@ extern crate panic_halt;
use alloc::{format, string::ToString};

use dlmalloc::GlobalDlmalloc;
use iroha_trigger::prelude::*;
use iroha_trigger::{debug::dbg_panic, prelude::*};

#[global_allocator]
static ALLOC: GlobalDlmalloc = GlobalDlmalloc;

getrandom::register_custom_getrandom!(iroha_trigger::stub_getrandom);

#[iroha_trigger::main]
fn main(host: Iroha, _context: Context) {
fn main(host: Iroha, context: Context) {
iroha_trigger::log::info!("Executing trigger");
let accounts_cursor = host.query(FindAccounts).execute().dbg_unwrap();

if !matches!(context.event, EventBox::Time(_)) {
dbg_panic("Only work as a by call trigger");
};

let bad_domain_ids: [DomainId; 3] = [
"system".parse().dbg_unwrap(),
"genesis".parse().dbg_unwrap(),
"garden_of_live_flowers".parse().dbg_unwrap(),
];

for account in accounts_cursor {
for account in host.query(FindAccounts).execute().dbg_unwrap() {
let account = account.dbg_unwrap();

if bad_domain_ids.contains(account.id().domain()) {
Expand Down
16 changes: 0 additions & 16 deletions wasm/samples/executor_custom_data_model/Cargo.toml

This file was deleted.

Loading

0 comments on commit 2aa8d18

Please sign in to comment.