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

test staking #173

Merged
merged 60 commits into from
Jan 15, 2021
Merged

test staking #173

merged 60 commits into from
Jan 15, 2021

Conversation

4meta5
Copy link
Contributor

@4meta5 4meta5 commented Jan 9, 2021

What does it do?

This is a follow up of #159 that builds on #162 . The primary goal of this PR is to automate calling set_author by every block producer when they produce a block so the author is necessarily set before every block is finalized.

  • add back requirement for a block author set every block
  • integration tests work with this requirement (and automatically set author every block)
  • integration test for author reporting => payment

What important points reviewers should know?

Is there something left for follow-up PRs?

#179
#180

What alternative implementations were considered?

Are there relevant PRs or issues in other repositories (Substrate, Polkadot, Frontier, Cumulus)?

What value does it bring to the blockchain users?

Checklist

  • Does it require a purge of the network? No
  • You bumped the runtime version if there are breaking changes in the runtime ?
  • Does it require changes in documentation/tutorials ? No

node/parachain/src/service.rs Outdated Show resolved Hide resolved
@4meta5 4meta5 added the A0-pleasereview Pull request needs code review. label Jan 14, 2021
@4meta5 4meta5 mentioned this pull request Jan 14, 2021
Copy link
Contributor

@JoshOrndorff JoshOrndorff left a comment

Choose a reason for hiding this comment

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

I think this looks good and is ready. I left some comments below, but most of them were me learning out loud.

Comment on lines -101 to +107
stake: Some(StakeConfig { stakers: vec![] }),
stake: Some(StakeConfig {
stakers: endowed_accounts
.iter()
.cloned()
.map(|k| (k, None, 100_000))
.collect(),
}),
Copy link
Contributor

Choose a reason for hiding this comment

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

So all of the endowed accounts are the initial stakers.

That means when we launch a parachain we have to give a particular CLI flag to include one of those accounts in the author inherent right? Can you give an example of what the collator command would look like?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So all of the endowed accounts are the initial stakers.

Yes, that is correct.

we have to give a particular CLI flag to include one of those accounts in the author inherent right?

I guess presumably just like the node CLI which now has the --account-id flag.

Can you give an example of what the collator command would look like?

Collator command to do what? To join the collator set or to author blocks?

Copy link
Contributor

Choose a reason for hiding this comment

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

Imagine a new user hears of moonbeam and wants to try it out. They decide to run a simple standalone node. So the run moonbase-standalone --dev. But now their chain doesn't work because no blocks meet the author inherent requirement. Doesn't it have to be moonbase-standalone --dev --author-id ????

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think this should go with the --dev/alice/bob work

node/parachain/src/cli.rs Show resolved Hide resolved
node/parachain/src/command.rs Outdated Show resolved Hide resolved
node/parachain/src/service.rs Outdated Show resolved Hide resolved
node/standalone/src/chain_spec.rs Show resolved Hide resolved
pallets/stake/src/lib.rs Outdated Show resolved Hide resolved
runtime/src/lib.rs Show resolved Hide resolved
runtime/src/lib.rs Outdated Show resolved Hide resolved
tests/tests/test-balance.ts Outdated Show resolved Hide resolved
@@ -46,6 +47,7 @@ export async function startMoonbeamNode(
`--no-telemetry`,
`--no-prometheus`,
`--manual-seal`,
`--account-id=${GENESIS_ACCOUNT.substring(2)}`, // Required by author inherent
Copy link
Contributor

Choose a reason for hiding this comment

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

It would be nice to wire up the --dev --alice --bob etc flags to work with the author inherent. I'm okay if that happens later though.

4meta5 and others added 6 commits January 14, 2021 12:33
Co-authored-by: Joshy Orndorff <JoshOrndorff@users.noreply.github.com>
Co-authored-by: Joshy Orndorff <JoshOrndorff@users.noreply.github.com>
Co-authored-by: Joshy Orndorff <JoshOrndorff@users.noreply.github.com>
Co-authored-by: Joshy Orndorff <JoshOrndorff@users.noreply.github.com>
Co-authored-by: Joshy Orndorff <JoshOrndorff@users.noreply.github.com>
Copy link
Collaborator

@crystalin crystalin left a comment

Choose a reason for hiding this comment

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

Awesome work !! 🔥
I left few small comments

pallets/stake/src/lib.rs Outdated Show resolved Hide resolved
pallets/stake/src/lib.rs Outdated Show resolved Hide resolved
pallets/stake/src/lib.rs Outdated Show resolved Hide resolved
pallets/stake/src/lib.rs Show resolved Hide resolved
pallets/stake/src/lib.rs Show resolved Hide resolved
runtime/src/lib.rs Show resolved Hide resolved
tests/tests/test-balance.ts Outdated Show resolved Hide resolved
tests/tests/test-stake.ts Outdated Show resolved Hide resolved
tests/tests/test-stake.ts Outdated Show resolved Hide resolved
@crystalin
Copy link
Collaborator

It is also missing to include the --author in the scripts and docker images I believe, but I can take care of that in another PR

Copy link
Contributor

@JoshOrndorff JoshOrndorff left a comment

Choose a reason for hiding this comment

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

This is really good. I think we identified a few little things to clean up, but I think they should be in followups so we can start experimenting with this work more easily. I support merging.

@4meta5 4meta5 merged commit 22c4742 into master Jan 15, 2021
@4meta5 4meta5 deleted the amar-staking-tests branch January 15, 2021 13:47
@4meta5
Copy link
Contributor Author

4meta5 commented Jan 15, 2021

Remaining TODOs:

  • fix --dev command
  • update script and docker images

tests/tests/test-balance.ts Show resolved Hide resolved
tests/tests/test-balance.ts Show resolved Hide resolved
tests/tests/test-stake.ts Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A0-pleasereview Pull request needs code review.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants