Skip to content

Commit

Permalink
[Communities] Benchmarking and Runtime Parameters (#340)
Browse files Browse the repository at this point in the history
* chore(kreivo-runtime): subdependencies to pallet-communities

* feat(kreivo-runtime): initial parameters for pallet-communities

* chore(env): update zombienet configuration files

* wip(pallet-communities): initial parmeters for benchmarks

* feat(pallet-communities): bench test for create

* fix(runtime/kreivo): set FreezeIdentifier to RuntimeHoldReason on pallet_balance

* feat(pallet-communities): benchmark for set_metadata / set_decision_method

* feat(pallet-communities): preparing benchmarking helpers for loading memberships and subsequent testings

* fix(pallet-communities): check/lint

* fix(kreivo-runtime)[wip]: prepare for building with runtime-benchmarks

* change(pallet-communities): Added event emitter for removing votes. (#341)

* change(pallet-communities): Added event emitter for removing votes.

* fix(runtime-kreivo): increase MaxHolds / increase MaxFreezes

- Increased MaxHolds: This is because we included pallet_communities::HoldReasons::Voting to the available HoldReasons
- Increase MaxFreezes: This is since you now have funds freezed if you're voting on a community.

---------

Co-authored-by: Pablo Andrés Dorado Suárez <[email protected]>

* feat(pallet-communities): benchmarking test for vote

* fix(pallet-communities): lint

* Pallet communities benchmarking runtime parameters (#342)

* change(pallet-communities): Added event emitter for removing votes.

* fix(runtime-kreivo): increase MaxHolds / increase MaxFreezes

- Increased MaxHolds: This is because we included pallet_communities::HoldReasons::Voting to the available HoldReasons
- Increase MaxFreezes: This is since you now have funds freezed if you're voting on a community.

* feat(pallet-communities): benchmarking test for add_member.

---------

Co-authored-by: Pablo Andrés Dorado Suárez <[email protected]>

* change(pallet-communities): sort benchmarks by call order

* feat(pallet-communities): benchmarking test for remove_vote

* refactor(pallet-communities): externalize factory dependencies from benchmarking

* fix(pallet-communities): remove unnecessary imports on benchmarking

* refactor(pallet-communities): move BenchmarkHelper to types module

* change(kreivo-runtime): configure benchmarking helpers for community related pallets

* fix(pallet-communities): gate exporting types::BenchmarkHelper behind feature flag

* fix(kreivo-runtime): missing dependencies / missing parameters

* change(pallet-communities): prepare

- configure benchmark helper for pallet-referenda-tracks
- fix: missing imports for vec-like structures on benchmarking

* change(kreivo-runtime): setup benchmark helper for community tracks pallet

* feat(pallet-communities): finished benchmarking tests for remove_member, promote_member, and demote_member (#343)

* change(runtime/kreivo): include pallet-communities on dependencies

* chore(cargo): update Cargo.lock

* feat(pallet-communities): implement structures and storage for governance

* feat(pallet-communities): add set_decision_method extrinsic

* feat(pallet-communities): implement vote extrinsic

* chore(pallet-communities): add initial set of tests for governance section

* fix(pallet-communities): lint

* chore(cargo): update lockfile

* fix(pallet-communities:tests): typo

* feat(pallet-communities): better handle type bounds for T::Assets and T::Polls

* chore(pallet-communities): refine usage of type aliases

* change(pallet-communities:tests): support including multiple communities

* feat(pallet-communities): implement unlock call

* feat(pallet-communities:tests): extend dynamic communities creation on TestEnvBuilder to create tracks

* chore(pallet-communities): test when casting vote on an invalid track / test tie-breaking

* fix(pallet-communities): lint

* chore(pallet-communities): coverage testing for AssetBalance and NativeBalance voting methods

* chore(pallet-communities): add tests for unlock

* feat(pallet-communities): implement remove_vote

* feat(pallet-communities): implement voting for DecisionMethod::Rank

* fix(pallet-communities): lint

* chore(kreivo-runtime): subdependencies to pallet-communities

* feat(kreivo-runtime): initial parameters for pallet-communities

* chore(env): update zombienet configuration files

* chore(cargo): update lockfile

* wip(pallet-communities): initial parmeters for benchmarks

* feat(pallet-communities): bench test for create

* fix(runtime/kreivo): set FreezeIdentifier to RuntimeHoldReason on pallet_balance

* feat(pallet-communities): benchmark for set_metadata / set_decision_method

* feat(pallet-communities): preparing benchmarking helpers for loading memberships and subsequent testings

* fix(pallet-communities): check/lint

* fix(kreivo-runtime)[wip]: prepare for building with runtime-benchmarks

* change(pallet-communities): Added event emitter for removing votes. (#341)

* change(pallet-communities): Added event emitter for removing votes.

* fix(runtime-kreivo): increase MaxHolds / increase MaxFreezes

- Increased MaxHolds: This is because we included pallet_communities::HoldReasons::Voting to the available HoldReasons
- Increase MaxFreezes: This is since you now have funds freezed if you're voting on a community.

---------

Co-authored-by: Pablo Andrés Dorado Suárez <[email protected]>

* feat(pallet-communities): benchmarking test for vote

* fix(pallet-communities): lint

* Pallet communities benchmarking runtime parameters (#342)

* change(pallet-communities): Added event emitter for removing votes.

* fix(runtime-kreivo): increase MaxHolds / increase MaxFreezes

- Increased MaxHolds: This is because we included pallet_communities::HoldReasons::Voting to the available HoldReasons
- Increase MaxFreezes: This is since you now have funds freezed if you're voting on a community.

* feat(pallet-communities): benchmarking test for add_member.

---------

Co-authored-by: Pablo Andrés Dorado Suárez <[email protected]>

* change(pallet-communities): sort benchmarks by call order

* feat(pallet-communities): benchmarking test for remove_vote

* refactor(pallet-communities): externalize factory dependencies from benchmarking

* fix(pallet-communities): remove unnecessary imports on benchmarking

* refactor(pallet-communities): move BenchmarkHelper to types module

* change(kreivo-runtime): configure benchmarking helpers for community related pallets

* fix(pallet-communities): gate exporting types::BenchmarkHelper behind feature flag

* fix(kreivo-runtime): missing dependencies / missing parameters

* feat(pallet-communities): finished benchmarking tests for remove_member, promote_member, and demote_member

* fix(kreivo-runtime): lint

---------

Co-authored-by: Pablo Andrés Dorado Suárez <[email protected]>

* feat(pallet-communities): benchmark method for unlock

* feat(kreivo-runtime): configure benchmark helper for pallet-communities

* change(pallet-communities): ensure benchmarks run with default externalities

* chore(cargo): update dependencies

* fix(kreivo-runtime): set MembershipCollectionId to 0

* fix(pallet-commujnities): remove mock out of tests module

* fix(zombienet): add parachain inclusion to relay genesis

* feat(pallet-communities): receive community accountId as a valid origin for CommunityMemberMgmt

- Create and implement EnsureCommunityAccountId.
- Add a benchmarking method to it.
- Setup parameter for mock.
- Setup parameter for runtime.

* change(kreivo-runtime): setup communities-related origins

* change(kreivo-runtime): remove Nfts pallet from runtime

- This is because it's not being used initially

* fix(kreivo-runtime): add EnsureRootWithSuccess for SubmitOrigin on CommunityReferenda

---------

Co-authored-by: Juan Pablo Gutiérrez Restrepo <[email protected]>
  • Loading branch information
pandres95 and jgutierrezre committed Mar 17, 2024
1 parent 652c4b0 commit 73defc1
Show file tree
Hide file tree
Showing 20 changed files with 1,307 additions and 93 deletions.
106 changes: 85 additions & 21 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 19 additions & 8 deletions pallets/communities/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
[package]
name = "pallet-communities"
version = "0.1.0"
description = "This pallet enables the creation of communities that are soverign entities with diverse forms of governance. In simpler terms, it can be considered a DAO Factory."
authors = ["Virto Team<[email protected]>"]
edition = "2021"
description = "This pallet enables the creation of communities that are soverign entities with diverse forms of governance. In simpler terms, it can be considered a DAO Factory."
license = "MIT-0"
publish = false
repository = "https://github.com/virto-network/virto-node/"
homepage = 'https://github.com/virto-network/virto-node'
repository = 'https://github.com/virto-network/virto-node'
edition = "2021"

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

[dependencies]
parity-scale-codec = { workspace = true, features = ["derive"] }
scale-info = { workspace = true, features = ["derive"] }

frame-benchmarking = { workspace = true, optional = true }
frame-support = { workspace = true }
frame-system = { workspace = true }

parity-scale-codec = { workspace = true, features = ["derive"] }
scale-info = { workspace = true, features = ["derive"] }

sp-runtime = { workspace = true }
sp-std = { workspace = true }
xcm = { workspace = true, optional = true }
Expand All @@ -42,18 +43,28 @@ std = [
"frame-support/std",
"frame-system/std",
"pallet-assets/std",
"sp-core/std",
"pallet-balances/std",
"pallet-nfts/std",
"pallet-preimage/std",
"pallet-referenda/std",
"pallet-referenda-tracks/std",
"pallet-scheduler/std",
"parity-scale-codec/std",
"sp-core/std",
"scale-info/std",
"sp-core/std",
"sp-runtime/std",
"sp-std/std",
"xcm?/std",
]
runtime-benchmarks = [
"frame-benchmarking/runtime-benchmarks",
"pallet-assets/runtime-benchmarks",
"pallet-balances/runtime-benchmarks",
"pallet-nfts/runtime-benchmarks",
"pallet-preimage/runtime-benchmarks",
"pallet-referenda/runtime-benchmarks",
"pallet-referenda-tracks/runtime-benchmarks",
"pallet-scheduler/runtime-benchmarks",
]
try-runtime = ["frame-support/try-runtime"]
Loading

0 comments on commit 73defc1

Please sign in to comment.