Skip to content

Commit abba0d5

Browse files
authored
Feat/adjust fast mode governance (#164)
* chore: update lock * feat: add weights * feat: tweak fast-mode params * feat: extend the voting period * feat: cleanup base runtime depcencies * chore: use workspace version * chore: cleanup the profiles
1 parent f554953 commit abba0d5

File tree

8 files changed

+386
-70
lines changed

8 files changed

+386
-70
lines changed

Cargo.lock

+14-18
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+1-10
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,7 @@ panic = "unwind"
2828
opt-level = 3
2929
strip = "debuginfo"
3030

31-
32-
[profile.dev]
33-
split-debuginfo = "unpacked"
34-
# make sure dev builds with backtrace do
35-
# not slow us down
31+
# Make sure dev builds with backtrace do not slow us down
3632
[profile.dev.package.backtrace]
3733
inherits = "release"
3834

@@ -41,11 +37,6 @@ inherits = "release"
4137
lto = true
4238
codegen-units = 1
4339

44-
[profile.testnet]
45-
inherits = "release"
46-
debug = 1 # debug symbols are useful for profilers
47-
debug-assertions = true
48-
overflow-checks = true
4940

5041
[workspace.dependencies]
5142
# Testing deps

runtimes/base/Cargo.toml

+2-10
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,13 @@ version.workspace = true
1414
substrate-wasm-builder.workspace = true
1515

1616
[dependencies]
17-
parity-scale-codec = { version = "3.6.5", default-features = false, features = [
17+
parity-scale-codec = { workspace= true, default-features = false, features = [
1818
"derive",
1919
] }
20-
hex-literal = { version = "0.3.4", optional = true }
2120
log.workspace = true
22-
scale-info = { version = "2.9.0", default-features = false, features = [
21+
scale-info = { workspace= true, default-features = false, features = [
2322
"derive",
2423
] }
25-
smallvec = "1.11.0"
2624

2725
# Local
2826
pallet-parachain-staking.workspace = true
@@ -57,7 +55,6 @@ pallet-transaction-payment-rpc-runtime-api.workspace = true
5755
pallet-treasury.workspace = true
5856
pallet-utility.workspace = true
5957
pallet-vesting.workspace = true
60-
sp-arithmetic.workspace = true
6158
sp-api.workspace = true
6259
sp-block-builder.workspace = true
6360
sp-consensus-aura.workspace = true
@@ -90,7 +87,6 @@ cumulus-primitives-timestamp.workspace = true
9087
cumulus-primitives-utility.workspace = true
9188
parachain-info.workspace = true
9289
parachains-common.workspace = true
93-
polkadot-primitives.workspace = true
9490

9591
# ORML
9692
orml-oracle.workspace = true
@@ -145,12 +141,10 @@ std = [
145141
"parity-scale-codec/std",
146142
"polimec-common/std",
147143
"polkadot-parachain/std",
148-
"polkadot-primitives/std",
149144
"polkadot-runtime-common/std",
150145
"scale-info/std",
151146
"shared-configuration/std",
152147
"sp-api/std",
153-
"sp-arithmetic/std",
154148
"sp-block-builder/std",
155149
"sp-consensus-aura/std",
156150
"sp-core/std",
@@ -174,7 +168,6 @@ runtime-benchmarks = [
174168
"frame-support/runtime-benchmarks",
175169
"frame-system-benchmarking/runtime-benchmarks",
176170
"frame-system/runtime-benchmarks",
177-
"hex-literal",
178171
"pallet-balances/runtime-benchmarks",
179172
"pallet-collective/runtime-benchmarks",
180173
"pallet-democracy/runtime-benchmarks",
@@ -194,7 +187,6 @@ runtime-benchmarks = [
194187
"pallet-xcm/runtime-benchmarks",
195188
"polimec-common/runtime-benchmarks",
196189
"polkadot-parachain/runtime-benchmarks",
197-
"polkadot-primitives/runtime-benchmarks",
198190
"polkadot-runtime-common/runtime-benchmarks",
199191
"shared-configuration/runtime-benchmarks",
200192
"sp-runtime/runtime-benchmarks",

runtimes/base/src/lib.rs

+20-15
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,14 @@
2121
#[cfg(feature = "runtime-benchmarks")]
2222
#[macro_use]
2323
extern crate frame_benchmarking;
24+
2425
use cumulus_pallet_parachain_system::RelayNumberStrictlyIncreases;
2526
use frame_support::{
2627
construct_runtime, parameter_types,
27-
traits::{fungible::{Credit, Inspect}, tokens, ConstU32, Contains, EitherOfDiverse, InstanceFilter, PrivilegeCmp},
28+
traits::{
29+
fungible::{Credit, Inspect},
30+
tokens, ConstU32, Contains, EitherOfDiverse, InstanceFilter, PrivilegeCmp,
31+
},
2832
weights::{ConstantMultiplier, Weight},
2933
};
3034
use frame_system::{EnsureRoot, EnsureSigned};
@@ -34,10 +38,7 @@ use parachains_common::AssetIdForTrustBackedAssets as AssetId;
3438
use parity_scale_codec::Encode;
3539
use polkadot_runtime_common::{BlockHashCount, CurrencyToVote, SlowAdjustingFeeUpdate};
3640
use sp_api::impl_runtime_apis;
37-
pub use sp_consensus_aura::sr25519::AuthorityId as AuraId;
3841
use sp_core::{crypto::KeyTypeId, OpaqueMetadata};
39-
#[cfg(any(feature = "std", test))]
40-
pub use sp_runtime::BuildStorage;
4142
use sp_runtime::{
4243
create_runtime_str, generic, impl_opaque_keys,
4344
traits::{
@@ -46,27 +47,31 @@ use sp_runtime::{
4647
transaction_validity::{TransactionSource, TransactionValidity},
4748
ApplyExtrinsicResult, FixedU128, MultiSignature, SaturatedConversion,
4849
};
49-
pub use sp_runtime::{MultiAddress, Perbill, Permill};
5050
use sp_std::{cmp::Ordering, prelude::*};
51-
52-
#[cfg(feature = "std")]
53-
use sp_version::NativeVersion;
5451
use sp_version::RuntimeVersion;
5552

5653
// XCM Imports
5754
use xcm_config::{XcmConfig, XcmOriginToTransactDispatchOrigin};
5855
use xcm_executor::XcmExecutor;
5956

6057
// Polimec Shared Imports
61-
pub use shared_configuration::{currency::*, fee::*, funding::*, governance::*, proxy::*, staking::*, weights::*};
62-
6358
pub use pallet_parachain_staking;
59+
pub use shared_configuration::{currency::*, fee::*, funding::*, governance::*, proxy::*, staking::*, weights::*};
60+
pub use sp_consensus_aura::sr25519::AuthorityId as AuraId;
61+
pub use sp_runtime::{MultiAddress, Perbill, Permill};
6462

6563
// Make the WASM binary available.
6664
#[cfg(feature = "std")]
6765
include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs"));
6866

67+
#[cfg(feature = "std")]
68+
use sp_version::NativeVersion;
69+
70+
#[cfg(any(feature = "std", test))]
71+
pub use sp_runtime::BuildStorage;
72+
6973
mod custom_migrations;
74+
mod weights;
7075
pub mod xcm_config;
7176

7277
/// Alias to 512-bit hash when used in the context of a transaction signature on the chain.
@@ -190,7 +195,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
190195
spec_name: create_runtime_str!("polimec-mainnet"),
191196
impl_name: create_runtime_str!("polimec-mainnet"),
192197
authoring_version: 1,
193-
spec_version: 0_005_000,
198+
spec_version: 0_005_001,
194199
impl_version: 0,
195200
apis: RUNTIME_API_VERSIONS,
196201
transaction_version: 1,
@@ -482,7 +487,7 @@ impl pallet_elections_phragmen::Config for Runtime {
482487
/// triggered and the module will be in passive mode.
483488
type TermDuration = TermDuration;
484489
type VotingLockPeriod = VotingLockPeriod;
485-
type WeightInfo = pallet_elections_phragmen::weights::SubstrateWeight<Runtime>;
490+
type WeightInfo = weights::pallet_elections_phragmen::WeightInfo<Runtime>;
486491
}
487492

488493
pub struct Electorate;
@@ -550,7 +555,7 @@ pub struct EqualOrGreatestRootCmp;
550555
impl PrivilegeCmp<OriginCaller> for EqualOrGreatestRootCmp {
551556
fn cmp_privilege(left: &OriginCaller, right: &OriginCaller) -> Option<Ordering> {
552557
if left == right {
553-
return Some(Ordering::Equal)
558+
return Some(Ordering::Equal);
554559
}
555560
match (left, right) {
556561
// Root is greater than anything.
@@ -832,11 +837,11 @@ mod benches {
832837
// Monetary stuff.
833838
[pallet_balances, Balances]
834839
[pallet_vesting, Vesting]
835-
840+
836841
// Collator support.
837842
[pallet_session, SessionBench::<Runtime>]
838843
[pallet_parachain_staking, ParachainStaking]
839-
844+
840845
// XCM helpers.
841846
[cumulus_pallet_xcmp_queue, XcmpQueue]
842847
[pallet_xcm, PolkadotXcm]

runtimes/base/src/weights/mod.rs

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// Polimec Blockchain – https://www.polimec.org/
2+
// Copyright (C) Polimec 2022. All rights reserved.
3+
4+
// The Polimec Blockchain is free software: you can redistribute it and/or modify
5+
// it under the terms of the GNU General Public License as published by
6+
// the Free Software Foundation, either version 3 of the License, or
7+
// (at your option) any later version.
8+
9+
// The Polimec Blockchain is distributed in the hope that it will be useful,
10+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
// GNU General Public License for more details.
13+
14+
// You should have received a copy of the GNU General Public License
15+
// along with this program. If not, see <https://www.gnu.org/licenses/>.
16+
17+
// the generated files do not pass clippy
18+
#![allow(clippy::all)]
19+
20+
pub mod pallet_elections_phragmen;

0 commit comments

Comments
 (0)