Skip to content

Commit

Permalink
Merge pull request #15 from OriginTrail/feature/multisig
Browse files Browse the repository at this point in the history
Multisig implementation
  • Loading branch information
NZT48 authored May 10, 2022
2 parents 7ec9e89 + 9ec4230 commit a69a6e2
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 23 deletions.
45 changes: 23 additions & 22 deletions runtime/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "origintrail-parachain-runtime"
version = "1.0.0"
version = "1.0.1"
authors = ["TraceLabs"]
description = "OriginTrail Parachain Runtime - Cumulus FRAME-based Substrate Runtime"
license = "GPL-3.0-only"
Expand All @@ -15,10 +15,14 @@ targets = ["x86_64-unknown-linux-gnu"]
substrate-wasm-builder = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.18" }

[dependencies]
codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] }
codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = [
"derive",
] }
hex-literal = { version = "0.3.4", optional = true }
log = { version = "0.4.14", default-features = false }
scale-info = { version = "2.0.0", default-features = false, features = ["derive"] }
scale-info = { version = "2.0.0", default-features = false, features = [
"derive",
] }
serde = { version = "1.0.132", optional = true, features = ["derive"] }
smallvec = "1.6.1"

Expand All @@ -36,7 +40,8 @@ frame-try-runtime = { git = "https://github.com/paritytech/substrate", default-f
pallet-aura = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.18" }
pallet-authorship = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.18" }
pallet-balances = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.18" }
pallet-scheduler = { git = "https://github.com/paritytech/substrate.git", default-features = false, branch = "polkadot-v0.9.18" }
pallet-multisig = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.18" }
pallet-scheduler = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.18" }
pallet-session = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.18" }
pallet-sudo = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.18" }
pallet-timestamp = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.18" }
Expand Down Expand Up @@ -64,22 +69,20 @@ xcm-builder = { git = "https://github.com/paritytech/polkadot", default-features
xcm-executor = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "release-v0.9.18" }

# Cumulus
cumulus-pallet-aura-ext = { git = "https://github.com/paritytech/cumulus", default-features = false, branch = "polkadot-v0.9.18" }
cumulus-pallet-dmp-queue = { git = "https://github.com/paritytech/cumulus", default-features = false, branch = "polkadot-v0.9.18" }
cumulus-pallet-parachain-system = { git = "https://github.com/paritytech/cumulus", default-features = false, branch = "polkadot-v0.9.18" }
cumulus-pallet-session-benchmarking = { git = "https://github.com/paritytech/cumulus", default-features = false, branch = "polkadot-v0.9.18" }
cumulus-pallet-xcm = { git = "https://github.com/paritytech/cumulus", default-features = false, branch = "polkadot-v0.9.18" }
cumulus-pallet-xcmp-queue = { git = "https://github.com/paritytech/cumulus", default-features = false, branch = "polkadot-v0.9.18" }
cumulus-primitives-core = { git = "https://github.com/paritytech/cumulus", default-features = false, branch = "polkadot-v0.9.18" }
cumulus-primitives-timestamp = { git = "https://github.com/paritytech/cumulus", default-features = false, branch = "polkadot-v0.9.18" }
cumulus-primitives-utility = { git = "https://github.com/paritytech/cumulus", default-features = false, branch = "polkadot-v0.9.18" }
pallet-collator-selection = { git = "https://github.com/paritytech/cumulus", default-features = false, branch = "polkadot-v0.9.18" }
parachain-info = { git = "https://github.com/paritytech/cumulus", default-features = false, branch = "polkadot-v0.9.18" }
cumulus-pallet-aura-ext = { git = "https://github.com/paritytech/cumulus", default-features = false, branch = "polkadot-v0.9.18" }
cumulus-pallet-dmp-queue = { git = "https://github.com/paritytech/cumulus", default-features = false, branch = "polkadot-v0.9.18" }
cumulus-pallet-parachain-system = { git = "https://github.com/paritytech/cumulus", default-features = false, branch = "polkadot-v0.9.18" }
cumulus-pallet-session-benchmarking = { git = "https://github.com/paritytech/cumulus", default-features = false, branch = "polkadot-v0.9.18" }
cumulus-pallet-xcm = { git = "https://github.com/paritytech/cumulus", default-features = false, branch = "polkadot-v0.9.18" }
cumulus-pallet-xcmp-queue = { git = "https://github.com/paritytech/cumulus", default-features = false, branch = "polkadot-v0.9.18" }
cumulus-primitives-core = { git = "https://github.com/paritytech/cumulus", default-features = false, branch = "polkadot-v0.9.18" }
cumulus-primitives-timestamp = { git = "https://github.com/paritytech/cumulus", default-features = false, branch = "polkadot-v0.9.18" }
cumulus-primitives-utility = { git = "https://github.com/paritytech/cumulus", default-features = false, branch = "polkadot-v0.9.18" }
pallet-collator-selection = { git = "https://github.com/paritytech/cumulus", default-features = false, branch = "polkadot-v0.9.18" }
parachain-info = { git = "https://github.com/paritytech/cumulus", default-features = false, branch = "polkadot-v0.9.18" }

[features]
default = [
"std",
]
default = ["std"]
std = [
"codec/std",
"log/std",
Expand All @@ -101,6 +104,7 @@ std = [
"pallet-authorship/std",
"pallet-balances/std",
"pallet-collator-selection/std",
"pallet-multisig/std",
"pallet-scheduler/std",
"pallet-session/std",
"pallet-sudo/std",
Expand Down Expand Up @@ -146,7 +150,4 @@ runtime-benchmarks = [
"cumulus-pallet-xcmp-queue/runtime-benchmarks",
]

try-runtime = [
"frame-executive/try-runtime",
"frame-try-runtime",
]
try-runtime = ["frame-executive/try-runtime", "frame-try-runtime"]
25 changes: 24 additions & 1 deletion runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
spec_name: create_runtime_str!("origintrail-parachain"),
impl_name: create_runtime_str!("origintrail-parachain"),
authoring_version: 1,
spec_version: 100,
spec_version: 101,
impl_version: 0,
apis: RUNTIME_API_VERSIONS,
transaction_version: 1,
Expand Down Expand Up @@ -200,6 +200,10 @@ pub const OTP: Balance = 1_000_000_000_000;
pub const MILLIOTP: Balance = 1_000_000_000;
pub const MICROOTP: Balance = 1_000_000;

pub const fn deposit(items: u32, bytes: u32) -> Balance {
items as Balance * 15 * OTP + (bytes as Balance) * 6 * OTP
}

/// The existential deposit. Set to 1/10 of the Connected Relay Chain.
pub const EXISTENTIAL_DEPOSIT: Balance = OTP;

Expand Down Expand Up @@ -476,6 +480,24 @@ impl pallet_sudo::Config for Runtime {
type Call = Call;
}

parameter_types! {
// One storage item; key size is 32; value is size 4+4+16+32 bytes = 56 bytes.
pub const DepositBase: Balance = deposit(1, 88);
// Additional storage item size of 32 bytes.
pub const DepositFactor: Balance = deposit(0, 32);
pub const MaxSignatories: u16 = 100;
}

impl pallet_multisig::Config for Runtime {
type Event = Event;
type Call = Call;
type Currency = Balances;
type DepositBase = DepositBase;
type DepositFactor = DepositFactor;
type MaxSignatories = MaxSignatories;
type WeightInfo = pallet_multisig::weights::SubstrateWeight<Runtime>;
}

/// Configure the pallet template in pallets/template.
impl pallet_template::Config for Runtime {
type Event = Event;
Expand All @@ -495,6 +517,7 @@ construct_runtime!(
} = 1,
Timestamp: pallet_timestamp::{Pallet, Call, Storage, Inherent} = 2,
ParachainInfo: parachain_info::{Pallet, Storage, Config} = 3,
Multisig: pallet_multisig::{Pallet, Call, Storage, Event<T>} = 4,

// Monetary stuff.
Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>} = 10,
Expand Down

0 comments on commit a69a6e2

Please sign in to comment.