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

Pallet Staking Lottery #1036

Merged
merged 194 commits into from Jul 6, 2023
Merged

Pallet Staking Lottery #1036

merged 194 commits into from Jul 6, 2023

Conversation

Garandor
Copy link
Contributor

@Garandor Garandor commented Mar 6, 2023

Implements an APY-maximizing no-loss lottery for Manta/Calamari

  • liquidate_lottery and rebalance_stake extrinsics are left unimplemented for later
  • reverify DrawingFreezeout is long enough for both Polkadot and Kusama

Note that the test winner_distribution_should_be_equal_with_equal_deposits is nondeterministic and can sometimes fail.
I have set the boundary low enough for random failures to be rare, but nonetheless, this test failing is not necessarily indication of an error if it occurs isolated.

Signed-off-by: Adam Reif Garandor@manta.network


Before we can approve this PR for merge, please make sure that all the following items have been checked off:

  • Connected to an issue with discussion and accepted design using zenhub "Connect issue" button below
  • Added one label out of the L- group to this PR
  • Added one or more labels from the A- and C- groups to this PR
  • Explicitly labelled A-calamari, A-dolphin and/or A-manta if your changes are meant for/impact either of these (CI depends on it)
  • Re-reviewed Files changed in the Github PR explorer.

Situational Notes:

  • If adding functionality, write unit tests!
  • If importing a new pallet, choose a proper module index for it, and allow it in BaseFilter. Ensure every extrinsic works from front-end. If there's corresponding tool, ensure both work for each other.
  • If needed, update our Javascript/Typescript APIs. These APIs are officially used by exchanges or community developers.
  • If modifying existing runtime storage items, make sure to implement storage migrations for the runtime and test them with try-runtime. This includes migrations inherited from upstream changes, and you can search the diffs for modifications of #[pallet::storage] items to check for any.

Adam Reif added 30 commits March 1, 2023 15:34
Signed-off-by: Adam Reif <Garandor@manta.network>
Signed-off-by: Adam Reif <Garandor@manta.network>
Signed-off-by: Adam Reif <Garandor@manta.network>
Signed-off-by: Adam Reif <Garandor@manta.network>
Signed-off-by: Adam Reif <Garandor@manta.network>
Signed-off-by: Adam Reif <Garandor@manta.network>
Signed-off-by: Adam Reif <Garandor@manta.network>
Signed-off-by: Adam Reif <Garandor@manta.network>
Signed-off-by: Adam Reif <Garandor@manta.network>
Signed-off-by: Adam Reif <Garandor@manta.network>
Signed-off-by: Adam Reif <Garandor@manta.network>
Signed-off-by: Adam Reif <Garandor@manta.network>
Signed-off-by: Adam Reif <Garandor@manta.network>
Signed-off-by: Adam Reif <Garandor@manta.network>
Signed-off-by: Adam Reif <Garandor@manta.network>
Signed-off-by: Adam Reif <Garandor@manta.network>
Signed-off-by: Adam Reif <Garandor@manta.network>
Signed-off-by: Adam Reif <Garandor@manta.network>
Signed-off-by: Adam Reif <Garandor@manta.network>
Signed-off-by: Adam Reif <Garandor@manta.network>
Signed-off-by: Adam Reif <Garandor@manta.network>
Signed-off-by: Adam Reif <Garandor@manta.network>
Signed-off-by: Adam Reif <Garandor@manta.network>
Signed-off-by: Adam Reif <Garandor@manta.network>
Signed-off-by: Adam Reif <Garandor@manta.network>
Signed-off-by: Adam Reif <Garandor@manta.network>
fmt
Signed-off-by: Adam Reif <Garandor@manta.network>
Signed-off-by: Adam Reif <Garandor@manta.network>
Signed-off-by: Adam Reif <Garandor@manta.network>
Adam Reif added 5 commits July 4, 2023 16:31
…d collators for deposit

Signed-off-by: Adam Reif <Garandor@manta.network>
Signed-off-by: Adam Reif <Garandor@manta.network>
fix: set genesis config for mock to have a normal gas_reserve for testing
add two more testcases, comments

Signed-off-by: Adam Reif <Garandor@manta.network>
Signed-off-by: Adam Reif <Garandor@manta.network>
Signed-off-by: Adam Reif <Garandor@manta.network>
@Garandor Garandor requested a review from ghzlatarev July 5, 2023 15:56
fmt
Signed-off-by: Adam Reif <Garandor@manta.network>
Adam Reif added 10 commits July 5, 2023 11:14
Signed-off-by: Adam Reif <Garandor@manta.network>
Signed-off-by: Adam Reif <Garandor@manta.network>
Signed-off-by: Adam Reif <Garandor@manta.network>
Signed-off-by: Adam Reif <Garandor@manta.network>
Signed-off-by: Adam Reif <Garandor@manta.network>
Signed-off-by: Adam Reif <Garandor@manta.network>
Signed-off-by: Adam Reif <Garandor@manta.network>
Signed-off-by: Adam Reif <Garandor@manta.network>
Signed-off-by: Adam Reif <Garandor@manta.network>
Signed-off-by: Adam Reif <Garandor@manta.network>
ghzlatarev
ghzlatarev previously approved these changes Jul 6, 2023
pallets/pallet-lottery/src/staking/mod.rs Outdated Show resolved Hide resolved
pallets/pallet-lottery/src/lib.rs Show resolved Hide resolved
pallets/pallet-lottery/src/lib.rs Show resolved Hide resolved
Apokalip
Apokalip previously approved these changes Jul 6, 2023
Copy link
Contributor

@Apokalip Apokalip left a comment

Choose a reason for hiding this comment

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

LGMT! Just add issues for all TODOs so we don't forget them

Signed-off-by: Adam Reif <Garandor@manta.network>
@Garandor Garandor dismissed stale reviews from Apokalip and ghzlatarev via 30a0da4 July 6, 2023 13:52
@Apokalip Apokalip self-requested a review July 6, 2023 14:03
@Garandor Garandor merged commit aefac61 into manta Jul 6, 2023
35 checks passed
@Garandor Garandor deleted the garandor/pt branch July 6, 2023 16:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-calamari Area: Issues and PRs related to the Calamari Runtime A-manta Area: Issues and PRs related to the Manta Runtime C-experiment Category: Experimental feature or tool L-added Log: Issues and PRs related to addition P-unreleased Product: yet to be released product related features
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants