Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

98 voting pallet #107

Merged
merged 28 commits into from
Aug 16, 2022
Merged
Show file tree
Hide file tree
Changes from 21 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
94cfc73
Updating branch with main updates (#100)
letodunc Jul 18, 2022
56e4f03
Merge main into voting pallet branch (#104)
letodunc Jul 19, 2022
9c557f0
added voting pallet, added config in runtime
letodunc Jul 19, 2022
ab3e623
added collective and democracy pallets to voting pallet and runtime c…
letodunc Jul 25, 2022
b492d99
added collective and democracy config to runtime
letodunc Jul 25, 2022
2f9f9be
updated pallet_template
letodunc Aug 8, 2022
42194c7
added members to house council
letodunc Aug 8, 2022
2aa0e1d
added functions to voting
letodunc Aug 8, 2022
1cb16a3
added pallet roles to voting
letodunc Aug 8, 2022
7ad0a04
update functions implementation
letodunc Aug 8, 2022
19d04b1
added events, refactored code
letodunc Aug 9, 2022
65634d3
updated test configuration
letodunc Aug 9, 2022
03ebaa6
added call formating for collective::propose()
letodunc Aug 9, 2022
c5f71d5
added full process voting implementation with basic checks
letodunc Aug 10, 2022
30fdb0a
added origin check on proposal dispatching from Democracy
letodunc Aug 11, 2022
6baf939
added check origin call from collective pallet
letodunc Aug 11, 2022
a995d56
added proposal status transition management and documentation
letodunc Aug 16, 2022
2f51df6
Merge branch 'main' into 98-voting-pallet
letodunc Aug 16, 2022
4c1f726
updated voting mockup for tests
letodunc Aug 16, 2022
2d70c77
Merge branch '98-voting-pallet' of https://github.com/Fair-Squares/fa…
letodunc Aug 16, 2022
0d44d24
refactored code
letodunc Aug 16, 2022
4a59015
removed comments
letodunc Aug 16, 2022
ef0d525
code review updates
letodunc Aug 16, 2022
0b3cbb6
code review updates
letodunc Aug 16, 2022
ee82453
fix for voting benchmarking
letodunc Aug 16, 2022
827df24
added fix for voting benchmarking
letodunc Aug 16, 2022
74db7c9
fix update
letodunc Aug 16, 2022
cef7e62
temporary deactivated voting benchmarking
letodunc Aug 16, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions assets/pallet_template/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ std = [
"codec/std",
"scale-info/std",
"sp-std/std",
"sp-runtime/std",
"frame-support/std",
"frame-system/std",
"frame-benchmarking/std",
Expand Down
13 changes: 12 additions & 1 deletion node/src/chain_spec.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use fs_node_runtime::{
AccountId, AuraConfig, BalancesConfig, GenesisConfig, GrandpaConfig, Signature, SudoConfig,
SystemConfig, WASM_BINARY,
SystemConfig, WASM_BINARY, HouseCouncilConfig
};
use sc_service::Properties;
use sc_service::ChainType;
Expand Down Expand Up @@ -161,5 +161,16 @@ fn testnet_genesis(
key: Some(root_key),
},
transaction_payment: Default::default(),
democracy: Default::default(),
treasury: Default::default(),
house_council: HouseCouncilConfig {
members: vec![
get_account_id_from_seed::<sr25519::Public>("Alice"),
get_account_id_from_seed::<sr25519::Public>("Bob"),
get_account_id_from_seed::<sr25519::Public>("Charlie"),
get_account_id_from_seed::<sr25519::Public>("Dave"),
],
phantom: Default::default(),
}
}
}
56 changes: 56 additions & 0 deletions pallets/voting/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
[package]
name = "pallet-voting"
version = "4.0.0-dev"
description = "FRAME pallet template for defining custom runtime logic."
authors = ["Substrate DevHub <https://github.com/substrate-developer-hub>"]
homepage = "https://substrate.io/"
edition = "2021"
license = "Unlicense"
publish = false
repository = "https://github.com/letodunc/substrate-node/"

[package.metadata.docs.rs]
targets = ["x86_64-unknown-linux-gnu"]

[dependencies]
codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = [
"derive",
] }
scale-info = { version = "2.1.1", default-features = false, features = ["derive"] }
frame-support = { default-features = false, version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.26"}
frame-system = { default-features = false, version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.26" }
frame-benchmarking = { default-features = false, version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.26", optional = true }
sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.26" }
pallet-collective = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.26", default-features = false }
pallet-democracy = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.26", default-features = false }
pallet-balances = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.26" }
pallet-scheduler = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.26", default-features = false }
pallet-sudo = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.26" }
pallet-roles = { default-features = false, path="../roles" }

[dev-dependencies]
sp-core = { default-features = false, version = "6.0.0", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.26" }
sp-io = { default-features = false, version = "6.0.0", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.26" }
sp-runtime = { default-features = false, version = "6.0.0", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.26" }
sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.26" }

[features]
default = ["std"]
std = [
"codec/std",
"scale-info/std",
"sp-std/std",
"sp-runtime/std",
"frame-support/std",
"frame-system/std",
"frame-benchmarking/std",
"pallet-collective/std",
"pallet-democracy/std",
"pallet-scheduler/std",
"pallet-balances/std",
"pallet-roles/std",
"pallet-sudo/std",
]

runtime-benchmarks = ["frame-benchmarking/runtime-benchmarks"]
try-runtime = ["frame-support/try-runtime"]
1 change: 1 addition & 0 deletions pallets/voting/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
License: Unlicense
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

License Apache 2.0 or remove

20 changes: 20 additions & 0 deletions pallets/voting/src/benchmarking.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
//! Benchmarking setup for pallet-template

use super::*;

#[allow(unused)]
use crate::Pallet as Voting;
use frame_benchmarking::{benchmarks, whitelisted_caller};
use frame_system::RawOrigin;

benchmarks! {
do_something {
let s in 0 .. 100;
let caller: T::AccountId = whitelisted_caller();
}: _(RawOrigin::Signed(caller), s)
verify {
assert_eq!(Something::<T>::get(), Some(s));
}

impl_benchmark_test_suite!(Voting, crate::mock::new_test_ext(), crate::mock::Test);
}
Loading