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

Add pallet services payment to runtime #314

Merged
merged 26 commits into from
Nov 15, 2023

Conversation

tmpolaczyk
Copy link
Contributor

@tmpolaczyk tmpolaczyk commented Nov 3, 2023

Pallet-services payment allow developers to get block production credit. The mechanism we are thinking of releasing as a v0 is to burn a certain amount of tokens per block credit, which this parachain would obtain.

Changes in this PR:

  • We only assign collators to parachains that have at least credit for 2 sessions.
  • We substract 1 credit every time we see a block with a higher number than the one we have stored. This means that producing more than 1 block in between two tanssi blocks only costs 1 credit. And a parachain that has produced 0 blocks will not be charged any credits, even if it was assigned collators.
  • Parachains registered in genesis start with 1000 credits (so we don't worry about credits when testing).
  • For dancebox and live networks, there is a migration to give existing parachains enough credits for 60 days.
  • Parachains registered afterwards need to purchase credits. The cost is 1 microDANCE for 1 block credit, and a parachain cannot have more than 60 days worth of credits. Anyone can buy credits for a parachain. Credits can be bought even before registering the parachain, as long as you know the para id.

Will always burn at most 1 credit per tanssi block, even if the
container chain has created more than 1 block in that time.
@tmpolaczyk tmpolaczyk added B7-runtimenoteworthy Changes should be noted in any runtime-upgrade release notes breaking Needs to be mentioned in breaking changes labels Nov 3, 2023
Copy link
Contributor

github-actions bot commented Nov 3, 2023

Master coverage: 71.33%
Coverage generated "Wed Nov 15 09:00:08 UTC 2023":
https://d3gkbsry1ehhqi.cloudfront.net/tanssi-coverage/pulls/314/index.html
Pull coverage: 71.84%

@tmpolaczyk tmpolaczyk marked this pull request as ready for review November 7, 2023 10:38
node/src/chain_spec.rs Outdated Show resolved Hide resolved
@tmpolaczyk
Copy link
Contributor Author

tmpolaczyk commented Nov 8, 2023

Missing: remove dev_mode, add benchmarks, add migration that gives credit to existing container chains, set MaxCreditsStored to 60 days of blocks Done

@girazoki
Copy link
Collaborator

Test that I would like to see in ts dev tests:

  • We can buy additional block credit
  • If we run out of credit our chain does not produce blocks because collators are not assigned to it

Copy link
Collaborator

@girazoki girazoki left a comment

Choose a reason for hiding this comment

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

LGTM, good job!

@tmpolaczyk tmpolaczyk merged commit 94cc02d into master Nov 15, 2023
24 checks passed
@tmpolaczyk tmpolaczyk deleted the tomasz-pallet-services-payment branch November 15, 2023 17:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
B7-runtimenoteworthy Changes should be noted in any runtime-upgrade release notes breaking Needs to be mentioned in breaking changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants