Skip to content
This repository has been archived by the owner on Mar 30, 2023. It is now read-only.

Commit

Permalink
Clean imports (#271)
Browse files Browse the repository at this point in the history
* Clean imports

* Fix tests
  • Loading branch information
AurevoirXavier committed Feb 8, 2023
1 parent b69b7b5 commit 93aff17
Show file tree
Hide file tree
Showing 48 changed files with 389 additions and 440 deletions.
24 changes: 11 additions & 13 deletions pallet/message-transact/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,8 @@ use pallet_ethereum::IntermediateStateRoot;
use frame_support::{
dispatch::RawOrigin,
ensure,
pallet_prelude::Weight,
traits::{ConstU32, Everything},
};
use sp_core::{H256, U256};
use sp_runtime::{
testing::Header,
traits::{BlakeTwo256, DispatchInfoOf, IdentifyAccount, IdentityLookup, Verify},
Expand All @@ -43,7 +41,7 @@ use bp_message_dispatch::{CallValidate, IntoDispatchOrigin as IntoDispatchOrigin

pub type Block = frame_system::mocking::MockBlock<TestRuntime>;
pub type Balance = u64;
pub type AccountId = H160;
pub type AccountId = sp_core::H160;
pub type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<TestRuntime>;

frame_support::parameter_types! {
Expand All @@ -58,7 +56,7 @@ impl frame_system::Config for TestRuntime {
type BlockNumber = u64;
type BlockWeights = ();
type DbWeight = ();
type Hash = H256;
type Hash = sp_core::H256;
type Hashing = BlakeTwo256;
type Header = Header;
type Index = u64;
Expand Down Expand Up @@ -105,14 +103,14 @@ impl pallet_timestamp::Config for TestRuntime {
frame_support::parameter_types! {
pub const TransactionByteFee: u64 = 1;
pub const ChainId: u64 = 42;
pub const BlockGasLimit: U256 = U256::MAX;
pub const WeightPerGas: Weight = Weight::from_ref_time(20_000);
pub const BlockGasLimit: sp_core::U256 = sp_core::U256::MAX;
pub const WeightPerGas: frame_support::weights::Weight = frame_support::weights::Weight::from_ref_time(20_000);
}

pub struct FixedGasPrice;
impl FeeCalculator for FixedGasPrice {
fn min_gas_price() -> (U256, Weight) {
(U256::from(5), Weight::zero())
fn min_gas_price() -> (sp_core::U256, frame_support::weights::Weight) {
(sp_core::U256::from(5), frame_support::weights::Weight::zero())
}
}

Expand Down Expand Up @@ -141,8 +139,8 @@ impl pallet_ethereum::Config for TestRuntime {
}

pub struct MockAccountIdConverter;
impl sp_runtime::traits::Convert<H256, AccountId> for MockAccountIdConverter {
fn convert(hash: H256) -> AccountId {
impl sp_runtime::traits::Convert<sp_core::H256, AccountId> for MockAccountIdConverter {
fn convert(hash: sp_core::H256) -> AccountId {
hash.into()
}
}
Expand Down Expand Up @@ -266,7 +264,7 @@ frame_support::construct_runtime! {
}

impl fp_self_contained::SelfContainedCall for RuntimeCall {
type SignedInfo = H160;
type SignedInfo = sp_core::H160;

fn is_self_contained(&self) -> bool {
match self {
Expand Down Expand Up @@ -323,8 +321,8 @@ impl fp_self_contained::SelfContainedCall for RuntimeCall {
}

pub(crate) struct AccountInfo {
pub address: H160,
pub private_key: H256,
pub address: sp_core::H160,
pub private_key: sp_core::H256,
}

pub(crate) fn address_build(seed: u8) -> AccountInfo {
Expand Down
3 changes: 1 addition & 2 deletions pallet/message-transact/src/tests/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,13 @@ use crate::mock::*;
use bp_message_dispatch::{CallOrigin, MessageDispatch, MessagePayload, SpecVersion};
use bp_runtime::messages::DispatchFeePayment;
// substrate
use frame_support::pallet_prelude::Weight;
use sp_core::{H256, U256};

pub(crate) const TEST_SPEC_VERSION: SpecVersion = 0;
pub(crate) type SubChainId = [u8; 4];
pub(crate) const SOURCE_CHAIN_ID: SubChainId = *b"srce";
pub(crate) const TARGET_CHAIN_ID: SubChainId = *b"trgt";
pub(crate) const TEST_WEIGHT: Weight = Weight::from_ref_time(1_000_000_000_000);
pub(crate) const TEST_WEIGHT: frame_support::weights::Weight = frame_support::weights::Weight::from_ref_time(1_000_000_000_000);

// This ERC-20 contract mints the maximum amount of tokens to the contract creator.
// pragma solidity ^0.5.0;
Expand Down
3 changes: 1 addition & 2 deletions precompile/assets/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ use codec::{Decode, Encode, MaxEncodedLen};
// frontier
use fp_evm::{Precompile, PrecompileSet};
// parity
use frame_support::pallet_prelude::Weight;
use sp_core::{H160, H256, U256};
use sp_std::{marker::PhantomData, prelude::*};
// darwinia
Expand Down Expand Up @@ -148,7 +147,7 @@ impl AccountToAssetId<AccountId, AssetId> for AssetIdConverter {

frame_support::parameter_types! {
pub const BlockGasLimit: U256 = U256::MAX;
pub const WeightPerGas: Weight = Weight::from_ref_time(20_000);
pub const WeightPerGas: frame_support::weights::Weight = frame_support::weights::Weight::from_ref_time(20_000);
pub PrecompilesValue: TestPrecompiles<TestRuntime> = TestPrecompiles::<_>::new();
}

Expand Down
3 changes: 1 addition & 2 deletions precompile/deposit/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ use crate::*;
// frontier
use fp_evm::{Precompile, PrecompileSet};
// substrate
use frame_support::pallet_prelude::Weight;
use sp_core::{ConstU32, H160, H256, U256};

pub(crate) type Balance = u128;
Expand Down Expand Up @@ -150,7 +149,7 @@ fn addr(a: u64) -> H160 {

frame_support::parameter_types! {
pub const BlockGasLimit: U256 = U256::MAX;
pub const WeightPerGas: Weight = Weight::from_ref_time(20_000);
pub const WeightPerGas: frame_support::weights::Weight = frame_support::weights::Weight::from_ref_time(20_000);
pub PrecompilesValue: TestPrecompiles<TestRuntime> = TestPrecompiles::<_>::new();
}

Expand Down
3 changes: 1 addition & 2 deletions precompile/staking/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ use crate::*;
// frontier
use fp_evm::{Precompile, PrecompileSet};
// substrate
use frame_support::pallet_prelude::Weight;
use sp_core::{ConstU32, H160, H256, U256};

pub(crate) type Balance = u128;
Expand Down Expand Up @@ -154,7 +153,7 @@ pub type PCall = StakingCall<TestRuntime>;

frame_support::parameter_types! {
pub const BlockGasLimit: U256 = U256::MAX;
pub const WeightPerGas: Weight = Weight::from_ref_time(20_000);
pub const WeightPerGas: frame_support::weights::Weight = frame_support::weights::Weight::from_ref_time(20_000);
pub PrecompilesValue: TestPrecompiles<TestRuntime> = TestPrecompiles::<_>::new();
}

Expand Down
4 changes: 2 additions & 2 deletions precompile/state-storage/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ use codec::{Decode, Encode, MaxEncodedLen};
// frontier
use fp_evm::{Precompile, PrecompileSet};
// substrate
use frame_support::{pallet_prelude::Weight, StorageHasher, Twox128};
use frame_support::{StorageHasher, Twox128};
use sp_core::{H160, H256, U256};
use sp_std::{marker::PhantomData, prelude::*};
// darwinia
Expand Down Expand Up @@ -134,7 +134,7 @@ fn addr(a: u64) -> H160 {

frame_support::parameter_types! {
pub const BlockGasLimit: U256 = U256::MAX;
pub const WeightPerGas: Weight = Weight::from_ref_time(20_000);
pub const WeightPerGas: frame_support::weights::Weight = frame_support::weights::Weight::from_ref_time(20_000);
pub PrecompilesValue: TestPrecompiles<TestRuntime> = TestPrecompiles::<_>::new();
}

Expand Down
4 changes: 2 additions & 2 deletions runtime/common/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ pub const fn darwinia_deposit(items: u32, bytes: u32) -> Balance {
macro_rules! impl_self_contained_call {
() => {
impl fp_self_contained::SelfContainedCall for RuntimeCall {
type SignedInfo = H160;
type SignedInfo = sp_core::H160;

fn is_self_contained(&self) -> bool {
match self {
Expand Down Expand Up @@ -119,7 +119,7 @@ macro_rules! impl_self_contained_call {
info: &Self::SignedInfo,
dispatch_info: &sp_runtime::traits::DispatchInfoOf<RuntimeCall>,
len: usize,
) -> Option<TransactionValidity> {
) -> Option<sp_runtime::transaction_validity::TransactionValidity> {
match self {
RuntimeCall::Ethereum(call) =>
call.validate_self_contained(info, dispatch_info, len),
Expand Down
Loading

0 comments on commit 93aff17

Please sign in to comment.