Skip to content

Commit

Permalink
[encointer] introduce collator selection and send fees to authors ins…
Browse files Browse the repository at this point in the history
…tead of treasury (#270)

closes #183 
closes #176
closes #146 (should be closed already, but this PR adds more)

This PR aligns collator selection and fee distribution logic of
Encointer with other system chains and thereby is a small step towards
[self-sustainability of
infrastructure](https://forum.polkadot.network/t/towards-encointer-self-sustainability/4195)

* [x] remove treasury (and leave negligible funds on trsry account)
* [x] add collator-selection, session and authorship pallets
* [x] instead of burning fees in community currency , send them to block
authors like native KSM
* [x] remove DMP queue pallet (pure cleanup, no change in functionality)
* [x] add migration to inject existing collators as invulnerables
* [x] remove applied migrations from release 1.2.0

steps to reproduce the new fee logic:
https://gist.github.com/brenzi/ca9e0c326198c73ff2dd0a2e74468053

---------

Co-authored-by: joe petrowski <[email protected]>
  • Loading branch information
brenzi and joepetrowski authored May 21, 2024
1 parent e859933 commit 2fe6f56
Show file tree
Hide file tree
Showing 13 changed files with 641 additions and 514 deletions.
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
### Fixed

- Handle extra erroneous consumer reference when a nomination pool is destroying ([polkadot-fellows/runtimes#318](https://github.com/polkadot-fellows/runtimes/pull/318))
- Introduce [Encointer](https://encointer.org) collator selection and send fees to authors instead of treasury ([polkadot-fellows/runtimes#270](https://github.com/polkadot-fellows/runtimes/pull/270))

## [1.2.4] 20.05.2024

Expand Down Expand Up @@ -69,8 +70,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

- Remove state-trie-migration pallet from kusama, add state trie migration to V1 on polkadot ([polkadot-fellows/runtimes#170](https://github.com/polkadot-fellows/runtimes/pull/170))
- Introduce chain spec generator ([polkadot-fellows/runtimes#127](https://github.com/polkadot-fellows/runtimes/pull/127))
- Add [Encointer](https://encointer.org) system parachain runtime, completing [RFC22](https://github.com/polkadot-fellows/RFCs/blob/main/text/
0022-adopt-encointer-runtime.md) ([polkadot-fellows/runtimes#80](https://github.com/polkadot-fellows/runtimes/pull/80))
- Add [Encointer](https://encointer.org) system parachain runtime, completing [RFC22](https://github.com/polkadot-fellows/RFCs/blob/main/text/0022-adopt-encointer-runtime.md) ([polkadot-fellows/runtimes#80](https://github.com/polkadot-fellows/runtimes/pull/80))
- Feature for enabling debug prints in the Polkadot and Kusama runtime ([polkadot-fellows/runtimes#85](https://github.com/polkadot-fellows/runtimes/pull/85))
- Added new "Wish for Change" track ([polkadot-fellows/runtimes#184](https://github.com/polkadot-fellows/runtimes/pull/184))
- Enable Coretime and on-demand on Kusama ([polkadot-fellows/runtimes#159](https://github.com/polkadot-fellows/runtimes/pull/159))
Expand Down
10 changes: 6 additions & 4 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ pallet-encointer-ceremonies = { version = "~6.1.0", default-features = false }
pallet-encointer-ceremonies-rpc-runtime-api = { version = "~6.1.0", default-features = false }
pallet-encointer-communities = { version = "~6.1.0", default-features = false }
pallet-encointer-communities-rpc-runtime-api = { version = "~6.1.0", default-features = false }
pallet-encointer-faucet = { version = "~6.1.0", default-features = false }
pallet-encointer-faucet = { version = "~6.2.0", default-features = false }
pallet-encointer-reputation-commitments = { version = "~6.1.0", default-features = false }
pallet-encointer-scheduler = { version = "~6.1.0", default-features = false }
pallet-fast-unstake = { version = "28.0.0", default-features = false }
Expand Down
17 changes: 17 additions & 0 deletions chain-spec-generator/src/system_parachains_specs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -562,6 +562,23 @@ fn encointer_kusama_genesis(endowed_accounts: Vec<AccountId>, id: u32) -> serde_
parachain_id: id.into(),
..Default::default()
},
"collatorSelection": encointer_kusama_runtime::CollatorSelectionConfig {
invulnerables: invulnerables().iter().cloned().map(|(acc, _)| acc).collect(),
candidacy_bond: ENCOINTER_KUSAMA_ED * 16,
..Default::default()
},
"session": asset_hub_kusama_runtime::SessionConfig {
keys: invulnerables()
.into_iter()
.map(|(acc, aura)| {
(
acc.clone(), // account id
acc, // validator id
asset_hub_kusama_session_keys(aura), // session keys
)
})
.collect(),
},
"polkadotXcm": {
"safeXcmVersion": Some(SAFE_XCM_VERSION),
},
Expand Down
22 changes: 15 additions & 7 deletions system-parachains/encointer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ version.workspace = true

[dependencies]
codec = { features = ["derive"], workspace = true }
hex-literal = { optional = true, workspace = true }
hex-literal = { workspace = true }
log = { workspace = true }
scale-info = { features = ["derive"], workspace = true }
smallvec = { workspace = true }
Expand Down Expand Up @@ -50,30 +50,31 @@ frame-system-rpc-runtime-api = { workspace = true }
frame-try-runtime = { optional = true, workspace = true }
pallet-asset-tx-payment = { workspace = true }
pallet-aura = { features = ["experimental"], workspace = true }
pallet-authorship = { workspace = true }
pallet-balances = { workspace = true }
pallet-collective = { workspace = true }
pallet-insecure-randomness-collective-flip = { workspace = true }
pallet-membership = { workspace = true }
pallet-message-queue = { workspace = true }
pallet-proxy = { workspace = true }
pallet-scheduler = { workspace = true }
pallet-session = { workspace = true }
pallet-timestamp = { workspace = true }
pallet-transaction-payment = { workspace = true }
pallet-transaction-payment-rpc-runtime-api = { workspace = true }
pallet-treasury = { workspace = true }
pallet-utility = { workspace = true }
sp-api = { workspace = true }
sp-block-builder = { workspace = true }
sp-consensus-aura = { workspace = true }
sp-core = { workspace = true }
sp-genesis-builder = { workspace = true }
sp-inherents = { workspace = true }
sp-offchain = { workspace = true }
sp-runtime = { workspace = true }
sp-session = { workspace = true }
sp-std = { workspace = true }
sp-transaction-pool = { workspace = true }
sp-version = { workspace = true }
sp-genesis-builder = { workspace = true }

# Polkadot dependencies
pallet-xcm = { workspace = true }
Expand All @@ -88,11 +89,13 @@ cumulus-pallet-aura-ext = { workspace = true }
cumulus-pallet-parachain-system = { features = [
"parameterized-consensus-hook",
], workspace = true }
cumulus-pallet-session-benchmarking = { optional = true, workspace = true }
cumulus-pallet-xcm = { workspace = true }
cumulus-pallet-xcmp-queue = { workspace = true }
cumulus-primitives-aura = { workspace = true }
cumulus-primitives-core = { workspace = true }
cumulus-primitives-utility = { workspace = true }
pallet-collator-selection = { workspace = true }
parachain-info = { workspace = true }
parachains-common = { workspace = true }
polkadot-core-primitives = { workspace = true }
Expand All @@ -113,6 +116,7 @@ system-parachains-constants = { workspace = true, default-features = true }
default = ["std"]
runtime-benchmarks = [
"cumulus-pallet-parachain-system/runtime-benchmarks",
"cumulus-pallet-session-benchmarking/runtime-benchmarks",
"cumulus-pallet-xcmp-queue/runtime-benchmarks",
"cumulus-primitives-core/runtime-benchmarks",
"cumulus-primitives-utility/runtime-benchmarks",
Expand All @@ -122,9 +126,9 @@ runtime-benchmarks = [
"frame-support/runtime-benchmarks",
"frame-system-benchmarking/runtime-benchmarks",
"frame-system/runtime-benchmarks",
"hex-literal",
"pallet-asset-tx-payment/runtime-benchmarks",
"pallet-balances/runtime-benchmarks",
"pallet-collator-selection/runtime-benchmarks",
"pallet-collective/runtime-benchmarks",
"pallet-encointer-balances/runtime-benchmarks",
"pallet-encointer-bazaar/runtime-benchmarks",
Expand All @@ -138,7 +142,6 @@ runtime-benchmarks = [
"pallet-proxy/runtime-benchmarks",
"pallet-scheduler/runtime-benchmarks",
"pallet-timestamp/runtime-benchmarks",
"pallet-treasury/runtime-benchmarks",
"pallet-utility/runtime-benchmarks",
"pallet-xcm/runtime-benchmarks",
"parachains-common/runtime-benchmarks",
Expand All @@ -153,6 +156,7 @@ std = [
"codec/std",
"cumulus-pallet-aura-ext/std",
"cumulus-pallet-parachain-system/std",
"cumulus-pallet-session-benchmarking?/std",
"cumulus-pallet-xcm/std",
"cumulus-pallet-xcmp-queue/std",
"cumulus-primitives-aura/std",
Expand All @@ -172,7 +176,9 @@ std = [
"log/std",
"pallet-asset-tx-payment/std",
"pallet-aura/std",
"pallet-authorship/std",
"pallet-balances/std",
"pallet-collator-selection/std",
"pallet-collective/std",
"pallet-encointer-balances/std",
"pallet-encointer-bazaar-rpc-runtime-api/std",
Expand All @@ -189,10 +195,10 @@ std = [
"pallet-message-queue/std",
"pallet-proxy/std",
"pallet-scheduler/std",
"pallet-session/std",
"pallet-timestamp/std",
"pallet-transaction-payment-rpc-runtime-api/std",
"pallet-transaction-payment/std",
"pallet-treasury/std",
"pallet-utility/std",
"pallet-xcm/std",
"parachain-info/std",
Expand Down Expand Up @@ -234,7 +240,9 @@ try-runtime = [
"frame-try-runtime/try-runtime",
"pallet-asset-tx-payment/try-runtime",
"pallet-aura/try-runtime",
"pallet-authorship/try-runtime",
"pallet-balances/try-runtime",
"pallet-collator-selection/try-runtime",
"pallet-collective/try-runtime",
"pallet-encointer-balances/try-runtime",
"pallet-encointer-bazaar/try-runtime",
Expand All @@ -248,9 +256,9 @@ try-runtime = [
"pallet-message-queue/try-runtime",
"pallet-proxy/try-runtime",
"pallet-scheduler/try-runtime",
"pallet-session/try-runtime",
"pallet-timestamp/try-runtime",
"pallet-transaction-payment/try-runtime",
"pallet-treasury/try-runtime",
"pallet-utility/try-runtime",
"pallet-xcm/try-runtime",
"parachain-info/try-runtime",
Expand Down
45 changes: 0 additions & 45 deletions system-parachains/encointer/src/deal_with_fees.rs

This file was deleted.

Loading

0 comments on commit 2fe6f56

Please sign in to comment.