From 784ac3dff83c4e73a506a02cfabfd57f32a3aedf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marin=20Ver=C5=A1i=C4=87?= Date: Fri, 18 Oct 2024 16:04:08 +0200 Subject: [PATCH] refactor: unnest integration tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Marin Veršić --- CHANGELOG.md | 2 +- Cargo.lock | 1 - crates/iroha/tests/{integration => }/asset.rs | 0 .../{integration => }/asset_propagation.rs | 0 .../tests/{integration => }/events/data.rs | 0 .../tests/{integration => }/events/mod.rs | 0 .../{integration => }/events/notification.rs | 0 .../{integration => }/events/pipeline.rs | 0 .../extra_functional/connected_peers.rs | 0 .../extra_functional/genesis.rs | 0 .../{integration => }/extra_functional/mod.rs | 0 .../multiple_blocks_created.rs | 0 .../extra_functional/normal.rs | 0 .../extra_functional/offline_peers.rs | 0 .../extra_functional/restart_peer.rs | 0 .../extra_functional/unregister_peer.rs | 0 crates/iroha/tests/integration/mod.rs | 20 ------- crates/iroha/tests/mod.rs | 1 - .../iroha/tests/{integration => }/multisig.rs | 0 .../tests/{integration => }/non_mintable.rs | 0 .../tests/{integration => }/pagination.rs | 0 .../tests/{integration => }/permissions.rs | 0 .../{integration => }/queries/account.rs | 0 .../tests/{integration => }/queries/asset.rs | 0 .../tests/{integration => }/queries/mod.rs | 0 .../{integration => }/queries/query_errors.rs | 0 .../tests/{integration => }/queries/role.rs | 0 .../queries/smart_contract.rs | 0 crates/iroha/tests/{integration => }/roles.rs | 0 .../tests/{integration => }/set_parameter.rs | 0 .../iroha/tests/{integration => }/sorting.rs | 0 .../{integration => }/status_response.rs | 0 .../tests/{integration => }/transfer_asset.rs | 0 .../{integration => }/transfer_domain.rs | 0 .../triggers/by_call_trigger.rs | 0 .../triggers/data_trigger.rs | 0 .../triggers/event_trigger.rs | 0 .../tests/{integration => }/triggers/mod.rs | 0 .../{integration => }/triggers/orphans.rs | 0 .../triggers/time_trigger.rs | 0 .../triggers/trigger_rollback.rs | 0 .../tests/{integration => }/tx_chain_id.rs | 0 .../tests/{integration => }/tx_history.rs | 0 .../tests/{integration => }/tx_rollback.rs | 0 .../ui_fail/cant_filter_singular_query.rs | 0 .../iroha/tests/{integration => }/upgrade.rs | 0 crates/iroha_codec/Cargo.toml | 3 - crates/iroha_codec/src/main.rs | 17 ++++-- .../iroha_core/benches/blocks/apply_blocks.rs | 9 ++- crates/iroha_core/benches/blocks/common.rs | 8 ++- .../benches/blocks/validate_blocks.rs | 7 +-- crates/iroha_core/benches/kura.rs | 12 ++-- crates/iroha_ffi/src/ir.rs | 60 +++++++++++++++---- gitchangelog-clean.py | 12 ---- 54 files changed, 80 insertions(+), 72 deletions(-) rename crates/iroha/tests/{integration => }/asset.rs (100%) rename crates/iroha/tests/{integration => }/asset_propagation.rs (100%) rename crates/iroha/tests/{integration => }/events/data.rs (100%) rename crates/iroha/tests/{integration => }/events/mod.rs (100%) rename crates/iroha/tests/{integration => }/events/notification.rs (100%) rename crates/iroha/tests/{integration => }/events/pipeline.rs (100%) rename crates/iroha/tests/{integration => }/extra_functional/connected_peers.rs (100%) rename crates/iroha/tests/{integration => }/extra_functional/genesis.rs (100%) rename crates/iroha/tests/{integration => }/extra_functional/mod.rs (100%) rename crates/iroha/tests/{integration => }/extra_functional/multiple_blocks_created.rs (100%) rename crates/iroha/tests/{integration => }/extra_functional/normal.rs (100%) rename crates/iroha/tests/{integration => }/extra_functional/offline_peers.rs (100%) rename crates/iroha/tests/{integration => }/extra_functional/restart_peer.rs (100%) rename crates/iroha/tests/{integration => }/extra_functional/unregister_peer.rs (100%) delete mode 100644 crates/iroha/tests/integration/mod.rs delete mode 100644 crates/iroha/tests/mod.rs rename crates/iroha/tests/{integration => }/multisig.rs (100%) rename crates/iroha/tests/{integration => }/non_mintable.rs (100%) rename crates/iroha/tests/{integration => }/pagination.rs (100%) rename crates/iroha/tests/{integration => }/permissions.rs (100%) rename crates/iroha/tests/{integration => }/queries/account.rs (100%) rename crates/iroha/tests/{integration => }/queries/asset.rs (100%) rename crates/iroha/tests/{integration => }/queries/mod.rs (100%) rename crates/iroha/tests/{integration => }/queries/query_errors.rs (100%) rename crates/iroha/tests/{integration => }/queries/role.rs (100%) rename crates/iroha/tests/{integration => }/queries/smart_contract.rs (100%) rename crates/iroha/tests/{integration => }/roles.rs (100%) rename crates/iroha/tests/{integration => }/set_parameter.rs (100%) rename crates/iroha/tests/{integration => }/sorting.rs (100%) rename crates/iroha/tests/{integration => }/status_response.rs (100%) rename crates/iroha/tests/{integration => }/transfer_asset.rs (100%) rename crates/iroha/tests/{integration => }/transfer_domain.rs (100%) rename crates/iroha/tests/{integration => }/triggers/by_call_trigger.rs (100%) rename crates/iroha/tests/{integration => }/triggers/data_trigger.rs (100%) rename crates/iroha/tests/{integration => }/triggers/event_trigger.rs (100%) rename crates/iroha/tests/{integration => }/triggers/mod.rs (100%) rename crates/iroha/tests/{integration => }/triggers/orphans.rs (100%) rename crates/iroha/tests/{integration => }/triggers/time_trigger.rs (100%) rename crates/iroha/tests/{integration => }/triggers/trigger_rollback.rs (100%) rename crates/iroha/tests/{integration => }/tx_chain_id.rs (100%) rename crates/iroha/tests/{integration => }/tx_history.rs (100%) rename crates/iroha/tests/{integration => }/tx_rollback.rs (100%) delete mode 100644 crates/iroha/tests/ui_fail/cant_filter_singular_query.rs rename crates/iroha/tests/{integration => }/upgrade.rs (100%) delete mode 100644 gitchangelog-clean.py diff --git a/CHANGELOG.md b/CHANGELOG.md index 308ede80509..b631e61cea0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -588,7 +588,7 @@ - hyperledger#1998 Add filters to queries. - hyperledger#2276 Include current Block hash into BlockHeaderValue. - hyperledger#2161 Handle id and shared FFI fns. - - add handle id and implement FFI equivalents of shared traits (Clone, Eq, Ord) +- add handle id and implement FFI equivalents of shared traits (Clone, Eq, Ord) - hyperledger#1638 `configuration` return doc sub-tree. - hyperledger#2132 Add `endpointN` proc macro. - hyperledger#2257 Revoke emits RoleRevoked event. diff --git a/Cargo.lock b/Cargo.lock index a60aebb9e0b..84071c580bd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3072,7 +3072,6 @@ dependencies = [ "iroha_primitives", "iroha_schema", "iroha_schema_gen", - "iroha_test_samples", "iroha_version", "parity-scale-codec", "serde", diff --git a/crates/iroha/tests/integration/asset.rs b/crates/iroha/tests/asset.rs similarity index 100% rename from crates/iroha/tests/integration/asset.rs rename to crates/iroha/tests/asset.rs diff --git a/crates/iroha/tests/integration/asset_propagation.rs b/crates/iroha/tests/asset_propagation.rs similarity index 100% rename from crates/iroha/tests/integration/asset_propagation.rs rename to crates/iroha/tests/asset_propagation.rs diff --git a/crates/iroha/tests/integration/events/data.rs b/crates/iroha/tests/events/data.rs similarity index 100% rename from crates/iroha/tests/integration/events/data.rs rename to crates/iroha/tests/events/data.rs diff --git a/crates/iroha/tests/integration/events/mod.rs b/crates/iroha/tests/events/mod.rs similarity index 100% rename from crates/iroha/tests/integration/events/mod.rs rename to crates/iroha/tests/events/mod.rs diff --git a/crates/iroha/tests/integration/events/notification.rs b/crates/iroha/tests/events/notification.rs similarity index 100% rename from crates/iroha/tests/integration/events/notification.rs rename to crates/iroha/tests/events/notification.rs diff --git a/crates/iroha/tests/integration/events/pipeline.rs b/crates/iroha/tests/events/pipeline.rs similarity index 100% rename from crates/iroha/tests/integration/events/pipeline.rs rename to crates/iroha/tests/events/pipeline.rs diff --git a/crates/iroha/tests/integration/extra_functional/connected_peers.rs b/crates/iroha/tests/extra_functional/connected_peers.rs similarity index 100% rename from crates/iroha/tests/integration/extra_functional/connected_peers.rs rename to crates/iroha/tests/extra_functional/connected_peers.rs diff --git a/crates/iroha/tests/integration/extra_functional/genesis.rs b/crates/iroha/tests/extra_functional/genesis.rs similarity index 100% rename from crates/iroha/tests/integration/extra_functional/genesis.rs rename to crates/iroha/tests/extra_functional/genesis.rs diff --git a/crates/iroha/tests/integration/extra_functional/mod.rs b/crates/iroha/tests/extra_functional/mod.rs similarity index 100% rename from crates/iroha/tests/integration/extra_functional/mod.rs rename to crates/iroha/tests/extra_functional/mod.rs diff --git a/crates/iroha/tests/integration/extra_functional/multiple_blocks_created.rs b/crates/iroha/tests/extra_functional/multiple_blocks_created.rs similarity index 100% rename from crates/iroha/tests/integration/extra_functional/multiple_blocks_created.rs rename to crates/iroha/tests/extra_functional/multiple_blocks_created.rs diff --git a/crates/iroha/tests/integration/extra_functional/normal.rs b/crates/iroha/tests/extra_functional/normal.rs similarity index 100% rename from crates/iroha/tests/integration/extra_functional/normal.rs rename to crates/iroha/tests/extra_functional/normal.rs diff --git a/crates/iroha/tests/integration/extra_functional/offline_peers.rs b/crates/iroha/tests/extra_functional/offline_peers.rs similarity index 100% rename from crates/iroha/tests/integration/extra_functional/offline_peers.rs rename to crates/iroha/tests/extra_functional/offline_peers.rs diff --git a/crates/iroha/tests/integration/extra_functional/restart_peer.rs b/crates/iroha/tests/extra_functional/restart_peer.rs similarity index 100% rename from crates/iroha/tests/integration/extra_functional/restart_peer.rs rename to crates/iroha/tests/extra_functional/restart_peer.rs diff --git a/crates/iroha/tests/integration/extra_functional/unregister_peer.rs b/crates/iroha/tests/extra_functional/unregister_peer.rs similarity index 100% rename from crates/iroha/tests/integration/extra_functional/unregister_peer.rs rename to crates/iroha/tests/extra_functional/unregister_peer.rs diff --git a/crates/iroha/tests/integration/mod.rs b/crates/iroha/tests/integration/mod.rs deleted file mode 100644 index d0d11bcbaae..00000000000 --- a/crates/iroha/tests/integration/mod.rs +++ /dev/null @@ -1,20 +0,0 @@ -mod asset; -mod asset_propagation; -mod events; -mod extra_functional; -mod multisig; -mod non_mintable; -mod pagination; -mod permissions; -mod queries; -mod roles; -mod set_parameter; -mod sorting; -mod status_response; -mod transfer_asset; -mod transfer_domain; -mod triggers; -mod tx_chain_id; -mod tx_history; -mod tx_rollback; -mod upgrade; diff --git a/crates/iroha/tests/mod.rs b/crates/iroha/tests/mod.rs deleted file mode 100644 index 6d3bbe6043c..00000000000 --- a/crates/iroha/tests/mod.rs +++ /dev/null @@ -1 +0,0 @@ -mod integration; diff --git a/crates/iroha/tests/integration/multisig.rs b/crates/iroha/tests/multisig.rs similarity index 100% rename from crates/iroha/tests/integration/multisig.rs rename to crates/iroha/tests/multisig.rs diff --git a/crates/iroha/tests/integration/non_mintable.rs b/crates/iroha/tests/non_mintable.rs similarity index 100% rename from crates/iroha/tests/integration/non_mintable.rs rename to crates/iroha/tests/non_mintable.rs diff --git a/crates/iroha/tests/integration/pagination.rs b/crates/iroha/tests/pagination.rs similarity index 100% rename from crates/iroha/tests/integration/pagination.rs rename to crates/iroha/tests/pagination.rs diff --git a/crates/iroha/tests/integration/permissions.rs b/crates/iroha/tests/permissions.rs similarity index 100% rename from crates/iroha/tests/integration/permissions.rs rename to crates/iroha/tests/permissions.rs diff --git a/crates/iroha/tests/integration/queries/account.rs b/crates/iroha/tests/queries/account.rs similarity index 100% rename from crates/iroha/tests/integration/queries/account.rs rename to crates/iroha/tests/queries/account.rs diff --git a/crates/iroha/tests/integration/queries/asset.rs b/crates/iroha/tests/queries/asset.rs similarity index 100% rename from crates/iroha/tests/integration/queries/asset.rs rename to crates/iroha/tests/queries/asset.rs diff --git a/crates/iroha/tests/integration/queries/mod.rs b/crates/iroha/tests/queries/mod.rs similarity index 100% rename from crates/iroha/tests/integration/queries/mod.rs rename to crates/iroha/tests/queries/mod.rs diff --git a/crates/iroha/tests/integration/queries/query_errors.rs b/crates/iroha/tests/queries/query_errors.rs similarity index 100% rename from crates/iroha/tests/integration/queries/query_errors.rs rename to crates/iroha/tests/queries/query_errors.rs diff --git a/crates/iroha/tests/integration/queries/role.rs b/crates/iroha/tests/queries/role.rs similarity index 100% rename from crates/iroha/tests/integration/queries/role.rs rename to crates/iroha/tests/queries/role.rs diff --git a/crates/iroha/tests/integration/queries/smart_contract.rs b/crates/iroha/tests/queries/smart_contract.rs similarity index 100% rename from crates/iroha/tests/integration/queries/smart_contract.rs rename to crates/iroha/tests/queries/smart_contract.rs diff --git a/crates/iroha/tests/integration/roles.rs b/crates/iroha/tests/roles.rs similarity index 100% rename from crates/iroha/tests/integration/roles.rs rename to crates/iroha/tests/roles.rs diff --git a/crates/iroha/tests/integration/set_parameter.rs b/crates/iroha/tests/set_parameter.rs similarity index 100% rename from crates/iroha/tests/integration/set_parameter.rs rename to crates/iroha/tests/set_parameter.rs diff --git a/crates/iroha/tests/integration/sorting.rs b/crates/iroha/tests/sorting.rs similarity index 100% rename from crates/iroha/tests/integration/sorting.rs rename to crates/iroha/tests/sorting.rs diff --git a/crates/iroha/tests/integration/status_response.rs b/crates/iroha/tests/status_response.rs similarity index 100% rename from crates/iroha/tests/integration/status_response.rs rename to crates/iroha/tests/status_response.rs diff --git a/crates/iroha/tests/integration/transfer_asset.rs b/crates/iroha/tests/transfer_asset.rs similarity index 100% rename from crates/iroha/tests/integration/transfer_asset.rs rename to crates/iroha/tests/transfer_asset.rs diff --git a/crates/iroha/tests/integration/transfer_domain.rs b/crates/iroha/tests/transfer_domain.rs similarity index 100% rename from crates/iroha/tests/integration/transfer_domain.rs rename to crates/iroha/tests/transfer_domain.rs diff --git a/crates/iroha/tests/integration/triggers/by_call_trigger.rs b/crates/iroha/tests/triggers/by_call_trigger.rs similarity index 100% rename from crates/iroha/tests/integration/triggers/by_call_trigger.rs rename to crates/iroha/tests/triggers/by_call_trigger.rs diff --git a/crates/iroha/tests/integration/triggers/data_trigger.rs b/crates/iroha/tests/triggers/data_trigger.rs similarity index 100% rename from crates/iroha/tests/integration/triggers/data_trigger.rs rename to crates/iroha/tests/triggers/data_trigger.rs diff --git a/crates/iroha/tests/integration/triggers/event_trigger.rs b/crates/iroha/tests/triggers/event_trigger.rs similarity index 100% rename from crates/iroha/tests/integration/triggers/event_trigger.rs rename to crates/iroha/tests/triggers/event_trigger.rs diff --git a/crates/iroha/tests/integration/triggers/mod.rs b/crates/iroha/tests/triggers/mod.rs similarity index 100% rename from crates/iroha/tests/integration/triggers/mod.rs rename to crates/iroha/tests/triggers/mod.rs diff --git a/crates/iroha/tests/integration/triggers/orphans.rs b/crates/iroha/tests/triggers/orphans.rs similarity index 100% rename from crates/iroha/tests/integration/triggers/orphans.rs rename to crates/iroha/tests/triggers/orphans.rs diff --git a/crates/iroha/tests/integration/triggers/time_trigger.rs b/crates/iroha/tests/triggers/time_trigger.rs similarity index 100% rename from crates/iroha/tests/integration/triggers/time_trigger.rs rename to crates/iroha/tests/triggers/time_trigger.rs diff --git a/crates/iroha/tests/integration/triggers/trigger_rollback.rs b/crates/iroha/tests/triggers/trigger_rollback.rs similarity index 100% rename from crates/iroha/tests/integration/triggers/trigger_rollback.rs rename to crates/iroha/tests/triggers/trigger_rollback.rs diff --git a/crates/iroha/tests/integration/tx_chain_id.rs b/crates/iroha/tests/tx_chain_id.rs similarity index 100% rename from crates/iroha/tests/integration/tx_chain_id.rs rename to crates/iroha/tests/tx_chain_id.rs diff --git a/crates/iroha/tests/integration/tx_history.rs b/crates/iroha/tests/tx_history.rs similarity index 100% rename from crates/iroha/tests/integration/tx_history.rs rename to crates/iroha/tests/tx_history.rs diff --git a/crates/iroha/tests/integration/tx_rollback.rs b/crates/iroha/tests/tx_rollback.rs similarity index 100% rename from crates/iroha/tests/integration/tx_rollback.rs rename to crates/iroha/tests/tx_rollback.rs diff --git a/crates/iroha/tests/ui_fail/cant_filter_singular_query.rs b/crates/iroha/tests/ui_fail/cant_filter_singular_query.rs deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/crates/iroha/tests/integration/upgrade.rs b/crates/iroha/tests/upgrade.rs similarity index 100% rename from crates/iroha/tests/integration/upgrade.rs rename to crates/iroha/tests/upgrade.rs diff --git a/crates/iroha_codec/Cargo.toml b/crates/iroha_codec/Cargo.toml index 694511cabc1..fad92c53da8 100644 --- a/crates/iroha_codec/Cargo.toml +++ b/crates/iroha_codec/Cargo.toml @@ -35,6 +35,3 @@ parity-scale-codec = { workspace = true } serde_json = { workspace = true, features = ["std"]} serde = { workspace = true } eyre = { workspace = true } - -[dev-dependencies] -iroha_test_samples = { workspace = true } diff --git a/crates/iroha_codec/src/main.rs b/crates/iroha_codec/src/main.rs index a6d902131de..2aa7b236eb4 100644 --- a/crates/iroha_codec/src/main.rs +++ b/crates/iroha_codec/src/main.rs @@ -304,19 +304,22 @@ fn list_types(map: &ConverterMap, writer: &mut W) -> Result<()> { #[cfg(test)] mod tests { use iroha_data_model::prelude::*; - use iroha_test_samples::ALICE_ID; use super::*; #[test] fn decode_account_sample() { + let account_id = + "ed0120CE7FA46C9DCE7EA4B125E2E36BDB63EA33073E7590AC92816AE1E861B7048B03@wonderland" + .parse() + .unwrap(); let mut metadata = Metadata::default(); metadata.insert( "hat".parse().expect("Valid"), "white".parse::().expect("Valid"), ); - let account = Account::new(ALICE_ID.clone()).with_metadata(metadata); + let account = Account::new(account_id).with_metadata(metadata); decode_sample("account.bin", String::from("NewAccount"), &account); } @@ -337,20 +340,24 @@ mod tests { #[test] fn decode_trigger_sample() { + let account_id = + "ed0120CE7FA46C9DCE7EA4B125E2E36BDB63EA33073E7590AC92816AE1E861B7048B03@wonderland" + .parse::() + .unwrap(); let rose_definition_id = AssetDefinitionId::new( "wonderland".parse().expect("Valid"), "rose".parse().expect("Valid"), ); - let rose_id = AssetId::new(rose_definition_id, ALICE_ID.clone()); + let rose_id = AssetId::new(rose_definition_id, account_id.clone()); let trigger_id = "mint_rose".parse().expect("Valid"); let action = Action::new( vec![Mint::asset_numeric(1u32, rose_id)], Repeats::Indefinitely, - ALICE_ID.clone(), + account_id, DomainEventFilter::new().for_events(DomainEventSet::AnyAccount), ); - let trigger = Trigger::new(trigger_id, action); + let trigger = Trigger::new(trigger_id, action); decode_sample("trigger.bin", String::from("Trigger"), &trigger); } diff --git a/crates/iroha_core/benches/blocks/apply_blocks.rs b/crates/iroha_core/benches/blocks/apply_blocks.rs index b82b5ab4fff..7db0939c1a4 100644 --- a/crates/iroha_core/benches/blocks/apply_blocks.rs +++ b/crates/iroha_core/benches/blocks/apply_blocks.rs @@ -1,3 +1,7 @@ +#[path = "./common.rs"] +mod common; + +use common::*; use eyre::Result; use iroha_core::{ block::CommittedBlock, prelude::*, state::State, sumeragi::network_topology::Topology, @@ -5,11 +9,6 @@ use iroha_core::{ use iroha_data_model::peer::PeerId; use iroha_test_samples::gen_account_in; -#[path = "./common.rs"] -mod common; - -use common::*; - pub struct StateApplyBlocks { state: State, blocks: Vec, diff --git a/crates/iroha_core/benches/blocks/common.rs b/crates/iroha_core/benches/blocks/common.rs index 388cde51f34..e75b061d639 100644 --- a/crates/iroha_core/benches/blocks/common.rs +++ b/crates/iroha_core/benches/blocks/common.rs @@ -18,8 +18,9 @@ use iroha_data_model::{ ChainId, }; use iroha_executor_data_model::permission::{ - account::CanUnregisterAccount, asset_definition::CanUnregisterAssetDefinition, - domain::CanUnregisterDomain, + account::CanUnregisterAccount, + asset_definition::CanUnregisterAssetDefinition, + domain::{CanRegisterDomain, CanUnregisterDomain}, }; /// Create block @@ -75,7 +76,8 @@ pub fn populate_state( asset_definitions: &[AssetDefinitionId], owner_id: &AccountId, ) -> Vec { - let mut instructions: Vec = Vec::new(); + let mut instructions: Vec = + vec![Grant::account_permission(CanRegisterDomain, owner_id.clone()).into()]; for domain_id in domains { let domain = Domain::new(domain_id.clone()); diff --git a/crates/iroha_core/benches/blocks/validate_blocks.rs b/crates/iroha_core/benches/blocks/validate_blocks.rs index 46e0cf09358..b5a831bb1d0 100644 --- a/crates/iroha_core/benches/blocks/validate_blocks.rs +++ b/crates/iroha_core/benches/blocks/validate_blocks.rs @@ -1,11 +1,10 @@ -use iroha_core::{prelude::*, state::State, sumeragi::network_topology::Topology}; -use iroha_data_model::{isi::InstructionBox, prelude::*}; -use iroha_test_samples::gen_account_in; - #[path = "./common.rs"] mod common; use common::*; +use iroha_core::{prelude::*, state::State, sumeragi::network_topology::Topology}; +use iroha_data_model::{isi::InstructionBox, prelude::*}; +use iroha_test_samples::gen_account_in; pub struct StateValidateBlocks { state: State, diff --git a/crates/iroha_core/benches/kura.rs b/crates/iroha_core/benches/kura.rs index 281ff1e1c62..1d4856bebb5 100644 --- a/crates/iroha_core/benches/kura.rs +++ b/crates/iroha_core/benches/kura.rs @@ -49,13 +49,16 @@ async fn measure_block_size_for_n_executors(n_executors: u32) { }; let tx = AcceptedTransaction::accept(tx, &chain_id, max_clock_drift, tx_limits) .expect("Failed to accept Transaction."); - let (peer_public_key, peer_private_key) = KeyPair::random().into_parts(); - let peer_id = PeerId::new("127.0.0.1:8080".parse().unwrap(), peer_public_key); + let peer_key_pair = KeyPair::random(); + let peer_id = PeerId::new( + "127.0.0.1:8080".parse().unwrap(), + peer_key_pair.public_key().clone(), + ); let topology = Topology::new(vec![peer_id]); let mut block = { let unverified_block = BlockBuilder::new(vec![tx]) .chain(0, state.view().latest_block().as_deref()) - .sign(&peer_private_key) + .sign(peer_key_pair.private_key()) .unpack(|_| {}); let mut state_block = state.block(unverified_block.header()); @@ -64,9 +67,8 @@ async fn measure_block_size_for_n_executors(n_executors: u32) { block }; - let key_pair = KeyPair::random(); for _ in 1..n_executors { - block.sign(&key_pair, &topology); + block.sign(&peer_key_pair, &topology); } let mut block_store = BlockStore::new(dir.path()); block_store.create_files_if_they_do_not_exist().unwrap(); diff --git a/crates/iroha_ffi/src/ir.rs b/crates/iroha_ffi/src/ir.rs index 3d84f84a7ac..4cbbd9293ca 100644 --- a/crates/iroha_ffi/src/ir.rs +++ b/crates/iroha_ffi/src/ir.rs @@ -124,14 +124,26 @@ pub trait IrTypeFamily { } impl IrTypeFamily for R { - type Ref<'itm> = &'itm Self where Self: 'itm; + type Ref<'itm> + = &'itm Self + where + Self: 'itm; // NOTE: Unused - type RefMut<'itm> = () where Self: 'itm; + type RefMut<'itm> + = () + where + Self: 'itm; type Box = Box; type BoxedSlice = Box<[Self]>; - type RefSlice<'itm> = &'itm [Self] where Self: 'itm; + type RefSlice<'itm> + = &'itm [Self] + where + Self: 'itm; // NOTE: Unused - type RefMutSlice<'itm> = () where Self: 'itm; + type RefMutSlice<'itm> + = () + where + Self: 'itm; type Vec = Vec; type Arr = [Self; N]; } @@ -166,22 +178,46 @@ impl IrTypeFamily for Transparent { type Arr = Self; } impl IrTypeFamily for &Extern { - type Ref<'itm> = &'itm Self where Self: 'itm; - type RefMut<'itm> = &'itm mut Self where Self: 'itm; + type Ref<'itm> + = &'itm Self + where + Self: 'itm; + type RefMut<'itm> + = &'itm mut Self + where + Self: 'itm; type Box = Box; type BoxedSlice = Box<[Self]>; - type RefSlice<'itm> = &'itm [Self] where Self: 'itm; - type RefMutSlice<'itm> = &'itm mut [Self] where Self: 'itm; + type RefSlice<'itm> + = &'itm [Self] + where + Self: 'itm; + type RefMutSlice<'itm> + = &'itm mut [Self] + where + Self: 'itm; type Vec = Vec; type Arr = [Self; N]; } impl IrTypeFamily for &mut Extern { - type Ref<'itm> = &'itm Self where Self: 'itm; - type RefMut<'itm> = &'itm mut Self where Self: 'itm; + type Ref<'itm> + = &'itm Self + where + Self: 'itm; + type RefMut<'itm> + = &'itm mut Self + where + Self: 'itm; type Box = Box; type BoxedSlice = Box<[Self]>; - type RefSlice<'itm> = &'itm [Self] where Self: 'itm; - type RefMutSlice<'itm> = &'itm mut [Self] where Self: 'itm; + type RefSlice<'itm> + = &'itm [Self] + where + Self: 'itm; + type RefMutSlice<'itm> + = &'itm mut [Self] + where + Self: 'itm; type Vec = Vec; type Arr = [Self; N]; } diff --git a/gitchangelog-clean.py b/gitchangelog-clean.py deleted file mode 100644 index 5124ec7c5c6..00000000000 --- a/gitchangelog-clean.py +++ /dev/null @@ -1,12 +0,0 @@ -import re - -def remove_names(): - with open("CHANGELOG.rst", "r") as changelog_file: - changelog = changelog_file.read() - changelog = re.sub('\s\[.*(\n\s\s.*)*\]', '', changelog) - with open("CHANGELOG.rst", "w") as changelog_file: - changelog_file.write(changelog) - - -if __name__ == "__main__": - remove_names() \ No newline at end of file