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 blockchain crate defining basic emulated blockchain structure #9

Merged
merged 12 commits into from
Oct 11, 2023

Conversation

mina86
Copy link
Collaborator

@mina86 mina86 commented Sep 4, 2023

Sorry for the delay. I would have sworn I’ve sent this PR for review
on Saturday already. Anyway here it is. The two big missing parts
are rewards and slashing.

For rewards we probably need to keep track who generated signatures
(including valid signatures submitted within some period after quorum
has been reached). I have some thoughts and draft code for handling
this but not yet finalised. I’m imagining some kind of RewardsManager
who keeps track of last blocks and marks who signed them.

With slashing there are many questions to answer: do we and if so how
do we remove slashed validator from validators set. Removal requires
creation of a new epoch and of course it only applies for the future
blocks.

And there’s overall question about configuration such as minimum
number of validators, minimum amount of stake etc. What happens if
validator quits and that brings us below the minimums? What if
validators gets slashed and that brings us below the minimums? Do we
have minimums?

The big missing parat are rewards and slashing.  For rewards we probably
need to keep track who generated signatures (including valid signatures
submitted within some period after quorum has been reached).

With slashing there are many questions to answer: do we and if so how
do we remove slashed validator from validators set.
@blasrodri
Copy link
Contributor

All of these are really good points. I'd suggest bringing them to Miguel Matos.
My feelings is:

  • let's have a min of total staked amount. If it's not reached, we halt until we get these amounts.
  • slashing does not remove the validator from the set, but only takes some amount from it
  • rewards, probably you are thinking in the right direction

blockchain/src/block.rs Outdated Show resolved Hide resolved
@mina86
Copy link
Collaborator Author

mina86 commented Sep 4, 2023

If it's not reached, we halt until we get these amounts.

There’s no obvious way how to halt though. To remove someone from validators we need to generate a new block with new epoch. So we either generate a new epoch with minimums being breached but then can never recover since we don’t have enough stake to sign on a new validator. Or we don’t generate a new epoch and stop block production until we get new validators but in that case the validators who wanted to quite still remain in the epoch.

@blasrodri
Copy link
Contributor

blasrodri commented Sep 4, 2023

I was thinking about the second option

Or we don’t generate a new epoch and stop block production until we get new validators but in that case the validators who wanted to quite still remain in the epoch.

blockchain/src/block.rs Outdated Show resolved Hide resolved
blockchain/src/manager.rs Outdated Show resolved Hide resolved
@mina86
Copy link
Collaborator Author

mina86 commented Sep 4, 2023

I was thinking about the second option

Or we don’t generate a new epoch and stop block production until we get new validators but in that case the validators who wanted to quite still remain in the epoch.

But then whoever wants to quit will remain a validator until a replacement is found. This is what’s essentially implemented right now (with the exception that the chain isn’t stopped).

@mina86
Copy link
Collaborator Author

mina86 commented Sep 28, 2023

@blasrodri

@mina86 mina86 requested a review from dhruvja October 6, 2023 09:52
common/blockchain/src/block.rs Outdated Show resolved Hide resolved
@mina86 mina86 merged commit 3da57cd into master Oct 11, 2023
4 checks passed
@mina86 mina86 deleted the mpn/a branch October 11, 2023 15:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants