Skip to content

Commit ab177cd

Browse files
authored
remove unused code and comments (#231)
1 parent 55b0c9c commit ab177cd

File tree

3 files changed

+41
-99
lines changed

3 files changed

+41
-99
lines changed

node/Cargo.toml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,7 @@ sp-inherents = { version = "4.0.0-dev", git = "https://github.com/CESSProject/su
3838
sp-keyring = { version = "7.0.0", git = "https://github.com/CESSProject/substrate.git", branch = "cess-polkadot-v0.9.36" }
3939
sp-keystore = { version = "0.13.0", git = "https://github.com/CESSProject/substrate.git", branch = "cess-polkadot-v0.9.36" }
4040
sp-consensus = { version = "0.10.0-dev", git = "https://github.com/CESSProject/substrate.git", branch = "cess-polkadot-v0.9.36" }
41-
# sp-transaction-pool
4241
sp-transaction-storage-proof = { version = "4.0.0-dev", git = "https://github.com/CESSProject/substrate.git", branch = "cess-polkadot-v0.9.36" }
43-
# sp-io
4442

4543
# client dependencies
4644
sc-client-api = { version = "4.0.0-dev", git = "https://github.com/CESSProject/substrate.git", branch = "cess-polkadot-v0.9.36" }
@@ -65,21 +63,15 @@ sc-sysinfo = { version = "6.0.0-dev", git = "https://github.com/CESSProject/subs
6563

6664
# frame dependencies
6765
frame-system = { version = "4.0.0-dev", git = "https://github.com/CESSProject/substrate.git", branch = "cess-polkadot-v0.9.36" }
68-
# frame-system-rpc-runtime-api = { version = "4.0.0-dev", git = "https://github.com/CESSProject/substrate.git", branch = "cess-polkadot-v0.9.36" }
6966
pallet-transaction-payment = { version = "4.0.0-dev", default-features = false, git = "https://github.com/CESSProject/substrate.git", branch = "cess-polkadot-v0.9.36" }
70-
# pallet-assets
71-
# pallet-asset-tx-payment
7267
pallet-im-online = { version = "4.0.0-dev", git = "https://github.com/CESSProject/substrate.git", branch = "cess-polkadot-v0.9.36" }
7368

7469
# node-specific dependencies
7570
cess-node-runtime = { path = "../runtime" }
76-
# node-rpc
77-
# node-primitives
7871

7972
# CLI-specific dependencies
8073
sc-cli = { version = "0.10.0-dev", git = "https://github.com/CESSProject/substrate.git", branch = "cess-polkadot-v0.9.36" }
8174
frame-benchmarking-cli = { version = "4.0.0-dev", git = "https://github.com/CESSProject/substrate.git", branch = "cess-polkadot-v0.9.36" }
82-
# node-inspect
8375
try-runtime-cli = { version = "0.10.0-dev", optional = true, git = "https://github.com/CESSProject/substrate.git", branch = "cess-polkadot-v0.9.36" }
8476
serde_json = "1.0.85"
8577

runtime/src/constants.rs

Lines changed: 0 additions & 59 deletions
This file was deleted.

runtime/src/lib.rs

Lines changed: 41 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,18 @@ pub fn wasm_binary_unwrap() -> &'static [u8] {
1616
)
1717
}
1818

19-
use codec::{Decode, Encode, /*MaxEncodedLen*/};
20-
use frame_election_provider_support::{
21-
onchain, ExtendedBalance, ElectionDataProvider, VoteWeight
22-
};
19+
use codec::{Decode, Encode};
20+
use cp_cess_common::FRAGMENT_COUNT;
21+
use frame_election_provider_support::{onchain, ElectionDataProvider, ExtendedBalance, VoteWeight};
22+
pub use frame_system::Call as SystemCall;
2323
pub use pallet_file_bank;
24-
pub use pallet_storage_handler;
25-
pub use pallet_oss;
2624
use pallet_grandpa::{
2725
fg_primitives, AuthorityId as GrandpaId, AuthorityList as GrandpaAuthorityList,
2826
};
2927
use pallet_im_online::sr25519::AuthorityId as ImOnlineId;
28+
pub use pallet_oss;
3029
use pallet_session::historical as pallet_session_historical;
30+
pub use pallet_storage_handler;
3131
pub use pallet_transaction_payment::{CurrencyAdapter, Multiplier, TargetedFeeAdjustment};
3232
use pallet_transaction_payment::{FeeDetails, RuntimeDispatchInfo};
3333
use sp_api::impl_runtime_apis;
@@ -39,36 +39,37 @@ use sp_runtime::{
3939
generic::Era,
4040
impl_opaque_keys,
4141
traits::{
42-
BlakeTwo256, Block as BlockT, Bounded, ConvertInto, Dispatchable, DispatchInfoOf, IdentifyAccount, NumberFor,
43-
OpaqueKeys, PostDispatchInfoOf, SaturatedConversion, StaticLookup, Verify,
42+
BlakeTwo256, Block as BlockT, Bounded, ConvertInto, DispatchInfoOf, Dispatchable,
43+
IdentifyAccount, NumberFor, OpaqueKeys, PostDispatchInfoOf, SaturatedConversion,
44+
StaticLookup, Verify,
4445
},
4546
transaction_validity::{
4647
TransactionPriority, TransactionSource, TransactionValidity, TransactionValidityError,
4748
},
4849
ApplyExtrinsicResult, FixedPointNumber, MultiSignature, Perbill, Percent, Permill, Perquintill,
4950
RuntimeAppPublic,
5051
};
51-
use cp_cess_common::{FRAGMENT_COUNT};
5252
use sp_std::{marker::PhantomData, prelude::*};
53-
pub use frame_system::Call as SystemCall;
5453
#[cfg(feature = "std")]
5554
use sp_version::NativeVersion;
5655
use sp_version::RuntimeVersion;
5756

5857
// A few exports that help ease life for downstream crates.
5958
pub use frame_support::{
6059
construct_runtime,
60+
dispatch::DispatchClass,
6161
pallet_prelude::Get,
6262
parameter_types,
63-
dispatch::DispatchClass,
6463
traits::{
6564
AsEnsureOriginWithArg, ConstBool, ConstU128, ConstU16, ConstU32, ConstU8, Currency,
6665
CurrencyToVote, EitherOfDiverse, EqualPrivilegeOnly, Everything, FindAuthor, Imbalance,
67-
InstanceFilter, KeyOwnerProofSystem, Nothing,
68-
OnUnbalanced, Randomness, StorageInfo, U128CurrencyToVote,
66+
InstanceFilter, KeyOwnerProofSystem, Nothing, OnUnbalanced, Randomness, StorageInfo,
67+
U128CurrencyToVote,
6968
},
7069
weights::{
71-
constants::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight, WEIGHT_REF_TIME_PER_SECOND},
70+
constants::{
71+
BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight, WEIGHT_REF_TIME_PER_SECOND,
72+
},
7273
ConstantMultiplier, IdentityFee, Weight,
7374
},
7475
ConsensusEngineId, PalletId, StorageValue,
@@ -81,11 +82,7 @@ use frame_system::{
8182

8283
pub mod impls;
8384
use impls::{Author, CreditToBlockAuthor, SchedulerStashAccountFinder};
84-
// use frame_support::traits::OnRuntimeUpgrade;
85-
// pub use pallet_file_bank::migrations::TestMigrationFileBank;
86-
// pub use pallet_audit::migrations::MigrationSegmentBook;
8785

88-
pub mod constants;
8986
use fp_rpc::TransactionStatus;
9087
pub use pallet_balances::Call as BalancesCall;
9188
use pallet_ethereum::{Call::transact, Transaction as EthereumTransaction};
@@ -274,7 +271,8 @@ parameter_types! {
274271
const AVERAGE_ON_INITIALIZE_RATIO: Perbill = Perbill::from_percent(10);
275272

276273
/// We allow for 2 seconds of compute with a 6 second average block time.
277-
const MAXIMUM_BLOCK_WEIGHT: Weight = Weight::from_parts(WEIGHT_REF_TIME_PER_SECOND.saturating_mul(2), u64::MAX);
274+
const MAXIMUM_BLOCK_WEIGHT: Weight =
275+
Weight::from_parts(WEIGHT_REF_TIME_PER_SECOND.saturating_mul(2), u64::MAX);
278276

279277
parameter_types! {
280278
pub RuntimeBlockLength: BlockLength =
@@ -459,8 +457,6 @@ impl pallet_scheduler::Config for Runtime {
459457
type WeightInfo = pallet_scheduler::weights::SubstrateWeight<Runtime>;
460458
type OriginPrivilegeCmp = EqualPrivilegeOnly;
461459
type Preimages = Preimage;
462-
// type PreimageProvider = Preimage;
463-
// type NoPreimagePostponement = NoPreimagePostponement;
464460
}
465461

466462
parameter_types! {
@@ -770,7 +766,10 @@ pub struct OnChainVrfSloverConfig;
770766
impl pallet_rrsc::VrfSloverConfig for OnChainVrfSloverConfig {
771767
fn min_electable_weight() -> VoteWeight {
772768
let total_issuance = <Runtime as pallet_cess_staking::Config>::Currency::total_issuance();
773-
<Runtime as pallet_cess_staking::Config>::CurrencyToVote::to_vote(MIN_ELECTABLE_STAKE, total_issuance)
769+
<Runtime as pallet_cess_staking::Config>::CurrencyToVote::to_vote(
770+
MIN_ELECTABLE_STAKE,
771+
total_issuance,
772+
)
774773
}
775774
}
776775

@@ -926,8 +925,13 @@ impl pallet_transaction_payment::Config for Runtime {
926925
type OperationalFeeMultiplier = OperationalFeeMultiplier;
927926
type WeightToFee = IdentityFee<Balance>;
928927
type LengthToFee = ConstantMultiplier<Balance, TransactionByteFee>;
929-
type FeeMultiplierUpdate =
930-
TargetedFeeAdjustment<Self, TargetBlockFullness, AdjustmentVariable, MinimumMultiplier, MaximumMultiplier>;
928+
type FeeMultiplierUpdate = TargetedFeeAdjustment<
929+
Self,
930+
TargetBlockFullness,
931+
AdjustmentVariable,
932+
MinimumMultiplier,
933+
MaximumMultiplier,
934+
>;
931935
}
932936

933937
impl pallet_sudo::Config for Runtime {
@@ -1125,7 +1129,10 @@ where
11251129
public: <Signature as sp_runtime::traits::Verify>::Signer,
11261130
account: AccountId,
11271131
nonce: Index,
1128-
) -> Option<(RuntimeCall, <UncheckedExtrinsic as sp_runtime::traits::Extrinsic>::SignaturePayload)> {
1132+
) -> Option<(
1133+
RuntimeCall,
1134+
<UncheckedExtrinsic as sp_runtime::traits::Extrinsic>::SignaturePayload,
1135+
)> {
11291136
let tip = 0;
11301137
// take the biggest period possible.
11311138
let period =
@@ -1409,7 +1416,7 @@ impl fp_self_contained::SelfContainedCall for RuntimeCall {
14091416
}
14101417

14111418
fn validate_self_contained(
1412-
&self,
1419+
&self,
14131420
info: &Self::SignedInfo,
14141421
dispatch_info: &DispatchInfoOf<RuntimeCall>,
14151422
len: usize,
@@ -1420,15 +1427,15 @@ impl fp_self_contained::SelfContainedCall for RuntimeCall {
14201427
}
14211428
}
14221429

1423-
14241430
fn pre_dispatch_self_contained(
14251431
&self,
14261432
info: &Self::SignedInfo,
14271433
dispatch_info: &DispatchInfoOf<RuntimeCall>,
14281434
len: usize,
14291435
) -> Option<Result<(), TransactionValidityError>> {
14301436
match self {
1431-
RuntimeCall::Ethereum(call) => call.pre_dispatch_self_contained(info, dispatch_info, len),
1437+
RuntimeCall::Ethereum(call) =>
1438+
call.pre_dispatch_self_contained(info, dispatch_info, len),
14321439
_ => None,
14331440
}
14341441
}
@@ -1438,9 +1445,10 @@ impl fp_self_contained::SelfContainedCall for RuntimeCall {
14381445
info: Self::SignedInfo,
14391446
) -> Option<sp_runtime::DispatchResultWithInfo<PostDispatchInfoOf<Self>>> {
14401447
match self {
1441-
call @ RuntimeCall::Ethereum(pallet_ethereum::Call::transact { .. }) => Some(
1442-
call.dispatch(RuntimeOrigin::from(pallet_ethereum::RawOrigin::EthereumTransaction(info))),
1443-
),
1448+
call @ RuntimeCall::Ethereum(pallet_ethereum::Call::transact { .. }) =>
1449+
Some(call.dispatch(RuntimeOrigin::from(
1450+
pallet_ethereum::RawOrigin::EthereumTransaction(info),
1451+
))),
14441452
_ => None,
14451453
}
14461454
}
@@ -1565,7 +1573,8 @@ pub type SignedExtra = (
15651573
pub type UncheckedExtrinsic =
15661574
fp_self_contained::UncheckedExtrinsic<Address, RuntimeCall, Signature, SignedExtra>;
15671575
/// Extrinsic type that has already been checked.
1568-
pub type CheckedExtrinsic = fp_self_contained::CheckedExtrinsic<AccountId, RuntimeCall, SignedExtra, H160>;
1576+
pub type CheckedExtrinsic =
1577+
fp_self_contained::CheckedExtrinsic<AccountId, RuntimeCall, SignedExtra, H160>;
15691578
/// The payload being signed in transactions.
15701579
pub type SignedPayload = generic::SignedPayload<RuntimeCall, SignedExtra>;
15711580
// Executive: handles dispatch to the various modules.

0 commit comments

Comments
 (0)