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

98 voting pallet #107

merged 28 commits into from
Aug 16, 2022

Conversation

letodunc
Copy link
Contributor

Implemented functions to manage voting through the collective and democracy pallet for the House Council vote session and Investors vote session

letodunc and others added 17 commits July 18, 2022 13:31
* Runtime update

Update to polkadot-v0.9.26

* Token symbol and pallet-uniques

Added the pallet-uniques to the runtime, and changed the token Symbol to USD

* Benchmarking fixed

Co-authored-by: ndkazu <ndongmefane@gmail.com>
Co-authored-by: Kazunobu Ndong <33208377+ndkazu@users.noreply.github.com>
* Runtime update

Update to polkadot-v0.9.26

* Token symbol and pallet-uniques

Added the pallet-uniques to the runtime, and changed the token Symbol to USD

* Benchmarking fixed

* refresh FS repo (#101)

* update readme and badges

* delete diagram

* add w3f badge and adjust readme

* adjust size and position

* remove unused files

* adjusted the readme some more

* add w3f badge back

* changed from docker hub to ghcr registry

* small change to the DockerFile

* 102 automatization tasks (#103)

* added a script to add a new pallet from a pallet template and configure the runtime Cargo.toml and lib.rs

* added a script to update polkadot lib in .toml files for the node, runtime, pallets and pallet template

Co-authored-by: ndkazu <ndongmefane@gmail.com>
Co-authored-by: Kazunobu Ndong <33208377+ndkazu@users.noreply.github.com>
Co-authored-by: Ilhan <29432367+ilhanu@users.noreply.github.com>
Co-authored-by: “ilhanu” <ilhanunlu@gmail.com>
@letodunc letodunc added the enhancement New feature or request label Aug 16, 2022
@letodunc letodunc added this to the M2 milestone Aug 16, 2022
@letodunc letodunc requested review from ilhanu and ndkazu August 16, 2022 05:11
@letodunc letodunc self-assigned this Aug 16, 2022
@letodunc letodunc linked an issue Aug 16, 2022 that may be closed by this pull request
5 tasks
@codecov-commenter
Copy link

codecov-commenter commented Aug 16, 2022

Codecov Report

Merging #107 (cef7e62) into main (9bcff90) will decrease coverage by 7.86%.
The diff coverage is 2.83%.

@@            Coverage Diff             @@
##             main     #107      +/-   ##
==========================================
- Coverage   60.34%   52.48%   -7.87%     
==========================================
  Files          22       27       +5     
  Lines        1339     1551     +212     
==========================================
+ Hits          808      814       +6     
- Misses        531      737     +206     
Impacted Files Coverage Δ
node/src/chain_spec.rs 0.00% <0.00%> (ø)
pallets/voting/src/lib.rs 0.00% <0.00%> (ø)
pallets/voting/src/structs.rs 0.00% <0.00%> (ø)
pallets/voting/src/weights.rs 0.00% <0.00%> (ø)
runtime/src/lib.rs 2.77% <0.00%> (-0.30%) ⬇️
pallets/voting/src/mock.rs 60.00% <60.00%> (ø)
pallets/voting/src/tests.rs 100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

Copy link
Contributor

@ndkazu ndkazu left a comment

Choose a reason for hiding this comment

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

Did a global review focusing on lib.rs, but I think we need to complete the testing part in order to do a better review and do the merge in main

pallets/voting/src/lib.rs Outdated Show resolved Hide resolved
pallets/voting/src/lib.rs Show resolved Hide resolved
// Check that the extrinsic was signed and get the signer
let who = ensure_signed(origin)?;

// Check that the account has the investor role
Copy link
Contributor

Choose a reason for hiding this comment

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

The role (correctly defined in the code) is Seller, instead of investor

};

use scale_info::TypeInfo;
use scale_info::prelude::boxed::Box;
Copy link
Contributor

Choose a reason for hiding this comment

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

I am wondering if scale_info::prelude::boxed::Box is different from sp_std::boxed::Box

pallets/voting/src/lib.rs Show resolved Hide resolved
Copy link
Member

@ilhanu ilhanu left a comment

Choose a reason for hiding this comment

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

Looks good, nice work!

@@ -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

/// A investor has voted
InvestorVoted(T::AccountId, T::Hash, BlockNumberOf<T>),
/// TODO: to remove, Event for test purpose
CollectiveMotionChecked(BlockNumberOf<T>),
Copy link
Member

Choose a reason for hiding this comment

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

Think these events can be formed for the purpose of investor voting instead of removing them

}

// Errors inform users that something went wrong.
#[pallet::error]
Copy link
Member

Choose a reason for hiding this comment

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

What about errors for the investor voting ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

the voting bring up the democracy's errors for the investor voting

let block_number = <frame_system::Pallet<T>>::block_number();
let democration_motion_duration = block_number.saturating_add(<T as DEMO::Config>::VotingPeriod::get()).saturating_add(delay);

// Set the the storage to be wathed for the democracy process
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
// Set the the storage to be wathed for the democracy process
// Set the the storage to be watched for the democracy process

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Man, hawkeye... Corrected!

@letodunc letodunc merged commit aeffcca into main Aug 16, 2022
cuteolaf pushed a commit to cuteolaf/fair-squares that referenced this pull request Oct 7, 2022
* Updating branch with main updates (Fair-Squares#100)

* Runtime update

Update to polkadot-v0.9.26

* Token symbol and pallet-uniques

Added the pallet-uniques to the runtime, and changed the token Symbol to USD

* Benchmarking fixed

Co-authored-by: ndkazu <ndongmefane@gmail.com>
Co-authored-by: Kazunobu Ndong <33208377+ndkazu@users.noreply.github.com>

* Merge main into voting pallet branch (Fair-Squares#104)

* Runtime update

Update to polkadot-v0.9.26

* Token symbol and pallet-uniques

Added the pallet-uniques to the runtime, and changed the token Symbol to USD

* Benchmarking fixed

* refresh FS repo (Fair-Squares#101)

* update readme and badges

* delete diagram

* add w3f badge and adjust readme

* adjust size and position

* remove unused files

* adjusted the readme some more

* add w3f badge back

* changed from docker hub to ghcr registry

* small change to the DockerFile

* 102 automatization tasks (Fair-Squares#103)

* added a script to add a new pallet from a pallet template and configure the runtime Cargo.toml and lib.rs

* added a script to update polkadot lib in .toml files for the node, runtime, pallets and pallet template

Co-authored-by: ndkazu <ndongmefane@gmail.com>
Co-authored-by: Kazunobu Ndong <33208377+ndkazu@users.noreply.github.com>
Co-authored-by: Ilhan <29432367+ilhanu@users.noreply.github.com>
Co-authored-by: “ilhanu” <ilhanunlu@gmail.com>

* added voting pallet, added config in runtime

* added collective and democracy pallets to voting pallet and runtime config

* added collective and democracy config to runtime

* updated pallet_template

* added members to house council

* added functions to voting

* added pallet roles to voting

* update functions implementation

* added events, refactored code

* updated test configuration

* added call formating for collective::propose()

* added full process voting implementation with basic checks

* added origin check on proposal dispatching from Democracy

* added check origin call from collective pallet

* added proposal status transition management and documentation

* updated voting mockup for tests

* refactored code

* removed comments

* code review updates

* code review updates

* fix for voting benchmarking

* added fix for voting benchmarking

* fix update

* temporary deactivated voting benchmarking

Co-authored-by: ndkazu <ndongmefane@gmail.com>
Co-authored-by: Kazunobu Ndong <33208377+ndkazu@users.noreply.github.com>
Co-authored-by: Ilhan <29432367+ilhanu@users.noreply.github.com>
Co-authored-by: “ilhanu” <ilhanunlu@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
No open projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Voting Pallet
4 participants