Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Logic for the (Core) Fellowship #13503

Merged
merged 97 commits into from
Mar 11, 2023
Merged

Logic for the (Core) Fellowship #13503

merged 97 commits into from
Mar 11, 2023

Conversation

gavofyork
Copy link
Member

@gavofyork gavofyork commented Mar 1, 2023

Closes #13480.
Based on #13378.

Introduces the new Core-Fellowship pallet, which contains logic specific to the (Core) Fellowship, but which could be used in other fellowships also.

Doesn't touch live code so can be merged, but should not be used in Polkadot until after an audit.

TODO

  • Consider a fn request_proof(info: [u8; 32]) function to record information concerning a proof, and perhaps a similar one for promotion.
  • Benchmarks
  • Weights
  • Ensure there is a script to check overall voting records in line with Fellowship voting requirements.

gavofyork and others added 3 commits March 7, 2023 13:00
Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com>
Copy link
Member

@ggwpez ggwpez left a comment

Choose a reason for hiding this comment

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

Very nice!

frame/core-fellowship/src/lib.rs Show resolved Hide resolved
frame/core-fellowship/src/lib.rs Outdated Show resolved Hide resolved
frame/core-fellowship/src/lib.rs Outdated Show resolved Hide resolved
frame/core-fellowship/src/lib.rs Outdated Show resolved Hide resolved
frame/core-fellowship/src/lib.rs Show resolved Hide resolved
frame/core-fellowship/src/lib.rs Show resolved Hide resolved
frame/core-fellowship/src/lib.rs Show resolved Hide resolved
frame/core-fellowship/src/lib.rs Show resolved Hide resolved
frame/core-fellowship/src/lib.rs Show resolved Hide resolved
frame/core-fellowship/src/benchmarking.rs Outdated Show resolved Hide resolved
gavofyork and others added 4 commits March 7, 2023 18:12
Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
params.offboard_timeout
} else {
let rank_index = Self::rank_to_index(rank).ok_or(Error::<T, I>::InvalidRank)?;
params.demotion_period[rank_index]
Copy link
Member

Choose a reason for hiding this comment

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

just scrolling through, but feels like this should be using get api, which handles if the index does not exist, rather than panic. could happen if bad migrations or something else, idk

Copy link
Member Author

Choose a reason for hiding this comment

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

rank_to_index guarantees the bound is respected.

@gavofyork gavofyork merged commit 9d34fb0 into master Mar 11, 2023
@gavofyork gavofyork deleted the gav-core-fellowship branch March 11, 2023 12:11
@vivekvpandya
Copy link
Contributor

Small thing is missing in dependency , causing CI break https://gitlab.parity.io/parity/mirrors/substrate/-/jobs/2513783

@ggwpez
Copy link
Member

ggwpez commented Mar 13, 2023

Small thing is missing in dependency , causing CI break https://gitlab.parity.io/parity/mirrors/substrate/-/jobs/2513783

Yea the dev dependencies should be stripped before publishing. Dont know if anyone is working on that.

ukint-vs pushed a commit to gear-tech/substrate that referenced this pull request Apr 10, 2023
* More drafting

* Paymaster pallet

* Fix build

* More tests

* Rename

* Rename

* Renaming

* Revert old changes

* Multi-phase payouts to avoid bank-runs

* Tests

* Tests

* Allow payment to be targeted elsewhere

* Proper ssync payment failure handling

* Test for repayment

* Docs

* Impl RankedMembers for RankedCollective

* Implement Pay for Pot (i.e. basic account).

* Benchmarks

* Weights

* Introduce Salary benchmark into node

* Fix warning

* ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_salary

* Update primitives/arithmetic/src/traits.rs

Co-authored-by: Jegor Sidorenko <5252494+jsidorenko@users.noreply.github.com>

* Update frame/salary/src/lib.rs

Co-authored-by: Jegor Sidorenko <5252494+jsidorenko@users.noreply.github.com>

* Update lib.rs

* Update frame/salary/src/lib.rs

Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com>

* Docs

* Update frame/salary/src/lib.rs

Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com>

* Update frame/salary/src/lib.rs

Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com>

* Fix

* Fixes

* Fixes

* Move some salary traits stuff to a shared location

* Initial draft

* Comment out bits

* Fix

* First couple of tests

* One more test

* Update frame/salary/src/lib.rs

Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Update frame/salary/src/lib.rs

Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Mul floor

* Tests

* Mul floor

* Fix warnings

* Fix test

* Tests

* Last tests

* Docs

* Fix warnings

* Benchmarks

* Weights

* Integrate benchmark

* Fixes

* Fix

* ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_core_fellowship

* Better process flow

* Fix benchmarks & tests

* Docs

* Fixes

* Fixes

* docs

* ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_core_fellowship

* Docs and allow custom evidence size

* ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_core_fellowship

* Update frame/core-fellowship/src/lib.rs

Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>

* Update frame/core-fellowship/src/tests.rs

Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>

* Update frame/core-fellowship/src/benchmarking.rs

* Update frame/core-fellowship/src/benchmarking.rs

* Apply suggestions from code review

* Rename

* Update primitives/arithmetic/src/traits.rs

Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com>

* Reduce magic numbers

* Update frame/core-fellowship/src/lib.rs

Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Update frame/core-fellowship/src/lib.rs

Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Benchmark result

* Remove dependency

* set_params should pay

* induct should pay

* Remove some other free calls

---------

Co-authored-by: command-bot <>
Co-authored-by: Jegor Sidorenko <5252494+jsidorenko@users.noreply.github.com>
Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com>
Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
nathanwhit pushed a commit to nathanwhit/substrate that referenced this pull request Jul 19, 2023
* More drafting

* Paymaster pallet

* Fix build

* More tests

* Rename

* Rename

* Renaming

* Revert old changes

* Multi-phase payouts to avoid bank-runs

* Tests

* Tests

* Allow payment to be targeted elsewhere

* Proper ssync payment failure handling

* Test for repayment

* Docs

* Impl RankedMembers for RankedCollective

* Implement Pay for Pot (i.e. basic account).

* Benchmarks

* Weights

* Introduce Salary benchmark into node

* Fix warning

* ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_salary

* Update primitives/arithmetic/src/traits.rs

Co-authored-by: Jegor Sidorenko <5252494+jsidorenko@users.noreply.github.com>

* Update frame/salary/src/lib.rs

Co-authored-by: Jegor Sidorenko <5252494+jsidorenko@users.noreply.github.com>

* Update lib.rs

* Update frame/salary/src/lib.rs

Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com>

* Docs

* Update frame/salary/src/lib.rs

Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com>

* Update frame/salary/src/lib.rs

Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com>

* Fix

* Fixes

* Fixes

* Move some salary traits stuff to a shared location

* Initial draft

* Comment out bits

* Fix

* First couple of tests

* One more test

* Update frame/salary/src/lib.rs

Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Update frame/salary/src/lib.rs

Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Mul floor

* Tests

* Mul floor

* Fix warnings

* Fix test

* Tests

* Last tests

* Docs

* Fix warnings

* Benchmarks

* Weights

* Integrate benchmark

* Fixes

* Fix

* ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_core_fellowship

* Better process flow

* Fix benchmarks & tests

* Docs

* Fixes

* Fixes

* docs

* ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_core_fellowship

* Docs and allow custom evidence size

* ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_core_fellowship

* Update frame/core-fellowship/src/lib.rs

Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>

* Update frame/core-fellowship/src/tests.rs

Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>

* Update frame/core-fellowship/src/benchmarking.rs

* Update frame/core-fellowship/src/benchmarking.rs

* Apply suggestions from code review

* Rename

* Update primitives/arithmetic/src/traits.rs

Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com>

* Reduce magic numbers

* Update frame/core-fellowship/src/lib.rs

Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Update frame/core-fellowship/src/lib.rs

Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Benchmark result

* Remove dependency

* set_params should pay

* induct should pay

* Remove some other free calls

---------

Co-authored-by: command-bot <>
Co-authored-by: Jegor Sidorenko <5252494+jsidorenko@users.noreply.github.com>
Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com>
Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A0-please_review Pull request needs code review. B1-note_worthy Changes should be noted in the release notes C1-low PR touches the given topic and has a low impact on builders. D2-notlive 💤 PR contains changes in a runtime directory that is not deployed to a chain that requires an audit. T1-runtime This PR/Issue is related to the topic “runtime”.
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Core Fellowship logic
10 participants