Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[itc-parentchain-test] better re-exports to simplify imports #1294

Merged
merged 1 commit into from
May 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion core-primitives/stf-executor/src/executor_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ use ita_stf::{
test_genesis::{endowed_account, test_genesis_setup},
State, TrustedCall,
};
use itc_parentchain_test::parentchain_header_builder::ParentchainHeaderBuilder;
use itc_parentchain_test::ParentchainHeaderBuilder;
use itp_node_api::metadata::{metadata_mocks::NodeMetadataMock, provider::NodeMetadataRepository};
use itp_ocall_api::EnclaveAttestationOCallApi;
use itp_sgx_externalities::SgxExternalitiesTrait;
Expand Down
2 changes: 1 addition & 1 deletion core/parentchain/indirect-calls-executor/src/executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ mod test {
};
use codec::{Decode, Encode};
use ita_stf::TrustedOperation;
use itc_parentchain_test::parentchain_block_builder::ParentchainBlockBuilder;
use itc_parentchain_test::ParentchainBlockBuilder;
use itp_node_api::{
api_client::{
ExtrinsicParams, ParentchainAdditionalParams, ParentchainExtrinsicParams,
Expand Down
2 changes: 1 addition & 1 deletion core/parentchain/light-client/src/mocks/validator_mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use crate::{
error::Result, state::RelayState, ExtrinsicSender, HashFor, LightClientState,
LightValidationState, Validator,
};
use itc_parentchain_test::parentchain_header_builder::ParentchainHeaderBuilder;
use itc_parentchain_test::ParentchainHeaderBuilder;
use itp_types::Block;
use sp_runtime::{generic::SignedBlock, traits::Block as BlockT, OpaqueExtrinsic};
use std::vec::Vec;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*/

use crate::{error::Error, state::RelayState, LightValidationState};
use itc_parentchain_test::parentchain_header_builder::ParentchainHeaderBuilder;
use itc_parentchain_test::ParentchainHeaderBuilder;
use itp_sgx_io::StaticSealedIO;
use itp_types::Block;

Expand Down
7 changes: 5 additions & 2 deletions core/parentchain/test/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,8 @@

#![cfg_attr(not(feature = "std"), no_std)]

pub mod parentchain_block_builder;
pub mod parentchain_header_builder;
mod parentchain_block_builder;
mod parentchain_header_builder;

pub use parentchain_block_builder::{Block, ParentchainBlockBuilder, SignedBlock};
pub use parentchain_header_builder::{BlockNumber, Header, ParentchainHeaderBuilder, H256};
9 changes: 4 additions & 5 deletions core/parentchain/test/src/parentchain_block_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,12 @@

extern crate alloc;

use crate::parentchain_header_builder::ParentchainHeaderBuilder;
use crate::ParentchainHeaderBuilder;
use alloc::vec::Vec;
use itp_types::parentchain::Header;
use sp_runtime::{
generic::{Block, SignedBlock},
traits::MaybeSerialize,
};
use sp_runtime::traits::MaybeSerialize;

pub use sp_runtime::generic::{Block, SignedBlock};

pub struct ParentchainBlockBuilder<Extrinsic> {
header: Header,
Expand Down
4 changes: 2 additions & 2 deletions core/parentchain/test/src/parentchain_header_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@

//! Builder pattern for a parentchain header.

use itp_types::{BlockNumber, Header, H256};
use sp_runtime::generic::Digest;
pub use itp_types::{BlockNumber, Header, H256};
pub use sp_runtime::generic::Digest;

#[derive(Default)]
pub struct ParentchainHeaderBuilder {
Expand Down
2 changes: 1 addition & 1 deletion enclave-runtime/src/test/sidechain_aura_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ use ita_stf::{
Balance, StatePayload, TrustedCall, TrustedOperation,
};
use itc_parentchain::light_client::mocks::validator_access_mock::ValidatorAccessMock;
use itc_parentchain_test::parentchain_header_builder::ParentchainHeaderBuilder;
use itc_parentchain_test::ParentchainHeaderBuilder;
use itp_extrinsics_factory::mock::ExtrinsicsFactoryMock;
use itp_node_api::metadata::{metadata_mocks::NodeMetadataMock, provider::NodeMetadataRepository};
use itp_ocall_api::EnclaveAttestationOCallApi;
Expand Down
2 changes: 1 addition & 1 deletion enclave-runtime/src/test/sidechain_event_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ use crate::{
use ita_sgx_runtime::Runtime;
use ita_stf::helpers::set_block_number;
use itc_parentchain::light_client::mocks::validator_access_mock::ValidatorAccessMock;
use itc_parentchain_test::parentchain_header_builder::ParentchainHeaderBuilder;
use itc_parentchain_test::ParentchainHeaderBuilder;
use itp_extrinsics_factory::mock::ExtrinsicsFactoryMock;
use itp_node_api::metadata::{metadata_mocks::NodeMetadataMock, provider::NodeMetadataRepository};
use itp_settings::{
Expand Down
5 changes: 1 addition & 4 deletions enclave-runtime/src/test/top_pool_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,7 @@ use itc_parentchain::indirect_calls_executor::{
parentchain_extrinsic_parser::ParentchainExtrinsicParser, ExecuteIndirectCalls,
IndirectCallsExecutor,
};
use itc_parentchain_test::{
parentchain_block_builder::ParentchainBlockBuilder,
parentchain_header_builder::ParentchainHeaderBuilder,
};
use itc_parentchain_test::{ParentchainBlockBuilder, ParentchainHeaderBuilder};
use itp_node_api::{
api_client::{
ExtrinsicParams, ParentchainAdditionalParams, ParentchainExtrinsicParams,
Expand Down
5 changes: 1 addition & 4 deletions service/src/tests/mocks/parentchain_api_mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,7 @@

*/

use itc_parentchain_test::{
parentchain_block_builder::ParentchainBlockBuilder,
parentchain_header_builder::ParentchainHeaderBuilder,
};
use itc_parentchain_test::{ParentchainBlockBuilder, ParentchainHeaderBuilder};
use itp_node_api::api_client::{ApiResult, ChainApi, SignedBlock};
use itp_types::{
parentchain::{Hash, Header, StorageProof},
Expand Down
2 changes: 1 addition & 1 deletion service/src/tests/parentchain_handler_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ use crate::{
use itc_parentchain::{
light_client::light_client_init_params::SimpleParams, primitives::ParentchainInitParams,
};
use itc_parentchain_test::parentchain_header_builder::ParentchainHeaderBuilder;
use itc_parentchain_test::ParentchainHeaderBuilder;
use itp_node_api::api_client::ChainApi;
use std::sync::Arc;

Expand Down
2 changes: 1 addition & 1 deletion sidechain/block-verification/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ mod tests {
use super::*;
use core::assert_matches::assert_matches;
use frame_support::assert_ok;
use itc_parentchain_test::parentchain_header_builder::ParentchainHeaderBuilder;
use itc_parentchain_test::ParentchainHeaderBuilder;
use itp_types::{AccountId, Block as ParentchainBlock};
use its_primitives::types::{block::SignedBlock, header::SidechainHeader as Header};
use its_test::{
Expand Down
5 changes: 1 addition & 4 deletions sidechain/consensus/aura/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -260,10 +260,7 @@ mod tests {
mocks::environment_mock::EnvironmentMock,
};
use itc_parentchain_block_import_dispatcher::trigger_parentchain_block_import_mock::TriggerParentchainBlockImportMock;
use itc_parentchain_test::{
parentchain_block_builder::ParentchainBlockBuilder,
parentchain_header_builder::ParentchainHeaderBuilder,
};
use itc_parentchain_test::{ParentchainBlockBuilder, ParentchainHeaderBuilder};
use itp_test::mock::onchain_mock::OnchainMock;
use itp_types::{
Block as ParentchainBlock, Enclave, Header as ParentchainHeader,
Expand Down
5 changes: 1 addition & 4 deletions sidechain/consensus/aura/src/test/block_importer_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,7 @@ use crate::{block_importer::BlockImporter, test::fixtures::validateer, ShardIden
use codec::Encode;
use core::assert_matches::assert_matches;
use itc_parentchain_block_import_dispatcher::trigger_parentchain_block_import_mock::TriggerParentchainBlockImportMock;
use itc_parentchain_test::{
parentchain_block_builder::ParentchainBlockBuilder,
parentchain_header_builder::ParentchainHeaderBuilder,
};
use itc_parentchain_test::{ParentchainBlockBuilder, ParentchainHeaderBuilder};
use itp_sgx_crypto::{aes::Aes, mocks::KeyRepositoryMock, StateCrypto};
use itp_sgx_externalities::SgxExternalitiesDiffType;
use itp_stf_state_handler::handle_state::HandleState;
Expand Down
2 changes: 1 addition & 1 deletion sidechain/consensus/common/src/peer_block_sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ mod tests {
block_importer_mock::BlockImportMock, confirm_block_import_mock::ConfirmBlockImportMock,
};
use core::assert_matches::assert_matches;
use itc_parentchain_test::parentchain_header_builder::ParentchainHeaderBuilder;
use itc_parentchain_test::ParentchainHeaderBuilder;
use itp_test::mock::sidechain_ocall_api_mock::SidechainOCallApiMock;
use itp_types::Block as ParentchainBlock;
use its_primitives::types::block::SignedBlock as SignedSidechainBlock;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*/

use crate::{mocks::SimpleSlotWorkerMock, PerShardSlotWorkerScheduler, SlotInfo};
use itc_parentchain_test::parentchain_header_builder::ParentchainHeaderBuilder;
use itc_parentchain_test::ParentchainHeaderBuilder;
use itp_settings::sidechain::SLOT_DURATION;
use itp_time_utils::duration_now;
use itp_types::{Block as ParentchainBlock, ShardIdentifier};
Expand Down
2 changes: 1 addition & 1 deletion sidechain/consensus/slots/src/slots.rs
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ pub mod sgx {
mod tests {
use super::*;
use core::assert_matches::assert_matches;
use itc_parentchain_test::parentchain_header_builder::ParentchainHeaderBuilder;
use itc_parentchain_test::ParentchainHeaderBuilder;
use itp_sgx_io::StaticSealedIO;
use itp_types::Block as ParentchainBlock;
use its_primitives::{
Expand Down
2 changes: 1 addition & 1 deletion sidechain/validateer-fetch/src/validateer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ impl<OnchainStorage: EnclaveOnChainOCallApi> ValidateerFetch for OnchainStorage
mod tests {
use super::*;
use codec::Encode;
use itc_parentchain_test::parentchain_header_builder::ParentchainHeaderBuilder;
use itc_parentchain_test::ParentchainHeaderBuilder;
use itp_test::mock::onchain_mock::{validateer_set, OnchainMock};
use std::string::ToString;

Expand Down