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

feat: add new staking pallet #46

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
3,759 changes: 3,759 additions & 0 deletions polimec-skeleton/pallets/parachain-staking/Cargo.lock

Large diffs are not rendered by default.

65 changes: 65 additions & 0 deletions polimec-skeleton/pallets/parachain-staking/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
[package]
name = "pallet-parachain-staking"
description = "parachain staking pallet for collator selection and reward distribution"
edition = "2021"
version = "3.0.0"

[dependencies]
serde = { version = "1", default-features = false, optional = true }
log = "0.4"

# Substrate
frame-benchmarking = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.42", optional = true }
frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.42" }
frame-system = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.42" }
parity-scale-codec = { version = "3.3.0", default-features = false, features = [
"derive",
] }
scale-info = { version = "2.3.1", default-features = false, features = [
"derive",
] }
sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.42" }
sp-std = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.42" }
substrate-fixed = { git = "https://github.com/encointer/substrate-fixed", default-features = false }
sp-staking = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.42", default-features = false }
pallet-authorship = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.42", default-features = false }
pallet-session = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.42", default-features = false }

[dev-dependencies]
pallet-balances = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.42", features = [
"std",
] }
pallet-aura = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.42", features = [
"std",
] }
pallet-timestamp = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.42", features = [
"std",
] }
similar-asserts = "1.1.0"
sp-core = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.42", features = [
"std",
] }
sp-io = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.42", features = [
"std",
] }
sp-consensus-aura = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.42", features = [
"std",
] }

[features]
default = ["std"]
std = [
"frame-benchmarking?/std",
"frame-support/std",
"frame-system/std",
"parity-scale-codec/std",
"scale-info/std",
"serde/std",
"sp-runtime/std",
"sp-std/std",
"sp-staking/std",
"pallet-authorship/std",
"pallet-session/std",
]
runtime-benchmarks = ["frame-benchmarking"]
try-runtime = ["frame-support/try-runtime"]
12 changes: 12 additions & 0 deletions polimec-skeleton/pallets/parachain-staking/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# DPoS Pallet for Parachain Staking

This repository contains a modified version of Moonbeam's 'parachain_staking' Substrate Pallet. The original version can be found [here](https://github.com/PureStake/moonbeam/tree/master/pallets/parachain-staking).

## Modifications
The modifications to the original pallet include the following:
1. Removed Nimbus Dependencies: The original dependencies on Nimbus have been removed. This simplifies the usage of the pallet and makes it independent of Nimbus.
2. Implemented Traits from **pallet_authorship** and **pallet_session**: To replace some functionality previously provided by Nimbus, several traits from pallet_authorship and pallet_session have been implemented:
- **EventHandler** from *pallet_authorship*: This trait is used to note the block author and award them points for producing a block. The points are then used for staking purposes.
- **SessionManager** from *pallet_session*: This trait is used to manage the start and end of sessions, as well as assemble new collators for new sessions.
- **ShouldEndSession** from *pallet_session*: This trait is used to decide when a session should end.
- **EstimateNextSessionRotation** from *pallet_session*: This trait is used to estimate the average session length and the current session progress, as well as estimate the next session rotation.
Loading