Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
172 commits
Select commit Hold shift + click to select a range
60eab08
Add proposals modules
shamil-gadelshin Feb 11, 2020
979b8a4
Delete modules *.lock files
shamil-gadelshin Feb 11, 2020
cae4ee8
Change proposal approval algorithm
shamil-gadelshin Feb 11, 2020
e120bde
Add proposal grace period
shamil-gadelshin Feb 11, 2020
0ae5765
Simplify proposal tests
shamil-gadelshin Feb 11, 2020
b7d1db3
Update proposal codex module
shamil-gadelshin Feb 11, 2020
ba2270a
Remove unnecessary crates
shamil-gadelshin Feb 12, 2020
a56b4c5
Fix review comments 1
shamil-gadelshin Feb 13, 2020
2495f3c
Fix tests and update codex module
shamil-gadelshin Feb 13, 2020
a77f8e2
Embed tally results into the proposal object
shamil-gadelshin Feb 14, 2020
29c63ff
Embed votes into the proposal struct
shamil-gadelshin Feb 14, 2020
a856fd2
Change VoteExistsByProposalByAccount cache
shamil-gadelshin Feb 14, 2020
484ae58
Refactor tally() method
shamil-gadelshin Feb 14, 2020
1cea688
Codex module build fix
shamil-gadelshin Feb 14, 2020
f5857b3
Introduce proposer_id instead of account_id
shamil-gadelshin Feb 14, 2020
3b79fae
Introduce VoterId type instead of AccountId for voting
shamil-gadelshin Feb 14, 2020
cc81780
Add TODO: add maximum allowed active proposals
shamil-gadelshin Feb 14, 2020
123ea30
Add stake dependency
shamil-gadelshin Feb 14, 2020
def6faf
Remove redundant check on voting
shamil-gadelshin Feb 17, 2020
753fff5
Add VotingResults type
shamil-gadelshin Feb 17, 2020
c11fd84
Remove votes from the Proposal
shamil-gadelshin Feb 17, 2020
bbabc67
Introduce define_proposal_decision_status()
shamil-gadelshin Feb 17, 2020
b2278bf
Remove TallyResults and Vote types
shamil-gadelshin Feb 17, 2020
f350622
Add comments and refactor
shamil-gadelshin Feb 17, 2020
f2e78a3
Apply cargo fmt
shamil-gadelshin Feb 17, 2020
9bb8523
Add max_active_proposals_number const
shamil-gadelshin Feb 17, 2020
d2175a3
Upgrade TextProposal
shamil-gadelshin Feb 17, 2020
ee5155a
Introduce RuntimeUpgrade proposal type
shamil-gadelshin Feb 17, 2020
6b447b6
Merge pull request #152 from shamil-gadelshin/proposals_v2_iteration2…
bedeho Feb 17, 2020
d75711a
Make Text and Wasm length configurable in codex storage
shamil-gadelshin Feb 18, 2020
2929675
Merge branch 'proposals_v2' into proposals_v2_iteration3
shamil-gadelshin Feb 18, 2020
d5d9f69
Add MaxActiveProposals storage config parameter
shamil-gadelshin Feb 18, 2020
e2d2284
Add stake to the proposal on creation
shamil-gadelshin Feb 19, 2020
1127041
Change ProposalStatus type
shamil-gadelshin Feb 19, 2020
7c66d0a
Add stakes to the proposal
shamil-gadelshin Feb 19, 2020
672eca5
Add remove_stake() function with errors mapping
shamil-gadelshin Feb 20, 2020
209012b
Refactor stakes error handling.
shamil-gadelshin Feb 20, 2020
dfaf17e
Add stake removing during proposal finalization
shamil-gadelshin Feb 20, 2020
d9c8cb9
Add test for stakes and balances
shamil-gadelshin Feb 20, 2020
b5fe654
Add stake mocks
shamil-gadelshin Feb 20, 2020
1767f3d
Add stake mock test
shamil-gadelshin Feb 20, 2020
8040356
Add comments
shamil-gadelshin Feb 21, 2020
b1858b6
Add proposal slashing with tests
shamil-gadelshin Feb 21, 2020
1b7843d
Refactor create_proposal() ensure’s and add new check.
shamil-gadelshin Feb 21, 2020
119f661
Add slashes
shamil-gadelshin Feb 21, 2020
26acb33
Refactor types and tests
shamil-gadelshin Feb 21, 2020
f7022f7
Change comments
shamil-gadelshin Feb 24, 2020
ca9946e
Add comments regarding stake module issue
shamil-gadelshin Feb 24, 2020
e6ddc04
Add discussion module skeleton
shamil-gadelshin Feb 25, 2020
6cf7c87
Add create_discussion() API method
shamil-gadelshin Feb 25, 2020
38bcd53
Add a post
shamil-gadelshin Feb 25, 2020
793b028
Add virtual workspace for the proposals module
shamil-gadelshin Feb 25, 2020
fadabb1
Integrate discussion system with codex and engine
shamil-gadelshin Feb 26, 2020
7419578
Add comments
shamil-gadelshin Feb 26, 2020
de1b9e3
Add update_post() extrinsic
shamil-gadelshin Feb 27, 2020
3ce4801
Remove approved_at field from the Proposal
shamil-gadelshin Feb 27, 2020
f2746e0
Move finalized_at to the FinalizationData
shamil-gadelshin Feb 27, 2020
bcf3c65
Move proposal parameters to the separate module
shamil-gadelshin Feb 27, 2020
4cf9e98
Add proposal status comments.
shamil-gadelshin Feb 27, 2020
2351fd0
Refactor stakes
shamil-gadelshin Feb 27, 2020
64d270a
Change config() parameters to the Get<> parameters
shamil-gadelshin Feb 28, 2020
a3ab113
Change config() params to Get<> in the codex
shamil-gadelshin Feb 28, 2020
b2b81f6
Apply cargo fmt
shamil-gadelshin Feb 28, 2020
9e44370
Change MaxPostEditionNumber from config() to Get<>
shamil-gadelshin Feb 28, 2020
79daae2
Migrate posts from map to double map in discussion
shamil-gadelshin Feb 28, 2020
541369a
Move discussion dependency from the engine to the codex
shamil-gadelshin Feb 28, 2020
d378788
Add tests for thread and post content in discussions
shamil-gadelshin Feb 28, 2020
3af739a
Add create_thread() title ensure_*()
shamil-gadelshin Feb 28, 2020
49e3eea
Add checks for discussion module extrinsics
shamil-gadelshin Feb 28, 2020
0d0542c
Merge pull request #162 from shamil-gadelshin/proposals_v2_iteration3
bedeho Mar 2, 2020
fcf1483
Merge branch 'proposals_v2' into proposals_v2_iteration4
shamil-gadelshin Mar 2, 2020
79f4978
Merge pull request #175 from shamil-gadelshin/proposals_v2_iteration4
bedeho Mar 2, 2020
c0a74cc
Add antispam-gate for the thread creation
shamil-gadelshin Mar 3, 2020
e59ff2f
Update comments
shamil-gadelshin Mar 3, 2020
2e7478d
Add ActorOriginValidator trait
shamil-gadelshin Mar 3, 2020
0d9dba2
Introduce ‘PostAuthorOriginValidator’ associated type
shamil-gadelshin Mar 3, 2020
0ab9cd9
Add events to the discussion module
shamil-gadelshin Mar 3, 2020
7a3cbe7
Update codex module with latest discussion module
shamil-gadelshin Mar 3, 2020
7a503d6
Merge branch 'development' into proposal_v2_runtime_monorepo
shamil-gadelshin Mar 10, 2020
66d8d2f
Merge pull request #192 from shamil-gadelshin/proposals_v2_runtime_mo…
mnaamani Mar 12, 2020
3490851
Merge branch 'proposals_v2' into proposals_v2_iteration6
shamil-gadelshin Mar 12, 2020
0dad6a0
Move proposals to the ‘runtime-modules’ folder
shamil-gadelshin Mar 12, 2020
1d826d3
Update Cargo.toml’s
shamil-gadelshin Mar 12, 2020
147333c
Merge branch 'development' into proposals_v2_iteration6
shamil-gadelshin Mar 12, 2020
2967e9e
Disable warning in runtime lib.rs
shamil-gadelshin Mar 12, 2020
7587e9f
Integrate discussion system (proposals) with membership crate
shamil-gadelshin Mar 12, 2020
0edc918
Convert PostAuthorId to the MemberId
shamil-gadelshin Mar 12, 2020
59d1027
Integrate engine with membership module
shamil-gadelshin Mar 13, 2020
7985e6d
Refactor actor_origin_validator
shamil-gadelshin Mar 13, 2020
dc3d9b0
Update & fix tests
shamil-gadelshin Mar 13, 2020
79c2849
Add tests for membership module (MembershipOriginValidator)
shamil-gadelshin Mar 13, 2020
64f4486
Update membership module tests (origin validator)
shamil-gadelshin Mar 13, 2020
80ae71c
Make set_countil() public for testing purposes
shamil-gadelshin Mar 16, 2020
309f116
Move ActorOriginValidator from membership to common
shamil-gadelshin Mar 16, 2020
db0f440
Integrate engine module with council
shamil-gadelshin Mar 16, 2020
bc684d7
Implement total_voters_count() for engine module
shamil-gadelshin Mar 16, 2020
2a306e7
Change ensure_actor_origin() signature
shamil-gadelshin Mar 16, 2020
b889a42
Add souce_account_id in the engine module
shamil-gadelshin Mar 16, 2020
5b9fb19
Add StakingEventHandler for engine module
shamil-gadelshin Mar 16, 2020
90c2ad7
Remove comments
shamil-gadelshin Mar 17, 2020
b3f9c3d
Remove proposals version 1
shamil-gadelshin Mar 17, 2020
9b980fb
Add proposals modules to the runtime
shamil-gadelshin Mar 17, 2020
5b9fa74
Fix StakeEventsHandler in the proposals engine
shamil-gadelshin Mar 17, 2020
a326379
Integrate proposals StakeEventsHandler
shamil-gadelshin Mar 17, 2020
fae4e69
Add proposals extrinsics to the proposals codex
shamil-gadelshin Mar 17, 2020
e5da8ee
Migrate to the extrinsic execution model
shamil-gadelshin Mar 17, 2020
39dafdf
Restore tests for the extrinsic execution model
shamil-gadelshin Mar 17, 2020
14842a1
Migrate proposals engine to decl_error! macro
shamil-gadelshin Mar 18, 2020
a133506
Migrate proposals to decl_error! macro
shamil-gadelshin Mar 18, 2020
bcd36e7
Apply cargo fmt
shamil-gadelshin Mar 18, 2020
51c7a87
Merge branch 'development' into proposals_v2_iteration7
shamil-gadelshin Mar 19, 2020
4cd3cae
Update runtime version to 6.9.0
shamil-gadelshin Mar 19, 2020
ac4ed69
Fix stake module API change issues
shamil-gadelshin Mar 19, 2020
8161ab4
Migrate proposals to the new stake module API
shamil-gadelshin Mar 19, 2020
6da44c1
Restore commented RejectionFee slashing test
shamil-gadelshin Mar 19, 2020
269519e
Add runtime proposals integration test
shamil-gadelshin Mar 23, 2020
8771c93
Move origin validators to the runtime
shamil-gadelshin Mar 24, 2020
522dd9e
Fix integration tests
shamil-gadelshin Mar 24, 2020
d960833
Move StakingEventsHandler to the runtime
shamil-gadelshin Mar 25, 2020
6ae86f2
Refactor proposals engine module
shamil-gadelshin Mar 25, 2020
9e8e710
Add ensure calls of dependent modules in codex
shamil-gadelshin Mar 25, 2020
618f9fc
Change proposals actor validation
shamil-gadelshin Mar 25, 2020
24fc74f
Change MembershipOriginValidator in the runtime
shamil-gadelshin Mar 25, 2020
d4b7da4
Refactor execute_proposal() in the engine module
shamil-gadelshin Mar 25, 2020
ec69828
Refactor proposal status finalization_error
shamil-gadelshin Mar 25, 2020
1702dce
Refactor proposal stakes
shamil-gadelshin Mar 25, 2020
09c8b3a
Merge pull request #194 from shamil-gadelshin/proposals_v2_iteration6
bedeho Mar 25, 2020
19c09c6
Merge branch 'proposals_v2' into proposals_v2_iteration7
shamil-gadelshin Mar 26, 2020
85684bf
Fix broken tests
shamil-gadelshin Mar 26, 2020
32f6965
Merge branch 'development' into proposals_v2_iteration7
shamil-gadelshin Mar 26, 2020
bb8c043
Refactor engine module
shamil-gadelshin Mar 27, 2020
2ebff4a
Add tests for engine errors
shamil-gadelshin Mar 27, 2020
e9f1f16
Add error tests
shamil-gadelshin Mar 27, 2020
51628fb
Add CouncilElected hook for the proposals
shamil-gadelshin Mar 27, 2020
a1158d8
Merge branch 'development' into proposals_v2_iteration7
shamil-gadelshin Mar 30, 2020
d510d90
Add ‘set_election_parameters’ extrinsic
shamil-gadelshin Mar 30, 2020
97e0cb3
Merge branch 'development' into proposals_v2_iteration7
shamil-gadelshin Mar 30, 2020
6667cd3
Add create_set_council_mint_capacity_proposal() extrinsic
shamil-gadelshin Mar 30, 2020
9e2f9e9
Refactor codex proposal creation
shamil-gadelshin Mar 30, 2020
4f1aa44
Add tests for create_set_council_mint_capacity_proposal() in codex
shamil-gadelshin Mar 30, 2020
552de6b
Add create_set_content_working_group_mint_capacity_proposal() extrinsic
shamil-gadelshin Mar 31, 2020
17ea5f1
Add ‘spending proposal’ extrinsic
shamil-gadelshin Mar 31, 2020
a7f8fa6
Add ‘create_set_lead_proposal()’ extrinsic
shamil-gadelshin Mar 31, 2020
0044ee2
Add comments for the codex module
shamil-gadelshin Mar 31, 2020
715eaed
Merge branch 'development' into proposals_v2
shamil-gadelshin Apr 6, 2020
c3c3670
Merge pull request #263 from shamil-gadelshin/proposals_v2
bedeho Apr 6, 2020
5d5250b
Merge remote-tracking branch 'origin/proposals_v2' into proposals_v2_…
shamil-gadelshin Apr 6, 2020
6952350
Merge pull request #264 from shamil-gadelshin/propovals_v2_iteration7…
bedeho Apr 19, 2020
34b0e7c
Add codex ProposalDetails for the frontend
shamil-gadelshin Apr 1, 2020
51cde50
Add ‘create_evict_storage_provider_proposal’ extrinsic
shamil-gadelshin Apr 2, 2020
b994ee7
Add ‘create_set_validator_count_proposal’ extrinsic
shamil-gadelshin Apr 2, 2020
e77768a
Add ‘create_set_storage_role_parameters_proposal’ extrinsic
shamil-gadelshin Apr 2, 2020
6c01c09
Fix reset_proposal() in the engine module
shamil-gadelshin Apr 3, 2020
020f3c7
Change upgrade runtime proposal
shamil-gadelshin Apr 3, 2020
ab54a82
Add some comments to proposal modules
shamil-gadelshin Apr 3, 2020
c27a869
Set min validator count for the proposals
shamil-gadelshin Apr 6, 2020
aa793af
Add ensure_storage_role_parameters_valid() to the codex
shamil-gadelshin Apr 6, 2020
96720b4
Add ensure_council_election_parameters_valid() to the codex
shamil-gadelshin Apr 7, 2020
e8dbdcb
Change min_validator_count() limit in the codex
shamil-gadelshin Apr 7, 2020
b679257
Add veto for the pending execution proposal.
shamil-gadelshin Apr 8, 2020
f55dcf6
Set general proposal parameters.
shamil-gadelshin Apr 9, 2020
1884aa0
Update proposals runtime parameters
shamil-gadelshin Apr 9, 2020
dda832e
Set proposal parameters
shamil-gadelshin Apr 10, 2020
61a8127
Fix clippy comments
shamil-gadelshin Apr 13, 2020
a9bbf47
Add comments
shamil-gadelshin Apr 13, 2020
74e1fe2
Update comments
shamil-gadelshin Apr 13, 2020
00872d6
Add missing tests
shamil-gadelshin Apr 15, 2020
1683ac4
Add tests for proposal status resolution
shamil-gadelshin Apr 15, 2020
cb80ece
Migrate proposal votes calculations to Perbill
shamil-gadelshin Apr 15, 2020
ad3705b
Remove allowd member_id list for runtime upgrade proposal
shamil-gadelshin Apr 15, 2020
c2c9cb3
Remove ‘set council mint capacity’ proposal
shamil-gadelshin Apr 20, 2020
d193854
Merge pull request #279 from shamil-gadelshin/proposals_v2_iteration8
bedeho Apr 20, 2020
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
340 changes: 227 additions & 113 deletions Cargo.lock

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
[workspace]
members = [
"runtime",
"runtime-modules/proposals/engine",
"runtime-modules/proposals/codex",
"runtime-modules/proposals/discussion",
"runtime-modules/common",
"runtime-modules/content-working-group",
"runtime-modules/forum",
Expand Down
14 changes: 2 additions & 12 deletions node/src/chain_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ use node_runtime::{
AuthorityDiscoveryConfig, BabeConfig, Balance, BalancesConfig, ContentWorkingGroupConfig,
CouncilConfig, CouncilElectionConfig, DataObjectStorageRegistryConfig,
DataObjectTypeRegistryConfig, ElectionParameters, GrandpaConfig, ImOnlineConfig, IndicesConfig,
MembersConfig, Perbill, ProposalsConfig, SessionConfig, SessionKeys, Signature, StakerStatus,
StakingConfig, SudoConfig, SystemConfig, VersionedStoreConfig, DAYS, WASM_BINARY,
MembersConfig, Perbill, SessionConfig, SessionKeys, Signature, StakerStatus, StakingConfig,
SudoConfig, SystemConfig, VersionedStoreConfig, DAYS, WASM_BINARY,
};
pub use node_runtime::{AccountId, GenesisConfig};
use primitives::{sr25519, Pair, Public};
Expand Down Expand Up @@ -246,16 +246,6 @@ pub fn testnet_genesis(
min_voting_stake: 1 * DOLLARS,
},
}),
proposals: Some(ProposalsConfig {
approval_quorum: 66,
min_stake: 2 * DOLLARS,
cancellation_fee: 10 * CENTS,
rejection_fee: 1 * DOLLARS,
voting_period: 2 * DAYS,
name_max_len: 512,
description_max_len: 10_000,
wasm_code_max_len: 2_000_000,
}),
members: Some(MembersConfig {
default_paid_membership_fee: 100u128,
members: crate::members_config::initial_members(),
Expand Down
1 change: 1 addition & 0 deletions runtime-modules/common/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
#![cfg_attr(not(feature = "std"), no_std)]

pub mod currency;
pub mod origin_validator;
5 changes: 5 additions & 0 deletions runtime-modules/common/src/origin_validator.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/// Abstract validator for the origin(account_id) and actor_id (eg.: thread author id).
pub trait ActorOriginValidator<Origin, ActorId, AccountId> {
/// Check for valid combination of origin and actor_id
fn ensure_actor_origin(origin: Origin, actor_id: ActorId) -> Result<AccountId, &'static str>;
}
2 changes: 1 addition & 1 deletion runtime-modules/content-working-group/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1195,7 +1195,7 @@ decl_module! {
// Increment NextChannelId
NextChannelId::<T>::mutate(|id| *id += <ChannelId<T> as One>::one());

/// CREDENTIAL STUFF ///
// CREDENTIAL STUFF //

// Dial out to membership module and inform about new role as channe owner.
let registered_role = <members::Module<T>>::register_role_on_member(owner, &member_in_role).is_ok();
Expand Down
2 changes: 1 addition & 1 deletion runtime-modules/governance/src/council.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ decl_module! {
// Privileged methods

/// Force set a zero staked council. Stakes in existing council will vanish into thin air!
fn set_council(origin, accounts: Vec<T::AccountId>) {
pub fn set_council(origin, accounts: Vec<T::AccountId>) {
ensure_root(origin)?;
let new_council: Seats<T::AccountId, BalanceOf<T>> = accounts.into_iter().map(|account| {
Seat {
Expand Down
13 changes: 13 additions & 0 deletions runtime-modules/governance/src/election.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,19 @@ impl<Elected, Term, X: CouncilElected<Elected, Term>> CouncilElected<Elected, Te
X::council_elected(new_council, term);
}
}
// Chain of handlers.
impl<
Elected: Clone,
Term: Clone,
X: CouncilElected<Elected, Term>,
Y: CouncilElected<Elected, Term>,
> CouncilElected<Elected, Term> for (X, Y)
{
fn council_elected(new_council: Elected, term: Term) {
X::council_elected(new_council.clone(), term.clone());
Y::council_elected(new_council, term);
}
}

#[cfg_attr(feature = "std", derive(Serialize, Deserialize, Debug))]
#[derive(Clone, Copy, Encode, Decode, Default)]
Expand Down
1 change: 0 additions & 1 deletion runtime-modules/governance/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
pub mod council;
pub mod election;
pub mod election_params;
pub mod proposals;

mod sealed_vote;
mod stake;
Expand Down
2 changes: 1 addition & 1 deletion runtime-modules/governance/src/mock.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#![cfg(test)]

pub use super::{council, election, proposals};
pub use super::{council, election};
pub use common::currency::GovernanceCurrency;
pub use system;

Expand Down
Loading