Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.

Commit 31b4cc1

Browse files
merge master
2 parents 6f3602e + f028a50 commit 31b4cc1

File tree

84 files changed

+1806
-1474
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

84 files changed

+1806
-1474
lines changed

.gitlab-ci.yml

Lines changed: 119 additions & 87 deletions
Large diffs are not rendered by default.

Cargo.lock

Lines changed: 107 additions & 227 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ members = [
8686
"frame/metadata",
8787
"frame/nicks",
8888
"frame/offences",
89+
"frame/proxy",
8990
"frame/randomness-collective-flip",
9091
"frame/recovery",
9192
"frame/scheduler",
@@ -179,6 +180,74 @@ members = [
179180
"utils/wasm-builder",
180181
]
181182

183+
# The list of dependencies below (which can be both direct and indirect dependencies) are crates
184+
# that are suspected to be CPU-intensive, and that are unlikely to require debugging (as some of
185+
# their debug info might be missing) or to require to be frequently recompiled. We compile these
186+
# dependencies with `opt-level=3` even in "dev" mode in order to make "dev" mode more usable.
187+
# The majority of these crates are cryptographic libraries.
188+
#
189+
# Note that this does **not** affect crates that depend on Substrate. In other words, if you add
190+
# a dependency on Substrate, you have to copy-paste this list in your own `Cargo.toml` (assuming
191+
# that you want the same list). This list is only relevant when running `cargo build` from within
192+
# the Substrate workspace.
193+
#
194+
# If you see an error mentioning "profile package spec ... did not match any packages", it
195+
# probably concerns this list.
196+
#
197+
# This list is ordered alphabetically.
198+
[profile.dev.package]
199+
aes-ctr = { opt-level = 3 }
200+
aes-soft = { opt-level = 3 }
201+
aesni = { opt-level = 3 }
202+
blake2 = { opt-level = 3 }
203+
blake2-rfc = { opt-level = 3 }
204+
blake2b_simd = { opt-level = 3 }
205+
blake2s_simd = { opt-level = 3 }
206+
chacha20-poly1305-aead = { opt-level = 3 }
207+
cranelift-codegen = { opt-level = 3 }
208+
cranelift-wasm = { opt-level = 3 }
209+
crc32fast = { opt-level = 3 }
210+
crossbeam-deque = { opt-level = 3 }
211+
crossbeam-queue = { opt-level = 3 }
212+
crypto-mac = { opt-level = 3 }
213+
ctr = { opt-level = 3 }
214+
curve25519-dalek = { opt-level = 3 }
215+
ed25519-dalek = { opt-level = 3 }
216+
evm-core = { opt-level = 3 }
217+
evm-runtime = { opt-level = 3 }
218+
flate2 = { opt-level = 3 }
219+
futures-channel = { opt-level = 3 }
220+
hashbrown = { opt-level = 3 }
221+
h2 = { opt-level = 3 }
222+
hash-db = { opt-level = 3 }
223+
hmac = { opt-level = 3 }
224+
httparse = { opt-level = 3 }
225+
integer-sqrt = { opt-level = 3 }
226+
keccak = { opt-level = 3 }
227+
libm = { opt-level = 3 }
228+
librocksdb-sys = { opt-level = 3 }
229+
libsecp256k1 = { opt-level = 3 }
230+
libz-sys = { opt-level = 3 }
231+
mio = { opt-level = 3 }
232+
nalgebra = { opt-level = 3 }
233+
num-bigint = { opt-level = 3 }
234+
parking_lot = { opt-level = 3 }
235+
parking_lot_core = { opt-level = 3 }
236+
percent-encoding = { opt-level = 3 }
237+
primitive-types = { opt-level = 3 }
238+
ring = { opt-level = 3 }
239+
rustls = { opt-level = 3 }
240+
sha2 = { opt-level = 3 }
241+
sha3 = { opt-level = 3 }
242+
smallvec = { opt-level = 3 }
243+
snow = { opt-level = 3 }
244+
twox-hash = { opt-level = 3 }
245+
uint = { opt-level = 3 }
246+
wasmi = { opt-level = 3 }
247+
x25519-dalek = { opt-level = 3 }
248+
yamux = { opt-level = 3 }
249+
zeroize = { opt-level = 3 }
250+
182251
[profile.release]
183252
# Substrate runtime requires unwinding.
184253
panic = "unwind"

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ Substrate is a next-generation framework for blockchain innovation 🚀.
99

1010
## Trying it out
1111

12-
Simply go to [substrate.dev](https://substrate.dev) and follow the [getting started](https://substrate.dev/docs/en/overview/getting-started/) instructions.
12+
Simply go to [substrate.dev](https://substrate.dev) and follow the
13+
[installation](https://substrate.dev/docs/en/knowledgebase/getting-started/) instructions. You can
14+
also try out one of the [tutorials](https://substrate.dev/en/tutorials).
1315

1416
## Contributions & Code of Conduct
1517

bin/node/browser-testing/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ license = "Apache-2.0"
99
[dependencies]
1010
futures-timer = "3.0.2"
1111
libp2p = { version = "0.19.1", default-features = false }
12-
jsonrpc-core = "14.0.5"
12+
jsonrpc-core = "14.2"
1313
serde = "1.0.106"
1414
serde_json = "1.0.48"
1515
wasm-bindgen = { version = "=0.2.62", features = ["serde-serialize"] }

bin/node/cli/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ codec = { package = "parity-scale-codec", version = "1.3.0" }
3838
serde = { version = "1.0.102", features = ["derive"] }
3939
futures = { version = "0.3.1", features = ["compat"] }
4040
hex-literal = "0.2.1"
41-
jsonrpc-core = "14.0.3"
41+
jsonrpc-core = "14.2"
4242
log = "0.4.8"
4343
rand = "0.7.2"
4444
structopt = { version = "0.3.8", optional = true }

bin/node/rpc-client/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ targets = ["x86_64-unknown-linux-gnu"]
1414
env_logger = "0.7.0"
1515
futures = "0.1.29"
1616
hyper = "0.12.35"
17-
jsonrpc-core-client = { version = "14.0.5", default-features = false, features = ["http"] }
17+
jsonrpc-core-client = { version = "14.2", default-features = false, features = ["http"] }
1818
log = "0.4.8"
1919
node-primitives = { version = "2.0.0-rc2", path = "../primitives" }
2020
sc-rpc = { version = "2.0.0-rc2", path = "../../../client/rpc" }

bin/node/rpc/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ targets = ["x86_64-unknown-linux-gnu"]
1212

1313
[dependencies]
1414
sc-client-api = { version = "2.0.0-rc2", path = "../../../client/api" }
15-
jsonrpc-core = "14.0.3"
15+
jsonrpc-core = "14.2"
1616
node-primitives = { version = "2.0.0-rc2", path = "../primitives" }
1717
node-runtime = { version = "2.0.0-rc2", path = "../runtime" }
1818
sp-runtime = { version = "2.0.0-rc2", path = "../../../primitives/runtime" }

bin/node/runtime/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ pallet-identity = { version = "2.0.0-rc2", default-features = false, path = "../
6161
pallet-membership = { version = "2.0.0-rc2", default-features = false, path = "../../../frame/membership" }
6262
pallet-offences = { version = "2.0.0-rc2", default-features = false, path = "../../../frame/offences" }
6363
pallet-offences-benchmarking = { version = "2.0.0-rc2", path = "../../../frame/offences/benchmarking", default-features = false, optional = true }
64+
pallet-proxy = { version = "2.0.0-rc2", default-features = false, path = "../../../frame/proxy" }
6465
pallet-randomness-collective-flip = { version = "2.0.0-rc2", default-features = false, path = "../../../frame/randomness-collective-flip" }
6566
pallet-recovery = { version = "2.0.0-rc2", default-features = false, path = "../../../frame/recovery" }
6667
pallet-session = { version = "2.0.0-rc2", features = ["historical"], path = "../../../frame/session", default-features = false }
@@ -111,6 +112,7 @@ std = [
111112
"node-primitives/std",
112113
"sp-offchain/std",
113114
"pallet-offences/std",
115+
"pallet-proxy/std",
114116
"sp-core/std",
115117
"pallet-randomness-collective-flip/std",
116118
"sp-std/std",
@@ -149,6 +151,7 @@ runtime-benchmarks = [
149151
"pallet-elections-phragmen/runtime-benchmarks",
150152
"pallet-identity/runtime-benchmarks",
151153
"pallet-im-online/runtime-benchmarks",
154+
"pallet-proxy/runtime-benchmarks",
152155
"pallet-scheduler/runtime-benchmarks",
153156
"pallet-society/runtime-benchmarks",
154157
"pallet-staking/runtime-benchmarks",

bin/node/runtime/src/lib.rs

Lines changed: 61 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,14 @@
2424

2525
use sp_std::prelude::*;
2626
use frame_support::{
27-
construct_runtime, parameter_types, debug,
27+
construct_runtime, parameter_types, debug, RuntimeDebug,
2828
weights::{
2929
Weight, IdentityFee,
3030
constants::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight, WEIGHT_PER_SECOND},
3131
},
3232
traits::{Currency, Imbalance, KeyOwnerProofSystem, OnUnbalanced, Randomness, LockIdentifier},
3333
};
34+
use codec::{Encode, Decode};
3435
use sp_core::{
3536
crypto::KeyTypeId,
3637
u32_trait::{_1, _2, _3, _4},
@@ -60,7 +61,6 @@ use pallet_transaction_payment_rpc_runtime_api::RuntimeDispatchInfo;
6061
use pallet_contracts_rpc_runtime_api::ContractExecResult;
6162
use pallet_session::{historical as pallet_session_historical};
6263
use sp_inherents::{InherentData, CheckInherentsResult};
63-
use codec::Encode;
6464
use static_assertions::const_assert;
6565

6666
#[cfg(any(feature = "std", test))]
@@ -79,6 +79,7 @@ use impls::{CurrencyToVoteHandler, Author, TargetedFeeAdjustment};
7979
/// Constant values used within the runtime.
8080
pub mod constants;
8181
use constants::{time::*, currency::*};
82+
use frame_support::traits::InstanceFilter;
8283

8384
// Make the WASM binary available.
8485
#[cfg(feature = "std")]
@@ -168,11 +169,13 @@ impl frame_system::Trait for Runtime {
168169
type OnKilledAccount = ();
169170
}
170171

172+
const fn deposit(items: u32, bytes: u32) -> Balance { items as Balance * 15 * CENTS + (bytes as Balance) * 6 * CENTS }
173+
171174
parameter_types! {
172-
// One storage item; value is size 4+4+16+32 bytes = 56 bytes.
173-
pub const MultisigDepositBase: Balance = 30 * CENTS;
175+
// One storage item; key size is 32; value is size 4+4+16+32 bytes = 56 bytes.
176+
pub const MultisigDepositBase: Balance = deposit(1, 88);
174177
// Additional storage item size of 32 bytes.
175-
pub const MultisigDepositFactor: Balance = 5 * CENTS;
178+
pub const MultisigDepositFactor: Balance = deposit(0, 32);
176179
pub const MaxSignatories: u16 = 100;
177180
}
178181

@@ -186,6 +189,52 @@ impl pallet_utility::Trait for Runtime {
186189
type IsCallable = ();
187190
}
188191

192+
parameter_types! {
193+
// One storage item; key size 32, value size 8; .
194+
pub const ProxyDepositBase: Balance = deposit(1, 8);
195+
// Additional storage item size of 33 bytes.
196+
pub const ProxyDepositFactor: Balance = deposit(0, 33);
197+
pub const MaxProxies: u16 = 32;
198+
}
199+
200+
/// The type used to represent the kinds of proxying allowed.
201+
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Encode, Decode, RuntimeDebug)]
202+
pub enum ProxyType {
203+
Any,
204+
NonTransfer,
205+
Governance,
206+
Staking,
207+
}
208+
impl Default for ProxyType { fn default() -> Self { Self::Any } }
209+
impl InstanceFilter<Call> for ProxyType {
210+
fn filter(&self, c: &Call) -> bool {
211+
match self {
212+
ProxyType::Any => true,
213+
ProxyType::NonTransfer => !matches!(c,
214+
Call::Balances(..) | Call::Utility(..)
215+
| Call::Vesting(pallet_vesting::Call::vested_transfer(..))
216+
| Call::Indices(pallet_indices::Call::transfer(..))
217+
),
218+
ProxyType::Governance => matches!(c,
219+
Call::Democracy(..) | Call::Council(..) | Call::Society(..)
220+
| Call::TechnicalCommittee(..) | Call::Elections(..) | Call::Treasury(..)
221+
),
222+
ProxyType::Staking => matches!(c, Call::Staking(..)),
223+
}
224+
}
225+
}
226+
227+
impl pallet_proxy::Trait for Runtime {
228+
type Event = Event;
229+
type Call = Call;
230+
type Currency = Balances;
231+
type IsCallable = ();
232+
type ProxyType = ProxyType;
233+
type ProxyDepositBase = ProxyDepositBase;
234+
type ProxyDepositFactor = ProxyDepositFactor;
235+
type MaxProxies = MaxProxies;
236+
}
237+
189238
parameter_types! {
190239
pub MaximumSchedulerWeight: Weight = Perbill::from_percent(80) * MaximumBlockWeight::get();
191240
}
@@ -320,9 +369,11 @@ parameter_types! {
320369
pub const BondingDuration: pallet_staking::EraIndex = 24 * 28;
321370
pub const SlashDeferDuration: pallet_staking::EraIndex = 24 * 7; // 1/4 the bonding duration.
322371
pub const RewardCurve: &'static PiecewiseLinear<'static> = &REWARD_CURVE;
323-
pub const ElectionLookahead: BlockNumber = EPOCH_DURATION_IN_BLOCKS / 4;
324372
pub const MaxNominatorRewardedPerValidator: u32 = 64;
325-
pub const MaxIterations: u32 = 5;
373+
pub const ElectionLookahead: BlockNumber = EPOCH_DURATION_IN_BLOCKS / 4;
374+
pub const MaxIterations: u32 = 10;
375+
// 0.05%. The higher the value, the more strict solution acceptance becomes.
376+
pub MinSolutionScoreBump: Perbill = Perbill::from_rational_approximation(5u32, 10_000);
326377
}
327378

328379
impl pallet_staking::Trait for Runtime {
@@ -344,6 +395,7 @@ impl pallet_staking::Trait for Runtime {
344395
type ElectionLookahead = ElectionLookahead;
345396
type Call = Call;
346397
type MaxIterations = MaxIterations;
398+
type MinSolutionScoreBump = MinSolutionScoreBump;
347399
type MaxNominatorRewardedPerValidator = MaxNominatorRewardedPerValidator;
348400
type UnsignedPriority = StakingUnsignedPriority;
349401
}
@@ -756,6 +808,7 @@ construct_runtime!(
756808
Recovery: pallet_recovery::{Module, Call, Storage, Event<T>},
757809
Vesting: pallet_vesting::{Module, Call, Storage, Event<T>, Config<T>},
758810
Scheduler: pallet_scheduler::{Module, Call, Storage, Event<T>},
811+
Proxy: pallet_proxy::{Module, Call, Storage, Event},
759812
}
760813
);
761814

@@ -1006,6 +1059,7 @@ impl_runtime_apis! {
10061059
add_benchmark!(params, batches, b"identity", Identity);
10071060
add_benchmark!(params, batches, b"im-online", ImOnline);
10081061
add_benchmark!(params, batches, b"offences", OffencesBench::<Runtime>);
1062+
add_benchmark!(params, batches, b"proxy", Proxy);
10091063
add_benchmark!(params, batches, b"scheduler", Scheduler);
10101064
add_benchmark!(params, batches, b"session", SessionBench::<Runtime>);
10111065
add_benchmark!(params, batches, b"staking", Staking);

0 commit comments

Comments
 (0)